bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

simplification rewrite of stdint module installed into gnulib


From: Paul Eggert
Subject: simplification rewrite of stdint module installed into gnulib
Date: Sat, 01 Jul 2006 23:57:41 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

I made the changes that Bruno suggested to the stdint simplification
change.  Backporting to Autoconf 2.59, and checking that long long is
actually 64 bits or more, required updating longlong.m4 and
ulonglong.m4 as well.  I'd like gnulib to switch to the Autoconf 2.60
names (e.g., HAVE_LONG_LONG_INT rather than HAVE_LONG_LONG) but for
now longlong.m4 supports both names, and similarly for ulonglong.m4.

I no longer have access to OpenBSD 3.4, but tested on OpenBSD 3.9,
and discovered that its stdint.h also does not quite conform to
C99 (in a different way).  I added a test for that as well.

Once stdint settles down several other changes should be done in other
modules aside from the HAVE_LONG_LONG renaming (e.g., uint32_t.m4 can
go), but I deferred that for now.

Here's what I installed into gnulib:

2006-07-01  Paul Eggert  <address@hidden>

        * lib/stdint_.h (_GL_STDINT_H): Renamed from _STDINT_H, to avoid
        possible collision with system files.
        (<stdio.h>, <time.h>, <wchar.h>) [defined __cplusplus && ! defined
        __STDC_CONSTANT_MACROS)]: Do not include, since we don't need
        WCHAR_MIN and WCHAR_MAX in this case.
        (<stddef.h>): Do not include; no longer needed.
        (<sys/types.h>): Include if @HAVE_SYS_TYPES_H@, not if
        (defined(__OpenBSD__) || defined(__bsdi__) || defined(__sgi)).
        (<sys/inttypes.h>): Include if @HAVE_SYS_INTTYPES_H@ &&
        address@hidden@, not if (defined(__FreeBSD__)
        && (__FreeBSD__ >= 3) && (__FreeBSD__ <= 4)).
        (__STDINT_H__) address@hidden@ && defined __sgi && ! defined
        __c99]: Define, to work around IRIX <stdint.h> incompatibility.
        (@FULL_PATH_STDINT_H@) [!(defined(__sgi) && @HAVE_INTTYPES_H@ &&
        !defined(__c99))]: Include in this case too, since it's harmless
        now.
        (<inttypes.h>) address@hidden@]: Include, since it's no longer
        dangerous to do so.
        (@FULL_PATH_INTTYPES_H@) [(defined(__hpux) || defined(_AIX)) &&
        @address@hidden: Do not include, since we now include <inttypes.h>.
        (_STDINT_MIN, _STDINT_MAX): New macros.
        (int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t):
        (uint64_t, int_least8_t, uint_least8_t, int_least16_t):
        (uint_least16_t, int_least32_t, uint_least32_t, int_least64_t):
        (uint_least64_t, int_fast8_t, uint_fast8_t, int_fast16_t):
        (uint_fast16_t, int_fast32_t, uint_fast32_t, int_fast64_t):
        (uint_fast64_t, intptr_t, uintptr_t, intmax_t, uintmax_t): Now
        macros, not typedefs; this simplifies things quite a bit.
        Use long int for all types narrower than int64_t.
        (intmax_t, uintmax_t, INTMAX_C, UINTMAX_C):
        Define in terms of long long int or int64_t or long int,
        not int64_t or int32_t.  This saves some compile-time testing.
        (INT8_MIN, INT8_MAX, UINT8_MAX, INT16_MIN, INT16_MAX, UINT16_MAX):
        (INT32_MIN, INT32_MAX, UINT32_MAX, INT64_MIN, INT64_MAX):
        (UINT64_MAX, INT_LEAST8_MIN, INT_LEAST8_MAX, UINT_LEAST8_MAX):
        (INT_LEAST16_MIN, INT_LEAST16_MAX, UINT_LEAST16_MAX):
        (INT_LEAST32_MIN, INT_LEAST32_MAX, UINT_LEAST32_MAX):
        (INT_LEAST64_MIN, INT_LEAST64_MAX, UINT_LEAST64_MAX, 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):
        (INT_FAST64_MIN, INT_FAST64_MAX, UINT_FAST64_MAX, INTPTR_MIN):
        (INTPTR_MAX, UINTPTR_MAX, INTMAX_MIN, INTMAX_MAX, UINTMAX_MAX):
        (PTRDIFF_MIN, PTRDIFF_MAX, SIG_ATOMIC_MIN, SIG_ATOMIC_MAX):
        (SIZE_MAX, WCHAR_MIN, WCHAR_MAX, WINT_MIN, WINT_MAX):
        undef any previous version and define our own version, for
        simplicity and consistency with the new macros for types.
        (PTRDIFF_MIN, PTRDIFF_MAX, SIG_ATOMIC_MIN, SIG_ATOMIC_MAX):
        (SIZE_MAX, WCHAR_MIN, WCHAR_MAX, WINT_MIN, WINT_MAX):
        Simplify definitions by using _STDINT_MIN and _STDINT_MAX
        where appropriate.  Rely on new symbols @PTRDIFF_T_SUFFIX@,
        @SIG_ATOMIC_T_SUFFIX@, @SIZE_T_SUFFIX@, @WCHAR_T_SUFFIX@,
        @WINT_T_SUFFIX@ to keep things simple here.
        (UINT8_C, UINT16_C, UINT32_C, INT64_C, UINT64_C):
        Simplify by assuming typical 8/16/32/64 host, since we're
        already doing that elsewhere anyway.
        Use (LONG_MAX >> 31 >> 31 == 1) rather than @HAVE_LONG_64BIT@,
        and assume long long int is 64 bits if available.  This
        speeds up 'configure'.

        * m4/longlong.m4 (AC_TYPE_LONG_LONG_INT): Backport from Autoconf 2.60,
        but fix a bug, by requiring at least 64 bits.
        * m4/ulonglong.m4 (AC_TYPE_UNSIGNED_LONG_LONG_INT): Likewise.
        * m4/longlong.m4 (gl_AC_TYPE_LONG_LONG): Now just call
        AC_TYPE_LONG_LONG_INT.  This macro is obsolete and will go soon.
        * m4/ulonglong.m4 (gl_AC_TYPE_UNSIGNED_LONG_LONG) Likewise.

        * m4/stdint.m4 (gl_STDINT_H): Rewrite to accommodate stdint_.h
        changes.  Make 2.59 a prerequisite.  Check and substitute for
        HAVE_LONG_LONG_INT.  Rely on Autoconf to check for stdint.h and
        inttypes.h.  Do not use special include files; just use the
        defaults.  Check for sys/inttypes.h and sys/bitypes.h in the usual
        way now.  Remove no-longer-needed tests for HAVE_LONG_64BIT,
        HAVE_LONG_LONG_64BIT, 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, INT8_MIN, INT8_MAX, UINT8_MAX, INT16_MIN, INT16_MAX,
        UINT16_MAX, INT32_MIN, INT32_MAX, UINT32_MAX, INT64_MIN,
        INT64_MAX, UINT64_MAX, INT_LEAST8_MIN, INT_LEAST8_MAX,
        UINT_LEAST8_MAX, INT_LEAST16_MIN, INT_LEAST16_MAX,
        UINT_LEAST16_MAX, INT_LEAST32_MIN, INT_LEAST32_MAX,
        UINT_LEAST32_MAX, INT_LEAST64_MIN, INT_LEAST64_MAX,
        UINT_LEAST64_MAX, 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, INT_FAST64_MIN, INT_FAST64_MAX,
        UINT_FAST64_MAX, INTPTR_MIN, INTPTR_MAX, UINTPTR_MAX, INTMAX_MIN,
        INTMAX_MAX, UINTMAX_MAX, PTRDIFF_MIN, PTRDIFF_MAX, SIG_ATOMIC_MIN,
        SIG_ATOMIC_MAX, SIZE_MAX, WCHAR_MIN, WCHAR_MAX, WINT_MIN,
        WINT_MAX.  Check for C99 conformance more strictly, by detecting
        bugs in glibc 2.4, Solaris 10, and OpenBSD 3.9.  On the other hand do
        not check for things that C99 does not require, e.g., int8_t.  If
        a test isn't needed unless <stdint.h> isn't working, and is
        unlikely to be needed for any other reason, then don't do it
        unless <stdint.h> isn't working.  Do not check for ptrdiff_t or
        size_t, since we assume C89 freestanding at least.  Do not check
        for sig_atomic_t, wchar_t, or wint_t, since the code now does
        the right thing even if the types are not defined.  Instead use:
        (gl_STDINT_TYPE_PROPERTIES): New macro.
        (gl_HEADER_STDINT_H, gl_HEADER_INTTYPES_H): Remove.  Don't bother
        testing whether <sys/types.h> clashes, as Autoconf does this for
        us now.  All uses removed.
        (gl_STDINT_CHECK_TYPES, gl_STDINT_MISSING_BOUND):
        (gl_STDINT_MISSING_BOUNDS, gl_STDINT_MISSING_BOUNDS2):
        (gl_CHECK_TYPE_SAME):
        Remove; no longer needed.
        (gl_STDINT_BITSIZEOF): Don't bother to check whether the type
        exists, since we'll return 0 anyway in that case.
        (gl_INTEGER_TYPE_SUFFIX, gl_STDINT_INCLUDES): New macros.

        * modules/inttypes (Depends-on): No longer depends on stdint.
        * modules/stdint (Description): Say more about assumptions.
        Say that the fast types might differ.  Say macros are used.
        (Makefile.am): Revise list of substituted symbols to match
        new stdint.m4.
        * tests/test-stdint.c (verify_same_types)
        [! (__GNUC__ >= 2 && DO_PEDANTIC)]: Put in a decl, so that
        the code conforms to C99/C89.
        Test for WCHAR_MIN and WCHAR_MAX only if HAVE_WCHAR_T.
        Test for WINT_MIN and WINT_MAX only if HAVE_WINT_T.

Index: lib/stdint_.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/stdint_.h,v
retrieving revision 1.26
diff -p -u -r1.26 stdint_.h
--- lib/stdint_.h       27 Jun 2006 13:15:26 -0000      1.26
+++ lib/stdint_.h       2 Jul 2006 06:22:56 -0000
@@ -1,5 +1,5 @@
 /* Copyright (C) 2001-2002, 2004-2006 Free Software Foundation, Inc.
-   Written by Bruno Haible, Sam Steingold, Peter Burwood.
+   Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
    This file is part of gnulib.
 
    This program is free software; you can redistribute it and/or modify
@@ -16,132 +16,129 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-#ifndef _STDINT_H
-#define _STDINT_H
+#ifndef _GL_STDINT_H
+#define _GL_STDINT_H
 
 /*
  * ISO C 99 <stdint.h> for platforms that lack it.
  * <http://www.opengroup.org/susv3xbd/stdint.h.html>
  */
 
-/* Get wchar_t, WCHAR_MIN, WCHAR_MAX.  */
-#include <stddef.h>
-/* BSD/OS 4.2 defines WCHAR_MIN, WCHAR_MAX in <wchar.h>, not <stddef.h>.  */
-#if !(defined(WCHAR_MIN) && defined(WCHAR_MAX)) && @HAVE_WCHAR_H@
-# include <wchar.h>
+/* Get those types that are already defined in other system include
+   files, so that we can "#define int8_t signed char" below without
+   worrying about a later system include file containing a "typedef
+   signed char int8_t;" that will get messed up by our macro.  Our
+   macros should all be consistent with the system versions, except
+   for the "fast" types and macros, which we recommend against using
+   in public interfaces due to compiler differences.  */
+
+/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
+   IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).  */
+#if @HAVE_SYS_TYPES_H@
+# include <sys/types.h>
 #endif
 
 /* Get LONG_MIN, LONG_MAX, ULONG_MAX.  */
 #include <limits.h>
 
-/* Get those types that are already defined in other system include files.  */
-#if defined(__FreeBSD__) && (__FreeBSD__ >= 3) && (__FreeBSD__ <= 4)
-# include <sys/inttypes.h>
+#if @HAVE_STDINT_H@
+# if defined __sgi && ! defined __c99
+   /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
+      with "This header file is to be used only for c99 mode compilations"
+      diagnostics.  */
+#  define __STDINT_H__
+# endif
+  /* Other systems may have an incomplete or buggy <stdint.h>.
+     Include it before <inttypes.h>, since any "#include <stdint.h>"
+     in <inttypes.h> would reinclude us, skipping our contents because
+     _GL_STDINT_H is defined.  */
+# include @FULL_PATH_STDINT_H@
 #endif
-#if defined(__OpenBSD__) || defined(__bsdi__) || defined(__sgi)
-  /* In OpenBSD 3.8, <sys/types.h> includes <machine/types.h>, which defines
+
+#if @HAVE_INTTYPES_H@
+  /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
      int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
-     <inttypes.h> includes <machine/types.h> and also defines intptr_t and
-     uintptr_t.  */
-  /* BSD/OS 4.2 is similar, but doesn't have <inttypes.h> */
-  /* IRIX 6.5 has <inttypes.h>, and <sys/types.h> defines some of these
-     types as well.  */
-# include <sys/types.h>
-# if @HAVE_INTTYPES_H@
-#  include @FULL_PATH_INTTYPES_H@
-# endif
+     <inttypes.h> also defines intptr_t and uintptr_t.  */
+# include <inttypes.h>
 #endif
-#if defined(__linux__) && @HAVE_SYS_BITYPES_H@
+
+#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
   /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
      int{8,16,32,64}_t and __BIT_TYPES_DEFINED__.  In libc5 >= 5.2.2 it is
      included by <sys/types.h>.  */
 # include <sys/bitypes.h>
 #endif
-#if defined(__sun) && @HAVE_SYS_INTTYPES_H@
+
+#if @HAVE_SYS_INTTYPES_H@ && address@hidden@
   /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
      the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.
      But note that <sys/int_types.h> contains only the type definitions!  */
 # include <sys/inttypes.h>
 #endif
