2 dnl Copyright (C) 2004, 2006, 2008-2015 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.
7 AC_DEFUN_ONCE([gl_HEADER_ERRNO_H],
9 AC_REQUIRE([AC_PROG_CC])
10 AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
11 AC_EGREP_CPP([booboo],[
28 #if !defined EMULTIHOP
34 #if !defined EOVERFLOW
40 #if !defined ENETRESET
43 #if !defined ECONNABORTED
52 #if !defined ECANCELED
55 #if !defined EOWNERDEAD
58 #if !defined ENOTRECOVERABLE
65 [gl_cv_header_errno_h_complete=no],
66 [gl_cv_header_errno_h_complete=yes])
68 if test $gl_cv_header_errno_h_complete = yes; then
71 gl_NEXT_HEADERS([errno.h])
75 AM_CONDITIONAL([GL_GENERATE_ERRNO_H], [test -n "$ERRNO_H"])
76 gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
77 gl_REPLACE_ERRNO_VALUE([ENOLINK])
78 gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
81 # Assuming $1 = EOVERFLOW.
82 # The EOVERFLOW errno value ought to be defined in <errno.h>, according to
83 # POSIX. But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and
84 # some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
85 # Check for the value of EOVERFLOW.
86 # Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE.
87 AC_DEFUN([gl_REPLACE_ERRNO_VALUE],
89 if test -n "$ERRNO_H"; then
90 AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [
97 [gl_cv_header_errno_h_]$1[=yes],
98 [gl_cv_header_errno_h_]$1[=no])
99 if test $gl_cv_header_errno_h_]$1[ = no; then
101 #define _XOPEN_SOURCE_EXTENDED 1
106 ], [gl_cv_header_errno_h_]$1[=hidden])
107 if test $gl_cv_header_errno_h_]$1[ = hidden; then
108 dnl The macro exists but is hidden.
109 dnl Define it to the same value.
110 AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [
111 #define _XOPEN_SOURCE_EXTENDED 1
113 /* The following two lines are a workaround against an autoconf-2.52 bug. */
120 case $gl_cv_header_errno_h_]$1[ in
122 ]$1[_HIDDEN=0; ]$1[_VALUE=
125 ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1["
128 AC_SUBST($1[_HIDDEN])
133 dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
134 dnl Remove this when we can assume autoconf >= 2.61.
135 m4_ifdef([AC_COMPUTE_INT], [], [
136 AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])