summaryrefslogtreecommitdiffstats
path: root/gl/m4/errno_h.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/errno_h.m4')
-rw-r--r--gl/m4/errno_h.m468
1 files changed, 11 insertions, 57 deletions
diff --git a/gl/m4/errno_h.m4 b/gl/m4/errno_h.m4
index b6050e5d..ade19b6f 100644
--- a/gl/m4/errno_h.m4
+++ b/gl/m4/errno_h.m4
@@ -1,15 +1,21 @@
1# errno_h.m4 1# errno_h.m4
2# serial 14 2# serial 19
3dnl Copyright (C) 2004, 2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2004, 2006, 2008-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_PREREQ([2.61]) 9AC_PREREQ([2.61])
9 10
10AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], 11AC_DEFUN_ONCE([gl_HEADER_ERRNO_H],
11[ 12[
12 AC_REQUIRE([AC_PROG_CC]) 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
13 AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ 19 AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
14 AC_EGREP_CPP([booboo],[ 20 AC_EGREP_CPP([booboo],[
15#include <errno.h> 21#include <errno.h>
@@ -64,6 +70,9 @@ booboo
64#if !defined EILSEQ 70#if !defined EILSEQ
65booboo 71booboo
66#endif 72#endif
73#if !defined ESOCKTNOSUPPORT
74booboo
75#endif
67 ], 76 ],
68 [gl_cv_header_errno_h_complete=no], 77 [gl_cv_header_errno_h_complete=no],
69 [gl_cv_header_errno_h_complete=yes]) 78 [gl_cv_header_errno_h_complete=yes])
@@ -74,59 +83,4 @@ booboo
74 gl_NEXT_HEADERS([errno.h]) 83 gl_NEXT_HEADERS([errno.h])
75 GL_GENERATE_ERRNO_H=true 84 GL_GENERATE_ERRNO_H=true
76 fi 85 fi
77 gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
78 gl_REPLACE_ERRNO_VALUE([ENOLINK])
79 gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
80])
81
82# Assuming $1 = EOVERFLOW.
83# The EOVERFLOW errno value ought to be defined in <errno.h>, according to
84# POSIX. But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and
85# some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
86# Check for the value of EOVERFLOW.
87# Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE.
88AC_DEFUN([gl_REPLACE_ERRNO_VALUE],
89[
90 if $GL_GENERATE_ERRNO_H; then
91 AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [
92 AC_EGREP_CPP([yes],[
93#include <errno.h>
94#ifdef ]$1[
95yes
96#endif
97 ],
98 [gl_cv_header_errno_h_]$1[=yes],
99 [gl_cv_header_errno_h_]$1[=no])
100 if test $gl_cv_header_errno_h_]$1[ = no; then
101 AC_EGREP_CPP([yes],[
102#define _XOPEN_SOURCE_EXTENDED 1
103#include <errno.h>
104#ifdef ]$1[
105yes
106#endif
107 ], [gl_cv_header_errno_h_]$1[=hidden])
108 if test $gl_cv_header_errno_h_]$1[ = hidden; then
109 dnl The macro exists but is hidden.
110 dnl Define it to the same value.
111 AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [
112#define _XOPEN_SOURCE_EXTENDED 1
113#include <errno.h>
114/* The following two lines are a workaround against an autoconf-2.52 bug. */
115#include <stdio.h>
116#include <stdlib.h>
117])
118 fi
119 fi
120 ])
121 case $gl_cv_header_errno_h_]$1[ in
122 yes | no)
123 ]$1[_HIDDEN=0; ]$1[_VALUE=
124 ;;
125 *)
126 ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1["
127 ;;
128 esac
129 AC_SUBST($1[_HIDDEN])
130 AC_SUBST($1[_VALUE])
131 fi
132]) 86])