From: Bruno Haible Date: Thu, 9 Sep 2004 12:31:36 +0000 (+0000) Subject: Provide a substitute for EOVERFLOW if doesn't define it. X-Git-Tag: cvs-readonly~3962 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;h=9233887175545ad5a02bf2c21b873358ec614aea;p=gnulib.git Provide a substitute for EOVERFLOW if doesn't define it. --- diff --git a/ChangeLog b/ChangeLog index c43e5451d..774acf8e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-09-09 Bruno Haible + + * modules/vasnprintf (Files): Add m4/eoverflow.m4. + 2004-09-08 Bruno Haible Oskar Liljeblad diff --git a/m4/ChangeLog b/m4/ChangeLog index f7f6f5c5e..06598bf0f 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,9 @@ +2004-09-09 Bruno Haible + + * eoverflow.m4: New file, taken from GNU libiconv eilseq.m4 with + modifications. + * vasnprintf.m4 (gl_FUNC_VASNPRINTF): Require gl_EOVERFLOW. + 2004-09-08 Bruno Haible * stdint.m4: New file, taken from GNU clisp with modifications. diff --git a/m4/eoverflow.m4 b/m4/eoverflow.m4 new file mode 100644 index 000000000..7e6cea3d1 --- /dev/null +++ b/m4/eoverflow.m4 @@ -0,0 +1,66 @@ +# eoverflow.m4 serial 1 +dnl Copyright (C) 2004 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +# The EOVERFLOW errno value ought to be defined in , according to +# POSIX. But some systems (like AIX 3) don't define it, and some systems +# (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined. + +# Define EOVERFLOW as a C macro and as a substituted macro in such a way that +# 1. on all systems, after inclusion of , EOVERFLOW is usable, +# 2. on systems where EOVERFLOW is defined elsewhere, we use the same numeric +# value. + +AC_DEFUN([gl_EOVERFLOW], +[ + AC_REQUIRE([AC_PROG_CC])dnl + + AC_CACHE_CHECK([for EOVERFLOW], ac_cv_decl_EOVERFLOW, [ + AC_EGREP_CPP(yes,[ +#include +#ifdef EOVERFLOW +yes +#endif + ], have_eoverflow=1) + if test -n "$have_eoverflow"; then + dnl EOVERFLOW exists in . Don't need to define EOVERFLOW ourselves. + ac_cv_decl_EOVERFLOW=yes + else + AC_EGREP_CPP(yes,[ +#define _XOPEN_SOURCE_EXTENDED 1 +#include +#ifdef EOVERFLOW +yes +#endif + ], have_eoverflow=1) + if test -n "$have_eoverflow"; then + dnl EOVERFLOW exists but is hidden. + dnl Define it to the same value. + _AC_COMPUTE_INT([EOVERFLOW], ac_cv_decl_EOVERFLOW, [ +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include +]) + else + dnl EOVERFLOW isn't defined by the system. Define EOVERFLOW ourselves, but + dnl don't define it as EINVAL, because snprintf() callers want to + dnl distinguish EINVAL and EOVERFLOW. + ac_cv_decl_EOVERFLOW=E2BIG + fi + fi + ]) + if test "$ac_cv_decl_EOVERFLOW" != yes; then + AC_DEFINE_UNQUOTED([EOVERFLOW], [$ac_cv_decl_EOVERFLOW], + [Define as good substitute value for EOVERFLOW.]) + EOVERFLOW="$ac_cv_decl_EOVERFLOW" + AC_SUBST(EOVERFLOW) + fi +]) diff --git a/m4/vasnprintf.m4 b/m4/vasnprintf.m4 index cba4428bf..a116949da 100644 --- a/m4/vasnprintf.m4 +++ b/m4/vasnprintf.m4 @@ -1,4 +1,4 @@ -# vasnprintf.m4 serial 4 +# vasnprintf.m4 serial 5 dnl Copyright (C) 2002-2004 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General @@ -8,6 +8,7 @@ dnl the same distribution terms as the rest of that program. AC_DEFUN([gl_FUNC_VASNPRINTF], [ + AC_REQUIRE([gl_EOVERFLOW]) AC_REPLACE_FUNCS(vasnprintf) if test $ac_cv_func_vasnprintf = no; then AC_LIBOBJ(printf-args) diff --git a/modules/vasnprintf b/modules/vasnprintf index ec42b66b3..3b162c93e 100644 --- a/modules/vasnprintf +++ b/modules/vasnprintf @@ -15,6 +15,7 @@ m4/wchar_t.m4 m4/wint_t.m4 m4/longlong.m4 m4/intmax_t.m4 +m4/eoverflow.m4 m4/vasnprintf.m4 Depends-on: