Debian Codegraph @

m4/errno_h.m4

raw
1 # errno_h.m4
2 # serial 18
3 dnl Copyright (C) 2004, 2006, 2008-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7 dnl This file is offered as-is, without any warranty.
8
9 AC_PREREQ([2.61])
10
11 AC_DEFUN_ONCE([gl_HEADER_ERRNO_H],
12 [
13 AC_REQUIRE([AC_PROG_CC])
14
15 dnl Through the dependency on module extensions-aix, _LINUX_SOURCE_COMPAT
16 dnl gets defined already before this macro gets invoked. This persuades
17 dnl AIX 7.3 errno.h to assign ENOTEMPTY a value different than EEXIST.
18
19 AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
20 AC_EGREP_CPP([booboo],[
21 #include <errno.h>
22 #if !defined ETXTBSY
23 booboo
24 #endif
25 #if !defined ENOMSG
26 booboo
27 #endif
28 #if !defined EIDRM
29 booboo
30 #endif
31 #if !defined ENOLINK
32 booboo
33 #endif
34 #if !defined EPROTO
35 booboo
36 #endif
37 #if !defined EMULTIHOP
38 booboo
39 #endif
40 #if !defined EBADMSG
41 booboo
42 #endif
43 #if !defined EOVERFLOW
44 booboo
45 #endif
46 #if !defined ENOTSUP
47 booboo
48 #endif
49 #if !defined ENETRESET
50 booboo
51 #endif
52 #if !defined ECONNABORTED
53 booboo
54 #endif
55 #if !defined ESTALE
56 booboo
57 #endif
58 #if !defined EDQUOT
59 booboo
60 #endif
61 #if !defined ECANCELED
62 booboo
63 #endif
64 #if !defined EOWNERDEAD
65 booboo
66 #endif
67 #if !defined ENOTRECOVERABLE
68 booboo
69 #endif
70 #if !defined EILSEQ
71 booboo
72 #endif
73 #if !defined ESOCKTNOSUPPORT
74 booboo
75 #endif
76 ],
77 [gl_cv_header_errno_h_complete=no],
78 [gl_cv_header_errno_h_complete=yes])
79 ])
80 if test $gl_cv_header_errno_h_complete = yes; then
81 GL_GENERATE_ERRNO_H=false
82 else
83 gl_NEXT_HEADERS([errno.h])
84 GL_GENERATE_ERRNO_H=true
85 fi
86 gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
87 gl_REPLACE_ERRNO_VALUE([ENOLINK])
88 gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
89 ])
90
91 # Assuming $1 = EOVERFLOW.
92 # The EOVERFLOW errno value ought to be defined in <errno.h>, according to
93 # POSIX. But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and
94 # some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
95 # Check for the value of EOVERFLOW.
96 # Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE.
97 AC_DEFUN([gl_REPLACE_ERRNO_VALUE],
98 [
99 if $GL_GENERATE_ERRNO_H; then
100 AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [
101 AC_EGREP_CPP([yes],[
102 #include <errno.h>
103 #ifdef ]$1[
104 yes
105 #endif
106 ],
107 [gl_cv_header_errno_h_]$1[=yes],
108 [gl_cv_header_errno_h_]$1[=no])
109 if test $gl_cv_header_errno_h_]$1[ = no; then
110 AC_EGREP_CPP([yes],[
111 #define _XOPEN_SOURCE_EXTENDED 1
112 #include <errno.h>
113 #ifdef ]$1[
114 yes
115 #endif
116 ], [gl_cv_header_errno_h_]$1[=hidden])
117 if test $gl_cv_header_errno_h_]$1[ = hidden; then
118 dnl The macro exists but is hidden.
119 dnl Define it to the same value.
120 AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [
121 #define _XOPEN_SOURCE_EXTENDED 1
122 #include <errno.h>
123 /* The following two lines are a workaround against an autoconf-2.52 bug. */
124 #include <stdio.h>
125 #include <stdlib.h>
126 ])
127 fi
128 fi
129 ])
130 case $gl_cv_header_errno_h_]$1[ in
131 yes | no)
132 ]$1[_HIDDEN=0; ]$1[_VALUE=
133 ;;
134 *)
135 ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1["
136 ;;
137 esac
138 AC_SUBST($1[_HIDDEN])
139 AC_SUBST($1[_VALUE])
140 fi
141 ])