summaryrefslogtreecommitdiffstats
path: root/gl/m4/strerror.m4
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@aei.ca>2009-01-15 09:22:57 (GMT)
committerThomas Guyot-Sionnest <dermoth@aei.ca>2009-01-15 10:19:08 (GMT)
commit71cdb52799220f8d9052643baf1d3e9836a9c755 (patch)
tree27aee97a35d9ab51f0d8f64a46690bd41a5f8c1b /gl/m4/strerror.m4
parentf7afa46586645e50498d8b2d0c67884f014dc3a4 (diff)
downloadmonitoring-plugins-71cdb52799220f8d9052643baf1d3e9836a9c755.tar.gz
Sync with gnulib
Diffstat (limited to 'gl/m4/strerror.m4')
-rw-r--r--gl/m4/strerror.m463
1 files changed, 42 insertions, 21 deletions
diff --git a/gl/m4/strerror.m4 b/gl/m4/strerror.m4
index eb7d45a..8c16ca9 100644
--- a/gl/m4/strerror.m4
+++ b/gl/m4/strerror.m4
@@ -1,5 +1,5 @@
1# strerror.m4 serial 7 1# strerror.m4 serial 9
2dnl Copyright (C) 2002, 2007 Free Software Foundation, Inc. 2dnl Copyright (C) 2002, 2007-2008 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
7AC_DEFUN([gl_FUNC_STRERROR], 7AC_DEFUN([gl_FUNC_STRERROR],
8[ 8[
9 AC_REQUIRE([gl_FUNC_STRERROR_SEPARATE]) 9 AC_REQUIRE([gl_FUNC_STRERROR_SEPARATE])
10 if test $gl_cv_func_working_strerror = no; then 10 if test $REPLACE_STRERROR = 1; then
11 AC_LIBOBJ([strerror]) 11 AC_LIBOBJ([strerror])
12 AC_DEFINE_UNQUOTED([REPLACE_STRERROR], [$REPLACE_STRERROR], 12 AC_DEFINE_UNQUOTED([REPLACE_STRERROR], [$REPLACE_STRERROR],
13 [Define this to 1 if strerror is broken.]) 13 [Define this to 1 if strerror is broken.])
@@ -18,25 +18,38 @@ AC_DEFUN([gl_FUNC_STRERROR],
18AC_DEFUN([gl_FUNC_STRERROR_SEPARATE], 18AC_DEFUN([gl_FUNC_STRERROR_SEPARATE],
19[ 19[
20 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) 20 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
21 AC_CACHE_CHECK([for working strerror function], 21 AC_REQUIRE([gl_HEADER_ERRNO_H])
22 [gl_cv_func_working_strerror], 22 if test -z "$ERRNO_H"; then
23 [AC_RUN_IFELSE( 23 AC_CACHE_CHECK([for working strerror function],
24 [AC_LANG_PROGRAM( 24 [gl_cv_func_working_strerror],
25 [#include <string.h> 25 [AC_RUN_IFELSE(
26 ], 26 [AC_LANG_PROGRAM(
27 [return !*strerror (-2);])], 27 [[#include <string.h>
28 [gl_cv_func_working_strerror=yes], 28 ]],
29 [gl_cv_func_working_strerror=no], 29 [[return !*strerror (-2);]])],
30 [dnl Assume crossbuild works if it compiles. 30 [gl_cv_func_working_strerror=yes],
31 AC_COMPILE_IFELSE( 31 [gl_cv_func_working_strerror=no],
32 [AC_LANG_PROGRAM( 32 [dnl Assume crossbuild works if it compiles.
33 [#include <string.h> 33 AC_COMPILE_IFELSE(
34 ], 34 [AC_LANG_PROGRAM(
35 [return !*strerror (-2);])], 35 [[#include <string.h>
36 [gl_cv_func_working_strerror=yes], 36 ]],
37 [gl_cv_func_working_strerror=no])])]) 37 [[return !*strerror (-2);]])],
38 if test $gl_cv_func_working_strerror = no ; then 38 [gl_cv_func_working_strerror=yes],
39 [gl_cv_func_working_strerror=no])
40 ])
41 ])
42 if test $gl_cv_func_working_strerror = no; then
43 dnl The system's strerror() fails to return a string for out-of-range
44 dnl integers. Replace it.
45 REPLACE_STRERROR=1
46 fi
47 else
48 dnl The system's strerror() cannot know about the new errno values we add
49 dnl to <errno.h>. Replace it.
39 REPLACE_STRERROR=1 50 REPLACE_STRERROR=1
51 fi
52 if test $REPLACE_STRERROR = 1; then
40 gl_PREREQ_STRERROR 53 gl_PREREQ_STRERROR
41 fi 54 fi
42]) 55])
@@ -44,4 +57,12 @@ AC_DEFUN([gl_FUNC_STRERROR_SEPARATE],
44# Prerequisites of lib/strerror.c. 57# Prerequisites of lib/strerror.c.
45AC_DEFUN([gl_PREREQ_STRERROR], [ 58AC_DEFUN([gl_PREREQ_STRERROR], [
46 AC_CHECK_DECLS([strerror]) 59 AC_CHECK_DECLS([strerror])
60 AC_CHECK_HEADERS_ONCE([sys/socket.h])
61 if test $ac_cv_header_sys_socket_h != yes; then
62 dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
63 dnl the check for those headers unconditional; yet cygwin reports
64 dnl that the headers are present but cannot be compiled (since on
65 dnl cygwin, all socket information should come from sys/socket.h).
66 AC_CHECK_HEADERS([winsock2.h])
67 fi
47]) 68])