-#if (defined(__hpux) || defined(_AIX)) && @HAVE_INTTYPES_H@
-  /* HP-UX 10 <inttypes.h> has nearly everything, except UINT_LEAST8_MAX,
-     UINT_FAST8_MAX, PTRDIFF_MIN, PTRDIFF_MAX.  */
-  /* AIX 4 <inttypes.h> has nearly everything, except INTPTR_MIN, INTPTR_MAX,
-     UINTPTR_MAX, PTRDIFF_MIN, PTRDIFF_MAX.  */
-# include @FULL_PATH_INTTYPES_H@
-#endif
-#if @HAVE_STDINT_H@
-  /* Other systems may have an incomplete <stdint.h>.  */
-  /* On some versions of IRIX, the SGI C compiler comes with an <stdint.h>,
-     but
-       - in c99 mode, <inttypes.h> includes <stdint.h>,
-       - in c89 mode, <stdint.h> spews warnings and defines nothing.
-         <inttypes.h> defines only a subset of the types and macros that
-         <stdint.h> would define in c99 mode.
-     So we rely only on <inttypes.h> (included above).  It means that in
-     c89 mode, we shadow the contents of warning-spewing <stdint.h>.  */
-# if !(defined(__sgi) && @HAVE_INTTYPES_H@ && !defined(__c99))
-#  include @FULL_PATH_STDINT_H@
+
+#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
+
+/* Get WCHAR_MIN, WCHAR_MAX.  */
+# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
+   /* BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
+      <wchar.h>.  */
+#  include <stdio.h>
+#  include <time.h>
+#  include <wchar.h>
 # endif
+
 #endif
 
+/* Minimum and maximum values for a integer type under the usual assumption.
+   Return an unspecified value if BITS == 0, adding a check to pacify
+   picky compilers.  */
+
+#define _STDINT_MIN(signed, bits, zero) \
+  ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
+
+#define _STDINT_MAX(signed, bits, zero) \
+  ((signed) \
+   ? ~ _STDINT_MIN (signed, bits, zero) \
+   : ((((zero) + 1) << ((bits) ? (bits) - 1 : 0)) - 1) * 2 + 1)
+
 /* 7.18.1.1. Exact-width integer types */
 
 /* Here we assume a standard architecture where the hardware integer
    types have 8, 16, 32, optionally 64 bits.  */
 
-#if address@hidden@
-typedef signed char    int8_t;
-#endif
-#if address@hidden@
-typedef unsigned char  uint8_t;
-# define _UINT8_T /* avoid collision with Solaris 2.5.1 <pthread.h> */
-#endif
-
-#if address@hidden@
-typedef short          int16_t;
-#endif
-#if address@hidden@
-typedef unsigned short uint16_t;
-#endif
-
-#if address@hidden@
-typedef int            int32_t;
-#endif
-#if address@hidden@
-typedef unsigned int   uint32_t;
-# define _UINT32_T /* avoid collision with Solaris 2.5.1 <pthread.h> */
-#endif
+#undef int8_t
+#undef uint8_t
+#define int8_t signed char
+#define uint8_t unsigned char
+
+#undef int16_t
+#undef uint16_t
+#define int16_t short int
+#define uint16_t unsigned short int
+
+#undef int32_t
+#undef uint32_t
+#define int32_t int
+#define uint32_t unsigned int
+
+#undef int64_t
+#undef uint64_t
+#if LONG_MAX >> 31 >> 31 == 1
+# define int64_t long int
+# define uint64_t unsigned long int
+#elif defined _MSC_VER
+# define int64_t __int64
+# define uint64_t unsigned __int64
+#elif @HAVE_LONG_LONG_INT@
+# define int64_t long long int
+# define uint64_t unsigned long long int
+#endif
+
+/* Avoid collision with Solaris 2.5.1 <pthread.h> etc.  */
+#define _UINT8_T
+#define _UINT32_T
+#define _UINT64_T
 
-#if @HAVE_INT64_T@
-# define _STDINT_H_HAVE_INT64 1
-#else
-# if @HAVE_LONG_64BIT@
-typedef long           int64_t;
-#  define _STDINT_H_HAVE_INT64 1
-# elif @HAVE_LONG_LONG_64BIT@
-typedef long long      int64_t;
-#  define _STDINT_H_HAVE_INT64 1
-# elif defined _MSC_VER
-typedef __int64        int64_t;
-#  define _STDINT_H_HAVE_INT64 1
-# endif
-#endif
-#if @HAVE_UINT64_T@
-# define _STDINT_H_HAVE_UINT64 1
-#else
-# if @HAVE_LONG_64BIT@
-typedef unsigned long      uint64_t;
-#  define _STDINT_H_HAVE_UINT64 1
-# elif @HAVE_LONG_LONG_64BIT@
-typedef unsigned long long uint64_t;
-#  define _UINT64_T /* avoid collision with Solaris 2.5.1 <pthread.h> */
-#  define _STDINT_H_HAVE_UINT64 1
-# elif defined _MSC_VER
-typedef unsigned __int64   uint64_t;
-#  define _STDINT_H_HAVE_UINT64 1
-# endif
-#endif
 
 /* 7.18.1.2. Minimum-width integer types */
 
@@ -149,32 +146,23 @@ typedef unsigned __int64   uint64_t;
    types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
    are the same as the corresponding N_t types.  */
 
-#if address@hidden@
-typedef int8_t   int_least8_t;
-#endif
-#if address@hidden@
-typedef uint8_t  uint_least8_t;
-#endif
-
-#if address@hidden@
-typedef int16_t  int_least16_t;
-#endif
-#if address@hidden@
-typedef uint16_t uint_least16_t;
-#endif
-
-#if address@hidden@
-typedef int32_t  int_least32_t;
-#endif
-#if address@hidden@
-typedef uint32_t uint_least32_t;
-#endif
-
-#if address@hidden@ && _STDINT_H_HAVE_INT64
-typedef int64_t  int_least64_t;
-#endif
-#if address@hidden@ && _STDINT_H_HAVE_UINT64
-typedef uint64_t uint_least64_t;
+#undef int_least8_t
+#undef uint_least8_t
+#undef int_least16_t
+#undef uint_least16_t
+#undef int_least32_t
+#undef uint_least32_t
+#undef int_least64_t
+#undef uint_least64_t
+#define int_least8_t int8_t
+#define uint_least8_t uint8_t
+#define int_least16_t int16_t
+#define uint_least16_t uint16_t
+#define int_least32_t int32_t
+#define uint_least32_t uint32_t
+#ifdef int64_t
+# define int_least64_t int64_t
+# define uint_least64_t uint64_t
 #endif
 
 /* 7.18.1.3. Fastest minimum-width integer types */
@@ -184,244 +172,90 @@ typedef uint64_t uint_least64_t;
 
 /* Here we assume a standard architecture where the hardware integer
    types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
-   are taken from the same list of types.  */
-
-/* On alpha processors, int32_t variables are slower than int64_t variables,
-   due to the necessary zap instructions.  */
-#if defined __alpha
-# define _STDINT_H_INT64_FASTER_THAN_INT32 1
-#endif
-
-#if address@hidden@
-# if _STDINT_H_INT64_FASTER_THAN_INT32
-typedef int64_t  int_fast8_t;
-# else
-typedef int32_t  int_fast8_t;
-# endif
-#endif
-#if address@hidden@
-# if _STDINT_H_INT64_FASTER_THAN_INT32
-typedef uint64_t uint_fast8_t;
-# else
-typedef uint32_t uint_fast8_t;
-# endif
-#endif
+   are taken from the same list of types.  Assume that 'long int'
+   is fast enough for all narrower integers.  */
 
-#if address@hidden@
-# if _STDINT_H_INT64_FASTER_THAN_INT32
-typedef int64_t  int_fast16_t;
-# else
-typedef int32_t  int_fast16_t;
-# endif
-#endif
-#if address@hidden@
-# if _STDINT_H_INT64_FASTER_THAN_INT32
-typedef uint64_t uint_fast16_t;
-# else
-typedef uint32_t uint_fast16_t;
-# endif
-#endif
-
-#if address@hidden@
-# if _STDINT_H_INT64_FASTER_THAN_INT32
-typedef int64_t  int_fast32_t;
-# else
-typedef int32_t  int_fast32_t;
-# endif
-#endif
-#if address@hidden@
-# if _STDINT_H_INT64_FASTER_THAN_INT32
-typedef uint64_t uint_fast32_t;
-# else
-typedef uint32_t uint_fast32_t;
-# endif
-#endif
-
-#if address@hidden@ && _STDINT_H_HAVE_INT64
-typedef int64_t  int_fast64_t;
-#endif
-#if address@hidden@ && _STDINT_H_HAVE_UINT64
-typedef uint64_t uint_fast64_t;
+#undef int_fast8_t
+#undef uint_fast8_t
+#undef int_fast16_t
+#undef uint_fast16_t
+#undef int_fast32_t
+#undef uint_fast32_t
+#undef int_fast64_t
+#undef uint_fast64_t
+#define int_fast8_t long int
+#define uint_fast8_t unsigned int_fast8_t
+#define int_fast16_t long int
+#define uint_fast16_t unsigned int_fast16_t
+#define int_fast32_t long int
+#define uint_fast32_t unsigned int_fast32_t
+#ifdef int64_t
+# define int_fast64_t int64_t
+# define uint_fast64_t uint64_t
 #endif
 
 /* 7.18.1.4. Integer types capable of holding object pointers */
 
-/* On some platforms (like IRIX6 MIPS with -n32) sizeof(void*) < sizeof(long),
-   but this doesn't matter here.  */
-#if address@hidden@
-typedef long          intptr_t;
-#endif
-#if address@hidden@
-typedef unsigned long uintptr_t;
-#endif
+#undef intptr_t
+#undef uintptr_t
+#define intptr_t long int
+#define uintptr_t unsigned long int
 
 /* 7.18.1.5. Greatest-width integer types */
 
 /* Note: These types are compiler dependent. It may be unwise to use them in
    public header files. */
 
-#if address@hidden@
-/* Remove possible redundant definition from gnulib's config.h first.  */
-# undef intmax_t
-# ifdef _STDINT_H_HAVE_INT64
-typedef int64_t  intmax_t;
-# else
-typedef int32_t  intmax_t;
-# endif
-#endif
-#if address@hidden@
-/* Remove possible redundant definition from gnulib's config.h first.  */
-# undef uintmax_t
-# ifdef _STDINT_H_HAVE_UINT64
-typedef uint64_t uintmax_t;
-# else
-typedef uint32_t uintmax_t;
-# endif
+#undef intmax_t
+#undef uintmax_t
+#if @HAVE_LONG_LONG_INT@
+# define intmax_t long long int
+# define uintmax_t unsigned long long int
+#elif defined int64_t
+# define intmax_t int64_t
+# define uintmax_t uint64_t
+#else
+# define intmax_t long int
+# define uintmax_t unsigned long int
 #endif
 
 /* 7.18.2. Limits of specified-width integer types */
 
-#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
+#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
 
 /* 7.18.2.1. Limits of exact-width integer types */
 
 /* Here we assume a standard architecture where the hardware integer
    types have 8, 16, 32, optionally 64 bits.  */
 
