2N/A# errno_h.m4 serial 6
2N/Adnl Copyright (C) 2004, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
2N/Adnl This file is free software; the Free Software Foundation
2N/Adnl gives unlimited permission to copy and/or distribute it,
2N/Adnl with or without modifications, as long as this notice is preserved.
2N/A
2N/AAC_DEFUN_ONCE([gl_HEADER_ERRNO_H],
2N/A[
2N/A AC_REQUIRE([AC_PROG_CC])
2N/A AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
2N/A AC_EGREP_CPP([booboo],[
2N/A#include <errno.h>
2N/A#if !defined ENOMSG
2N/Abooboo
2N/A#endif
2N/A#if !defined EIDRM
2N/Abooboo
2N/A#endif
2N/A#if !defined ENOLINK
2N/Abooboo
2N/A#endif
2N/A#if !defined EPROTO
2N/Abooboo
2N/A#endif
2N/A#if !defined EMULTIHOP
2N/Abooboo
2N/A#endif
2N/A#if !defined EBADMSG
2N/Abooboo
2N/A#endif
2N/A#if !defined EOVERFLOW
2N/Abooboo
2N/A#endif
2N/A#if !defined ENOTSUP
2N/Abooboo
2N/A#endif
2N/A#if !defined ESTALE
2N/Abooboo
2N/A#endif
2N/A#if !defined ECANCELED
2N/Abooboo
2N/A#endif
2N/A ],
2N/A [gl_cv_header_errno_h_complete=no],
2N/A [gl_cv_header_errno_h_complete=yes])
2N/A ])
2N/A if test $gl_cv_header_errno_h_complete = yes; then
2N/A ERRNO_H=''
2N/A else
2N/A gl_CHECK_NEXT_HEADERS([errno.h])
2N/A ERRNO_H='errno.h'
2N/A fi
2N/A AC_SUBST([ERRNO_H])
2N/A gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
2N/A gl_REPLACE_ERRNO_VALUE([ENOLINK])
2N/A gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
2N/A])
2N/A
2N/A# Assuming $1 = EOVERFLOW.
2N/A# The EOVERFLOW errno value ought to be defined in <errno.h>, according to
2N/A# POSIX. But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and
2N/A# some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
2N/A# Check for the value of EOVERFLOW.
2N/A# Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE.
2N/AAC_DEFUN([gl_REPLACE_ERRNO_VALUE],
2N/A[
2N/A if test -n "$ERRNO_H"; then
2N/A AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [
2N/A AC_EGREP_CPP([yes],[
2N/A#include <errno.h>
2N/A#ifdef ]$1[
2N/Ayes
2N/A#endif
2N/A ],
2N/A [gl_cv_header_errno_h_]$1[=yes],
2N/A [gl_cv_header_errno_h_]$1[=no])
2N/A if test $gl_cv_header_errno_h_]$1[ = no; then
2N/A AC_EGREP_CPP([yes],[
2N/A#define _XOPEN_SOURCE_EXTENDED 1
2N/A#include <errno.h>
2N/A#ifdef ]$1[
2N/Ayes
2N/A#endif
2N/A ], [gl_cv_header_errno_h_]$1[=hidden])
2N/A if test $gl_cv_header_errno_h_]$1[ = hidden; then
2N/A dnl The macro exists but is hidden.
2N/A dnl Define it to the same value.
2N/A AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [
2N/A#define _XOPEN_SOURCE_EXTENDED 1
2N/A#include <errno.h>
2N/A/* The following two lines are a workaround against an autoconf-2.52 bug. */
2N/A#include <stdio.h>
2N/A#include <stdlib.h>
2N/A])
2N/A fi
2N/A fi
2N/A ])
2N/A case $gl_cv_header_errno_h_]$1[ in
2N/A yes | no)
2N/A ]$1[_HIDDEN=0; ]$1[_VALUE=
2N/A ;;
2N/A *)
2N/A ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1["
2N/A ;;
2N/A esac
2N/A AC_SUBST($1[_HIDDEN])
2N/A AC_SUBST($1[_VALUE])
2N/A fi
2N/A])
2N/A
2N/Adnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
2N/Adnl Remove this when we can assume autoconf >= 2.61.
2N/Am4_ifdef([AC_COMPUTE_INT], [], [
2N/A AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
2N/A])