267
|
1 # errno_h.m4 serial 4
|
|
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 dnl This macro must pass through AC_REQUIRE (never directly invoke it).
|
|
8 AC_DEFUN_ONCE([gl_HEADER_ERRNO_H],
|
|
9 [
|
|
10 AC_REQUIRE([AC_PROG_CC])
|
|
11 AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
|
|
12 AC_EGREP_CPP([booboo],[
|
|
13 #include <errno.h>
|
|
14 #if !defined ENOMSG
|
|
15 booboo
|
|
16 #endif
|
|
17 #if !defined EIDRM
|
|
18 booboo
|
|
19 #endif
|
|
20 #if !defined ENOLINK
|
|
21 booboo
|
|
22 #endif
|
|
23 #if !defined EPROTO
|
|
24 booboo
|
|
25 #endif
|
|
26 #if !defined EMULTIHOP
|
|
27 booboo
|
|
28 #endif
|
|
29 #if !defined EBADMSG
|
|
30 booboo
|
|
31 #endif
|
|
32 #if !defined EOVERFLOW
|
|
33 booboo
|
|
34 #endif
|
|
35 #if !defined ENOTSUP
|
|
36 booboo
|
|
37 #endif
|
|
38 #if !defined ECANCELED
|
|
39 booboo
|
|
40 #endif
|
|
41 ],
|
|
42 [gl_cv_header_errno_h_complete=no],
|
|
43 [gl_cv_header_errno_h_complete=yes])
|
|
44 ])
|
|
45 if test $gl_cv_header_errno_h_complete = yes; then
|
|
46 ERRNO_H=''
|
|
47 else
|
|
48 gl_CHECK_NEXT_HEADERS([errno.h])
|
|
49 ERRNO_H='errno.h'
|
|
50 fi
|
|
51 AC_SUBST([ERRNO_H])
|
|
52 gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
|
|
53 gl_REPLACE_ERRNO_VALUE([ENOLINK])
|
|
54 gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
|
|
55 ])
|
|
56
|
|
57 # Assuming $1 = EOVERFLOW.
|
|
58 # The EOVERFLOW errno value ought to be defined in <errno.h>, according to
|
|
59 # POSIX. But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and
|
|
60 # some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
|
|
61 # Check for the value of EOVERFLOW.
|
|
62 # Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE.
|
|
63 AC_DEFUN([gl_REPLACE_ERRNO_VALUE],
|
|
64 [
|
|
65 if test -n "$ERRNO_H"; then
|
|
66 AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [
|
|
67 AC_EGREP_CPP([yes],[
|
|
68 #include <errno.h>
|
|
69 #ifdef ]$1[
|
|
70 yes
|
|
71 #endif
|
|
72 ],
|
|
73 [gl_cv_header_errno_h_]$1[=yes],
|
|
74 [gl_cv_header_errno_h_]$1[=no])
|
|
75 if test $gl_cv_header_errno_h_]$1[ = no; then
|
|
76 AC_EGREP_CPP([yes],[
|
|
77 #define _XOPEN_SOURCE_EXTENDED 1
|
|
78 #include <errno.h>
|
|
79 #ifdef ]$1[
|
|
80 yes
|
|
81 #endif
|
|
82 ], [gl_cv_header_errno_h_]$1[=hidden])
|
|
83 if test $gl_cv_header_errno_h_]$1[ = hidden; then
|
|
84 dnl The macro exists but is hidden.
|
|
85 dnl Define it to the same value.
|
|
86 AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [
|
|
87 #define _XOPEN_SOURCE_EXTENDED 1
|
|
88 #include <errno.h>
|
|
89 /* The following two lines are a workaround against an autoconf-2.52 bug. */
|
|
90 #include <stdio.h>
|
|
91 #include <stdlib.h>
|
|
92 ])
|
|
93 fi
|
|
94 fi
|
|
95 ])
|
|
96 case $gl_cv_header_errno_h_]$1[ in
|
|
97 yes | no)
|
|
98 ]$1[_HIDDEN=0; ]$1[_VALUE=
|
|
99 ;;
|
|
100 *)
|
|
101 ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1["
|
|
102 ;;
|
|
103 esac
|
|
104 AC_SUBST($1[_HIDDEN])
|
|
105 AC_SUBST($1[_VALUE])
|
|
106 fi
|
|
107 ])
|
|
108
|
|
109 dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
|
|
110 dnl Remove this when we can assume autoconf >= 2.61.
|
|
111 m4_ifdef([AC_COMPUTE_INT], [], [
|
|
112 AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
|
|
113 ])
|