annotate m4/strndup.m4 @ 400:573ed4940625 3.0-beta1 3.0-beta1

Fixed inclusion of documentation in make dist
author lost@l-w.ca
date Fri, 23 Jul 2010 17:32:29 -0600
parents 7987ee447833
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
398
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
1 # strndup.m4 serial 17
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
2 dnl Copyright (C) 2002-2003, 2005-2010 Free Software Foundation, Inc.
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
6
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
7 AC_DEFUN([gl_FUNC_STRNDUP],
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
8 [
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
9 dnl Persuade glibc <string.h> to declare strndup().
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
10 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
11
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
12 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
13 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
14 AC_CHECK_DECLS_ONCE([strndup])
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
15 AC_CHECK_FUNCS_ONCE([strndup])
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
16 if test $ac_cv_have_decl_strndup = no; then
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
17 HAVE_DECL_STRNDUP=0
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
18 fi
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
19
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
20 if test $ac_cv_func_strndup = yes; then
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
21 # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'.
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
22 AC_CACHE_CHECK([for working strndup], [gl_cv_func_strndup_works],
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
23 [AC_RUN_IFELSE([
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
24 AC_LANG_PROGRAM([[#include <string.h>
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
25 #include <stdlib.h>]], [[
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
26 #ifndef HAVE_DECL_STRNDUP
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
27 extern char *strndup (const char *, size_t);
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
28 #endif
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
29 char *s;
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
30 s = strndup ("some longer string", 15);
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
31 free (s);
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
32 s = strndup ("shorter string", 13);
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
33 return s[13] != '\0';]])],
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
34 [gl_cv_func_strndup_works=yes],
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
35 [gl_cv_func_strndup_works=no],
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
36 [case $host_os in
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
37 aix*) gl_cv_func_strndup_works="guessing no";;
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
38 *) gl_cv_func_strndup_works="guessing yes";;
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
39 esac])])
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
40 case $gl_cv_func_strndup_works in
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
41 *no)
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
42 REPLACE_STRNDUP=1
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
43 AC_LIBOBJ([strndup])
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
44 ;;
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
45 esac
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
46 else
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
47 AC_LIBOBJ([strndup])
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
48 fi
7987ee447833 Added generated files for release
lost@l-w.ca
parents:
diff changeset
49 ])