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