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