summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2006-06-27 18:47:37 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2006-06-27 18:47:37 +0000
commit3b373a64fe7c6cd856897a32e4834cf125797713 (patch)
tree32a5761a04a99c3810ef006c7b3291f53ad2e411 /m4
parent6a4be40e01252fe8b2911a98d6dc1767328ccb67 (diff)
downloadmailutils-3b373a64fe7c6cd856897a32e4834cf125797713.tar.gz
mailutils-3b373a64fe7c6cd856897a32e4834cf125797713.tar.bz2
Updated by gnulib-sync
Diffstat (limited to 'm4')
-rw-r--r--m4/argp.m422
-rw-r--r--m4/extensions.m416
-rw-r--r--m4/getlogin_r.m47
-rw-r--r--m4/getopt.m49
-rw-r--r--m4/getpass.m410
-rw-r--r--m4/longdouble.m47
-rw-r--r--m4/regex.m479
-rw-r--r--m4/setenv.m46
-rw-r--r--m4/size_max.m445
-rw-r--r--m4/ssize_t.m413
-rw-r--r--m4/stdbool.m435
-rw-r--r--m4/stdint.m4654
-rw-r--r--m4/strerror_r.m41
-rw-r--r--m4/strndup.m436
14 files changed, 810 insertions, 130 deletions
diff --git a/m4/argp.m4 b/m4/argp.m4
index 6a5d6b246..7d761ae97 100644
--- a/m4/argp.m4
+++ b/m4/argp.m4
@@ -1,5 +1,5 @@
-# argp.m4 serial 5
-dnl Copyright (C) 2003-2005 Free Software Foundation, Inc.
+# argp.m4 serial 6
+dnl Copyright (C) 2003-2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -43,11 +43,19 @@ AC_DEFUN([gl_ARGP],
AC_MSG_RESULT(yes)],
[ AC_MSG_RESULT(no)] )
- AC_CHECK_DECLS_ONCE(
- [clearerr_unlocked feof_unlocked ferror_unlocked
- fflush_unlocked fgets_unlocked fputc_unlocked fputs_unlocked
- fread_unlocked fwrite_unlocked getc_unlocked
- getchar_unlocked putc_unlocked putchar_unlocked])
+ AC_CHECK_DECLS_ONCE([clearerr_unlocked])
+ AC_CHECK_DECLS_ONCE([feof_unlocked])
+ AC_CHECK_DECLS_ONCE([ferror_unlocked])
+ AC_CHECK_DECLS_ONCE([fflush_unlocked])
+ AC_CHECK_DECLS_ONCE([fgets_unlocked])
+ AC_CHECK_DECLS_ONCE([fputc_unlocked])
+ AC_CHECK_DECLS_ONCE([fputs_unlocked])
+ AC_CHECK_DECLS_ONCE([fread_unlocked])
+ AC_CHECK_DECLS_ONCE([fwrite_unlocked])
+ AC_CHECK_DECLS_ONCE([getc_unlocked])
+ AC_CHECK_DECLS_ONCE([getchar_unlocked])
+ AC_CHECK_DECLS_ONCE([putc_unlocked])
+ AC_CHECK_DECLS_ONCE([putchar_unlocked])
AC_CHECK_FUNCS_ONCE([flockfile funlockfile])
AC_CHECK_HEADERS_ONCE([features.h linewrap.h])
])
diff --git a/m4/extensions.m4 b/m4/extensions.m4
index e71845f1d..497607918 100644
--- a/m4/extensions.m4
+++ b/m4/extensions.m4
@@ -1,10 +1,13 @@
# Enable extensions on systems that normally disable them.
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
+# This file is only needed in autoconf <= 2.59. Newer versions of autoconf
+# have a macro AC_USE_SYSTEM_EXTENSIONS with identical semantics.
+
# gl_USE_SYSTEM_EXTENSIONS
# ------------------------
# Enable extensions on systems that normally disable them,
@@ -25,6 +28,15 @@ AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif])
- AC_DEFINE([__EXTENSIONS__])
+ AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
+ [ac_cv_safe_to_define___extensions__],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([
+ #define __EXTENSIONS__ 1
+ AC_INCLUDES_DEFAULT])],
+ [ac_cv_safe_to_define___extensions__=yes],
+ [ac_cv_safe_to_define___extensions__=no])])
+ test $ac_cv_safe_to_define___extensions__ = yes &&
+ AC_DEFINE([__EXTENSIONS__])
AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
])
diff --git a/m4/getlogin_r.m4 b/m4/getlogin_r.m4
index b90e0c275..5ad365c99 100644
--- a/m4/getlogin_r.m4
+++ b/m4/getlogin_r.m4
@@ -1,6 +1,6 @@
-#serial 1
+#serial 2
-# Copyright (C) 2005 Free Software Foundation, Inc.
+# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -29,5 +29,6 @@ AC_DEFUN([gl_GETLOGIN_R],
AC_DEFUN([gl_PREREQ_GETLOGIN_R],
[
AC_CHECK_HEADERS_ONCE([unistd.h])
- AC_CHECK_DECLS_ONCE([getlogin getlogin_r])
+ AC_CHECK_DECLS_ONCE([getlogin])
+ AC_CHECK_DECLS_ONCE([getlogin_r])
])
diff --git a/m4/getopt.m4 b/m4/getopt.m4
index c8b9171b3..e9ebae4cf 100644
--- a/m4/getopt.m4
+++ b/m4/getopt.m4
@@ -1,5 +1,5 @@
-# getopt.m4 serial 11
-dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+# getopt.m4 serial 12
+dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -77,4 +77,7 @@ AC_DEFUN([gl_GETOPT_IFELSE],
AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])])
# Prerequisites of lib/getopt*.
-AC_DEFUN([gl_PREREQ_GETOPT], [:])
+AC_DEFUN([gl_PREREQ_GETOPT],
+[
+ AC_CHECK_DECLS_ONCE([getenv])
+])
diff --git a/m4/getpass.m4 b/m4/getpass.m4
index 3d7d33bbb..ba6815f61 100644
--- a/m4/getpass.m4
+++ b/m4/getpass.m4
@@ -1,5 +1,5 @@
-# getpass.m4 serial 6
-dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc.
+# getpass.m4 serial 7
+dnl Copyright (C) 2002-2003, 2005-2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -37,5 +37,9 @@ AC_DEFUN([gl_FUNC_GETPASS_GNU],
AC_DEFUN([gl_PREREQ_GETPASS], [
AC_CHECK_HEADERS_ONCE(stdio_ext.h termios.h)
AC_CHECK_FUNCS_ONCE(__fsetlocking tcgetattr tcsetattr)
- AC_CHECK_DECLS_ONCE([fflush_unlocked flockfile fputs_unlocked funlockfile putc_unlocked])
+ AC_CHECK_DECLS_ONCE([fflush_unlocked])
+ AC_CHECK_DECLS_ONCE([flockfile])
+ AC_CHECK_DECLS_ONCE([fputs_unlocked])
+ AC_CHECK_DECLS_ONCE([funlockfile])
+ AC_CHECK_DECLS_ONCE([putc_unlocked])
])
diff --git a/m4/longdouble.m4 b/m4/longdouble.m4
index 40cd7ce02..25590f470 100644
--- a/m4/longdouble.m4
+++ b/m4/longdouble.m4
@@ -1,5 +1,5 @@
-# longdouble.m4 serial 1 (gettext-0.12)
-dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
+# longdouble.m4 serial 2 (gettext-0.15)
+dnl Copyright (C) 2002-2003, 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -8,6 +8,9 @@ dnl From Bruno Haible.
dnl Test whether the compiler supports the 'long double' type.
dnl Prerequisite: AC_PROG_CC
+dnl This file is only needed in autoconf <= 2.59. Newer versions of autoconf
+dnl have a macro AC_TYPE_LONG_DOUBLE with identical semantics.
+
AC_DEFUN([gt_TYPE_LONGDOUBLE],
[
AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
diff --git a/m4/regex.m4 b/m4/regex.m4
index f296ae8a7..29abb7456 100644
--- a/m4/regex.m4
+++ b/m4/regex.m4
@@ -1,7 +1,7 @@
-#serial 31
+#serial 36
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free
-# Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -14,31 +14,6 @@ AC_PREREQ([2.50])
AC_DEFUN([gl_REGEX],
[
- AC_REQUIRE([AC_SYS_LARGEFILE]) dnl for a sufficently-wide off_t
-
- AC_CACHE_CHECK([whether off_t can be used in a switch statement],
- [gl_cv_type_off_t_switch],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [AC_INCLUDES_DEFAULT],
- [[off_t o = -1;
- switch (o)
- {
- case -2:
- return 1;
- case -1:
- return 2;
- default:
- return 0;
- }
- ]])],
- [gl_cv_type_off_t_switch=yes],
- [gl_cv_type_off_t_switch=no])])
- if test $gl_cv_type_off_t_switch = yes; then
- AC_DEFINE([_REGEX_LARGE_OFFSETS], 1,
- [Define if you want regoff_t to be at least as wide POSIX requires.])
- fi
-
MU_LIBSOURCES(
[regcomp.c, regex.c, regex.h,
regex_internal.c, regex_internal.h, regexec.c])
@@ -49,7 +24,7 @@ AC_DEFUN([gl_REGEX],
systems with recent-enough versions of the GNU C
Library (use with caution on other systems)])])
- case $with_included_regex in
+ case $with_included_regex in #(
yes|no) ac_use_included_regex=$with_included_regex
;;
'')
@@ -59,20 +34,24 @@ AC_DEFUN([gl_REGEX],
# regex.c. The first failing regular expression is from `Spencer ere
# test #75' in grep-2.3.
AC_CACHE_CHECK([for working re_compile_pattern],
- [gl_cv_func_re_compile_pattern_broken],
+ [gl_cv_func_re_compile_pattern_working],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[AC_INCLUDES_DEFAULT
- #include <regex.h>],
+ #include <limits.h>
+ #include <regex.h>
+ ],
[[static struct re_pattern_buffer regex;
+ unsigned char folded_chars[UCHAR_MAX + 1];
+ int i;
const char *s;
struct re_registers regs;
- /* Use the POSIX-compliant spelling with leading REG_,
- rather than the traditional GNU spelling with leading RE_,
- so that we reject older libc implementations. */
- re_set_syntax (REG_SYNTAX_POSIX_EGREP);
+ re_set_syntax (RE_SYNTAX_POSIX_EGREP);
memset (&regex, 0, sizeof (regex));
- s = re_compile_pattern ("a[:@:>@:]b\n", 9, &regex);
+ for (i = 0; i <= UCHAR_MAX; i++)
+ folded_chars[i] = i;
+ regex.translate = folded_chars;
+ s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, &regex);
/* This should fail with _Invalid character class name_ error. */
if (!s)
exit (1);
@@ -106,10 +85,9 @@ AC_DEFUN([gl_REGEX],
exit (1);
/* The version of regex.c in older versions of gnulib
- ignored REG_IGNORE_CASE (which was then called RE_ICASE).
- Detect that problem too. */
+ ignored RE_ICASE. Detect that problem too. */
memset (&regex, 0, sizeof (regex));
- re_set_syntax (REG_SYNTAX_EMACS | REG_IGNORE_CASE);
+ re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE);
s = re_compile_pattern ("x", 1, &regex);
if (s)
exit (1);
@@ -123,24 +101,29 @@ AC_DEFUN([gl_REGEX],
exit (1);
/* Reject hosts whose regoff_t values are too narrow.
- These include glibc 2.3.5 on hosts with 64-bit off_t
- and 32-bit int, and Solaris 10 on hosts with 32-bit int
- and _FILE_OFFSET_BITS=64. */
- if (sizeof (regoff_t) < sizeof (off_t))
+ These include glibc 2.3.5 on hosts with 64-bit ptrdiff_t
+ and 32-bit int. */
+ if (sizeof (regoff_t) < sizeof (ptrdiff_t)
+ || sizeof (regoff_t) < sizeof (ssize_t))
exit (1);
exit (0);]])],
- [gl_cv_func_re_compile_pattern_broken=no],
- [gl_cv_func_re_compile_pattern_broken=yes],
- dnl When crosscompiling, assume it is broken.
- [gl_cv_func_re_compile_pattern_broken=yes])])
- ac_use_included_regex=$gl_cv_func_re_compile_pattern_broken
+ [gl_cv_func_re_compile_pattern_working=yes],
+ [gl_cv_func_re_compile_pattern_working=no],
+ dnl When crosscompiling, assume it is not working.
+ [gl_cv_func_re_compile_pattern_working=no])])
+ case $gl_cv_func_re_compile_pattern_working in #(
+ yes) ac_use_included_regex=no;; #(
+ no) ac_use_included_regex=yes;;
+ esac
;;
*) AC_MSG_ERROR([Invalid value for --with-included-regex: $with_included_regex])
;;
esac
if test $ac_use_included_regex = yes; then
+ AC_DEFINE([_REGEX_LARGE_OFFSETS], 1,
+ [Define if you want regoff_t to be at least as wide POSIX requires.])
AC_DEFINE([re_syntax_options], [rpl_re_syntax_options],
[Define to rpl_re_syntax_options if the replacement should be used.])
AC_DEFINE([re_set_syntax], [rpl_re_set_syntax],
diff --git a/m4/setenv.m4 b/m4/setenv.m4
index 4c76be1ff..623fcf2b5 100644
--- a/m4/setenv.m4
+++ b/m4/setenv.m4
@@ -1,5 +1,5 @@
-# setenv.m4 serial 5
-dnl Copyright (C) 2001-2004 Free Software Foundation, Inc.
+# setenv.m4 serial 6
+dnl Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -57,7 +57,6 @@ AC_DEFUN([gl_PREREQ_SETENV],
AC_CHECK_HEADERS_ONCE(unistd.h)
AC_CHECK_HEADERS(search.h)
AC_CHECK_FUNCS(tsearch)
- gt_CHECK_VAR_DECL([#include <errno.h>], errno)
gt_CHECK_VAR_DECL([#include <unistd.h>], environ)
])
@@ -65,6 +64,5 @@ AC_DEFUN([gl_PREREQ_SETENV],
AC_DEFUN([gl_PREREQ_UNSETENV],
[
AC_CHECK_HEADERS_ONCE(unistd.h)
- gt_CHECK_VAR_DECL([#include <errno.h>], errno)
gt_CHECK_VAR_DECL([#include <unistd.h>], environ)
])
diff --git a/m4/size_max.m4 b/m4/size_max.m4
index 0336f3af5..029e47195 100644
--- a/m4/size_max.m4
+++ b/m4/size_max.m4
@@ -1,5 +1,5 @@
-# size_max.m4 serial 3
-dnl Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+# size_max.m4 serial 4
+dnl Copyright (C) 2003, 2005-2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -23,28 +23,29 @@ Found it
], result=yes)
if test -z "$result"; then
dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
- dnl than the type 'unsigned long'.
- dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr',
- dnl which is guaranteed to work from LONG_MIN to LONG_MAX.
- _AC_COMPUTE_INT([(size_t)~(size_t)0 / 10], res_hi,
- [#include <stddef.h>], result=?)
- _AC_COMPUTE_INT([(size_t)~(size_t)0 % 10], res_lo,
- [#include <stddef.h>], result=?)
+ dnl than the type 'unsigned long'. Try hard to find a definition that can
+ dnl be used in a preprocessor #if, i.e. doesn't contain a cast.
+ _AC_COMPUTE_INT([sizeof (size_t) * CHAR_BIT - 1], size_t_bits_minus_1,
+ [#include <stddef.h>
+#include <limits.h>], size_t_bits_minus_1=)
_AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint,
- [#include <stddef.h>], result=?)
- if test "$fits_in_uint" = 1; then
- dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
- dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
- AC_TRY_COMPILE([#include <stddef.h>
- extern size_t foo;
- extern unsigned long foo;
- ], [], fits_in_uint=0)
- fi
- if test -z "$result"; then
- if test "$fits_in_uint" = 1; then
- result="$res_hi$res_lo"U
+ [#include <stddef.h>], fits_in_uint=)
+ if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then
+ if test $fits_in_uint = 1; then
+ dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
+ dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
+ AC_TRY_COMPILE([#include <stddef.h>
+ extern size_t foo;
+ extern unsigned long foo;
+ ], [], fits_in_uint=0)
+ fi
+ dnl We cannot use 'expr' to simplify this expression, because 'expr'
+ dnl works only with 'long' integers in the host environment, while we
+ dnl might be cross-compiling from a 32-bit platform to a 64-bit platform.
+ if test $fits_in_uint = 1; then
+ result="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)"
else
- result="$res_hi$res_lo"UL
+ result="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)"
fi
else
dnl Shouldn't happen, but who knows...
diff --git a/m4/ssize_t.m4 b/m4/ssize_t.m4
index 19b379fee..4eaef93ce 100644
--- a/m4/ssize_t.m4
+++ b/m4/ssize_t.m4
@@ -1,5 +1,5 @@
-# ssize_t.m4 serial 3 (gettext-0.13)
-dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
+# ssize_t.m4 serial 4 (gettext-0.15)
+dnl Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -9,12 +9,13 @@ dnl Test whether ssize_t is defined.
AC_DEFUN([gt_TYPE_SSIZE_T],
[
- AC_CACHE_CHECK([for ssize_t], gt_cv_ssize_t,
+ AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t],
[AC_TRY_COMPILE([#include <sys/types.h>],
- [int x = sizeof (ssize_t *) + sizeof (ssize_t);],
- gt_cv_ssize_t=yes, gt_cv_ssize_t=no)])
+ [int x = sizeof (ssize_t *) + sizeof (ssize_t);
+ return !x;],
+ [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])])
if test $gt_cv_ssize_t = no; then
- AC_DEFINE(ssize_t, int,
+ AC_DEFINE([ssize_t], [int],
[Define as a signed type of the same size as size_t.])
fi
])
diff --git a/m4/stdbool.m4 b/m4/stdbool.m4
index dcb579353..2204ecd98 100644
--- a/m4/stdbool.m4
+++ b/m4/stdbool.m4
@@ -1,6 +1,6 @@
# Check for stdbool.h that conforms to C99.
-dnl Copyright (C) 2002-2005 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -64,9 +64,9 @@ AC_DEFUN([AC_HEADER_STDBOOL],
char a[true == 1 ? 1 : -1];
char b[false == 0 ? 1 : -1];
char c[__bool_true_false_are_defined == 1 ? 1 : -1];
- char d[(bool) -0.5 == true ? 1 : -1];
+ char d[(bool) 0.5 == true ? 1 : -1];
bool e = &s;
- char f[(_Bool) -0.0 == false ? 1 : -1];
+ char f[(_Bool) 0.0 == false ? 1 : -1];
char g[true];
char h[sizeof (_Bool)];
char i[sizeof s.t];
@@ -74,11 +74,38 @@ AC_DEFUN([AC_HEADER_STDBOOL],
_Bool n[m];
char o[sizeof n == m * sizeof n[0] ? 1 : -1];
char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+ #if defined __xlc__ || defined __GNUC__
+ /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
+ reported by James Lemley on 2005-10-05; see
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
+ This test is not quite right, since xlc is allowed to
+ reject this program, as the initializer for xlcbug is
+ not one of the forms that C requires support for.
+ However, doing the test right would require a run-time
+ test, and that would make cross-compilation harder.
+ Let us hope that IBM fixes the xlc bug, and also adds
+ support for this kind of constant expression. In the
+ meantime, this test will reject xlc, which is OK, since
+ our stdbool.h substitute should suffice. We also test
+ this with GCC, where it should work, to detect more
+ quickly whether someone messes up the test in the
+ future. */
+ char digs[] = "0123456789";
+ int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
+ #endif
+ /* Catch a bug in an HP-UX C compiler. See
+ http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+ */
+ _Bool q = true;
+ _Bool *pq = &q;
],
[
+ *pq |= q;
+ *pq |= ! q;
/* Refer to every declared value, to avoid compiler optimizations. */
return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
- + !m + !n + !o + !p);
+ + !m + !n + !o + !p + !q + !pq);
],
[ac_cv_header_stdbool_h=yes],
[ac_cv_header_stdbool_h=no])])
diff --git a/m4/stdint.m4 b/m4/stdint.m4
index d4a6994c4..e529ef3d2 100644
--- a/m4/stdint.m4
+++ b/m4/stdint.m4
@@ -1,5 +1,5 @@
-# stdint.m4 serial 5
-dnl Copyright (C) 2001-2002, 2004-2005 Free Software Foundation, Inc.
+# stdint.m4 serial 10
+dnl Copyright (C) 2001-2002, 2004-2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -8,24 +8,59 @@ dnl From Bruno Haible.
dnl Test whether <stdint.h> is supported or must be substituted.
AC_DEFUN([gl_STDINT_H],
-[dnl Check for <inttypes.h>.
-AC_REQUIRE([gt_HEADER_INTTYPES_H])
-dnl Check for <sys/inttypes.h>.
-AC_CHECK_HEADERS([sys/inttypes.h])
-dnl Check for <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
-AC_CHECK_HEADERS([sys/bitypes.h])
-
-AC_MSG_CHECKING([for stdint.h])
-AC_CACHE_VAL(gl_cv_header_stdint_h, [
- AC_TRY_COMPILE([#include <stdint.h>], [],
- gl_cv_header_stdint_h=yes, gl_cv_header_stdint_h=no)])
-AC_MSG_RESULT([$gl_cv_header_stdint_h])
-if test $gl_cv_header_stdint_h = yes; then
- AC_DEFINE(HAVE_STDINT_H, 1,
- [Define if you have a working <stdint.h> header file.])
- STDINT_H=''
-else
- STDINT_H='stdint.h'
+[
+ dnl Check for <wchar.h>.
+ AC_CHECK_HEADERS_ONCE([wchar.h])
+ if test $ac_cv_header_wchar_h = yes; then
+ HAVE_WCHAR_H=1
+ else
+ HAVE_WCHAR_H=0
+ fi
+ AC_SUBST([HAVE_WCHAR_H])
+
+ dnl Check for <stdint.h> that doesn't clash with <sys/types.h>.
+ gl_HEADER_STDINT_H
+ if test $gl_cv_header_stdint_h = yes; then
+ ac_cv_header_stdint_h=yes; dnl Hack for gl_FULL_HEADER_PATH.
+ gl_FULL_HEADER_PATH([stdint.h])
+ FULL_PATH_STDINT_H='<'$gl_cv_full_path_stdint_h'>'
+ AC_SUBST([FULL_PATH_STDINT_H])
+ HAVE_STDINT_H=1
+ else
+ HAVE_STDINT_H=0
+ fi
+ AC_SUBST([HAVE_STDINT_H])
+
+ dnl Check for <inttypes.h> that doesn't clash with <sys/types.h>.
+ gl_HEADER_INTTYPES_H
+ if test $gl_cv_header_inttypes_h = yes; then
+ ac_cv_header_inttypes_h=yes; dnl Hack for gl_FULL_HEADER_PATH.
+ gl_FULL_HEADER_PATH([inttypes.h])
+ FULL_PATH_INTTYPES_H='<'$gl_cv_full_path_inttypes_h'>'
+ AC_SUBST([FULL_PATH_INTTYPES_H])
+ HAVE_INTTYPES_H=1
+ else
+ HAVE_INTTYPES_H=0
+ fi
+ AC_SUBST([HAVE_INTTYPES_H])
+
+ dnl Check for <sys/inttypes.h>.
+ AC_CHECK_HEADERS([sys/inttypes.h])
+ if test $ac_cv_header_sys_inttypes_h = yes; then
+ HAVE_SYS_INTTYPES_H=1
+ else
+ HAVE_SYS_INTTYPES_H=0
+ fi
+ AC_SUBST([HAVE_SYS_INTTYPES_H])
+
+ dnl Check for <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
+ AC_CHECK_HEADERS([sys/bitypes.h])
+ if test $ac_cv_header_sys_bitypes_h = yes; then
+ HAVE_SYS_BITYPES_H=1
+ else
+ HAVE_SYS_BITYPES_H=0
+ fi
+ AC_SUBST([HAVE_SYS_BITYPES_H])
dnl Is long == int64_t ?
AC_CACHE_CHECK([whether 'long' is 64 bit wide], gl_cv_long_bitsize_64, [
@@ -55,6 +90,581 @@ typedef int array [2 * (POW63 != 0 && POW64 == 0) - 1];
fi
AC_SUBST(HAVE_LONG_LONG_64BIT)
-fi
-AC_SUBST(STDINT_H)
+ dnl Here we use FULL_PATH_INTTYPES_H and FULL_PATH_STDINT_H, not just
+ dnl <inttypes.h> and <stdint.h>, so that it also works during a
+ dnl "config.status --recheck" if an inttypes.h or stdint.h have been
+ dnl created in the build directory.
+ other_includes='
+/* Get those types that are already defined in other system include files. */
+#if defined(__FreeBSD__) && (__FreeBSD__ >= 3) && (__FreeBSD__ <= 4)
+# include <sys/inttypes.h>
+#endif
+#if defined(__OpenBSD__) || defined(__bsdi__) || defined(__sgi)
+# include <sys/types.h>
+# if HAVE_INTTYPES_H
+# include FULL_PATH_INTTYPES_H
+# endif
+#endif
+#if defined(__linux__) && HAVE_SYS_BITYPES_H
+# include <sys/bitypes.h>
+#endif
+#if defined(__sun) && HAVE_SYS_INTTYPES_H
+# include <sys/inttypes.h>
+#endif
+#if (defined(__hpux) || defined(_AIX)) && HAVE_INTTYPES_H
+# include FULL_PATH_INTTYPES_H
+#endif
+#if HAVE_STDINT_H && !(defined(__sgi) && HAVE_INTTYPES_H && !defined(__c99))
+# include FULL_PATH_STDINT_H
+#endif
+'
+ gl_STDINT_CHECK_TYPES(
+ [int8_t int16_t int32_t int64_t \
+ uint8_t uint16_t uint32_t uint64_t \
+ int_least8_t int_least16_t int_least32_t int_least64_t \
+ uint_least8_t uint_least16_t uint_least32_t uint_least64_t \
+ int_fast8_t int_fast16_t int_fast32_t int_fast64_t \
+ uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t \
+ intptr_t uintptr_t \
+ intmax_t uintmax_t],
+ [$other_includes],
+ [gl_cv_type_], [], [])
+
+ dnl Now see if we need a substitute <stdint.h>.
+ gl_cv_header_working_stdint_h=no
+ if test $gl_cv_header_stdint_h = yes; then
+ gl_STDINT_CHECK_TYPES(
+ [int64_t uint64_t \
+ int_least64_t uint_least64_t \
+ int_fast64_t uint_fast64_t],
+ [#include <stdint.h>],
+ [gl_cv_stdint_], [_IN_STDINT_H], [in <stdint.h>])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([
+#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
+#include <stdint.h>
+int8_t a1 = INT8_C (17);
+int16_t a2 = INT16_C (17);
+int32_t a3 = INT32_C (17);
+#if HAVE_INT64_T_IN_STDINT_H
+int64_t a4 = INT64_C (17);
+#endif
+uint8_t b1 = UINT8_C (17);
+uint16_t b2 = UINT16_C (17);
+uint32_t b3 = UINT32_C (17);
+#if HAVE_UINT64_T_IN_STDINT_H
+uint64_t b4 = UINT64_C (17);
+#endif
+int_least8_t c1 = 17;
+int_least16_t c2 = 17;
+int_least32_t c3 = 17;
+#if HAVE_INT_LEAST64_T_IN_STDINT_H
+int_least64_t c4 = 17;
+#endif
+uint_least8_t d1 = 17;
+uint_least16_t d2 = 17;
+uint_least32_t d3 = 17;
+#if HAVE_UINT_LEAST64_T_IN_STDINT_H
+uint_least64_t d4 = 17;
+#endif
+int_fast8_t e1 = 17;
+int_fast16_t e2 = 17;
+int_fast32_t e3 = 17;
+#if HAVE_INT_FAST64_T_IN_STDINT_H
+int_fast64_t e4 = 17;
+#endif
+uint_fast8_t f1 = 17;
+uint_fast16_t f2 = 17;
+uint_fast32_t f3 = 17;
+#if HAVE_UINT_FAST64_T_IN_STDINT_H
+uint_fast64_t f4 = 17;
+#endif
+intptr_t g = 17;
+uintptr_t h = 17;
+intmax_t i = INTMAX_C (17);
+uintmax_t j = UINTMAX_C (17);
+ ])],
+ [gl_cv_header_working_stdint_h=yes])
+ fi
+ if test $gl_cv_header_working_stdint_h = yes; then
+ dnl Use the existing <stdint.h>, adding missing macro definitions.
+ suff64=
+ suffu64=
+ if test $HAVE_LONG_64BIT = 1; then
+ suff64=L
+ suffu64=UL
+ else
+ if test $HAVE_LONG_LONG_64BIT = 1; then
+ suff64=LL
+ suffu64=ULL
+ else
+ AC_EGREP_CPP([msvc compiler], [
+#ifdef _MSC_VER
+msvc compiler
+#endif
+ ], [
+ suff64=i64
+ suffu64=ui64
+ ])
+ fi
+ fi
+ dnl Here we assume a standard architecture where the hardware integer
+ dnl types have 8, 16, 32, optionally 64 bits.
+ gl_STDINT_MISSING_BOUND([INT8_MIN], [-128],
+ [Define if <stdint.h> doesn't define it.])
+ gl_STDINT_MISSING_BOUND([INT8_MAX], [127],
+ [Define if <stdint.h> doesn't define it.])
+ gl_STDINT_MISSING_BOUND([UINT8_MAX], [255],
+ [Define if <stdint.h> doesn't define it.])
+ gl_STDINT_MISSING_BOUND([INT16_MIN], [-32768],
+ [Define if <stdint.h> doesn't define it.])
+ gl_STDINT_MISSING_BOUND([INT16_MAX], [32767],
+ [Define if <stdint.h> doesn't define it.])
+ gl_STDINT_MISSING_BOUND([UINT16_MAX], [65535],
+ [Define if <stdint.h> doesn't define it.])
+ gl_STDINT_MISSING_BOUND([INT32_MIN], [(~INT32_MAX)],
+ [Define if <stdint.h> doesn't define it.])
+ gl_STDINT_MISSING_BOUND([INT32_MAX], [2147483647],
+ [Define if <stdint.h> doesn't define it.])
+ gl_STDINT_MISSING_BOUND([UINT32_MAX], [4294967295U],
+ [Define if <stdint.h> doesn't define it.])
+ if test $gl_cv_stdint_int64_t = yes; then
+ gl_STDINT_MISSING_BOUND([INT64_MIN], [(~INT64_MAX)],
+ [Define if <stdint.h> doesn't define it but has the int64_t type.])
+ gl_STDINT_MISSING_BOUND([INT64_MAX], [9223372036854775807${suff64}],
+ [Define if <stdint.h> doesn't define it but has the int64_t type.])
+ fi
+ if test $gl_cv_stdint_uint64_t = yes; then
+ gl_STDINT_MISSING_BOUND([UINT64_MAX], [18446744073709551615${suffu64}],
+ [Define if <stdint.h> doesn't define it but has the uint64_t type.])
+ fi
+ dnl Here we assume a standard architecture where the hardware integer
+ dnl types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
+ dnl are the same as the corresponding N_t types.
+ gl_STDINT_MISSING_BOUND([INT_LEAST8_MIN], [INT8_MIN],
+ [Define if <stdint.h> doesn't define it.])
+ gl_STDINT_MISSING_BOUND([INT_LEAST8_MAX], [INT8_MAX],
+ [Define if <stdint.h> doesn't define it.])
+ gl_STDINT_MISSING_BOUND([UINT_LEAST8_MAX], [UINT8_MAX],
+ [Define if <stdint.h> doesn't define it.])
+ gl_STDINT_MISSING_BOUND([INT_LEAST16_MIN], [INT16_MIN],
+ [Define if <stdint.h> doesn't define it.])
+ gl_STDINT_MISSING_BOUND([INT_LEAST16_MAX], [INT16_MAX],
+ [Define if <stdint.h> doesn't define it.])
+ gl_STDINT_MISSING_BOUND([UINT_LEAST16_MAX], [UINT16_MAX],
+ [Define if <stdint.h> doesn't define it.])
+ gl_STDINT_MISSING_BOUND([INT_LEAST32_MIN], [INT32_MIN],
+ [Define if <stdint.h> doesn't define it.])
+ gl_STDINT_MISSING_BOUND([INT_LEAST32_MAX], [INT32_MAX],
+ [Define if <stdint.h> doesn't define it.])
+ gl_STDINT_MISSING_BOUND([UINT_LEAST32_MAX], [UINT32_MAX],
+ [Define if <stdint.h> doesn't define it.])
+ if test $gl_cv_stdint_int_least64_t = yes; then
+ gl_STDINT_MISSING_BOUND([INT_LEAST64_MIN], [INT64_MIN],
+ [Define if <stdint.h> doesn't define it but has the int_least64_t type.])
+ gl_STDINT_MISSING_BOUND([INT_LEAST64_MAX], [INT64_MAX],
+ [Define if <stdint.h> doesn't define it but has the int_least64_t type.])
+ fi
+ if test $gl_cv_stdint_uint_least64_t = yes; then
+ gl_STDINT_MISSING_BOUND([UINT_LEAST64_MAX], [UINT64_MAX],
+ [Define if <stdint.h> doesn't define it but has the uint_least64_t type.])
+ fi
+ dnl Here we assume a standard architecture where the hardware integer
+ dnl types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
+ dnl are taken from the same list of types.
+ gl_STDINT_MISSING_BOUNDS([INT_FAST8_MIN INT_FAST8_MAX UINT_FAST8_MAX \
+ INT_FAST16_MIN INT_FAST16_MAX UINT_FAST16_MAX \
+ INT_FAST32_MIN INT_FAST32_MAX UINT_FAST32_MAX])
+ if test $gl_cv_stdint_uint_fast64_t = yes; then
+ gl_STDINT_MISSING_BOUNDS([INT_FAST64_MIN INT_FAST64_MAX])
+ fi
+ if test $gl_cv_stdint_uint_fast64_t = yes; then
+ gl_STDINT_MISSING_BOUNDS([UINT_FAST64_MAX])
+ fi
+ gl_STDINT_MISSING_BOUNDS([INTPTR_MIN INTPTR_MAX UINTPTR_MAX \
+ INTMAX_MIN INTMAX_MAX UINTMAX_MAX])
+ gl_STDINT_MISSING_BOUNDS([PTRDIFF_MIN PTRDIFF_MAX], [#include <stddef.h>])
+ gl_SIZE_MAX
+ gl_STDINT_MISSING_BOUNDS2([SIG_ATOMIC_MIN SIG_ATOMIC_MAX],
+ [#include <signal.h>])
+ dnl Don't bother defining WCHAR_MIN and WCHAR_MAX, since they should
+ dnl already be defined in <stddef.h> or <wchar.h>.
+ dnl For wint_t we need <wchar.h>.
+ dnl Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included
+ dnl before <wchar.h>.
+ dnl BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
+ dnl <wchar.h>.
+ gl_STDINT_MISSING_BOUNDS2([WINT_MIN WINT_MAX], [
+#include <stdio.h>
+#include <time.h>
+#include <wchar.h>
+])
+ STDINT_H=''
+ else
+
+ gl_STDINT_BITSIZEOF(
+ [int8_t int16_t int32_t int64_t \
+ uint8_t uint16_t uint32_t uint64_t \
+ int_least8_t int_least16_t int_least32_t int_least64_t \
+ uint_least8_t uint_least16_t uint_least32_t uint_least64_t \
+ int_fast8_t int_fast16_t int_fast32_t int_fast64_t \
+ uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t \
+ intptr_t uintptr_t \
+ intmax_t uintmax_t],
+ [$other_includes])
+
+ gl_cv_type_unsigned_int=yes
+ gl_cv_type_long=yes
+ gl_cv_type_unsigned_long=yes
+ gl_STDINT_BITSIZEOF([unsigned_int long unsigned_long],
+ [typedef unsigned int unsigned_int;
+ typedef unsigned long unsigned_long;])
+
+ AC_CHECK_TYPES([ptrdiff_t])
+ gl_cv_type_ptrdiff_t=$ac_cv_type_ptrdiff_t
+ AC_REQUIRE([AC_TYPE_SIZE_T])
+ gl_cv_type_size_t=yes
+ gl_STDINT_BITSIZEOF([ptrdiff_t size_t], [#include <stddef.h>])
+ gl_CHECK_TYPE_SAME([ptrdiff_t], [long], [#include <stddef.h>])
+ gl_CHECK_TYPE_SAME([size_t], [unsigned long], [#include <stddef.h>])
+
+ AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
+ gl_cv_type_sig_atomic_t=$ac_cv_type_sig_atomic_t
+ gl_STDINT_BITSIZEOF([sig_atomic_t], [#include <signal.h>])
+ gl_CHECK_TYPES_SIGNED([sig_atomic_t], [#include <signal.h>])
+ if test $HAVE_SIGNED_SIG_ATOMIC_T = 1; then
+ gl_CHECK_TYPE_SAME([sig_atomic_t], [long], [#include <signal.h>])
+ else
+ gl_CHECK_TYPE_SAME([sig_atomic_t], [unsigned long], [#include <signal.h>])
+ fi
+
+ AC_REQUIRE([gt_TYPE_WCHAR_T])
+ gl_cv_type_wchar_t=$gt_cv_c_wchar_t
+ gl_STDINT_BITSIZEOF([wchar_t], [#include <stddef.h>])
+ gl_CHECK_TYPES_SIGNED([wchar_t], [#include <stddef.h>])
+ if test $HAVE_SIGNED_WCHAR_T = 1; then
+ gl_CHECK_TYPE_SAME([wchar_t], [long], [#include <stddef.h>])
+ else
+ gl_CHECK_TYPE_SAME([wchar_t], [unsigned long], [#include <stddef.h>])
+ fi
+
+ dnl For wint_t we need <wchar.h>.
+ dnl Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included
+ dnl before <wchar.h>.
+ dnl BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be include