1 # eoverflow.m4 serial 1
2 dnl Copyright (C) 2004 Free Software Foundation, Inc.
3 dnl This file is free software, distributed under the terms of the GNU
4 dnl General Public License. As a special exception to the GNU General
5 dnl Public License, this file may be distributed as part of a program
6 dnl that contains a configuration script generated by Autoconf, under
7 dnl the same distribution terms as the rest of that program.
11 # The EOVERFLOW errno value ought to be defined in <errno.h>, according to
12 # POSIX. But some systems (like AIX 3) don't define it, and some systems
13 # (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
15 # Define EOVERFLOW as a C macro and as a substituted macro in such a way that
16 # 1. on all systems, after inclusion of <errno.h>, EOVERFLOW is usable,
17 # 2. on systems where EOVERFLOW is defined elsewhere, we use the same numeric
20 AC_DEFUN([gl_EOVERFLOW],
22 AC_REQUIRE([AC_PROG_CC])dnl
24 AC_CACHE_CHECK([for EOVERFLOW], ac_cv_decl_EOVERFLOW, [
31 if test -n "$have_eoverflow"; then
32 dnl EOVERFLOW exists in <errno.h>. Don't need to define EOVERFLOW ourselves.
33 ac_cv_decl_EOVERFLOW=yes
36 #define _XOPEN_SOURCE_EXTENDED 1
42 if test -n "$have_eoverflow"; then
43 dnl EOVERFLOW exists but is hidden.
44 dnl Define it to the same value.
45 _AC_COMPUTE_INT([EOVERFLOW], ac_cv_decl_EOVERFLOW, [
46 #define _XOPEN_SOURCE_EXTENDED 1
48 /* The following two lines are a workaround against an autoconf-2.52 bug. */
53 dnl EOVERFLOW isn't defined by the system. Define EOVERFLOW ourselves, but
54 dnl don't define it as EINVAL, because snprintf() callers want to
55 dnl distinguish EINVAL and EOVERFLOW.
56 ac_cv_decl_EOVERFLOW=E2BIG
60 if test "$ac_cv_decl_EOVERFLOW" != yes; then
61 AC_DEFINE_UNQUOTED([EOVERFLOW], [$ac_cv_decl_EOVERFLOW],
62 [Define as good substitute value for EOVERFLOW.])
63 EOVERFLOW="$ac_cv_decl_EOVERFLOW"