1 1.1 christos # eoverflow.m4 serial 1 2 1.1 christos dnl Copyright (C) 2004 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 dnl From Bruno Haible. 8 1.1 christos 9 1.1 christos # The EOVERFLOW errno value ought to be defined in <errno.h>, according to 10 1.1 christos # POSIX. But some systems (like AIX 3) don't define it, and some systems 11 1.1 christos # (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined. 12 1.1 christos 13 1.1 christos # Define EOVERFLOW as a C macro and as a substituted macro in such a way that 14 1.1 christos # 1. on all systems, after inclusion of <errno.h>, EOVERFLOW is usable, 15 1.1 christos # 2. on systems where EOVERFLOW is defined elsewhere, we use the same numeric 16 1.1 christos # value. 17 1.1 christos 18 1.1 christos AC_DEFUN([gl_EOVERFLOW], 19 1.1 christos [ 20 1.1 christos AC_REQUIRE([AC_PROG_CC])dnl 21 1.1 christos 22 1.1 christos AC_CACHE_CHECK([for EOVERFLOW], ac_cv_decl_EOVERFLOW, [ 23 1.1 christos AC_EGREP_CPP(yes,[ 24 1.1 christos #include <errno.h> 25 1.1 christos #ifdef EOVERFLOW 26 1.1 christos yes 27 1.1 christos #endif 28 1.1 christos ], have_eoverflow=1) 29 1.1 christos if test -n "$have_eoverflow"; then 30 1.1 christos dnl EOVERFLOW exists in <errno.h>. Don't need to define EOVERFLOW ourselves. 31 1.1 christos ac_cv_decl_EOVERFLOW=yes 32 1.1 christos else 33 1.1 christos AC_EGREP_CPP(yes,[ 34 1.1 christos #define _XOPEN_SOURCE_EXTENDED 1 35 1.1 christos #include <errno.h> 36 1.1 christos #ifdef EOVERFLOW 37 1.1 christos yes 38 1.1 christos #endif 39 1.1 christos ], have_eoverflow=1) 40 1.1 christos if test -n "$have_eoverflow"; then 41 1.1 christos dnl EOVERFLOW exists but is hidden. 42 1.1 christos dnl Define it to the same value. 43 1.1 christos _AC_COMPUTE_INT([EOVERFLOW], ac_cv_decl_EOVERFLOW, [ 44 1.1 christos #define _XOPEN_SOURCE_EXTENDED 1 45 1.1 christos #include <errno.h> 46 1.1 christos /* The following two lines are a workaround against an autoconf-2.52 bug. */ 47 1.1 christos #include <stdio.h> 48 1.1 christos #include <stdlib.h> 49 1.1 christos ]) 50 1.1 christos else 51 1.1 christos dnl EOVERFLOW isn't defined by the system. Define EOVERFLOW ourselves, but 52 1.1 christos dnl don't define it as EINVAL, because snprintf() callers want to 53 1.1 christos dnl distinguish EINVAL and EOVERFLOW. 54 1.1 christos ac_cv_decl_EOVERFLOW=E2BIG 55 1.1 christos fi 56 1.1 christos fi 57 1.1 christos ]) 58 1.1 christos if test "$ac_cv_decl_EOVERFLOW" != yes; then 59 1.1 christos AC_DEFINE_UNQUOTED([EOVERFLOW], [$ac_cv_decl_EOVERFLOW], 60 1.1 christos [Define as good substitute value for EOVERFLOW.]) 61 1.1 christos EOVERFLOW="$ac_cv_decl_EOVERFLOW" 62 1.1 christos AC_SUBST(EOVERFLOW) 63 1.1 christos fi 64 1.1 christos ]) 65