-#if @HAVE_INT8_T@
-# ifndef INT8_MIN
-#  define INT8_MIN  (-1 << (@BITSIZEOF_INT8_T@ - 1))
-# endif
-#else
-# define INT8_MIN  -128
-#endif
-#if @HAVE_INT8_T@
-# ifndef INT8_MAX
-#  define INT8_MAX  (~ (-1 << (@BITSIZEOF_INT8_T@ - 1)))
-# endif
-#else
-# define INT8_MAX  127
-#endif
-#if @HAVE_UINT8_T@
-# ifndef UINT8_MAX
-#  if @BITSIZEOF_UINT8_T@ < @BITSIZEOF_UNSIGNED_INT@
-#   define UINT8_MAX  (((1 << (@BITSIZEOF_UINT8_T@ - 1)) - 1) * 2 + 1)
-#  else
-#   define UINT8_MAX  (((1U << (@BITSIZEOF_UINT8_T@ - 1)) - 1) * 2 + 1)
-#  endif
-# endif
-#else
-# define UINT8_MAX  255
-#endif
-
-#if @HAVE_INT16_T@
-# ifndef INT16_MIN
-#  define INT16_MIN  (-1 << (@BITSIZEOF_INT16_T@ - 1))
-# endif
-#else
-# define INT16_MIN  -32768
-#endif
-#if @HAVE_INT16_T@
-# ifndef INT16_MAX
-#  define INT16_MAX  (~ (-1 << (@BITSIZEOF_INT16_T@ - 1)))
-# endif
-#else
-# define INT16_MAX  32767
-#endif
-#if @HAVE_UINT16_T@
-# ifndef UINT16_MAX
-#  if @BITSIZEOF_UINT16_T@ < @BITSIZEOF_UNSIGNED_INT@
-#   define UINT16_MAX  (((1 << (@BITSIZEOF_UINT16_T@ - 1)) - 1) * 2 + 1)
-#  else
-#   define UINT16_MAX  (((1U << (@BITSIZEOF_UINT16_T@ - 1)) - 1) * 2 + 1)
-#  endif
-# endif
-#else
-# define UINT16_MAX  65535
-#endif
-
-#if @HAVE_INT32_T@
-# ifndef INT32_MIN
-#  define INT32_MIN  (-1 << (@BITSIZEOF_INT32_T@ - 1))
-# endif
-#else
-# define INT32_MIN  (~INT32_MAX)
-#endif
-#if @HAVE_INT32_T@
-# ifndef INT32_MAX
-#  define INT32_MAX  (~ (-1 << (@BITSIZEOF_INT32_T@ - 1)))
-# endif
-#else
-# define INT32_MAX  2147483647
-#endif
-#if @HAVE_UINT32_T@
-# ifndef UINT32_MAX
-#  if @BITSIZEOF_UINT32_T@ < @BITSIZEOF_UNSIGNED_INT@
-#   define UINT32_MAX  (((1 << (@BITSIZEOF_UINT32_T@ - 1)) - 1) * 2 + 1)
-#  else
-#   define UINT32_MAX  (((1U << (@BITSIZEOF_UINT32_T@ - 1)) - 1) * 2 + 1)
-#  endif
-# endif
-#else
-# define UINT32_MAX  4294967295U
-#endif
-
-#if @HAVE_INT64_T@
-# ifndef INT64_MIN
-#  if @HAVE_LONG_64BIT@
-#   define INT64_MIN  (-1L << (@BITSIZEOF_INT64_T@ - 1))
-#  elif @HAVE_LONG_LONG_64BIT@
-#   define INT64_MIN  (-1LL << (@BITSIZEOF_INT64_T@ - 1))
-#  elif defined _MSC_VER
-#   define INT64_MIN  (-1i64 << (@BITSIZEOF_INT64_T@ - 1))
-#  endif
-# endif
-#else
-# ifdef _STDINT_H_HAVE_INT64
-#  define INT64_MIN  (~INT64_MAX)
-# endif
-#endif
-#if @HAVE_INT64_T@
-# ifndef INT64_MAX
-#  if @HAVE_LONG_64BIT@
-#   define INT64_MAX  (~ (-1L << (@BITSIZEOF_INT64_T@ - 1)))
-#  elif @HAVE_LONG_LONG_64BIT@
-#   define INT64_MAX  (~ (-1LL << (@BITSIZEOF_INT64_T@ - 1)))
-#  elif defined _MSC_VER
-#   define INT64_MAX  (~ (-1i64 << (@BITSIZEOF_INT64_T@ - 1)))
-#  endif
-# endif
-#else
-# ifdef _STDINT_H_HAVE_INT64
-#  if @HAVE_LONG_64BIT@
-#   define INT64_MAX  9223372036854775807L
-#  elif @HAVE_LONG_LONG_64BIT@
-#   define INT64_MAX  9223372036854775807LL
-#  elif defined _MSC_VER
-#   define INT64_MAX  9223372036854775807i64
-#  endif
-# endif
-#endif
-#if @HAVE_UINT64_T@
-# ifndef UINT64_MAX
-#  if @HAVE_LONG_64BIT@
-#   define UINT64_MAX  (((1UL << (@BITSIZEOF_UINT64_T@ - 1)) - 1) * 2 + 1)
-#  elif @HAVE_LONG_LONG_64BIT@
-#   define UINT64_MAX  (((1ULL << (@BITSIZEOF_UINT64_T@ - 1)) - 1) * 2 + 1)
-#  elif defined _MSC_VER
-#   define UINT64_MAX  (((1ui64 << (@BITSIZEOF_UINT64_T@ - 1)) - 1) * 2 + 1)
-#  endif
-# endif
-#else
-# ifdef _STDINT_H_HAVE_UINT64
-#  if @HAVE_LONG_64BIT@
-#   define UINT64_MAX 18446744073709551615UL
-#  elif @HAVE_LONG_LONG_64BIT@
-#   define UINT64_MAX 18446744073709551615ULL
-#  elif defined _MSC_VER
-#   define UINT64_MAX 18446744073709551615ui64
-#  endif
-# endif
+#undef INT8_MIN
+#undef INT8_MAX
+#undef UINT8_MAX
+#define INT8_MIN  (~ INT8_MAX)
+#define INT8_MAX  127
+#define UINT8_MAX  255
+
+#undef INT16_MIN
+#undef INT16_MAX
+#undef UINT16_MAX
+#define INT16_MIN  (~ INT16_MAX)
+#define INT16_MAX  32767
+#define UINT16_MAX  65535
+
+#undef INT32_MIN
+#undef INT32_MAX
+#undef UINT32_MAX
+#define INT32_MIN  (~ INT32_MAX)
+#define INT32_MAX  2147483647
+#define UINT32_MAX  4294967295U
+
+#undef INT64_MIN
+#undef INT64_MAX
+#undef UINT64_MAX
+#ifdef int64_t
+# define INT64_MIN  (~ INT64_MAX)
+# define INT64_MAX  INTMAX_C (9223372036854775807)
+# define UINT64_MAX  UINTMAX_C (18446744073709551615)
 #endif
 
 /* 7.18.2.2. Limits of minimum-width integer types */
@@ -430,128 +264,34 @@ typedef uint32_t uintmax_t;
    types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
    are the same as the corresponding N_t types.  */
 
-#if @HAVE_INT_LEAST8_T@
-# ifndef INT_LEAST8_MIN
-#  define INT_LEAST8_MIN  (-1 << (@BITSIZEOF_INT_LEAST8_T@ - 1))
-# endif
-#else
-# define INT_LEAST8_MIN  INT8_MIN
-#endif
-#if @HAVE_INT_LEAST8_T@
-# ifndef INT_LEAST8_MAX
-#  define INT_LEAST8_MAX  (~ (-1 << (@BITSIZEOF_INT_LEAST8_T@ - 1)))
-# endif
-#else
-# define INT_LEAST8_MAX  INT8_MAX
-#endif
-#if @HAVE_UINT_LEAST8_T@
-# ifndef UINT_LEAST8_MAX
-#  if @BITSIZEOF_UINT_LEAST8_T@ < @BITSIZEOF_UNSIGNED_INT@
-#   define UINT_LEAST8_MAX  (((1 << (@BITSIZEOF_UINT_LEAST8_T@ - 1)) - 1) * 2 
+ 1)
-#  else
-#   define UINT_LEAST8_MAX  (((1U << (@BITSIZEOF_UINT_LEAST8_T@ - 1)) - 1) * 2 
+ 1)
-#  endif
-# endif
-#else
-# define UINT_LEAST8_MAX  UINT8_MAX
-#endif
-
-#if @HAVE_INT_LEAST16_T@
-# ifndef INT_LEAST16_MIN
-#  define INT_LEAST16_MIN  (-1 << (@BITSIZEOF_INT_LEAST16_T@ - 1))
-# endif
-#else
-# define INT_LEAST16_MIN  INT16_MIN
-#endif
-#if @HAVE_INT_LEAST16_T@
-# ifndef INT_LEAST16_MAX
-#  define INT_LEAST16_MAX  (~ (-1 << (@BITSIZEOF_INT_LEAST16_T@ - 1)))
-# endif
-#else
-# define INT_LEAST16_MAX  INT16_MAX
-#endif
-#if @HAVE_UINT_LEAST16_T@
-# ifndef UINT_LEAST16_MAX
-#  if @BITSIZEOF_UINT_LEAST16_T@ < @BITSIZEOF_UNSIGNED_INT@
-#   define UINT_LEAST16_MAX  (((1 << (@BITSIZEOF_UINT_LEAST16_T@ - 1)) - 1) * 
2 + 1)
-#  else
-#   define UINT_LEAST16_MAX  (((1U << (@BITSIZEOF_UINT_LEAST16_T@ - 1)) - 1) * 
2 + 1)
-#  endif
-# endif
-#else
-# define UINT_LEAST16_MAX  UINT16_MAX
-#endif
-
-#if @HAVE_INT_LEAST32_T@
-# ifndef INT_LEAST32_MIN
-#  define INT_LEAST32_MIN  (-1 << (@BITSIZEOF_INT_LEAST32_T@ - 1))
-# endif
-#else
-# define INT_LEAST32_MIN  INT32_MIN
-#endif
-#if @HAVE_INT_LEAST32_T@
-# ifndef INT_LEAST32_MAX
-#  define INT_LEAST32_MAX  (~ (-1 << (@BITSIZEOF_INT_LEAST32_T@ - 1)))
-# endif
-#else
-# define INT_LEAST32_MAX  INT32_MAX
-#endif
-#if @HAVE_UINT_LEAST32_T@
-# ifndef UINT_LEAST32_MAX
-#  if @BITSIZEOF_UINT_LEAST32_T@ < @BITSIZEOF_UNSIGNED_INT@
-#   define UINT_LEAST32_MAX  (((1 << (@BITSIZEOF_UINT_LEAST32_T@ - 1)) - 1) * 
2 + 1)
-#  else
-#   define UINT_LEAST32_MAX  (((1U << (@BITSIZEOF_UINT_LEAST32_T@ - 1)) - 1) * 
2 + 1)
-#  endif
-# endif
-#else
-# define UINT_LEAST32_MAX  UINT32_MAX
-#endif
-
-#if @HAVE_INT_LEAST64_T@
-# ifndef INT_LEAST64_MIN
-#  if @HAVE_LONG_64BIT@
-#   define INT_LEAST64_MIN  (-1L << (@BITSIZEOF_INT_LEAST64_T@ - 1))
-#  elif @HAVE_LONG_LONG_64BIT@
-#   define INT_LEAST64_MIN  (-1LL << (@BITSIZEOF_INT_LEAST64_T@ - 1))
-#  elif defined _MSC_VER
-#   define INT_LEAST64_MIN  (-1i64 << (@BITSIZEOF_INT_LEAST64_T@ - 1))
-#  endif
-# endif
-#else
-# ifdef _STDINT_H_HAVE_INT64
-#  define INT_LEAST64_MIN  INT64_MIN
-# endif
-#endif
-#if @HAVE_INT_LEAST64_T@
-# ifndef INT_LEAST64_MAX
-#  if @HAVE_LONG_64BIT@
-#   define INT_LEAST64_MAX  (~ (-1L << (@BITSIZEOF_INT_LEAST64_T@ - 1)))
-#  elif @HAVE_LONG_LONG_64BIT@
-#   define INT_LEAST64_MAX  (~ (-1LL << (@BITSIZEOF_INT_LEAST64_T@ - 1)))
-#  elif defined _MSC_VER
-#   define INT_LEAST64_MAX  (~ (-1i64 << (@BITSIZEOF_INT_LEAST64_T@ - 1)))
-#  endif
-# endif
-#else
-# ifdef _STDINT_H_HAVE_INT64
-#  define INT_LEAST64_MAX  INT64_MAX
-# endif
-#endif
-#if @HAVE_UINT_LEAST64_T@
-# ifndef UINT_LEAST64_MAX
-#  if @HAVE_LONG_64BIT@
-#   define UINT_LEAST64_MAX  (((1UL << (@BITSIZEOF_UINT_LEAST64_T@ - 1)) - 1) 
* 2 + 1)
-#  elif @HAVE_LONG_LONG_64BIT@
-#   define UINT_LEAST64_MAX  (((1ULL << (@BITSIZEOF_UINT_LEAST64_T@ - 1)) - 1) 
* 2 + 1)
-#  elif defined _MSC_VER
-#   define UINT_LEAST64_MAX  (((1ui64 << (@BITSIZEOF_UINT_LEAST64_T@ - 1)) - 
1) * 2 + 1)
-#  endif
-# endif
-#else
-# ifdef _STDINT_H_HAVE_UINT64
-#  define UINT_LEAST64_MAX  UINT64_MAX
-# endif
+#undef INT_LEAST8_MIN
+#undef INT_LEAST8_MAX
+#undef UINT_LEAST8_MAX
+#define INT_LEAST8_MIN  INT8_MIN
+#define INT_LEAST8_MAX  INT8_MAX
+#define UINT_LEAST8_MAX  UINT8_MAX
+
+#undef INT_LEAST16_MIN
+#undef INT_LEAST16_MAX
+#undef UINT_LEAST16_MAX
+#define INT_LEAST16_MIN  INT16_MIN
+#define INT_LEAST16_MAX  INT16_MAX
+#define UINT_LEAST16_MAX  UINT16_MAX
+
+#undef INT_LEAST32_MIN
+#undef INT_LEAST32_MAX
+#undef UINT_LEAST32_MAX
+#define INT_LEAST32_MIN  INT32_MIN
+#define INT_LEAST32_MAX  INT32_MAX
+#define UINT_LEAST32_MAX  UINT32_MAX
+
+#undef INT_LEAST64_MIN
+#undef INT_LEAST64_MAX
+#undef UINT_LEAST64_MAX
+#ifdef int64_t
+# define INT_LEAST64_MIN  INT64_MIN
+# define INT_LEAST64_MAX  INT64_MAX
+# define UINT_LEAST64_MAX  UINT64_MAX
 #endif
 
 /* 7.18.2.3. Limits of fastest minimum-width integer types */
@@ -560,464 +300,151 @@ typedef uint32_t uintmax_t;
    types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
    are taken from the same list of types.  */
 
-#if @HAVE_INT_FAST8_T@
-# ifndef INT_FAST8_MIN
-#  define INT_FAST8_MIN  (-1L << (@BITSIZEOF_INT_FAST8_T@ - 1))
-# endif
-#else
-# if _STDINT_H_INT64_FASTER_THAN_INT32
-#  define INT_FAST8_MIN  INT64_MIN
-# else
-#  define INT_FAST8_MIN  INT32_MIN
-# endif
-#endif
-#if @HAVE_INT_FAST8_T@
-# ifndef INT_FAST8_MAX
-#  define INT_FAST8_MAX  (~ (-1L << (@BITSIZEOF_INT_FAST8_T@ - 1)))
-# endif
-#else
-# if _STDINT_H_INT64_FASTER_THAN_INT32
-#  define INT_FAST8_MAX  INT64_MAX
-# else
-#  define INT_FAST8_MAX  INT32_MAX
-# endif
-#endif
-#if @HAVE_UINT_FAST8_T@
-# ifndef UINT_FAST8_MAX
-#  if @BITSIZEOF_UINT_FAST8_T@ < @BITSIZEOF_UNSIGNED_INT@
-#   define UINT_FAST8_MAX  (((1 << (@BITSIZEOF_UINT_FAST8_T@ - 1)) - 1) * 2 + 
1)
-#  else
-#   define UINT_FAST8_MAX  (((1UL << (@BITSIZEOF_UINT_FAST8_T@ - 1)) - 1) * 2 
+ 1)
-#  endif
-# endif
-#else
-# if _STDINT_H_INT64_FASTER_THAN_INT32
-#  define UINT_FAST8_MAX  UINT64_MAX
-# else
-#  define UINT_FAST8_MAX  UINT32_MAX
-# endif
-#endif
-
-#if @HAVE_INT_FAST16_T@
-# ifndef INT_FAST16_MIN
-#  define INT_FAST16_MIN  (-1L << (@BITSIZEOF_INT_FAST16_T@ - 1))
-# endif
-#else
-# if _STDINT_H_INT64_FASTER_THAN_INT32
-#  define INT_FAST16_MIN  INT64_MIN
-# else
-#  define INT_FAST16_MIN  INT32_MIN
-# endif
-#endif
-#if @HAVE_INT_FAST16_T@
-# ifndef INT_FAST16_MAX
-#  define INT_FAST16_MAX  (~ (-1L << (@BITSIZEOF_INT_FAST16_T@ - 1)))
-# endif
-#else
-# if _STDINT_H_INT64_FASTER_THAN_INT32
-#  define INT_FAST16_MAX  INT64_MAX
-# else
-#  define INT_FAST16_MAX  INT32_MAX
-# endif
-#endif
-#if @HAVE_UINT_FAST16_T@
-# ifndef UINT_FAST16_MAX
-#  if @BITSIZEOF_UINT_FAST16_T@ < @BITSIZEOF_UNSIGNED_INT@
-#   define UINT_FAST16_MAX  (((1 << (@BITSIZEOF_UINT_FAST16_T@ - 1)) - 1) * 2 
+ 1)
-#  else
-#   define UINT_FAST16_MAX  (((1UL << (@BITSIZEOF_UINT_FAST16_T@ - 1)) - 1) * 
2 + 1)
-#  endif
-# endif
-#else
-# if _STDINT_H_INT64_FASTER_THAN_INT32
-#  define UINT_FAST16_MAX  UINT64_MAX
-# else
-#  define UINT_FAST16_MAX  UINT32_MAX
-# endif
-#endif
-
-#if @HAVE_INT_FAST32_T@
-# ifndef INT_FAST32_MIN
-#  define INT_FAST32_MIN  (-1L << (@BITSIZEOF_INT_FAST32_T@ - 1))
-# endif
-#else
-# if _STDINT_H_INT64_FASTER_THAN_INT32
-#  define INT_FAST32_MIN  INT64_MIN
-# else
-#  define INT_FAST32_MIN  INT32_MIN
-# endif
-#endif
-#if @HAVE_INT_FAST32_T@
-# ifndef INT_FAST32_MAX
-#  define INT_FAST32_MAX  (~ (-1L << (@BITSIZEOF_INT_FAST32_T@ - 1)))
-# endif
-#else
-# if _STDINT_H_INT64_FASTER_THAN_INT32
-#  define INT_FAST32_MAX  INT64_MAX
-# else
-#  define INT_FAST32_MAX  INT32_MAX
-# endif
-#endif
-#if @HAVE_UINT_FAST32_T@
-# ifndef UINT_FAST32_MAX
-#  if @BITSIZEOF_UINT_FAST32_T@ < @BITSIZEOF_UNSIGNED_INT@
-#   define UINT_FAST32_MAX  (((1 << (@BITSIZEOF_UINT_FAST32_T@ - 1)) - 1) * 2 
+ 1)
-#  else
-#   define UINT_FAST32_MAX  (((1UL << (@BITSIZEOF_UINT_FAST32_T@ - 1)) - 1) * 
2 + 1)
-#  endif
-# endif
-#else
-# if _STDINT_H_INT64_FASTER_THAN_INT32
-#  define UINT_FAST32_MAX  UINT64_MAX
-# else
-#  define UINT_FAST32_MAX  UINT32_MAX
-# endif
-#endif
-
-#if @HAVE_INT_FAST64_T@
-# ifndef INT_FAST64_MIN
-#  if @HAVE_LONG_64BIT@
-#   define INT_FAST64_MIN  (-1L << (@BITSIZEOF_INT_FAST64_T@ - 1))
-#  elif @HAVE_LONG_LONG_64BIT@
-#   define INT_FAST64_MIN  (-1LL << (@BITSIZEOF_INT_FAST64_T@ - 1))
-#  elif defined _MSC_VER
-#   define INT_FAST64_MIN  (-1i64 << (@BITSIZEOF_INT_FAST64_T@ - 1))
-#  endif
-# endif
-#else
-# ifdef _STDINT_H_HAVE_INT64
-#  define INT_FAST64_MIN  INT64_MIN
-# endif
-#endif
-#if @HAVE_INT_FAST64_T@
-# ifndef INT_FAST64_MAX
-#  if @HAVE_LONG_64BIT@
-#   define INT_FAST64_MAX  (~ (-1L << (@BITSIZEOF_INT_FAST64_T@ - 1)))
-#  elif @HAVE_LONG_LONG_64BIT@
-#   define INT_FAST64_MAX  (~ (-1LL << (@BITSIZEOF_INT_FAST64_T@ - 1)))
-#  elif defined _MSC_VER
-#   define INT_FAST64_MAX  (~ (-1i64 << (@BITSIZEOF_INT_FAST64_T@ - 1)))
-#  endif
-# endif
-#else
-# ifdef _STDINT_H_HAVE_INT64
-#  define INT_FAST64_MAX  INT64_MAX
-# endif
-#endif
-#if @HAVE_UINT_FAST64_T@
-# ifndef UINT_FAST64_MAX
-#  if @HAVE_LONG_64BIT@
-#   define UINT_FAST64_MAX  (((1UL << (@BITSIZEOF_UINT_FAST64_T@ - 1)) - 1) * 
2 + 1)
-#  elif @HAVE_LONG_LONG_64BIT@
-#   define UINT_FAST64_MAX  (((1ULL << (@BITSIZEOF_UINT_FAST64_T@ - 1)) - 1) * 
2 + 1)
-#  elif defined _MSC_VER
-#   define UINT_FAST64_MAX  (((1ui64 << (@BITSIZEOF_UINT_FAST64_T@ - 1)) - 1) 
* 2 + 1)
-#  endif
-# endif
-#else
-# ifdef _STDINT_H_HAVE_UINT64
-#  define UINT_FAST64_MAX  UINT64_MAX
-# endif
+#undef INT_FAST8_MIN
+#undef INT_FAST8_MAX
+#undef UINT_FAST8_MAX
+#define INT_FAST8_MIN  LONG_MIN
+#define INT_FAST8_MAX  LONG_MAX
+#define UINT_FAST8_MAX  ULONG_MAX
+
+#undef INT_FAST16_MIN
+#undef INT_FAST16_MAX
+#undef UINT_FAST16_MAX
+#define INT_FAST16_MIN  LONG_MIN
+#define INT_FAST16_MAX  LONG_MAX
+#define UINT_FAST16_MAX  ULONG_MAX
+
+#undef INT_FAST32_MIN
+#undef INT_FAST32_MAX
+#undef UINT_FAST32_MAX
+#define INT_FAST32_MIN  LONG_MIN
+#define INT_FAST32_MAX  LONG_MAX
+#define UINT_FAST32_MAX  ULONG_MAX
+
+#undef INT_FAST64_MIN
+#undef INT_FAST64_MAX
+#undef UINT_FAST64_MAX
+#ifdef int64_t
+# define INT_FAST64_MIN  INT64_MIN
+# define INT_FAST64_MAX  INT64_MAX
+# define UINT_FAST64_MAX  UINT64_MAX
 #endif
 
 /* 7.18.2.4. Limits of integer types capable of holding object pointers */
 
-#if @HAVE_INTPTR_T@
-# ifndef INTPTR_MIN
-#  if @BITSIZEOF_INTPTR_T@ > @BITSIZEOF_LONG@
-#   define INTPTR_MIN  (-1LL << (@BITSIZEOF_INTPTR_T@ - 1))
-#  else
-#   define INTPTR_MIN  (-1L << (@BITSIZEOF_INTPTR_T@ - 1))
-#  endif
-# endif
-#else
-# define INTPTR_MIN  LONG_MIN
-#endif
-#if @HAVE_INTPTR_T@
-# ifndef INTPTR_MAX
-#  if @BITSIZEOF_INTPTR_T@ > @BITSIZEOF_LONG@
-#   define INTPTR_MAX  (~ (-1LL << (@BITSIZEOF_INTPTR_T@ - 1)))
-#  else
-#   define INTPTR_MAX  (~ (-1L << (@BITSIZEOF_INTPTR_T@ - 1)))
-#  endif
-# endif
-#else
-# define INTPTR_MAX  LONG_MAX
-#endif
-#if @HAVE_UINTPTR_T@
-# ifndef UINTPTR_MAX
-#  if @BITSIZEOF_UINTPTR_T@ > @BITSIZEOF_UNSIGNED_LONG@
-#   define UINTPTR_MAX  (((1ULL << (@BITSIZEOF_UINTPTR_T@ - 1)) - 1) * 2 + 1)
-#  else
-#   define UINTPTR_MAX  (((1UL << (@BITSIZEOF_UINTPTR_T@ - 1)) - 1) * 2 + 1)
-#  endif
-# endif
-#else
-# define UINTPTR_MAX  ULONG_MAX
-#endif
+#undef INTPTR_MIN
+#undef INTPTR_MAX
+#undef UINTPTR_MAX
+#define INTPTR_MIN  LONG_MIN
+#define INTPTR_MAX  LONG_MAX
+#define UINTPTR_MAX  ULONG_MAX
 
 /* 7.18.2.5. Limits of greatest-width integer types */
 
-#if @HAVE_INTMAX_T@
-# ifndef INTMAX_MIN
-#  if @BITSIZEOF_INTMAX_T@ > @BITSIZEOF_LONG@
-#   define INTMAX_MIN  (-1LL << (@BITSIZEOF_INTMAX_T@ - 1))
-#  else
-#   define INTMAX_MIN  (-1L << (@BITSIZEOF_INTMAX_T@ - 1))
-#  endif
-# endif
+#undef INTMAX_MIN
+#undef INTMAX_MAX
+#undef UINTMAX_MAX
+#define INTMAX_MIN  (~ INTMAX_MAX)
+#ifdef INT64_MAX
+# define INTMAX_MAX  INT64_MAX
+# define UINTMAX_MAX  UINT64_MAX
 #else
-# ifdef _STDINT_H_HAVE_INT64
-#  define INTMAX_MIN  INT64_MIN
-# else
-#  define INTMAX_MIN  INT32_MIN
-# endif
-#endif
-#if @HAVE_INTMAX_T@
-# ifndef INTMAX_MAX
-#  if @BITSIZEOF_INTMAX_T@ > @BITSIZEOF_LONG@
-#   define INTMAX_MAX  (~ (-1LL << (@BITSIZEOF_INTMAX_T@ - 1)))
-#  else
-#   define INTMAX_MAX  (~ (-1L << (@BITSIZEOF_INTMAX_T@ - 1)))
-#  endif
-# endif
-#else
-# ifdef _STDINT_H_HAVE_INT64
-#  define INTMAX_MAX  INT64_MAX
-# else
-#  define INTMAX_MAX  INT32_MAX
-# endif
-#endif
-#if @HAVE_UINTMAX_T@
-# ifndef UINTMAX_MAX
-#  if @BITSIZEOF_UINTMAX_T@ > @BITSIZEOF_UNSIGNED_LONG@
-#   define UINTMAX_MAX  (((1ULL << (@BITSIZEOF_UINTMAX_T@ - 1)) - 1) * 2 + 1)
-#  else
-#   define UINTMAX_MAX  (((1UL << (@BITSIZEOF_UINTMAX_T@ - 1)) - 1) * 2 + 1)
-#  endif
-# endif
-#else
-# ifdef _STDINT_H_HAVE_INT64
-#  define UINTMAX_MAX  UINT64_MAX
-# else
-#  define UINTMAX_MAX  UINT32_MAX
-# endif
+# define INTMAX_MAX  INT32_MAX
+# define UINTMAX_MAX  UINT32_MAX
 #endif
 
 /* 7.18.3. Limits of other integer types */
 
 /* ptrdiff_t limits */
-#ifndef PTRDIFF_MIN
-# if @BITSIZEOF_PTRDIFF_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_PTRDIFF_T_LONG@
-#  define PTRDIFF_MIN  (-1L << (@BITSIZEOF_PTRDIFF_T@ - 1))
-# else
-#  define PTRDIFF_MIN  (-1 << (@BITSIZEOF_PTRDIFF_T@ - 1))
-# endif
-#endif
-#ifndef PTRDIFF_MAX
-# if @BITSIZEOF_PTRDIFF_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_PTRDIFF_T_LONG@
-#  define PTRDIFF_MAX  (~ (-1L << (@BITSIZEOF_PTRDIFF_T@ - 1)))
-# else
-#  define PTRDIFF_MAX  (~ (-1 << (@BITSIZEOF_PTRDIFF_T@ - 1)))
-# endif
-#endif
+#undef PTRDIFF_MIN
+#undef PTRDIFF_MAX
+#define PTRDIFF_MIN  \
+   _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, address@hidden@)
+#define PTRDIFF_MAX  \
+   _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, address@hidden@)
 
 /* sig_atomic_t limits */
-#ifndef SIG_ATOMIC_MIN
-# if @HAVE_SIGNED_SIG_ATOMIC_T@
-#  if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_LONG@ || 
@SAME_TYPE_SIG_ATOMIC_T_LONG@
-#   define SIG_ATOMIC_MIN  (-1L << (@BITSIZEOF_SIG_ATOMIC_T@ - 1))
-#  else
-#   define SIG_ATOMIC_MIN  (-1 << (@BITSIZEOF_SIG_ATOMIC_T@ - 1))
-#  endif
-# else
-#  if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_UNSIGNED_LONG@ || 
@SAME_TYPE_SIG_ATOMIC_T_UNSIGNED_LONG@
-#   define SIG_ATOMIC_MIN  0UL
-#  elif @BITSIZEOF_SIG_ATOMIC_T@ >= @BITSIZEOF_UNSIGNED_INT@
-#   define SIG_ATOMIC_MIN  0U
-#  else
-#   define SIG_ATOMIC_MIN  0
-#  endif
-# endif
-#endif
-#ifndef SIG_ATOMIC_MAX
-# if @HAVE_SIGNED_SIG_ATOMIC_T@
-#  if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_LONG@ || 
@SAME_TYPE_SIG_ATOMIC_T_LONG@
-#   define SIG_ATOMIC_MAX  (~ (-1L << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)))
-#  else
-#   define SIG_ATOMIC_MAX  (~ (-1 << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)))
-#  endif
-# else
-#  if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_UNSIGNED_LONG@ || 
@SAME_TYPE_SIG_ATOMIC_T_UNSIGNED_LONG@
-#   define SIG_ATOMIC_MAX  (((1UL << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)) - 1) * 2 
+ 1)
-#  elif @BITSIZEOF_SIG_ATOMIC_T@ >= @BITSIZEOF_UNSIGNED_INT@
-#   define SIG_ATOMIC_MAX  (((1U << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)) - 1) * 2 + 
1)
-#  else
-#   define SIG_ATOMIC_MAX  (((1 << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)) - 1) * 2 + 
1)
-#  endif
-# endif
-#endif
+#undef SIG_ATOMIC_MIN
+#undef SIG_ATOMIC_MAX
+#define SIG_ATOMIC_MIN  \
+   _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
+               address@hidden@)
+#define SIG_ATOMIC_MAX  \
+   _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
+               address@hidden@)
+
 
 /* size_t limit */
-#ifndef SIZE_MAX /* SIZE_MAX may also be defined in config.h. */
-# if @BITSIZEOF_SIZE_T@ > @BITSIZEOF_UNSIGNED_LONG@ || 
@SAME_TYPE_SIZE_T_UNSIGNED_LONG@
-#  define SIZE_MAX  (((1UL << (@BITSIZEOF_SIZE_T@ - 1)) - 1) * 2 + 1)
-# else
-#  define SIZE_MAX  (((1U << (@BITSIZEOF_SIZE_T@ - 1)) - 1) * 2 + 1)
-# endif
-#endif
+#undef SIZE_MAX
+#define SIZE_MAX  _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, address@hidden@)
 
-/* wchar_t limits may already be defined in <stddef.h>.  */
-#ifndef WCHAR_MIN
-# if @HAVE_SIGNED_WCHAR_T@
-#  if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WCHAR_T_LONG@
-#   define WCHAR_MIN  (-1L << (@BITSIZEOF_WCHAR_T@ - 1))
-#  else
-#   define WCHAR_MIN  (-1 << (@BITSIZEOF_WCHAR_T@ - 1))
-#  endif
-# else
-#  if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_UNSIGNED_LONG@ || 
@SAME_TYPE_WCHAR_T_UNSIGNED_LONG@
-#   define WCHAR_MIN  0UL
-#  elif @BITSIZEOF_WCHAR_T@ >= @BITSIZEOF_UNSIGNED_INT@
-#   define WCHAR_MIN  0U
-#  else
-#   define WCHAR_MIN  0
-#  endif
-# endif
-#endif
-#ifndef WCHAR_MAX
-# if @HAVE_SIGNED_WCHAR_T@
-#  if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WCHAR_T_LONG@
-#   define WCHAR_MAX  (~ (-1L << (@BITSIZEOF_WCHAR_T@ - 1)))
-#  else
-#   define WCHAR_MAX  (~ (-1 << (@BITSIZEOF_WCHAR_T@ - 1)))
-#  endif
-# else
-#  if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_UNSIGNED_LONG@ || 
@SAME_TYPE_WCHAR_T_UNSIGNED_LONG@
-#   define WCHAR_MAX  (((1UL << (@BITSIZEOF_WCHAR_T@ - 1)) - 1) * 2 + 1)
-#  elif @BITSIZEOF_WCHAR_T@ >= @BITSIZEOF_UNSIGNED_INT@
-#   define WCHAR_MAX  (((1U << (@BITSIZEOF_WCHAR_T@ - 1)) - 1) * 2 + 1)
-#  else
-#   define WCHAR_MAX  (((1 << (@BITSIZEOF_WCHAR_T@ - 1)) - 1) * 2 + 1)
-#  endif
-# endif
-#endif
+/* wchar_t limits */
+#undef WCHAR_MIN
+#undef WCHAR_MAX
+#define WCHAR_MIN  \
+   _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, address@hidden@)
+#define WCHAR_MAX  \
+   _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, address@hidden@)
 
 /* wint_t limits */
-#ifndef WINT_MIN
-# if @HAVE_SIGNED_WINT_T@
-#  if @BITSIZEOF_WINT_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WINT_T_LONG@
-#   define WINT_MIN  (-1L << (@BITSIZEOF_WINT_T@ - 1))
-#  else
-#   define WINT_MIN  (-1 << (@BITSIZEOF_WINT_T@ - 1))
-#  endif
-# else
-#  if @BITSIZEOF_WINT_T@ > @BITSIZEOF_UNSIGNED_LONG@ || 
@SAME_TYPE_WINT_T_UNSIGNED_LONG@
-#   define WINT_MIN  0UL
-#  elif @BITSIZEOF_WINT_T@ >= @BITSIZEOF_UNSIGNED_INT@
-#   define WINT_MIN  0U
-#  else
-#   define WINT_MIN  0
-#  endif
-# endif
-#endif
-#ifndef WINT_MAX
-# if @HAVE_SIGNED_WINT_T@
-#  if @BITSIZEOF_WINT_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WINT_T_LONG@
-#   define WINT_MAX  (~ (-1L << (@BITSIZEOF_WINT_T@ - 1)))
-#  else
-#   define WINT_MAX  (~ (-1 << (@BITSIZEOF_WINT_T@ - 1)))
-#  endif
-# else
-#  if @BITSIZEOF_WINT_T@ > @BITSIZEOF_UNSIGNED_LONG@ || 
@SAME_TYPE_WINT_T_UNSIGNED_LONG@
-#   define WINT_MAX  (((1UL << (@BITSIZEOF_WINT_T@ - 1)) - 1) * 2 + 1)
-#  elif @BITSIZEOF_WINT_T@ >= @BITSIZEOF_UNSIGNED_INT@
-#   define WINT_MAX  (((1U << (@BITSIZEOF_WINT_T@ - 1)) - 1) * 2 + 1)
-#  else
-#   define WINT_MAX  (((1 << (@BITSIZEOF_WINT_T@ - 1)) - 1) * 2 + 1)
-#  endif
-# endif
-#endif
-
-#endif
+#undef WINT_MIN
+#undef WINT_MAX
+#define WINT_MIN  \
+   _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, address@hidden@)
+#define WINT_MAX  \
+   _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, address@hidden@)
 
 /* 7.18.4. Macros for integer constants */
 
-#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
-
 /* 7.18.4.1. Macros for minimum-width integer constants */
 /* According to ISO C 99 Technical Corrigendum 1 */
 
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits, and int is 32 bits.  */
+
 #undef INT8_C
 #undef UINT8_C
 #define INT8_C(x) x
-#if @HAVE_UINT8_T@
-# if @BITSIZEOF_UINT8_T@ < @BITSIZEOF_UNSIGNED_INT@
-#  define UINT8_C(x) x
-# else
-#  define UINT8_C(x) x##U
-# endif
-#else
-# define UINT8_C(x) x
-#endif
+#define UINT8_C(x) x
 
 #undef INT16_C
 #undef UINT16_C
 #define INT16_C(x) x
-#if @HAVE_UINT16_T@
-# if @BITSIZEOF_UINT16_T@ < @BITSIZEOF_UNSIGNED_INT@
-#  define UINT16_C(x) x
-# else
-#  define UINT16_C(x) x##U
-# endif
-#else
-# define UINT16_C(x) x
-#endif
+#define UINT16_C(x) x
 
 #undef INT32_C
 #undef UINT32_C
 #define INT32_C(x) x
-#if @HAVE_UINT32_T@
-# if @BITSIZEOF_UINT32_T@ < @BITSIZEOF_UNSIGNED_INT@
-#  define UINT32_C(x) x
-# else
-#  define UINT32_C(x) x##U
-# endif
-#else
-# define UINT32_C(x) x
-#endif
+#define UINT32_C(x) x ## U
 
 #undef INT64_C
 #undef UINT64_C
-#if @HAVE_LONG_64BIT@
+#if LONG_MAX >> 31 >> 31 == 1
 # define INT64_C(x) x##L
 # define UINT64_C(x) x##UL
-#elif @HAVE_LONG_LONG_64BIT@
-# define INT64_C(x) x##LL
-# define UINT64_C(x) x##ULL
-#elif defined(_MSC_VER)
+#elif defined _MSC_VER
 # define INT64_C(x) x##i64
 # define UINT64_C(x) x##ui64
+#elif @HAVE_LONG_LONG_INT@
+# define INT64_C(x) x##LL
+# define UINT64_C(x) x##ULL
 #endif
 
 /* 7.18.4.2. Macros for greatest-width integer constants */
 
 #undef INTMAX_C
 #undef UINTMAX_C
-#if @HAVE_LONG_64BIT@
-# define INTMAX_C(x) x##L
-# define UINTMAX_C(x) x##UL
-#elif @HAVE_LONG_LONG_64BIT@
-# define INTMAX_C(x) x##LL
-# define UINTMAX_C(x) x##ULL
-#elif defined(_MSC_VER)
-# define INTMAX_C(x) x##i64
-# define UINTMAX_C(x) x##ui64
+#if @HAVE_LONG_LONG_INT@
+# define INTMAX_C(x)   x##LL
+# define UINTMAX_C(x)  x##ULL
+#elif defined int64_t
+# define INTMAX_C(x)   INT64_C(x)
+# define UINTMAX_C(x)  UINT64_C(x)
 #else
-# define INTMAX_C(x) x
-# define UINTMAX_C(x) x##U
+# define INTMAX_C(x)   x##L
+# define UINTMAX_C(x)  x##UL
 #endif
 
-#endif
+#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
 
-#endif /* _STDINT_H */
+#endif /* _GL_STDINT_H */
Index: m4/longlong.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/longlong.m4,v
retrieving revision 1.7
diff -p -u -r1.7 longlong.m4
--- m4/longlong.m4      18 Jan 2005 13:07:56 -0000      1.7
+++ m4/longlong.m4      2 Jul 2006 06:22:57 -0000
@@ -1,21 +1,42 @@
-# longlong.m4 serial 5
-dnl Copyright (C) 1999-2004 Free Software Foundation, Inc.
+# longlong.m4 serial 6
+dnl Copyright (C) 1999-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.
 
 dnl From Paul Eggert.
 
-# Define HAVE_LONG_LONG if 'long long' works.
+# Define HAVE_LONG_LONG_INT if 'long long int' works.
+# This fixes a bug in Autoconf 2.60, but can be removed once we
+# assume 2.61 everywhere.
 
