annotate m4/strndup.m4 @ 285:9010796c6253 2.3 2.3.1

Generated manual for distribution
author lost
date Fri, 24 Apr 2009 22:36:09 +0000
parents 2cb097e760a5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
283
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
1 # strndup.m4 serial 15
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
2 dnl Copyright (C) 2002-2003, 2005-2008 Free Software Foundation, Inc.
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
6
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
7 AC_DEFUN([gl_FUNC_STRNDUP],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
8 [
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
9 dnl Persuade glibc <string.h> to declare strndup().
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
10 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
11
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
12 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
13 AC_CHECK_DECLS_ONCE([strndup])
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
14 if test $ac_cv_have_decl_strndup = no; then
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
15 HAVE_DECL_STRNDUP=0
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
16 fi
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
17
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
18 # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'.
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
19 AC_CACHE_CHECK([for working strndup], gl_cv_func_strndup,
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
20 [AC_RUN_IFELSE([
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
21 AC_LANG_PROGRAM([[#include <string.h>
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
22 #include <stdlib.h>]], [[
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
23 #ifndef HAVE_DECL_STRNDUP
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
24 extern char *strndup (const char *, size_t);
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
25 #endif
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
26 char *s;
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
27 s = strndup ("some longer string", 15);
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
28 free (s);
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
29 s = strndup ("shorter string", 13);
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
30 return s[13] != '\0';]])],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
31 [gl_cv_func_strndup=yes],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
32 [gl_cv_func_strndup=no],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
33 [AC_CHECK_FUNC([strndup],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
34 [AC_EGREP_CPP([too risky], [
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
35 #ifdef _AIX
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
36 too risky
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
37 #endif
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
38 ],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
39 [gl_cv_func_strndup=no],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
40 [gl_cv_func_strndup=yes])],
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
41 [gl_cv_func_strndup=no])])])
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
42 if test $gl_cv_func_strndup = yes; then
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
43 AC_DEFINE([HAVE_STRNDUP], 1,
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
44 [Define if you have the strndup() function and it works.])
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
45 else
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
46 HAVE_STRNDUP=0
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
47 AC_LIBOBJ([strndup])
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
48 gl_PREREQ_STRNDUP
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
49 fi
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
50 ])
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
51
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
52 # Prerequisites of lib/strndup.c.
2cb097e760a5 Added various generated files in prep for release
lost
parents:
diff changeset
53 AC_DEFUN([gl_PREREQ_STRNDUP], [:])