diff options
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2009-01-15 09:22:57 (GMT) |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2009-01-15 10:19:08 (GMT) |
commit | 71cdb52799220f8d9052643baf1d3e9836a9c755 (patch) | |
tree | 27aee97a35d9ab51f0d8f64a46690bd41a5f8c1b /gl/m4/errno_h.m4 | |
parent | f7afa46586645e50498d8b2d0c67884f014dc3a4 (diff) | |
download | monitoring-plugins-71cdb52799220f8d9052643baf1d3e9836a9c755.tar.gz |
Sync with gnulib
Diffstat (limited to 'gl/m4/errno_h.m4')
-rw-r--r-- | gl/m4/errno_h.m4 | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/gl/m4/errno_h.m4 b/gl/m4/errno_h.m4 new file mode 100644 index 0000000..0682d1a --- /dev/null +++ b/gl/m4/errno_h.m4 | |||
@@ -0,0 +1,119 @@ | |||
1 | # errno_h.m4 serial 3 | ||
2 | dnl Copyright (C) 2004, 2006, 2008, 2009 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_HEADER_ERRNO_H], | ||
8 | [ | ||
9 | dnl Use AC_REQUIRE here, so that the default behavior below is expanded | ||
10 | dnl once only, before all statements that occur in other macros. | ||
11 | AC_REQUIRE([gl_HEADER_ERRNO_H_BODY]) | ||
12 | ]) | ||
13 | |||
14 | AC_DEFUN([gl_HEADER_ERRNO_H_BODY], | ||
15 | [ | ||
16 | AC_REQUIRE([AC_PROG_CC]) | ||
17 | AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ | ||
18 | AC_EGREP_CPP([booboo],[ | ||
19 | #include <errno.h> | ||
20 | #if !defined ENOMSG | ||
21 | booboo | ||
22 | #endif | ||
23 | #if !defined EIDRM | ||
24 | booboo | ||
25 | #endif | ||
26 | #if !defined ENOLINK | ||
27 | booboo | ||
28 | #endif | ||
29 | #if !defined EPROTO | ||
30 | booboo | ||
31 | #endif | ||
32 | #if !defined EMULTIHOP | ||
33 | booboo | ||
34 | #endif | ||
35 | #if !defined EBADMSG | ||
36 | booboo | ||
37 | #endif | ||
38 | #if !defined EOVERFLOW | ||
39 | booboo | ||
40 | #endif | ||
41 | #if !defined ENOTSUP | ||
42 | booboo | ||
43 | #endif | ||
44 | #if !defined ECANCELED | ||
45 | booboo | ||
46 | #endif | ||
47 | ], | ||
48 | [gl_cv_header_errno_h_complete=no], | ||
49 | [gl_cv_header_errno_h_complete=yes]) | ||
50 | ]) | ||
51 | if test $gl_cv_header_errno_h_complete = yes; then | ||
52 | ERRNO_H='' | ||
53 | else | ||
54 | gl_CHECK_NEXT_HEADERS([errno.h]) | ||
55 | ERRNO_H='errno.h' | ||
56 | fi | ||
57 | AC_SUBST([ERRNO_H]) | ||
58 | gl_REPLACE_ERRNO_VALUE([EMULTIHOP]) | ||
59 | gl_REPLACE_ERRNO_VALUE([ENOLINK]) | ||
60 | gl_REPLACE_ERRNO_VALUE([EOVERFLOW]) | ||
61 | ]) | ||
62 | |||
63 | # Assuming $1 = EOVERFLOW. | ||
64 | # The EOVERFLOW errno value ought to be defined in <errno.h>, according to | ||
65 | # POSIX. But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and | ||
66 | # some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined. | ||
67 | # Check for the value of EOVERFLOW. | ||
68 | # Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE. | ||
69 | AC_DEFUN([gl_REPLACE_ERRNO_VALUE], | ||
70 | [ | ||
71 | if test -n "$ERRNO_H"; then | ||
72 | AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [ | ||
73 | AC_EGREP_CPP([yes],[ | ||
74 | #include <errno.h> | ||
75 | #ifdef ]$1[ | ||
76 | yes | ||
77 | #endif | ||
78 | ], | ||
79 | [gl_cv_header_errno_h_]$1[=yes], | ||
80 | [gl_cv_header_errno_h_]$1[=no]) | ||
81 | if test $gl_cv_header_errno_h_]$1[ = no; then | ||
82 | AC_EGREP_CPP([yes],[ | ||
83 | #define _XOPEN_SOURCE_EXTENDED 1 | ||
84 | #include <errno.h> | ||
85 | #ifdef ]$1[ | ||
86 | yes | ||
87 | #endif | ||
88 | ], [gl_cv_header_errno_h_]$1[=hidden]) | ||
89 | if test $gl_cv_header_errno_h_]$1[ = hidden; then | ||
90 | dnl The macro exists but is hidden. | ||
91 | dnl Define it to the same value. | ||
92 | AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [ | ||
93 | #define _XOPEN_SOURCE_EXTENDED 1 | ||
94 | #include <errno.h> | ||
95 | /* The following two lines are a workaround against an autoconf-2.52 bug. */ | ||
96 | #include <stdio.h> | ||
97 | #include <stdlib.h> | ||
98 | ]) | ||
99 | fi | ||
100 | fi | ||
101 | ]) | ||
102 | case $gl_cv_header_errno_h_]$1[ in | ||
103 | yes | no) | ||
104 | ]$1[_HIDDEN=0; ]$1[_VALUE= | ||
105 | ;; | ||
106 | *) | ||
107 | ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1[" | ||
108 | ;; | ||
109 | esac | ||
110 | AC_SUBST($1[_HIDDEN]) | ||
111 | AC_SUBST($1[_VALUE]) | ||
112 | fi | ||
113 | ]) | ||
114 | |||
115 | dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. | ||
116 | dnl Remove this when we can assume autoconf >= 2.61. | ||
117 | m4_ifdef([AC_COMPUTE_INT], [], [ | ||
118 | AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) | ||
119 | ]) | ||