+AC_DEFUN([AC_TYPE_LONG_LONG_INT],
+[
+  AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
+    [AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+         [[long long int ll = 9223372036854775807ll;
+           long long int nll = -9223372036854775807LL;
+           typedef int a[((-9223372036854775807LL < 0
+                           && 0 < 9223372036854775807ll)
+                          ? 1 : -1)];
+           int i = 63;]],
+         [[long long int llmax = 9223372036854775807ll;
+           return (ll << 63 | ll >> 63 | ll < i | ll > i
+                   | llmax / ll | llmax % ll);]])],
+       [ac_cv_type_long_long_int=yes],
+       [ac_cv_type_long_long_int=no])])
+  if test $ac_cv_type_long_long_int = yes; then
+    AC_DEFINE([HAVE_LONG_LONG_INT], 1,
+      [Define to 1 if the system has the type `long long int'.])
+  fi
+])
+
+# This macro is obsolescent and should go away soon.
 AC_DEFUN([gl_AC_TYPE_LONG_LONG],
 [
-  AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
-  [AC_TRY_LINK([long long ll = 1LL; int i = 63;],
-    [long long llmax = (long long) -1;
-     return ll << i | ll >> i | llmax / ll | llmax % ll;],
-    ac_cv_type_long_long=yes,
-    ac_cv_type_long_long=no)])
+  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
+  ac_cv_type_long_long=$ac_cv_type_long_long_int
   if test $ac_cv_type_long_long = yes; then
     AC_DEFINE(HAVE_LONG_LONG, 1,
       [Define if you have the 'long long' type.])
Index: m4/stdint.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/stdint.m4,v
retrieving revision 1.13
diff -p -u -r1.13 stdint.m4
--- m4/stdint.m4        27 Jun 2006 15:47:13 -0000      1.13
+++ m4/stdint.m4        2 Jul 2006 06:22:57 -0000
@@ -1,14 +1,25 @@
-# stdint.m4 serial 11
+# stdint.m4 serial 12
 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.
 
-dnl From Bruno Haible.
+dnl From Paul Eggert and Bruno Haible.
 dnl Test whether <stdint.h> is supported or must be substituted.
 
 AC_DEFUN([gl_STDINT_H],
 [
+  AC_PREREQ(2.59)dnl
+
+  dnl Check for long long int.
+  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
+  if test $ac_cv_type_long_long_int = yes; then
+    HAVE_LONG_LONG_INT=1
+  else
+    HAVE_LONG_LONG_INT=0
+  fi
+  AC_SUBST([HAVE_LONG_LONG_INT])
+
   dnl Check for <wchar.h>.
   AC_CHECK_HEADERS_ONCE([wchar.h])
   if test $ac_cv_header_wchar_h = yes; then
@@ -18,582 +29,160 @@ AC_DEFUN([gl_STDINT_H],
   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])
+  dnl Check for <inttypes.h>.
+  dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h.
+  if test $ac_cv_header_inttypes_h = yes; then
     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
+  dnl Check for <sys/types.h>.
+  dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h.
+  if test $ac_cv_header_sys_types_h = yes; then
+    HAVE_SYS_TYPES_H=1
   else
-    HAVE_SYS_INTTYPES_H=0
+    HAVE_SYS_TYPES_H=0
   fi
-  AC_SUBST([HAVE_SYS_INTTYPES_H])
+  AC_SUBST([HAVE_SYS_TYPES_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, [
-    AC_TRY_COMPILE([
-#define POW63  ((((((long) 1 << 15) << 15) << 15) << 15) << 3)
-#define POW64  ((((((long) 1 << 15) << 15) << 15) << 15) << 4)
-typedef int array [2 * (POW63 != 0 && POW64 == 0) - 1];
-], , gl_cv_long_bitsize_64=yes, gl_cv_long_bitsize_64=no)])
-  if test $gl_cv_long_bitsize_64 = yes; then
-    HAVE_LONG_64BIT=1
-  else
-    HAVE_LONG_64BIT=0
-  fi
-  AC_SUBST(HAVE_LONG_64BIT)
-
-  dnl Is long long == int64_t ?
-  AC_CACHE_CHECK([whether 'long long' is 64 bit wide], 
gl_cv_longlong_bitsize_64, [
-    AC_TRY_COMPILE([
-#define POW63  ((((((long long) 1 << 15) << 15) << 15) << 15) << 3)
-#define POW64  ((((((long long) 1 << 15) << 15) << 15) << 15) << 4)
-typedef int array [2 * (POW63 != 0 && POW64 == 0) - 1];
-], , gl_cv_longlong_bitsize_64=yes, gl_cv_longlong_bitsize_64=no)])
-  if test $gl_cv_longlong_bitsize_64 = yes; then
-    HAVE_LONG_LONG_64BIT=1
+  dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_stdint_h.
+  if test $ac_cv_header_stdint_h = yes; then
+    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_LONG_LONG_64BIT=0
+    HAVE_STDINT_H=0
   fi
-  AC_SUBST(HAVE_LONG_LONG_64BIT)
+  AC_SUBST([HAVE_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 Now see whether we need a substitute <stdint.h>.  Use
+  dnl FULL_PATH_STDINT_H, not <stdint.h>, so that it also works during
+  dnl a "config.status --recheck" if a stdint.h has 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([
+  if test $ac_cv_header_stdint_h = yes; then
+    AC_CACHE_CHECK([whether stdint.h conforms to C99],
+      [gl_cv_header_working_stdint_h],
+      [gl_cv_header_working_stdint_h=no
+       AC_COMPILE_IFELSE([
+        AC_LANG_PROGRAM([[
+#include <stddef.h>
 #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
+#include FULL_PATH_STDINT_H
+#ifdef INT8_MAX
+int8_t a1 = INT8_MAX;
+#endif
+#ifdef INT16_MAX
+int16_t a2 = INT16_MAX;
+#endif
+#ifdef INT32_MAX
+int32_t a3 = INT32_MAX;
+#endif
+#ifdef INT64_MAX
+int64_t a4 = INT64_MAX;
+#endif
+#ifdef UINT8_MAX
+uint8_t b1 = UINT8_MAX;
+#else
+typedef int b1[(unsigned char) -1 != 255 ? 1 : -1];
+#endif
+#ifdef UINT16_MAX
+uint16_t b2 = UINT16_MAX;
+#endif
+#ifdef UINT32_MAX
+uint32_t b3 = UINT32_MAX;
+#endif
+#ifdef UINT64_MAX
+uint64_t b4 = UINT64_MAX;
+#endif
+int_least8_t c1 = INT8_C (0x7f);
+int_least16_t c2 = INT16_C (0x7fff);
+int_least32_t c3 = INT32_C (0x7fffffff);
+int_least64_t c4 = INT64_C (0x7fffffffffffffff);
+uint_least8_t d1 = UINT8_C (0xff);
+uint_least16_t d2 = UINT16_C (0xffff);
+uint_least32_t d3 = UINT32_C (0xffffffff);
+uint_least64_t d4 = UINT64_C (0xffffffffffffffff);
+int_fast8_t e1 = INT_FAST8_MAX;
+int_fast16_t e2 = INT_FAST16_MAX;
+int_fast32_t e3 = INT_FAST32_MAX;
+int_fast64_t e4 = INT_FAST64_MAX;
+uint_fast8_t f1 = UINT_FAST8_MAX;
+uint_fast16_t f2 = UINT_FAST16_MAX;
+uint_fast32_t f3 = UINT_FAST32_MAX;
+uint_fast64_t f4 = UINT_FAST64_MAX;
+#ifdef INTPTR_MAX
+intptr_t g = INTPTR_MAX;
+#endif
+#ifdef UINTPTR_MAX
+uintptr_t h = UINTPTR_MAX;
+#endif
+intmax_t i = INTMAX_MAX;
+uintmax_t j = UINTMAX_MAX;
+struct s {
+  int a: PTRDIFF_MIN < 0 && 0 < PTRDIFF_MAX ? 1 : -1;
+  int b: SIG_ATOMIC_MIN <= 0 && 0 < SIG_ATOMIC_MAX ? 1 : -1;
+  int c: 0 < SIZE_MAX ? 1 : -1;
+  int d: WCHAR_MIN <= 0 && 0 < WCHAR_MAX ? 1 : -1;
+  int e: WINT_MIN <= 0 && 0 < WINT_MAX ? 1 : -1;
+  /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others.  */
+  int f: (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1;
+  int g: (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1;
+
+  /* Detect bugs in OpenBSD 3.9 stdint.h.  */
+#ifdef UINT8_MAX
+  int uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1;
+#endif
+#ifdef UINT16_MAX
+  int uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1;
+#endif
+#ifdef UINT32_MAX
+  int uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1;
+#endif
+#ifdef UINT64_MAX
+  int uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1;
+#endif
+  int uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1;
+  int uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1;
+  int uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1;
+  int uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1;
+  int uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1;
+  int uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1;
+  int uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1;
+  int uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1;
+  int uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1;
+  int uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1;
+  int size: (size_t) -1 == SIZE_MAX ? 1 : -1;
+};
+        ]])],
+         [gl_cv_header_working_stdint_h=yes])])
+  fi
+  if test "$gl_cv_header_working_stdint_h" != yes; then
+
+    dnl Check for <sys/inttypes.h>, and for
+    dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
+    AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h])
+    if test $ac_cv_header_sys_inttypes_h = yes; then
+      HAVE_SYS_INTTYPES_H=1
     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.])
+      HAVE_SYS_INTTYPES_H=0
     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 included before
-    dnl <wchar.h>.
-    AC_CHECK_TYPES([wint_t], , , [#include <stdio.h>
-#include <time.h>
-#include <wchar.h>
-])
-    gl_cv_type_wint_t=$ac_cv_type_wint_t
-    gl_STDINT_BITSIZEOF([wint_t], [#include <stdio.h>
-#include <time.h>
-#include <wchar.h>
-])
-    gl_CHECK_TYPES_SIGNED([wint_t], [#include <stdio.h>
-#include <time.h>
-#include <wchar.h>
-])
-    if test $HAVE_SIGNED_WINT_T = 1; then
-      gl_CHECK_TYPE_SAME([wint_t], [long], [#include <stdio.h>
-#include <time.h>
-#include <wchar.h>
-])
+    AC_SUBST([HAVE_SYS_INTTYPES_H])
+    if test $ac_cv_header_sys_bitypes_h = yes; then
+      HAVE_SYS_BITYPES_H=1
     else
-      gl_CHECK_TYPE_SAME([wint_t], [unsigned long], [#include <stdio.h>
-#include <time.h>
-#include <wchar.h>
-])
+      HAVE_SYS_BITYPES_H=0
     fi
+    AC_SUBST([HAVE_SYS_BITYPES_H])
 
-    STDINT_H='stdint.h'
+    gl_STDINT_TYPE_PROPERTIES
+    STDINT_H=stdint.h
   fi
   AC_SUBST(STDINT_H)
 ])
 
-dnl Set gl_cv_header_stdint_h to yes and define HAVE_STDINT_H if
-dnl <stdint.h> exists and doesn't clash with <sys/types.h>.
-AC_DEFUN([gl_HEADER_STDINT_H],
-[
-  dnl Check for <stdint.h> that doesn't clash with <sys/types.h>.
-  AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h, [
-    AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <stdint.h>],
-      [], gl_cv_header_stdint_h=yes, gl_cv_header_stdint_h=no)
-  ])
-  if test $gl_cv_header_stdint_h = yes; then
-    AC_DEFINE_UNQUOTED(HAVE_STDINT_H, 1,
-      [Define if <stdint.h> exists and doesn't clash with <sys/types.h>.])
-  fi
-])
-
-dnl Set gl_cv_header_inttypes_h to yes and define HAVE_INTTYPES_H if
-dnl <inttypes.h> exists and doesn't clash with <sys/types.h>.
-AC_DEFUN([gl_HEADER_INTTYPES_H],
-[
-  dnl Check for <inttypes.h> that doesn't clash with <sys/types.h>.
-  dnl On IRIX 5.3, <inttypes.h> conflicts with <sys/types.h>.
-  AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h, [
-    AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <inttypes.h>],
-      [], gl_cv_header_inttypes_h=yes, gl_cv_header_inttypes_h=no)
-  ])
-  if test $gl_cv_header_inttypes_h = yes; then
-    AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
-      [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
-  fi
-])
-
-dnl gl_STDINT_CHECK_TYPES(TYPES, INCLUDES, CACHE_VAR_PREFIX, MACRO_SUFFIX, 
DESCRIPTION_SUFFIX)
-dnl Check each of the given types, whether they are defined in the given
-dnl include files.
-AC_DEFUN([gl_STDINT_CHECK_TYPES],
-[
-  dnl Use a shell loop, to avoid bloating configure, and
-  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
-  dnl   config.h.in,
-  dnl - extra AC_SUBST calls, so that the right substitutions are made.
-  AC_FOREACH([gltype], [$1],
-    
[AH_TEMPLATE([HAVE_]translit(gltype,[abcdefghijklmnopqrstuvwxyz],[ABCDEFGHIJKLMNOPQRSTUVWXYZ])[$4],
-       [Define to 1 if the type ']gltype[' is already defined$5.])])
-  for gltype in $1 ; do
-    AC_MSG_CHECKING([for $gltype])
-    AC_COMPILE_IFELSE([
-      AC_LANG_PROGRAM([$2
-/* Test if the type exists.  */
-$gltype x = 17;
-      ])],
-      result=yes, result=no)
-    eval $3${gltype}=\$result
-    AC_MSG_RESULT($result)
-    GLTYPE=`echo "$gltype" | tr abcdefghijklmnopqrstuvwxyz 
ABCDEFGHIJKLMNOPQRSTUVWXYZ`
-    if test $result = yes; then
-      AC_DEFINE_UNQUOTED([HAVE_${GLTYPE}$4], 1)
-      eval HAVE_${GLTYPE}$4=1
-    else
-      eval HAVE_${GLTYPE}$4=0
-    fi
-  done
-  AC_FOREACH([gltype], [$1],
-    
[AC_SUBST([HAVE_]translit(gltype,[abcdefghijklmnopqrstuvwxyz],[ABCDEFGHIJKLMNOPQRSTUVWXYZ])[$4])])
-])
-
-dnl gl_STDINT_MISSING_BOUND(TYPE_BOUND, DEFAULT, DESCRIPTION)
-dnl assumes an otherwise complete <stdint.h> and defines TYPE_BOUND if
-dnl <stdint.h> doesn't define it.
-AC_DEFUN([gl_STDINT_MISSING_BOUND],
-[
-  AC_CACHE_CHECK([for $1], [gl_cv_stdint_$1],
-    [AC_EGREP_CPP([found it], [#include <stdint.h>
-#ifdef $1
-found it
-#endif
-       ], [gl_cv_stdint_$1=yes], [gl_cv_stdint_$1="$2"])])
-  if test "$gl_cv_stdint_$1" != yes; then
-    AC_DEFINE_UNQUOTED([$1], [$2], [$3])
-  fi
-])
-
-dnl gl_STDINT_MISSING_BOUNDS(BOUNDS, INCLUDES)
-dnl assumes an otherwise complete <stdint.h> and defines each element of BOUNDS
-dnl if <stdint.h> doesn't define it.
-dnl Use this for types whose signedness is determined by the first letter
-dnl ('u' or not).
-AC_DEFUN([gl_STDINT_MISSING_BOUNDS],
-[
-  dnl Use a shell loop, to avoid bloating configure, and
-  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
-  dnl   config.h.in.
-  AC_FOREACH([bound], [$1],
-    [AH_TEMPLATE(bound, [Define if <stdint.h> doesn't define it.])])
-changequote(,)dnl
-  sed_unsigned='s,^\(U*\).*,\1,'
-  sed_limitkind='s,^.*\(_[^_]*\)$,\1,'
-changequote([,])dnl
-  for bound in $1; do
-    type=`echo $bound | sed -e 's,_MAX,_t,' -e 's,_MIN,_t,' | tr 
ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
-    unsigned=`echo $bound | sed -e "$sed_unsigned" | tr U u`
-    width=`echo $bound | sed -e 's,^U*INT,,' -e 's,_MIN,,' -e 's,_MAX,,'`
-    limitkind=`echo $bound | sed -e "$sed_limitkind"`
-    AC_CACHE_CHECK([for $bound], [gl_cv_stdint_$bound],
-      [AC_EGREP_CPP([found it], [#include <stdint.h>
-#ifdef $bound
-found it
-#endif
-         ], [eval gl_cv_stdint_$bound=yes],
-         [result=
-          case $width in
-            *8) widthlist="8 16 32 64" ;;
-            *16) widthlist="16 32 64" ;;
-            *32 | PTR | MAX | PTRDIFF) widthlist="32 64" ;;
-            *64) widthlist="64" ;;
-          esac
-          for w in $widthlist; do
-            if test -z "$result"; then
-              AC_COMPILE_IFELSE([[$2
-#include <stdint.h>
-int verify[2 * (sizeof ($type) == sizeof (${unsigned}int${w}_t)) - 1];
-                ]], [result=`echo "$unsigned" | tr u U`INT${w}${limitkind}])
-            else
-              break
-            fi
-          done
-          if test -z "$result"; then
-            result=no
-          fi
-          eval gl_cv_stdint_$bound=\$result
-         ])])
-    eval result=\$gl_cv_stdint_$bound
-    if test "$result" != yes && test "$result" != no; then
-      AC_DEFINE_UNQUOTED([$bound], [$result],
-        [Define if <stdint.h> doesn't define it.])
-    fi
-  done
-])
-
-dnl gl_STDINT_MISSING_BOUNDS2(BOUNDS, INCLUDES)
-dnl assumes an otherwise complete <stdint.h> and defines each element of BOUNDS
-dnl if <stdint.h> doesn't define it.
-dnl Use this for types whose signedness is a priori unknown.
-AC_DEFUN([gl_STDINT_MISSING_BOUNDS2],
-[
-  dnl Use a shell loop, to avoid bloating configure, and
-  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
-  dnl   config.h.in.
-  AC_FOREACH([bound], [$1],
-    [AH_TEMPLATE(bound, [Define if <stdint.h> doesn't define it.])])
-changequote(,)dnl
-  sed_limitkind='s,^.*\(_[^_]*\)$,\1,'
-changequote([,])dnl
-  for bound in $1; do
-    type=`echo $bound | sed -e 's,_MAX,_t,' -e 's,_MIN,_t,' | tr 
ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
-    limitkind=`echo $bound | sed -e "$sed_limitkind"`
-    AC_CACHE_CHECK([for $bound], [gl_cv_stdint_$bound],
-      [AC_EGREP_CPP([found it], [#include <stdint.h>
-#ifdef $bound
-found it
-#endif
-         ], [eval gl_cv_stdint_$bound=yes],
-         [result=
-          AC_COMPILE_IFELSE([[$2
-            int verify[2 * (($type) -1 >= ($type) 0) - 1];
-            ]],
-            [eval gl_cv_${type}_signed=no],
-            [eval gl_cv_${type}_signed=yes])
-          if eval test \$gl_cv_${type}_signed = yes; then
-            for w in 8 16 32 64; do
-              if test -z "$result"; then
-                AC_COMPILE_IFELSE([[$2
-#include <stdint.h>
-int verify[2 * (sizeof ($type) == sizeof (int${w}_t)) - 1];
-                  ]], [result=INT${w}${limitkind}])
-              else
-                break
-              fi
-            done
-          else
-            if test ${limitkind} = _MIN; then
-              result=0
-            else
-              for w in 8 16 32 64; do
-                if test -z "$result"; then
-                  AC_COMPILE_IFELSE([[$2
-#include <stdint.h>
-int verify[2 * (sizeof ($type) == sizeof (uint${w}_t)) - 1];
-                    ]], [result=UINT${w}${limitkind}])
-                else
-                  break
-                fi
-              done
-            fi
-          fi
-          if test -z "$result"; then
-            result=no
-          fi
-          eval gl_cv_stdint_$bound=\$result
-         ])])
-    eval result=\$gl_cv_stdint_$bound
-    if test "$result" != yes && test "$result" != no; then
-      AC_DEFINE_UNQUOTED([$bound], [$result],
-        [Define if <stdint.h> doesn't define it.])
-    fi
-  done
-])
-
 dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
 dnl Determine the size of each of the given types in bits.
 AC_DEFUN([gl_STDINT_BITSIZEOF],
@@ -606,15 +195,14 @@ AC_DEFUN([gl_STDINT_BITSIZEOF],
     [AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz 
],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
        [Define to the number of bits in type ']gltype['.])])
   for gltype in $1 ; do
-    if eval test \$gl_cv_type_${gltype} = yes; then
-      AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}],
-        [_AC_COMPUTE_INT([sizeof ($gltype) * CHAR_BIT], result,
-           [$2
-#include <limits.h>], result=unknown)
-         eval gl_cv_bitsizeof_${gltype}=\$result
-        ])
-      eval result=\$gl_cv_bitsizeof_${gltype}
-    else
+    AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}],
+      [_AC_COMPUTE_INT([sizeof ($gltype) * CHAR_BIT], result,
+        [$2
+#include <limits.h>], [result=unknown])
+       eval gl_cv_bitsizeof_${gltype}=\$result
+      ])
+    eval result=\$gl_cv_bitsizeof_${gltype}
+    if test $result = unknown; then
       dnl Use a nonempty default, because some compilers, such as IRIX 5 cc,
       dnl do a syntax check even on unused #if conditions and give an error
       dnl on valid C code like this:
@@ -647,9 +235,8 @@ AC_DEFUN([gl_CHECK_TYPES_SIGNED],
   for gltype in $1 ; do
     AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed],
       [AC_COMPILE_IFELSE(
-         [AC_LANG_PROGRAM([[$2
-            int verify[2 * (($1) -1 < ($1) 0) - 1];
-            ]])],
+         [AC_LANG_PROGRAM([$2[
+            int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])],
          result=yes, result=no)
        eval gl_cv_type_${gltype}_signed=\$result
       ])
@@ -666,14 +253,82 @@ AC_DEFUN([gl_CHECK_TYPES_SIGNED],
     [AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz 
],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
 ])
 
-dnl gl_CHECK_TYPE_SAME(TYPE, KNOWNTYPE, INCLUDES)
-dnl Determines whether two types are the same.
-AC_DEFUN([gl_CHECK_TYPE_SAME],
+dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES)
+dnl Determine the suffix to use for integer constants of the given types.
+dnl Define t_SUFFIX for each such type.
+AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
+[
+  dnl Use a shell loop, to avoid bloating configure, and
+  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
+  dnl   config.h.in,
+  dnl - extra AC_SUBST calls, so that the right substitutions are made.
+  AC_FOREACH([gltype], [$1],
+    [AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz 
],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
+       [Define to l, ll, u, ul, ull, etc., as suitable for
+       constants of type ']gltype['.])])
+  for gltype in $1 ; do
+    AC_CACHE_CHECK([for $gltype integer literal suffix],
+      [gl_cv_type_${gltype}_suffix],
+      [eval gl_cv_type_${gltype}_suffix=no
+       eval result=\$gl_cv_type_${gltype}_signed
+       if test "$result" = yes; then
+        glsufu=
+       else
+        glsufu=u
+       fi
+       for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
+        case $glsuf in
+          '')  gltype1='int';;
+          l)   gltype1='long int';;
+          ll)  gltype1='long long int';;
+          i64) gltype1='__int64';;
+          u)   gltype1='unsigned int';;
+          ul)  gltype1='unsigned long int';;
+          ull) gltype1='unsigned long long int';;
+          ui64)gltype1='unsigned __int64';;
+        esac
+        AC_COMPILE_IFELSE(
+          [AC_LANG_PROGRAM([$2
+             extern $gltype foo;
+             extern $gltype1 foo;])],
+          [eval gl_cv_type_${gltype}_suffix=\$glsuf])
+        eval test \"\$gl_cv_type_${gltype}_suffix\" != no && break
+       done])
+    GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 
'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
+    eval result=\$gl_cv_type_${gltype}_suffix
+    test "$result" = no && result=
+    eval ${GLTYPE}_SUFFIX=\$result
+    AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], $result)
+  done
+  AC_FOREACH([gltype], [$1],
+    [AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz 
],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
+])
+
+dnl gl_STDINT_INCLUDES
+AC_DEFUN([gl_STDINT_INCLUDES],
+[[
+  #include <stddef.h>
+  #include <signal.h>
+  #if HAVE_WCHAR_H
+    /* BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
+       <wchar.h>.  */
+  # include <stdio.h>
+  # include <time.h>
+  # include <wchar.h>
+  #endif
+]])
+
+dnl gl_STDINT_TYPE_PROPERTIES
+dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t
+dnl of interest to stdint_.h.
+AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
 [
-  AC_TRY_COMPILE([$3
-    extern $1 foo;
-    extern $2 foo;], [],
-    [SAME_TYPE_]AS_TR_CPP([$1])[_]AS_TR_CPP([$2])[=1],
-    [SAME_TYPE_]AS_TR_CPP([$1])[_]AS_TR_CPP([$2])[=0])
-  AC_SUBST([SAME_TYPE_]AS_TR_CPP([$1])[_]AS_TR_CPP([$2]))
+  gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
+    [gl_STDINT_INCLUDES])
+  gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t],
+    [gl_STDINT_INCLUDES])
+  gl_cv_type_ptrdiff_t_signed=yes
+  gl_cv_type_size_t_signed=no
+  gl_INTEGER_TYPE_SUFFIX([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
+    [gl_STDINT_INCLUDES])
 ])
Index: m4/ulonglong.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/ulonglong.m4,v
retrieving revision 1.9
diff -p -u -r1.9 ulonglong.m4
--- m4/ulonglong.m4     18 Jan 2005 13:07:56 -0000      1.9
+++ m4/ulonglong.m4     2 Jul 2006 06:22:57 -0000
@@ -1,21 +1,41 @@
-# ulonglong.m4 serial 4
-dnl Copyright (C) 1999-2004 Free Software Foundation, Inc.
+# ulonglong.m4 serial 5
+dnl Copyright (C) 1999-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.
 
 dnl From Paul Eggert.
 
-# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works.
+# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
+# This fixes a bug in Autoconf 2.60, but can be removed once we
+# assume 2.61 everywhere.
 
+AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
+[
+  AC_CACHE_CHECK([for unsigned long long int],
+    [ac_cv_type_unsigned_long_long_int],
+    [AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+         [[unsigned long long int ull = 18446744073709551615ULL;
+           typedef int a[(18446744073709551615ULL <= (unsigned long long int) 
-1
+                          ? 1 : -1)];
+          int i = 63;]],
+         [[unsigned long long int ullmax = 18446744073709551615ull;
+           return (ull << 63 | ull >> 63 | ull << i | ull >> i
+                   | ullmax / ull | ullmax % ull);]])],
+       [ac_cv_type_unsigned_long_long_int=yes],
+       [ac_cv_type_unsigned_long_long_int=no])])
+  if test $ac_cv_type_unsigned_long_long_int = yes; then
+    AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
+      [Define to 1 if the system has the type `unsigned long long int'.])
+  fi
+])
+
+# This macro is obsolescent and should go away soon.
 AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG],
 [
-  AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
-  [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;],
-    [unsigned long long ullmax = (unsigned long long) -1;
-     return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
-    ac_cv_type_unsigned_long_long=yes,
-    ac_cv_type_unsigned_long_long=no)])
+  AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
+  ac_cv_type_unsigned_long_long=$ac_cv_type_unsigned_long_long_int
   if test $ac_cv_type_unsigned_long_long = yes; then
     AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
       [Define if you have the 'unsigned long long' type.])
Index: modules/inttypes
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/inttypes,v
retrieving revision 1.2
diff -p -u -r1.2 inttypes
--- modules/inttypes    2 May 2006 23:48:20 -0000       1.2
+++ modules/inttypes    2 Jul 2006 06:22:57 -0000
@@ -10,7 +10,6 @@ m4/full-header-path.m4
 m4/_inttypes_h.m4
 
 Depends-on:
-stdint
 
 configure.ac:
 gl_INTTYPES_H
Index: modules/stdint
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/stdint,v
retrieving revision 1.7
diff -p -u -r1.7 stdint
--- modules/stdint      26 Jun 2006 17:27:54 -0000      1.7
+++ modules/stdint      2 Jul 2006 06:22:57 -0000
@@ -1,14 +1,16 @@
 Description:
-An <stdint.h> that nearly conforms to C99.
-(Nearly: {uint,int}_{fast,least}{8,16,32,64}_t may not correspond
-to the fastest and smallest types available on the system.)
+A <stdint.h> that nearly conforms to C99.
+Assumes typical host with 8-bit bytes, two's complement
+representation, and no padding or trap representations, with int
+widths equal to 8, 16, 32, and 64 bits.  {uint,int}_fast{8,16,32,64}_t
+may not correspond to the fastest types available on the system.
+Macros are used instead of typedefs.
 
 Files:
 lib/stdint_.h
 m4/stdint.m4
 m4/full-header-path.m4
-m4/size_max.m4
-m4/wchar_t.m4
+m4/longlong.m4
 
 Depends-on:
 
@@ -24,88 +26,25 @@ EXTRA_DIST += stdint_.h
 stdint.h: stdint_.h
        sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
            -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
+           -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
            -e 's|@''FULL_PATH_STDINT_H''@|$(FULL_PATH_STDINT_H)|g' \
            -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
-           -e 's|@''FULL_PATH_INTTYPES_H''@|$(FULL_PATH_INTTYPES_H)|g' \
            -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
            -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
-           -e 's/@''HAVE_LONG_64BIT''@/$(HAVE_LONG_64BIT)/g' \
-           -e 's/@''HAVE_LONG_LONG_64BIT''@/$(HAVE_LONG_LONG_64BIT)/g' \
-           -e 's/@''HAVE_INT8_T''@/$(HAVE_INT8_T)/g' \
-           -e 's/@''HAVE_INT16_T''@/$(HAVE_INT16_T)/g' \
-           -e 's/@''HAVE_INT32_T''@/$(HAVE_INT32_T)/g' \
-           -e 's/@''HAVE_INT64_T''@/$(HAVE_INT64_T)/g' \
-           -e 's/@''HAVE_UINT8_T''@/$(HAVE_UINT8_T)/g' \
-           -e 's/@''HAVE_UINT16_T''@/$(HAVE_UINT16_T)/g' \
-           -e 's/@''HAVE_UINT32_T''@/$(HAVE_UINT32_T)/g' \
-           -e 's/@''HAVE_UINT64_T''@/$(HAVE_UINT64_T)/g' \
-           -e 's/@''HAVE_INT_LEAST8_T''@/$(HAVE_INT_LEAST8_T)/g' \
-           -e 's/@''HAVE_INT_LEAST16_T''@/$(HAVE_INT_LEAST16_T)/g' \
-           -e 's/@''HAVE_INT_LEAST32_T''@/$(HAVE_INT_LEAST32_T)/g' \
-           -e 's/@''HAVE_INT_LEAST64_T''@/$(HAVE_INT_LEAST64_T)/g' \
-           -e 's/@''HAVE_UINT_LEAST8_T''@/$(HAVE_UINT_LEAST8_T)/g' \
-           -e 's/@''HAVE_UINT_LEAST16_T''@/$(HAVE_UINT_LEAST16_T)/g' \
-           -e 's/@''HAVE_UINT_LEAST32_T''@/$(HAVE_UINT_LEAST32_T)/g' \
-           -e 's/@''HAVE_UINT_LEAST64_T''@/$(HAVE_UINT_LEAST64_T)/g' \
-           -e 's/@''HAVE_INT_FAST8_T''@/$(HAVE_INT_FAST8_T)/g' \
-           -e 's/@''HAVE_INT_FAST16_T''@/$(HAVE_INT_FAST16_T)/g' \
-           -e 's/@''HAVE_INT_FAST32_T''@/$(HAVE_INT_FAST32_T)/g' \
-           -e 's/@''HAVE_INT_FAST64_T''@/$(HAVE_INT_FAST64_T)/g' \
-           -e 's/@''HAVE_UINT_FAST8_T''@/$(HAVE_UINT_FAST8_T)/g' \
-           -e 's/@''HAVE_UINT_FAST16_T''@/$(HAVE_UINT_FAST16_T)/g' \
-           -e 's/@''HAVE_UINT_FAST32_T''@/$(HAVE_UINT_FAST32_T)/g' \
-           -e 's/@''HAVE_UINT_FAST64_T''@/$(HAVE_UINT_FAST64_T)/g' \
-           -e 's/@''HAVE_INTPTR_T''@/$(HAVE_INTPTR_T)/g' \
-           -e 's/@''HAVE_UINTPTR_T''@/$(HAVE_UINTPTR_T)/g' \
-           -e 's/@''HAVE_INTMAX_T''@/$(HAVE_INTMAX_T)/g' \
-           -e 's/@''HAVE_UINTMAX_T''@/$(HAVE_UINTMAX_T)/g' \
-           -e 's/@''BITSIZEOF_UNSIGNED_INT''@/$(BITSIZEOF_UNSIGNED_INT)/g' \
-           -e 's/@''BITSIZEOF_LONG''@/$(BITSIZEOF_LONG)/g' \
-           -e 's/@''BITSIZEOF_UNSIGNED_LONG''@/$(BITSIZEOF_UNSIGNED_LONG)/g' \
-           -e 's/@''BITSIZEOF_INT8_T''@/$(BITSIZEOF_INT8_T)/g' \
-           -e 's/@''BITSIZEOF_INT16_T''@/$(BITSIZEOF_INT16_T)/g' \
-           -e 's/@''BITSIZEOF_INT32_T''@/$(BITSIZEOF_INT32_T)/g' \
-           -e 's/@''BITSIZEOF_INT64_T''@/$(BITSIZEOF_INT64_T)/g' \
-           -e 's/@''BITSIZEOF_UINT8_T''@/$(BITSIZEOF_UINT8_T)/g' \
-           -e 's/@''BITSIZEOF_UINT16_T''@/$(BITSIZEOF_UINT16_T)/g' \
-           -e 's/@''BITSIZEOF_UINT32_T''@/$(BITSIZEOF_UINT32_T)/g' \
-           -e 's/@''BITSIZEOF_UINT64_T''@/$(BITSIZEOF_UINT64_T)/g' \
-           -e 's/@''BITSIZEOF_INT_LEAST8_T''@/$(BITSIZEOF_INT_LEAST8_T)/g' \
-           -e 's/@''BITSIZEOF_INT_LEAST16_T''@/$(BITSIZEOF_INT_LEAST16_T)/g' \
-           -e 's/@''BITSIZEOF_INT_LEAST32_T''@/$(BITSIZEOF_INT_LEAST32_T)/g' \
-           -e 's/@''BITSIZEOF_INT_LEAST64_T''@/$(BITSIZEOF_INT_LEAST64_T)/g' \
-           -e 's/@''BITSIZEOF_UINT_LEAST8_T''@/$(BITSIZEOF_UINT_LEAST8_T)/g' \
-           -e 's/@''BITSIZEOF_UINT_LEAST16_T''@/$(BITSIZEOF_UINT_LEAST16_T)/g' 
\
-           -e 's/@''BITSIZEOF_UINT_LEAST32_T''@/$(BITSIZEOF_UINT_LEAST32_T)/g' 
\
-           -e 's/@''BITSIZEOF_UINT_LEAST64_T''@/$(BITSIZEOF_UINT_LEAST64_T)/g' 
\
-           -e 's/@''BITSIZEOF_INT_FAST8_T''@/$(BITSIZEOF_INT_FAST8_T)/g' \
-           -e 's/@''BITSIZEOF_INT_FAST16_T''@/$(BITSIZEOF_INT_FAST16_T)/g' \
-           -e 's/@''BITSIZEOF_INT_FAST32_T''@/$(BITSIZEOF_INT_FAST32_T)/g' \
-           -e 's/@''BITSIZEOF_INT_FAST64_T''@/$(BITSIZEOF_INT_FAST64_T)/g' \
-           -e 's/@''BITSIZEOF_UINT_FAST8_T''@/$(BITSIZEOF_UINT_FAST8_T)/g' \
-           -e 's/@''BITSIZEOF_UINT_FAST16_T''@/$(BITSIZEOF_UINT_FAST16_T)/g' \
-           -e 's/@''BITSIZEOF_UINT_FAST32_T''@/$(BITSIZEOF_UINT_FAST32_T)/g' \
-           -e 's/@''BITSIZEOF_UINT_FAST64_T''@/$(BITSIZEOF_UINT_FAST64_T)/g' \
-           -e 's/@''BITSIZEOF_INTPTR_T''@/$(BITSIZEOF_INTPTR_T)/g' \
-           -e 's/@''BITSIZEOF_UINTPTR_T''@/$(BITSIZEOF_UINTPTR_T)/g' \
-           -e 's/@''BITSIZEOF_INTMAX_T''@/$(BITSIZEOF_INTMAX_T)/g' \
-           -e 's/@''BITSIZEOF_UINTMAX_T''@/$(BITSIZEOF_UINTMAX_T)/g' \
+           -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
            -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
-           -e 's/@''SAME_TYPE_PTRDIFF_T_LONG''@/$(SAME_TYPE_PTRDIFF_T_LONG)/g' 
\
+           -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
            -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
            -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' 
\
-           -e 
's/@''SAME_TYPE_SIG_ATOMIC_T_LONG''@/$(SAME_TYPE_SIG_ATOMIC_T_LONG)/g' \
-           -e 
's/@''SAME_TYPE_SIG_ATOMIC_T_UNSIGNED_LONG''@/$(SAME_TYPE_SIG_ATOMIC_T_UNSIGNED_LONG)/g'
 \
+           -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \
            -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \
-           -e 
's/@''SAME_TYPE_SIZE_T_UNSIGNED_LONG''@/$(SAME_TYPE_SIZE_T_UNSIGNED_LONG)/g' \
+           -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \
            -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \
            -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \
-           -e 's/@''SAME_TYPE_WCHAR_T_LONG''@/$(SAME_TYPE_WCHAR_T_LONG)/g' \
-           -e 
's/@''SAME_TYPE_WCHAR_T_UNSIGNED_LONG''@/$(SAME_TYPE_WCHAR_T_UNSIGNED_LONG)/g' \
+           -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \
            -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
            -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
-           -e 's/@''SAME_TYPE_WINT_T_LONG''@/$(SAME_TYPE_WINT_T_LONG)/g' \
-           -e 
's/@''SAME_TYPE_WINT_T_UNSIGNED_LONG''@/$(SAME_TYPE_WINT_T_UNSIGNED_LONG)/g' \
+           -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
            < $(srcdir)/stdint_.h > address@hidden
        mv address@hidden $@
 MOSTLYCLEANFILES += stdint.h stdint.h-t
Index: modules/stdint-tests
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/stdint-tests,v
retrieving revision 1.1
diff -p -u -r1.1 stdint-tests
--- modules/stdint-tests        16 Jun 2006 13:29:04 -0000      1.1
+++ modules/stdint-tests        2 Jul 2006 06:22:57 -0000
@@ -1,11 +1,15 @@
 Files:
 tests/test-stdint.c
+m4/wchar_t.m4
+m4/wint_t.m4
 
 Depends-on:
 verify
 intprops
 
 configure.ac:
+gt_TYPE_WCHAR_T
+gt_TYPE_WINT_T
 
 Makefile.am:
 TESTS += test-stdint$(EXEEXT)
Index: tests/test-stdint.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/tests/test-stdint.c,v
retrieving revision 1.2
diff -p -u -r1.2 test-stdint.c
--- tests/test-stdint.c 23 Jun 2006 14:58:59 -0000      1.2
+++ tests/test-stdint.c 2 Jul 2006 06:22:57 -0000
@@ -38,7 +38,7 @@
 # define _verify_func(line) _verify_func2(line)
 # define _verify_func2(line) verify_func_ ## line
 #else
-# define verify_same_types(expr1,expr2)
+# define verify_same_types(expr1,expr2) extern void verify_func (int)
 #endif
 
 /* 7.18.1.1. Exact-width integer types */
@@ -62,7 +62,7 @@ verify (TYPE_MAXIMUM (int32_t) == INT32_
 verify_same_types (INT32_MIN, (int32_t) 0 + 0);
 verify_same_types (INT32_MAX, (int32_t) 0 + 0);
 
-#if HAVE_INT64_T_IN_STDINT_H || _STDINT_H_HAVE_INT64
+#ifdef INT64_MAX
 int64_t a4[3] = { INT64_C (17), INT64_MIN, INT64_MAX };
 verify (TYPE_MINIMUM (int64_t) == INT64_MIN);
 verify (TYPE_MAXIMUM (int64_t) == INT64_MAX);
@@ -82,7 +82,7 @@ uint32_t b3[2] = { UINT32_C (17), UINT32
 verify (TYPE_MAXIMUM (uint32_t) == UINT32_MAX);
 verify_same_types (UINT32_MAX, (uint32_t) 0 + 0);
 
-#if HAVE_UINT64_T_IN_STDINT_H || _STDINT_H_HAVE_UINT64
+#ifdef UINT64_MAX
 uint64_t b4[2] = { UINT64_C (17), UINT64_MAX };
 verify (TYPE_MAXIMUM (uint64_t) == UINT64_MAX);
 verify_same_types (UINT64_MAX, (uint64_t) 0 + 0);
@@ -121,7 +121,7 @@ verify (TYPE_MAXIMUM (int_least32_t) == 
 verify_same_types (INT_LEAST32_MIN, (int_least32_t) 0 + 0);
 verify_same_types (INT_LEAST32_MAX, (int_least32_t) 0 + 0);
 
-#if HAVE_INT_LEAST64_T_IN_STDINT_H || _STDINT_H_HAVE_INT64
+#ifdef INT_LEAST64_MAX
 int_least64_t c4[3] = { 17, INT_LEAST64_MIN, INT_LEAST64_MAX };
 verify (TYPE_MINIMUM (int_least64_t) == INT_LEAST64_MIN);
 verify (TYPE_MAXIMUM (int_least64_t) == INT_LEAST64_MAX);
@@ -141,7 +141,7 @@ uint_least32_t d3[2] = { 17, UINT_LEAST3
 verify (TYPE_MAXIMUM (uint_least32_t) == UINT_LEAST32_MAX);
 verify_same_types (UINT_LEAST32_MAX, (uint_least32_t) 0 + 0);
 
-#if HAVE_UINT_LEAST64_T_IN_STDINT_H || _STDINT_H_HAVE_UINT64
+#ifdef UINT_LEAST64_MAX
 uint_least64_t d4[2] = { 17, UINT_LEAST64_MAX };
 verify (TYPE_MAXIMUM (uint_least64_t) == UINT_LEAST64_MAX);
 verify_same_types (UINT_LEAST64_MAX, (uint_least64_t) 0 + 0);
@@ -180,7 +180,7 @@ verify (TYPE_MAXIMUM (int_fast32_t) == I
 verify_same_types (INT_FAST32_MIN, (int_fast32_t) 0 + 0);
 verify_same_types (INT_FAST32_MAX, (int_fast32_t) 0 + 0);
 
-#if HAVE_INT_FAST64_T_IN_STDINT_H || _STDINT_H_HAVE_INT64
+#ifdef INT_FAST64_MAX
 int_fast64_t e4[3] = { 17, INT_FAST64_MIN, INT_FAST64_MAX };
 verify (TYPE_MINIMUM (int_fast64_t) == INT_FAST64_MIN);
 verify (TYPE_MAXIMUM (int_fast64_t) == INT_FAST64_MAX);
@@ -200,7 +200,7 @@ uint_fast32_t f3[2] = { 17, UINT_FAST32_
 verify (TYPE_MAXIMUM (uint_fast32_t) == UINT_FAST32_MAX);
 verify_same_types (UINT_FAST32_MAX, (uint_fast32_t) 0 + 0);
 
-#if HAVE_UINT_FAST64_T_IN_STDINT_H || _STDINT_H_HAVE_UINT64
+#ifdef UINT_FAST64_MAX
 uint_fast64_t f4[2] = { 17, UINT_FAST64_MAX };
 verify (TYPE_MAXIMUM (uint_fast64_t) == UINT_FAST64_MAX);
 verify_same_types (UINT_FAST64_MAX, (uint_fast64_t) 0 + 0);
@@ -293,30 +293,36 @@ verify_same_types (SIZE_MAX, (size_t) 0 
 err or;
 #endif
 
+#if HAVE_WCHAR_T
 verify (TYPE_MINIMUM (wchar_t) == WCHAR_MIN);
 verify (TYPE_MAXIMUM (wchar_t) == WCHAR_MAX);
 verify_same_types (WCHAR_MIN, (wchar_t) 0 + 0);
 verify_same_types (WCHAR_MAX, (wchar_t) 0 + 0);
 
-#if WCHAR_MIN != 17 && WCHAR_MAX
+# if WCHAR_MIN != 17 && WCHAR_MAX
 /* ok */
-#else
+# else
 err or;
+# endif
 #endif
 
-#include <stdio.h>
-#include <time.h>
-#include <wchar.h>
+#if HAVE_WINT_T
+# if HAVE_WCHAR_H
+#  include <stdio.h>
+#  include <time.h>
+#  include <wchar.h>
+# endif
 
 verify (TYPE_MINIMUM (wint_t) == WINT_MIN);
 verify (TYPE_MAXIMUM (wint_t) == WINT_MAX);
 verify_same_types (WINT_MIN, (wint_t) 0 + 0);
 verify_same_types (WINT_MAX, (wint_t) 0 + 0);
 
-#if WINT_MIN != 17 && WINT_MAX
+# if WINT_MIN != 17 && WINT_MAX
 /* ok */
-#else
+# else
 err or;
+# endif
 #endif
 
 /* 7.18.4. Macros for integer constants */
@@ -336,11 +342,11 @@ verify_same_types (INT32_C (17), (int_le
 verify (UINT32_C (17) == 17);
 verify_same_types (UINT32_C (17), (uint_least32_t)0 + 0);
 
-#if HAVE_INT_LEAST64_T_IN_STDINT_H || _STDINT_H_HAVE_INT64
+#ifdef INT64_C
 verify (INT64_C (17) == 17);
 verify_same_types (INT64_C (17), (int_least64_t)0 + 0);
 #endif
-#if HAVE_UINT_LEAST64_T_IN_STDINT_H || _STDINT_H_HAVE_UINT64
+#ifdef UINT64_C
 verify (UINT64_C (17) == 17);
 verify_same_types (UINT64_C (17), (uint_least64_t)0 + 0);
 #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]