1
# eoverflow.m4 serial 1
2
dnl Copyright (C) 2004 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.
9
# The EOVERFLOW errno value ought to be defined in <errno.h>, according to
10
# POSIX. But some systems (like AIX 3) don't define it, and some systems
11
# (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
13
# Define EOVERFLOW as a C macro and as a substituted macro in such a way that
14
# 1. on all systems, after inclusion of <errno.h>, EOVERFLOW is usable,
15
# 2. on systems where EOVERFLOW is defined elsewhere, we use the same numeric
18
AC_DEFUN([gl_EOVERFLOW],
20
AC_REQUIRE([AC_PROG_CC])dnl
22
AC_CACHE_CHECK([for EOVERFLOW], ac_cv_decl_EOVERFLOW, [
29
if test -n "$have_eoverflow"; then
30
dnl EOVERFLOW exists in <errno.h>. Don't need to define EOVERFLOW ourselves.
31
ac_cv_decl_EOVERFLOW=yes
34
#define _XOPEN_SOURCE_EXTENDED 1
40
if test -n "$have_eoverflow"; then
41
dnl EOVERFLOW exists but is hidden.
42
dnl Define it to the same value.
43
_AC_COMPUTE_INT([EOVERFLOW], ac_cv_decl_EOVERFLOW, [
44
#define _XOPEN_SOURCE_EXTENDED 1
46
/* The following two lines are a workaround against an autoconf-2.52 bug. */
51
dnl EOVERFLOW isn't defined by the system. Define EOVERFLOW ourselves, but
52
dnl don't define it as EINVAL, because snprintf() callers want to
53
dnl distinguish EINVAL and EOVERFLOW.
54
ac_cv_decl_EOVERFLOW=E2BIG
58
if test "$ac_cv_decl_EOVERFLOW" != yes; then
59
AC_DEFINE_UNQUOTED([EOVERFLOW], [$ac_cv_decl_EOVERFLOW],
60
[Define as good substitute value for EOVERFLOW.])
61
EOVERFLOW="$ac_cv_decl_EOVERFLOW"