Blame gettext-tools/gnulib-m4/errno_h.m4

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