diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-08-19 21:27:12 (GMT) |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-08-19 21:27:12 (GMT) |
commit | 26fbe7f1e68bb0c96da32491efcf3696fe6c299b (patch) | |
tree | c4d95289187a64e9c7517bf73d8208026c3d2fb3 /gl/m4/strndup.m4 | |
parent | 5f79e3e9f62ca5487d9881973149136ba1d19d3e (diff) | |
download | monitoring-plugins-26fbe7f1e68bb0c96da32491efcf3696fe6c299b.tar.gz |
Sync with the latest Gnulib code (6f2d632)
Diffstat (limited to 'gl/m4/strndup.m4')
-rw-r--r-- | gl/m4/strndup.m4 | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/gl/m4/strndup.m4 b/gl/m4/strndup.m4 index 810313c..a1f8274 100644 --- a/gl/m4/strndup.m4 +++ b/gl/m4/strndup.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # strndup.m4 serial 17 | 1 | # strndup.m4 serial 21 |
2 | dnl Copyright (C) 2002-2003, 2005-2010 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2003, 2005-2013 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -18,13 +18,18 @@ AC_DEFUN([gl_FUNC_STRNDUP], | |||
18 | fi | 18 | fi |
19 | 19 | ||
20 | if test $ac_cv_func_strndup = yes; then | 20 | if test $ac_cv_func_strndup = yes; then |
21 | HAVE_STRNDUP=1 | ||
21 | # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. | 22 | # 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_CACHE_CHECK([for working strndup], [gl_cv_func_strndup_works], |
23 | [AC_RUN_IFELSE([ | 24 | [AC_RUN_IFELSE([ |
24 | AC_LANG_PROGRAM([[#include <string.h> | 25 | AC_LANG_PROGRAM([[#include <string.h> |
25 | #include <stdlib.h>]], [[ | 26 | #include <stdlib.h>]], [[ |
26 | #ifndef HAVE_DECL_STRNDUP | 27 | #if !HAVE_DECL_STRNDUP |
27 | extern char *strndup (const char *, size_t); | 28 | extern |
29 | #ifdef __cplusplus | ||
30 | "C" | ||
31 | #endif | ||
32 | char *strndup (const char *, size_t); | ||
28 | #endif | 33 | #endif |
29 | char *s; | 34 | char *s; |
30 | s = strndup ("some longer string", 15); | 35 | s = strndup ("some longer string", 15); |
@@ -33,17 +38,18 @@ AC_DEFUN([gl_FUNC_STRNDUP], | |||
33 | return s[13] != '\0';]])], | 38 | return s[13] != '\0';]])], |
34 | [gl_cv_func_strndup_works=yes], | 39 | [gl_cv_func_strndup_works=yes], |
35 | [gl_cv_func_strndup_works=no], | 40 | [gl_cv_func_strndup_works=no], |
36 | [case $host_os in | 41 | [ |
37 | aix*) gl_cv_func_strndup_works="guessing no";; | 42 | changequote(,)dnl |
38 | *) gl_cv_func_strndup_works="guessing yes";; | 43 | case $host_os in |
39 | esac])]) | 44 | aix | aix[3-6]*) gl_cv_func_strndup_works="guessing no";; |
45 | *) gl_cv_func_strndup_works="guessing yes";; | ||
46 | esac | ||
47 | changequote([,])dnl | ||
48 | ])]) | ||
40 | case $gl_cv_func_strndup_works in | 49 | case $gl_cv_func_strndup_works in |
41 | *no) | 50 | *no) REPLACE_STRNDUP=1 ;; |
42 | REPLACE_STRNDUP=1 | ||
43 | AC_LIBOBJ([strndup]) | ||
44 | ;; | ||
45 | esac | 51 | esac |
46 | else | 52 | else |
47 | AC_LIBOBJ([strndup]) | 53 | HAVE_STRNDUP=0 |
48 | fi | 54 | fi |
49 | ]) | 55 | ]) |