annotate m4/strndup.m4 @ 267:bec6d2480f08 2.6

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