bug-gnulib
[Top][All Lists]
Advanced

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

stdint module rewrite (was: Re: Build CVS (TRUNK) failed.)


From: Bruno Haible
Subject: stdint module rewrite (was: Re: Build CVS (TRUNK) failed.)
Date: Tue, 13 Jun 2006 18:20:18 +0200
User-agent: KMail/1.9.1

Mark D. Baushke wrote:
> > If not, then the current solution is OK, albeit annoying. If so, then
> > what breaks? We can test for that.
> 
> Apparently, none of the intNN_t or uintNN_t or intmax_t or uintmax_t
> types are defined.
> 
> For our own code, we could just add a
> 
> #if HAVE_INTTYPES_H
> #include <inttypes.h>
> #endif
> 
> but that does not really help us with all of the GNULIB code that
> includes <stdint.h> and fails to get the types expected.

Likewise on HP-UX IA64: <stdint.h> does not define the types like
uint32_t, but <inttypes.h> does.

Here is a proposed rewrite of the stdint module. It defines a
*complete* <stdint.h>, and is autoconfiguring - no more
#ifdef __FreeBSD__ etc. that are hard to maintain.

It appears to work fine on Solaris and HP-UX IA64.

The only downside is that it bloats up 'configure' - but autoconf 3
should annihilate that growth, I'm told.

Bruno


Index: modules/stdint
===================================================================
RCS file: /sources/gnulib/gnulib/modules/stdint,v
retrieving revision 1.5
diff -c -3 -r1.5 stdint
*** modules/stdint      5 Oct 2005 16:15:35 -0000       1.5
--- modules/stdint      13 Jun 2006 15:45:00 -0000
***************
*** 6,12 ****
  Files:
  lib/stdint_.h
  m4/stdint.m4
! m4/inttypes.m4
  
  Depends-on:
  
--- 6,13 ----
  Files:
  lib/stdint_.h
  m4/stdint.m4
! m4/full-header-path.m4
! m4/size_max.m4
  
  Depends-on:
  
Index: lib/stdint_.h
===================================================================
RCS file: /sources/gnulib/gnulib/lib/stdint_.h,v
retrieving revision 1.14
diff -c -3 -r1.14 stdint_.h
*** lib/stdint_.h       17 May 2006 10:46:10 -0000      1.14
--- lib/stdint_.h       13 Jun 2006 15:45:00 -0000
***************
*** 40,46 ****
       uintptr_t.  */
  # include <sys/types.h>
  # if HAVE_INTTYPES_H
! #  include <inttypes.h>
  # endif
  #endif
  #if defined(__linux__) && HAVE_SYS_BITYPES_H
--- 40,46 ----
       uintptr_t.  */
  # include <sys/types.h>
  # if HAVE_INTTYPES_H
! #  include FULL_PATH_INTTYPES_H
  # endif
  #endif
  #if defined(__linux__) && HAVE_SYS_BITYPES_H
***************
*** 50,165 ****
  # include <sys/bitypes.h>
  #endif
  #if defined(__sun) && HAVE_SYS_INTTYPES_H
- # include <sys/inttypes.h>
    /* 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!  */
! # define _STDINT_H_HAVE_SYSTEM_INTTYPES
  #endif
  #if (defined(__hpux) || defined(_AIX)) && HAVE_INTTYPES_H
- # include <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.  */
! # define _STDINT_H_HAVE_SYSTEM_INTTYPES
  #endif
! #if !((defined(__CYGWIN__) || defined(__linux__)) && 
defined(__BIT_TYPES_DEFINED__))
! # define _STDINT_H_NEED_SIGNED_INT_TYPES
  #endif
  
- #if !defined(_STDINT_H_HAVE_SYSTEM_INTTYPES)
- 
  /* 7.18.1.1. Exact-width integer types */
  
! #if !(defined(__FreeBSD__) || defined(__OpenBSD__))
  
! #ifdef _STDINT_H_NEED_SIGNED_INT_TYPES
  typedef signed char    int8_t;
  #endif
  typedef unsigned char  uint8_t;
  
! #ifdef _STDINT_H_NEED_SIGNED_INT_TYPES
  typedef short          int16_t;
  #endif
  typedef unsigned short uint16_t;
  
! #ifdef _STDINT_H_NEED_SIGNED_INT_TYPES
  typedef int            int32_t;
  #endif
  typedef unsigned int   uint32_t;
  
! #if @HAVE_LONG_64BIT@
! #ifdef _STDINT_H_NEED_SIGNED_INT_TYPES
  typedef long           int64_t;
  #endif
! typedef unsigned long  uint64_t;
! #define _STDINT_H_HAVE_INT64
! #elif @HAVE_LONG_LONG_64BIT@
! #ifdef _STDINT_H_NEED_SIGNED_INT_TYPES
! typedef long long          int64_t;
! #endif
  typedef unsigned long long uint64_t;
! #define _STDINT_H_HAVE_INT64
! #elif defined(_MSC_VER)
! typedef __int64          int64_t;
! typedef unsigned __int64 uint64_t;
! #define _STDINT_H_HAVE_INT64
  #endif
  
- #endif /* !(FreeBSD || OpenBSD) */
- 
  /* 7.18.1.2. Minimum-width integer types */
  
  typedef int8_t   int_least8_t;
  typedef uint8_t  uint_least8_t;
  typedef int16_t  int_least16_t;
  typedef uint16_t uint_least16_t;
  typedef int32_t  int_least32_t;
  typedef uint32_t uint_least32_t;
! #ifdef _STDINT_H_HAVE_INT64
  typedef int64_t  int_least64_t;
  typedef uint64_t uint_least64_t;
  #endif
  
  /* 7.18.1.3. Fastest minimum-width integer types */
  
  typedef int32_t  int_fast8_t;
  typedef uint32_t uint_fast8_t;
  typedef int32_t  int_fast16_t;
  typedef uint32_t uint_fast16_t;
  typedef int32_t  int_fast32_t;
  typedef uint32_t uint_fast32_t;
! #ifdef _STDINT_H_HAVE_INT64
  typedef int64_t  int_fast64_t;
  typedef uint64_t uint_fast64_t;
  #endif
  
  /* 7.18.1.4. Integer types capable of holding object pointers */
  
- #if !(defined(__FreeBSD__) || (defined(__OpenBSD__) && HAVE_INTTYPES_H))
- 
  /* On some platforms (like IRIX6 MIPS with -n32) sizeof(void*) < sizeof(long),
     but this doesn't matter here.  */
  typedef long          intptr_t;
  typedef unsigned long uintptr_t;
! 
! #endif /* !(FreeBSD || (OpenBSD && HAVE_INTTYPES_H)) */
  
  /* 7.18.1.5. Greatest-width integer types */
  
! #ifdef _STDINT_H_HAVE_INT64
! # ifndef intmax_t
  typedef int64_t  intmax_t;
! # endif
! # ifndef uintmax_t
! typedef uint64_t uintmax_t;
! # endif
! #else
! # ifndef intmax_t
  typedef int32_t  intmax_t;
  # endif
! # ifndef uintmax_t
  typedef uint32_t uintmax_t;
  # endif
  #endif
--- 50,249 ----
  # include <sys/bitypes.h>
  #endif
  #if defined(__sun) && HAVE_SYS_INTTYPES_H
    /* 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>.  */
! # include FULL_PATH_STDINT_H
  #endif
  
  /* 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 !HAVE_INT8_T
  typedef signed char    int8_t;
  #endif
+ #if !HAVE_UINT8_T
  typedef unsigned char  uint8_t;
+ #endif
  
! #if !HAVE_INT16_T
  typedef short          int16_t;
  #endif
+ #if !HAVE_UINT16_T
  typedef unsigned short uint16_t;
+ #endif
  
! #if !HAVE_INT32_T
  typedef int            int32_t;
  #endif
+ #if !HAVE_UINT32_T
  typedef unsigned int   uint32_t;
+ #endif
  
! #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 _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 */
  
+ /* Here we assume a standard architecture where the hardware integer
+    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
  typedef int8_t   int_least8_t;
+ #endif
+ #if !HAVE_UINT_LEAST8_T
  typedef uint8_t  uint_least8_t;
+ #endif
+ 
+ #if !HAVE_INT_LEAST16_T
  typedef int16_t  int_least16_t;
+ #endif
+ #if !HAVE_UINT_LEAST16_T
  typedef uint16_t uint_least16_t;
+ #endif
+ 
+ #if !HAVE_INT_LEAST32_T
  typedef int32_t  int_least32_t;
+ #endif
+ #if !HAVE_UINT_LEAST32_T
  typedef uint32_t uint_least32_t;
! #endif
! 
! #if !HAVE_INT_LEAST64_T && _STDINT_H_HAVE_INT64
  typedef int64_t  int_least64_t;
+ #endif
+ #if !HAVE_UINT_LEAST64_T && _STDINT_H_HAVE_UINT64
  typedef uint64_t uint_least64_t;
  #endif
  
  /* 7.18.1.3. Fastest minimum-width integer types */
  
+ /* 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 !HAVE_INT_FAST8_T
+ # if _STDINT_H_INT64_FASTER_THAN_INT32
+ typedef int64_t  int_fast8_t;
+ # else
  typedef int32_t  int_fast8_t;
+ # endif
+ #endif
+ #if !HAVE_UINT_FAST8_T
+ # if _STDINT_H_INT64_FASTER_THAN_INT32
+ typedef uint64_t uint_fast8_t;
+ # else
  typedef uint32_t uint_fast8_t;
+ # endif
+ #endif
+ 
+ #if !HAVE_INT_FAST16_T
+ # if _STDINT_H_INT64_FASTER_THAN_INT32
+ typedef int64_t  int_fast16_t;
+ # else
  typedef int32_t  int_fast16_t;
+ # endif
+ #endif
+ #if !HAVE_UINT_FAST16_T
+ # if _STDINT_H_INT64_FASTER_THAN_INT32
+ typedef uint64_t uint_fast16_t;
+ # else
  typedef uint32_t uint_fast16_t;
+ # endif
+ #endif
+ 
+ #if !HAVE_INT_FAST32_T
+ # if _STDINT_H_INT64_FASTER_THAN_INT32
+ typedef int64_t  int_fast32_t;
+ # else
  typedef int32_t  int_fast32_t;
+ # endif
+ #endif
+ #if !HAVE_UINT_FAST32_T
+ # if _STDINT_H_INT64_FASTER_THAN_INT32
+ typedef uint64_t uint_fast32_t;
+ # else
  typedef uint32_t uint_fast32_t;
! # endif
! #endif
! 
! #if !HAVE_INT_FAST64_T && _STDINT_H_HAVE_INT64
  typedef int64_t  int_fast64_t;
+ #endif
+ #if !HAVE_UINT_FAST64_T && _STDINT_H_HAVE_UINT64
  typedef uint64_t uint_fast64_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 !HAVE_INTPTR_T
  typedef long          intptr_t;
+ #endif
+ #if !HAVE_UINTPTR_T
  typedef unsigned long uintptr_t;
! #endif
  
  /* 7.18.1.5. Greatest-width integer types */
  
! #if !HAVE_INTMAX_T
! # ifdef _STDINT_H_HAVE_INT64
  typedef int64_t  intmax_t;
! # else
  typedef int32_t  intmax_t;
  # endif
! #endif
! #if !HAVE_UINTMAX_T
! # ifdef _STDINT_H_HAVE_UINT64
! typedef uint64_t uintmax_t;
! # else
  typedef uint32_t uintmax_t;
  # endif
  #endif
***************
*** 170,265 ****
  
  /* 7.18.2.1. Limits of exact-width integer types */
  
! #define INT8_MIN  -128
! #define INT8_MAX   127
! #define UINT8_MAX  255U
! #define INT16_MIN  -32768
! #define INT16_MAX   32767
! #define UINT16_MAX  65535U
! #define INT32_MIN   (~INT32_MAX)
! #define INT32_MAX   2147483647
! #define UINT32_MAX  4294967295U
! #ifdef _STDINT_H_HAVE_INT64
! #define INT64_MIN   (~INT64_MAX)
! #if @HAVE_LONG_64BIT@
! #define INT64_MAX   9223372036854775807L
! #define UINT64_MAX 18446744073709551615UL
! #elif @HAVE_LONG_LONG_64BIT@
! #define INT64_MAX   9223372036854775807LL
! #define UINT64_MAX 18446744073709551615ULL
! #elif defined(_MSC_VER)
! #define INT64_MAX   9223372036854775807i64
! #define UINT64_MAX 18446744073709551615ui64
  #endif
  #endif
  
  /* 7.18.2.2. Limits of minimum-width integer types */
  
! #define INT_LEAST8_MIN INT8_MIN
! #define INT_LEAST8_MAX INT8_MAX
! #define UINT_LEAST8_MAX UINT8_MAX
! #define INT_LEAST16_MIN INT16_MIN
! #define INT_LEAST16_MAX INT16_MAX
! #define UINT_LEAST16_MAX UINT16_MAX
! #define INT_LEAST32_MIN INT32_MIN
! #define INT_LEAST32_MAX INT32_MAX
! #define UINT_LEAST32_MAX UINT32_MAX
! #ifdef _STDINT_H_HAVE_INT64
! #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 */
  
! #define INT_FAST8_MIN INT32_MIN
! #define INT_FAST8_MAX INT32_MAX
! #define UINT_FAST8_MAX UINT32_MAX
! #define INT_FAST16_MIN INT32_MIN
! #define INT_FAST16_MAX INT32_MAX
! #define UINT_FAST16_MAX UINT32_MAX
! #define INT_FAST32_MIN INT32_MIN
! #define INT_FAST32_MAX INT32_MAX
! #define UINT_FAST32_MAX UINT32_MAX
! #ifdef _STDINT_H_HAVE_INT64
! #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 */
  
! #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 */
  
! #ifdef _STDINT_H_HAVE_INT64
! #define INTMAX_MIN INT64_MIN
! #define INTMAX_MAX INT64_MAX
! #define UINTMAX_MAX UINT64_MAX
! #else
! #define INTMAX_MIN INT32_MIN
! #define INTMAX_MAX INT32_MAX
! #define UINTMAX_MAX UINT32_MAX
  #endif
  
  /* 7.18.3. Limits of other integer types */
  
! #define PTRDIFF_MIN (~(ptrdiff_t)0 << (sizeof(ptrdiff_t)*CHAR_BIT-1))
! #define PTRDIFF_MAX (~PTRDIFF_MIN)
  
! /* This may be wrong...  */
! #define SIG_ATOMIC_MIN 0
! #define SIG_ATOMIC_MAX 127
  
  #ifndef SIZE_MAX /* SIZE_MAX may also be defined in config.h. */
! # define SIZE_MAX ((size_t)~(size_t)0)
  #endif
  
! /* wchar_t limits already defined in <stddef.h>.  */
! /* wint_t limits already defined in <wchar.h>.  */
  
  #endif
  
--- 254,804 ----
  
  /* 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 << (SIZEOF_INT8_T * CHAR_BIT - 1))
! # endif
! #else
! # define INT8_MIN  -128
! #endif
! #if HAVE_INT8_T
! # ifndef INT8_MAX
! #  define INT8_MAX  (~ (-1 << (SIZEOF_INT8_T * CHAR_BIT - 1)))
! # endif
! #else
! # define INT8_MAX  127
  #endif
+ #if HAVE_UINT8_T
+ # ifndef UINT8_MAX
+ #  define UINT8_MAX  (((1U << (SIZEOF_UINT8_T * CHAR_BIT - 2)) - 1) * 2 + 1)
+ # endif
+ #else
+ # define UINT8_MAX  255U
+ #endif
+ 
+ #if HAVE_INT16_T
+ # ifndef INT16_MIN
+ #  define INT16_MIN  (-1 << (SIZEOF_INT16_T * CHAR_BIT - 1))
+ # endif
+ #else
+ # define INT16_MIN  -32768
+ #endif
+ #if HAVE_INT16_T
+ # ifndef INT16_MAX
+ #  define INT16_MAX  (~ (-1 << (SIZEOF_INT16_T * CHAR_BIT - 1)))
+ # endif
+ #else
+ # define INT16_MAX  32767
+ #endif
+ #if HAVE_UINT16_T
+ # ifndef UINT16_MAX
+ #  define UINT16_MAX  (((1U << (SIZEOF_UINT16_T * CHAR_BIT - 2)) - 1) * 2 + 1)
+ # endif
+ #else
+ # define UINT16_MAX  65535U
+ #endif
+ 
+ #if HAVE_INT32_T
+ # ifndef INT32_MIN
+ #  define INT32_MIN  (-1 << (SIZEOF_INT32_T * CHAR_BIT - 1))
+ # endif
+ #else
+ # define INT32_MIN  (~INT32_MAX)
+ #endif
+ #if HAVE_INT32_T
+ # ifndef INT32_MAX
+ #  define INT32_MAX  (~ (-1 << (SIZEOF_INT32_T * CHAR_BIT - 1)))
+ # endif
+ #else
+ # define INT32_MAX  2147483647
+ #endif
+ #if HAVE_UINT32_T
+ # ifndef UINT32_MAX
+ #  define UINT32_MAX  (((1U << (SIZEOF_UINT32_T * CHAR_BIT - 2)) - 1) * 2 + 1)
+ # endif
+ #else
+ # define UINT32_MAX  4294967295U
+ #endif
+ 
+ #if HAVE_INT64_T
+ # ifndef INT64_MIN
+ #  if @HAVE_LONG_64BIT@
+ #   define INT64_MIN  (-1L << (SIZEOF_INT64_T * CHAR_BIT - 1))
+ #  elif @HAVE_LONG_LONG_64BIT@
+ #   define INT64_MIN  (-1LL << (SIZEOF_INT64_T * CHAR_BIT - 1))
+ #  elif defined _MSC_VER
+ #   define INT64_MIN  (-1i64 << (SIZEOF_INT64_T * CHAR_BIT - 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 << (SIZEOF_INT64_T * CHAR_BIT - 1)))
+ #  elif @HAVE_LONG_LONG_64BIT@
+ #   define INT64_MAX  (~ (-1LL << (SIZEOF_INT64_T * CHAR_BIT - 1)))
+ #  elif defined _MSC_VER
+ #   define INT64_MAX  (~ (-1i64 << (SIZEOF_INT64_T * CHAR_BIT - 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 << (SIZEOF_UINT64_T * CHAR_BIT - 2)) - 1) * 2 + 
1)
+ #  elif @HAVE_LONG_LONG_64BIT@
+ #   define UINT64_MAX  (((1ULL << (SIZEOF_UINT64_T * CHAR_BIT - 2)) - 1) * 2 
+ 1)
+ #  elif defined _MSC_VER
+ #   define UINT64_MAX  (((1ui64 << (SIZEOF_UINT64_T * CHAR_BIT - 2)) - 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
  #endif
  
  /* 7.18.2.2. Limits of minimum-width integer types */
  
! /* Here we assume a standard architecture where the hardware integer
!    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 << (SIZEOF_INT_LEAST8_T * CHAR_BIT - 1))
! # endif
! #else
! # define INT_LEAST8_MIN  INT8_MIN
! #endif
! #if HAVE_INT_LEAST8_T
! # ifndef INT_LEAST8_MAX
! #  define INT_LEAST8_MAX  (~ (-1 << (SIZEOF_INT_LEAST8_T * CHAR_BIT - 1)))
! # endif
! #else
! # define INT_LEAST8_MAX  INT8_MAX
! #endif
! #if HAVE_UINT_LEAST8_T
! # ifndef UINT_LEAST8_MAX
! #  define UINT_LEAST8_MAX  (((1U << (SIZEOF_UINT_LEAST8_T * CHAR_BIT - 2)) - 
1) * 2 + 1)
! # endif
! #else
! # define UINT_LEAST8_MAX  UINT8_MAX
! #endif
! 
! #if HAVE_INT_LEAST16_T
! # ifndef INT_LEAST16_MIN
! #  define INT_LEAST16_MIN  (-1 << (SIZEOF_INT_LEAST16_T * CHAR_BIT - 1))
! # endif
! #else
! # define INT_LEAST16_MIN  INT16_MIN
! #endif
! #if HAVE_INT_LEAST16_T
! # ifndef INT_LEAST16_MAX
! #  define INT_LEAST16_MAX  (~ (-1 << (SIZEOF_INT_LEAST16_T * CHAR_BIT - 1)))
! # endif
! #else
! # define INT_LEAST16_MAX  INT16_MAX
! #endif
! #if HAVE_UINT_LEAST16_T
! # ifndef UINT_LEAST16_MAX
! #  define UINT_LEAST16_MAX  (((1U << (SIZEOF_UINT_LEAST16_T * CHAR_BIT - 2)) 
- 1) * 2 + 1)
! # endif
! #else
! # define UINT_LEAST16_MAX  UINT16_MAX
! #endif
! 
! #if HAVE_INT_LEAST32_T
! # ifndef INT_LEAST32_MIN
! #  define INT_LEAST32_MIN  (-1 << (SIZEOF_INT_LEAST32_T * CHAR_BIT - 1))
! # endif
! #else
! # define INT_LEAST32_MIN  INT32_MIN
! #endif
! #if HAVE_INT_LEAST32_T
! # ifndef INT_LEAST32_MAX
! #  define INT_LEAST32_MAX  (~ (-1 << (SIZEOF_INT_LEAST32_T * CHAR_BIT - 1)))
! # endif
! #else
! # define INT_LEAST32_MAX  INT32_MAX
! #endif
! #if HAVE_UINT_LEAST32_T
! # ifndef UINT_LEAST32_MAX
! #  define UINT_LEAST32_MAX  (((1U << (SIZEOF_UINT_LEAST32_T * CHAR_BIT - 2)) 
- 1) * 2 + 1)
! # 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 << (SIZEOF_INT_LEAST64_T * CHAR_BIT - 1))
! #  elif @HAVE_LONG_LONG_64BIT@
! #   define INT_LEAST64_MIN  (-1LL << (SIZEOF_INT_LEAST64_T * CHAR_BIT - 1))
! #  elif defined _MSC_VER
! #   define INT_LEAST64_MIN  (-1i64 << (SIZEOF_INT_LEAST64_T * CHAR_BIT - 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 << (SIZEOF_INT_LEAST64_T * CHAR_BIT - 1)))
! #  elif @HAVE_LONG_LONG_64BIT@
! #   define INT_LEAST64_MAX  (~ (-1LL << (SIZEOF_INT_LEAST64_T * CHAR_BIT - 
1)))
! #  elif defined _MSC_VER
! #   define INT_LEAST64_MAX  (~ (-1i64 << (SIZEOF_INT_LEAST64_T * CHAR_BIT - 
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 << (SIZEOF_UINT_LEAST64_T * CHAR_BIT - 
2)) - 1) * 2 + 1)
! #  elif @HAVE_LONG_LONG_64BIT@
! #   define UINT_LEAST64_MAX  (((1ULL << (SIZEOF_UINT_LEAST64_T * CHAR_BIT - 
2)) - 1) * 2 + 1)
! #  elif defined _MSC_VER
! #   define UINT_LEAST64_MAX  (((1ui64 << (SIZEOF_UINT_LEAST64_T * CHAR_BIT - 
2)) - 1) * 2 + 1)
! #  endif
! # endif
! #else
! # ifdef _STDINT_H_HAVE_UINT64
! #  define UINT_LEAST64_MAX  UINT64_MAX
! # endif
  #endif
  
  /* 7.18.2.3. Limits of fastest minimum-width integer types */
  
! /* 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.  */
! 
! #if HAVE_INT_FAST8_T
! # ifndef INT_FAST8_MIN
! #  define INT_FAST8_MIN  (-1L << (SIZEOF_INT_FAST8_T * CHAR_BIT - 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 << (SIZEOF_INT_FAST8_T * CHAR_BIT - 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
! #  define UINT_FAST8_MAX  (((1UL << (SIZEOF_UINT_FAST8_T * CHAR_BIT - 2)) - 
1) * 2 + 1)
! # 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 << (SIZEOF_INT_FAST16_T * CHAR_BIT - 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 << (SIZEOF_INT_FAST16_T * CHAR_BIT - 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
! #  define UINT_FAST16_MAX  (((1UL << (SIZEOF_UINT_FAST16_T * CHAR_BIT - 2)) - 
1) * 2 + 1)
! # 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 << (SIZEOF_INT_FAST32_T * CHAR_BIT - 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 << (SIZEOF_INT_FAST32_T * CHAR_BIT - 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
! #  define UINT_FAST32_MAX  (((1UL << (SIZEOF_UINT_FAST32_T * CHAR_BIT - 2)) - 
1) * 2 + 1)
! # 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 << (SIZEOF_INT_FAST64_T * CHAR_BIT - 1))
! #  elif @HAVE_LONG_LONG_64BIT@
! #   define INT_FAST64_MIN  (-1LL << (SIZEOF_INT_FAST64_T * CHAR_BIT - 1))
! #  elif defined _MSC_VER
! #   define INT_FAST64_MIN  (-1i64 << (SIZEOF_INT_FAST64_T * CHAR_BIT - 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 << (SIZEOF_INT_FAST64_T * CHAR_BIT - 1)))
! #  elif @HAVE_LONG_LONG_64BIT@
! #   define INT_FAST64_MAX  (~ (-1LL << (SIZEOF_INT_FAST64_T * CHAR_BIT - 1)))
! #  elif defined _MSC_VER
! #   define INT_FAST64_MAX  (~ (-1i64 << (SIZEOF_INT_FAST64_T * CHAR_BIT - 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 << (SIZEOF_UINT_FAST64_T * CHAR_BIT - 2)) 
- 1) * 2 + 1)
! #  elif @HAVE_LONG_LONG_64BIT@
! #   define UINT_FAST64_MAX  (((1ULL << (SIZEOF_UINT_FAST64_T * CHAR_BIT - 2)) 
- 1) * 2 + 1)
! #  elif defined _MSC_VER
! #   define UINT_FAST64_MAX  (((1ui64 << (SIZEOF_UINT_FAST64_T * CHAR_BIT - 
2)) - 1) * 2 + 1)
! #  endif
! # endif
! #else
! # ifdef _STDINT_H_HAVE_UINT64
! #  define UINT_FAST64_MAX  UINT64_MAX
! # endif
  #endif
  
  /* 7.18.2.4. Limits of integer types capable of holding object pointers */
  
! #if HAVE_INTPTR_T
! # ifndef INTPTR_MIN
! #  if SIZEOF_INTPTR_T > SIZEOF_LONG
! #   define INTPTR_MIN  (-1LL << (SIZEOF_INTPTR_T * CHAR_BIT - 1))
! #  else
! #   define INTPTR_MIN  (-1L << (SIZEOF_INTPTR_T * CHAR_BIT - 1))
! #  endif
! # endif
! #else
! # define INTPTR_MIN  LONG_MIN
! #endif
! #if HAVE_INTPTR_T
! # ifndef INTPTR_MAX
! #  if SIZEOF_INTPTR_T > SIZEOF_LONG
! #   define INTPTR_MAX  (~ (-1LL << (SIZEOF_INTPTR_T * CHAR_BIT - 1)))
! #  else
! #   define INTPTR_MAX  (~ (-1L << (SIZEOF_INTPTR_T * CHAR_BIT - 1)))
! #  endif
! # endif
! #else
! # define INTPTR_MAX  LONG_MAX
! #endif
! #if HAVE_UINTPTR_T
! # ifndef UINTPTR_MAX
! #  if SIZEOF_UINTPTR_T > SIZEOF_UNSIGNED_LONG
! #   define UINTPTR_MAX  (((1ULL << (SIZEOF_UINTPTR_T * CHAR_BIT - 2)) - 1) * 
2 + 1)
! #  else
! #   define UINTPTR_MAX  (((1UL << (SIZEOF_UINTPTR_T * CHAR_BIT - 2)) - 1) * 2 
+ 1)
! #  endif
! # endif
! #else
! # define UINTPTR_MAX  ULONG_MAX
! #endif
  
  /* 7.18.2.5. Limits of greatest-width integer types */
  
! #if HAVE_INTMAX_T
! # ifndef INTMAX_MIN
! #  if SIZEOF_INTMAX_T > SIZEOF_LONG
! #   define INTMAX_MIN  (-1LL << (SIZEOF_INTMAX_T * CHAR_BIT - 1))
! #  else
! #   define INTMAX_MIN  (-1L << (SIZEOF_INTMAX_T * CHAR_BIT - 1))
! #  endif
! # endif
! #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 SIZEOF_INTMAX_T > SIZEOF_LONG
! #   define INTMAX_MAX  (~ (-1LL << (SIZEOF_INTMAX_T * CHAR_BIT - 1)))
! #  else
! #   define INTMAX_MAX  (~ (-1L << (SIZEOF_INTMAX_T * CHAR_BIT - 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 SIZEOF_UINTMAX_T > SIZEOF_UNSIGNED_LONG
! #   define UINTMAX_MAX  (((1ULL << (SIZEOF_UINTMAX_T * CHAR_BIT - 2)) - 1) * 
2 + 1)
! #  else
! #   define UINTMAX_MAX  (((1UL << (SIZEOF_UINTMAX_T * CHAR_BIT - 2)) - 1) * 2 
+ 1)
! #  endif
! # endif
! #else
! # ifdef _STDINT_H_HAVE_INT64
! #  define UINTMAX_MAX  UINT64_MAX
! # else
! #  define UINTMAX_MAX  UINT32_MAX
! # endif
  #endif
  
  /* 7.18.3. Limits of other integer types */
  
! /* ptrdiff_t limits */
! #ifndef PTRDIFF_MIN
! # define PTRDIFF_MIN  (-1L << (SIZEOF_PTRDIFF_T * CHAR_BIT - 1))
! #endif
! #ifndef PTRDIFF_MAX
! # define PTRDIFF_MAX  (~ (-1L << (SIZEOF_PTRDIFF_T * CHAR_BIT - 1)))
! #endif
  
! /* sig_atomic_t limits */
! #ifndef SIG_ATOMIC_MIN
! # if HAVE_SIGNED_SIG_ATOMIC_T
! #  define SIG_ATOMIC_MIN  (-1L << (SIZEOF_SIG_ATOMIC_T * CHAR_BIT - 1))
! # else
! #  define SIG_ATOMIC_MIN  0
! # endif
! #endif
! #ifndef SIG_ATOMIC_MAX
! # if HAVE_SIGNED_SIG_ATOMIC_T
! #  define SIG_ATOMIC_MAX  (~ (-1L << (SIZEOF_SIG_ATOMIC_T * CHAR_BIT - 1)))
! # else
! #  define SIG_ATOMIC_MAX  (((1UL << (SIZEOF_SIG_ATOMIC_T * CHAR_BIT - 2)) - 
1) * 2 + 1)
! # endif
! #endif
  
+ /* size_t limit */
  #ifndef SIZE_MAX /* SIZE_MAX may also be defined in config.h. */
! # define SIZE_MAX  (((1UL << (SIZEOF_SIZE_T * CHAR_BIT - 2)) - 1) * 2 + 1)
  #endif
  
! /* wchar_t limits may already be defined in <stddef.h>.  */
! #ifndef WCHAR_MIN
! # if HAVE_SIGNED_WCHAR_T
! #  define WCHAR_MIN  (-1L << (SIZEOF_WCHAR_T * CHAR_BIT - 1))
! # else
! #  define WCHAR_MIN  0
! # endif
! #endif
! #ifndef WCHAR_MAX
! # if HAVE_SIGNED_WCHAR_T
! #  define WCHAR_MAX  (~ (-1L << (SIZEOF_WCHAR_T * CHAR_BIT - 1)))
! # else
! #  define WCHAR_MAX  (((1UL << (SIZEOF_WCHAR_T * CHAR_BIT - 2)) - 1) * 2 + 1)
! # endif
! #endif
! 
! /* wint_t limits */
! #ifndef WINT_MIN
! # if HAVE_SIGNED_WINT_T
! #  define WINT_MIN  (-1L << (SIZEOF_WINT_T * CHAR_BIT - 1))
! # else
! #  define WINT_MIN  0
! # endif
! #endif
! #ifndef WINT_MAX
! # if HAVE_SIGNED_WINT_T
! #  define WINT_MAX  (~ (-1L << (SIZEOF_WINT_T * CHAR_BIT - 1)))
! # else
! #  define WINT_MAX  (((1UL << (SIZEOF_WINT_T * CHAR_BIT - 2)) - 1) * 2 + 1)
! # endif
! #endif
  
  #endif
  
***************
*** 269,309 ****
  
  /* 7.18.4.1. Macros for minimum-width integer constants */
  
  #define INT8_C(x) x
  #define UINT8_C(x) x##U
  #define INT16_C(x) x
  #define UINT16_C(x) x##U
  #define INT32_C(x) x
  #define UINT32_C(x) x##U
  #if @HAVE_LONG_64BIT@
! #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)
! #define INT64_C(x) x##i64
! #define UINT64_C(x) x##ui64
  #endif
  
  /* 7.18.4.2. Macros for greatest-width integer constants */
  
  #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
  #else
! #define INTMAX_C(x) x
! #define UINTMAX_C(x) x##U
  #endif
  
  #endif
  
- #endif  /* !_STDINT_H_HAVE_SYSTEM_INTTYPES */
- 
  #endif /* _STDINT_H */
--- 808,859 ----
  
  /* 7.18.4.1. Macros for minimum-width integer constants */
  
+ #undef INT8_C
+ #undef UINT8_C
  #define INT8_C(x) x
  #define UINT8_C(x) x##U
+ 
+ #undef INT16_C
+ #undef UINT16_C
  #define INT16_C(x) x
  #define UINT16_C(x) x##U
+ 
+ #undef INT32_C
+ #undef UINT32_C
  #define INT32_C(x) x
  #define UINT32_C(x) x##U
+ 
+ #undef INT64_C
+ #undef UINT64_C
  #if @HAVE_LONG_64BIT@
! # 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)
! # define INT64_C(x) x##i64
! # define UINT64_C(x) x##ui64
  #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
  #else
! # define INTMAX_C(x) x
! # define UINTMAX_C(x) x##U
  #endif
  
  #endif
  
  #endif /* _STDINT_H */
Index: m4/stdint.m4
===================================================================
RCS file: /sources/gnulib/gnulib/m4/stdint.m4,v
retrieving revision 1.4
diff -c -3 -r1.4 stdint.m4
*** m4/stdint.m4        9 Jan 2006 13:20:01 -0000       1.4
--- m4/stdint.m4        13 Jun 2006 15:45:00 -0000
***************
*** 1,5 ****
! # stdint.m4 serial 5
! dnl Copyright (C) 2001-2002, 2004-2005 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.
--- 1,5 ----
! # stdint.m4 serial 6
! dnl Copyright (C) 2001-2002, 2004-2006 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
  dnl with or without modifications, as long as this notice is preserved.
***************
*** 8,31 ****
  dnl Test whether <stdint.h> is supported or must be substituted.
  
  AC_DEFUN([gl_STDINT_H],
! [dnl Check for <inttypes.h>.
! AC_REQUIRE([gt_HEADER_INTTYPES_H])
! dnl Check for <sys/inttypes.h>.
! AC_CHECK_HEADERS([sys/inttypes.h])
! dnl Check for <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
! AC_CHECK_HEADERS([sys/bitypes.h])
! 
! AC_MSG_CHECKING([for stdint.h])
! AC_CACHE_VAL(gl_cv_header_stdint_h, [
!   AC_TRY_COMPILE([#include <stdint.h>], [],
!     gl_cv_header_stdint_h=yes, gl_cv_header_stdint_h=no)])
! AC_MSG_RESULT([$gl_cv_header_stdint_h])
! if test $gl_cv_header_stdint_h = yes; then
!   AC_DEFINE(HAVE_STDINT_H, 1,
!             [Define if you have a working <stdint.h> header file.])
!   STDINT_H=''
! else
!   STDINT_H='stdint.h'
  
    dnl Is long == int64_t ?
    AC_CACHE_CHECK([whether 'long' is 64 bit wide], gl_cv_long_bitsize_64, [
--- 8,48 ----
  dnl Test whether <stdint.h> is supported or must be substituted.
  
  AC_DEFUN([gl_STDINT_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>.])
!     ac_cv_header_inttypes_h=yes; dnl Hack for gl_FULL_HEADER_PATH.
!     gl_FULL_HEADER_PATH([inttypes.h])
!   fi
! 
!   dnl Check for <sys/inttypes.h>.
!   AC_CHECK_HEADERS([sys/inttypes.h])
! 
!   dnl Check for <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
!   AC_CHECK_HEADERS([sys/bitypes.h])
! 
!   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>.])
!     ac_cv_header_stdint_h=yes; dnl Hack for gl_FULL_HEADER_PATH.
!     gl_FULL_HEADER_PATH([stdint.h])
!   fi
  
    dnl Is long == int64_t ?
    AC_CACHE_CHECK([whether 'long' is 64 bit wide], gl_cv_long_bitsize_64, [
***************
*** 55,60 ****
    fi
    AC_SUBST(HAVE_LONG_LONG_64BIT)
  
! fi
! AC_SUBST(STDINT_H)
  ])
--- 72,1107 ----
    fi
    AC_SUBST(HAVE_LONG_LONG_64BIT)
  
!   dnl Here we use FULL_PATH_INTTYPES_H and FULL_PATH_STDINT_H, not just
!   dnl <inttypes.h> and <stdint.h>, so that it also works during a
!   dnl "config.status --recheck" if an inttypes.h or stdint.h have been
!   dnl created in the build directory.
!   other_includes='
! /* Get those types that are already defined in other system include files.  */
! #if defined(__FreeBSD__)
! # include <sys/inttypes.h>
! #endif
! #if defined(__OpenBSD__)
! # 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
! # include FULL_PATH_STDINT_H
! #endif
! '
! 
!   AC_FOREACH([gltype],
!              [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], [
!     AC_MSG_CHECKING([for gltype])
!     AC_COMPILE_IFELSE([
!       AC_LANG_PROGRAM([$other_includes
! /* Test if the type exists.  */
! gltype x = 17;
!       ])],
!       result=yes, result=no)
!     gl_cv_type_[]gltype=$result
!     AC_MSG_RESULT($result)
!     if test $result = yes; then
!       
AC_DEFINE_UNQUOTED([HAVE_]translit(gltype,[aefilmnprstux],[AEFILMNPRSTUX]), 1,
!         [Define to 1 if the type 'gltype' is already defined.])
!     fi
!   ])
! 
!   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
!     AC_FOREACH([gltype],
!                [int64_t uint64_t
!                 int_least64_t uint_least64_t
!                 int_fast64_t uint_fast64_t], [
!       AC_COMPILE_IFELSE([
!         AC_LANG_PROGRAM([#include <stdint.h>
! /* Test if the type exists.  */
! gltype x = 17;
!         ])],
!         result=yes, result=no)
!       gl_cv_stdint_[]gltype=$result
!       if test $result = yes; then
!         
AC_DEFINE_UNQUOTED([HAVE_]translit(gltype,[aefilmnprstux],[AEFILMNPRSTUX])[_IN_STDINT_H],
 1,
!           [Define to 1 if the type '$type' is already defined in <stdint.h>.])
!       fi
!     ])
!     AC_COMPILE_IFELSE([
!       AC_LANG_PROGRAM([
! #define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
! #include <stdint.h>
! int8_t a1 = INT8_C (17);
! int16_t a2 = INT16_C (17);
! int32_t a3 = INT32_C (17);
! #if HAVE_INT64_T_IN_STDINT_H
! int64_t a4 = INT64_C (17);
! #endif
! uint8_t b1 = UINT8_C (17);
! uint16_t b2 = UINT16_C (17);
! uint32_t b3 = UINT32_C (17);
! #if HAVE_UINT64_T_IN_STDINT_H
! uint64_t b4 = UINT64_C (17);
! #endif
! int_least8_t c1 = 17;
! int_least16_t c2 = 17;
! int_least32_t c3 = 17;
! #if HAVE_INT_LEAST64_T_IN_STDINT_H
! int_least64_t c4 = 17;
! #endif
! uint_least8_t d1 = 17;
! uint_least16_t d2 = 17;
! uint_least32_t d3 = 17;
! #if HAVE_UINT_LEAST64_T_IN_STDINT_H
! uint_least64_t d4 = 17;
! #endif
! int_fast8_t e1 = 17;
! int_fast16_t e2 = 17;
! int_fast32_t e3 = 17;
! #if HAVE_INT_FAST64_T_IN_STDINT_H
! int_fast64_t e4 = 17;
! #endif
! uint_fast8_t f1 = 17;
! uint_fast16_t f2 = 17;
! uint_fast32_t f3 = 17;
! #if HAVE_UINT_FAST64_T_IN_STDINT_H
! uint_fast64_t f4 = 17;
! #endif
! intptr_t g = 17;
! uintptr_t h = 17;
! intmax_t i = INTMAX_C (17);
! uintmax_t j = UINTMAX_C (17);
!       ])],
!       [gl_cv_header_working_stdint_h=yes])
!   fi
!   if test $gl_cv_header_working_stdint_h = yes; then
!     dnl Use the existing <stdint.h>, adding missing macro definitions.
!     suff64=
!     suffu64=
!     if test $HAVE_LONG_64BIT = 1; then
!       suff64=L
!       suffu64=UL
!     else
!       if test $HAVE_LONG_LONG_64BIT = 1; then
!         suff64=LL
!         suffu64=ULL
!       else
!         AC_EGREP_CPP([msvc compiler], [
! #ifdef _MSC_VER
! msvc compiler
! #endif
!           ], [
!           suff64=i64
!           suffu64=ui64
!         ])
!       fi
!     fi
!     dnl Here we assume a standard architecture where the hardware integer
!     dnl types have 8, 16, 32, optionally 64 bits.
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT8_MIN
! found it
! #endif
!       ], ,
!       [AC_DEFINE([INT8_MIN], [-128],
!          [Define if <stdint.h> doesn't define it.])])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT8_MAX
! found it
! #endif
!       ], ,
!       [AC_DEFINE([INT8_MAX], [127],
!          [Define if <stdint.h> doesn't define it.])])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef UINT8_MAX
! found it
! #endif
!       ], ,
!       [AC_DEFINE([UINT8_MAX], [255U],
!          [Define if <stdint.h> doesn't define it.])])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT16_MIN
! found it
! #endif
!       ], ,
!       [AC_DEFINE([INT16_MIN], [-32768],
!          [Define if <stdint.h> doesn't define it.])])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT16_MAX
! found it
! #endif
!       ], ,
!       [AC_DEFINE([INT16_MAX], [32767],
!          [Define if <stdint.h> doesn't define it.])])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef UINT16_MAX
! found it
! #endif
!       ], ,
!       [AC_DEFINE([UINT16_MAX], [65535U],
!          [Define if <stdint.h> doesn't define it.])])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT32_MIN
! found it
! #endif
!       ], ,
!       [AC_DEFINE([INT32_MIN], [(~INT32_MAX)],
!          [Define if <stdint.h> doesn't define it.])])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT32_MAX
! found it
! #endif
!       ], ,
!       [AC_DEFINE([INT32_MAX], [2147483647],
!          [Define if <stdint.h> doesn't define it.])])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef UINT32_MAX
! found it
! #endif
!       ], ,
!       [AC_DEFINE([UINT32_MAX], [4294967295U],
!          [Define if <stdint.h> doesn't define it.])])
!     if test $gl_cv_stdint_int64_t = yes; then
!       AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT64_MIN
! found it
! #endif
!         ], ,
!         [AC_DEFINE([INT64_MIN], [(~INT64_MAX)],
!            [Define if <stdint.h> doesn't define it but has the int64_t 
type.])])
!       AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT64_MAX
! found it
! #endif
!         ], ,
!         [AC_DEFINE([INT64_MAX], [9223372036854775807${suff64}],
!            [Define if <stdint.h> doesn't define it but has the int64_t 
type.])])
!     fi
!     if test $gl_cv_stdint_uint64_t = yes; then
!       AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef UINT64_MAX
! found it
! #endif
!         ], ,
!         [AC_DEFINE([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.
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT_LEAST8_MIN
! found it
! #endif
!       ], ,
!       [AC_DEFINE([INT_LEAST8_MIN], [INT8_MIN],
!          [Define if <stdint.h> doesn't define it.])])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT_LEAST8_MAX
! found it
! #endif
!       ], ,
!       [AC_DEFINE([INT_LEAST8_MAX], [INT8_MAX],
!          [Define if <stdint.h> doesn't define it.])])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef UINT_LEAST8_MAX
! found it
! #endif
!       ], ,
!       [AC_DEFINE([UINT_LEAST8_MAX], [UINT8_MAX],
!          [Define if <stdint.h> doesn't define it.])])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT_LEAST16_MIN
! found it
! #endif
!       ], ,
!       [AC_DEFINE([INT_LEAST16_MIN], [INT16_MIN],
!          [Define if <stdint.h> doesn't define it.])])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT_LEAST16_MAX
! found it
! #endif
!       ], ,
!       [AC_DEFINE([INT_LEAST16_MAX], [INT16_MAX],
!          [Define if <stdint.h> doesn't define it.])])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef UINT_LEAST16_MAX
! found it
! #endif
!       ], ,
!       [AC_DEFINE([UINT_LEAST16_MAX], [UINT16_MAX],
!          [Define if <stdint.h> doesn't define it.])])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT_LEAST32_MIN
! found it
! #endif
!       ], ,
!       [AC_DEFINE([INT_LEAST32_MIN], [INT32_MIN],
!          [Define if <stdint.h> doesn't define it.])])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT_LEAST32_MAX
! found it
! #endif
!       ], ,
!       [AC_DEFINE([INT_LEAST32_MAX], [INT32_MAX],
!          [Define if <stdint.h> doesn't define it.])])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef UINT_LEAST32_MAX
! found it
! #endif
!       ], ,
!       [AC_DEFINE([UINT_LEAST32_MAX], [UINT32_MAX],
!          [Define if <stdint.h> doesn't define it.])])
!     if test $gl_cv_stdint_int_least64_t = yes; then
!       AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT_LEAST64_MIN
! found it
! #endif
!         ], ,
!         [AC_DEFINE([INT_LEAST64_MIN], [INT64_MIN],
!            [Define if <stdint.h> doesn't define it but has the int64_t 
type.])])
!       AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT_LEAST64_MAX
! found it
! #endif
!         ], ,
!         [AC_DEFINE([INT_LEAST64_MAX], [INT64_MAX],
!            [Define if <stdint.h> doesn't define it but has the int64_t 
type.])])
!     fi
!     if test $gl_cv_stdint_uint_least64_t = yes; then
!       AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef UINT_LEAST64_MAX
! found it
! #endif
!         ], ,
!         [AC_DEFINE([UINT_LEAST64_MAX], [UINT64_MAX],
!            [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 fastN_t types
!     dnl are taken from the same list of types.
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT_FAST8_MIN
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stdint.h>
!          int verify[2 * (sizeof int_fast8_t == sizof int8_t) - 1];
!          ]], [result=INT8_MIN])
!        if test -z "$result"; then
!          AC_COMPILE_IFELSE([[#include <stdint.h>
!            int verify[2 * (sizeof int_fast8_t == sizof int16_t) - 1];
!            ]], [result=INT16_MIN])
!          if test -z "$result"; then
!            AC_COMPILE_IFELSE([[#include <stdint.h>
!              int verify[2 * (sizeof int_fast8_t == sizof int32_t) - 1];
!              ]], [result=INT32_MIN])
!            if test -z "$result"; then
!              AC_COMPILE_IFELSE([[#include <stdint.h>
!                int verify[2 * (sizeof int_fast8_t == sizof int64_t) - 1];
!                ]], [result=INT64_MIN])
!            fi
!          fi
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([INT_FAST8_MIN], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT_FAST8_MAX
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stdint.h>
!          int verify[2 * (sizeof int_fast8_t == sizof int8_t) - 1];
!          ]], [result=INT8_MAX])
!        if test -z "$result"; then
!          AC_COMPILE_IFELSE([[#include <stdint.h>
!            int verify[2 * (sizeof int_fast8_t == sizof int16_t) - 1];
!            ]], [result=INT16_MAX])
!          if test -z "$result"; then
!            AC_COMPILE_IFELSE([[#include <stdint.h>
!              int verify[2 * (sizeof int_fast8_t == sizof int32_t) - 1];
!              ]], [result=INT32_MAX])
!            if test -z "$result"; then
!              AC_COMPILE_IFELSE([[#include <stdint.h>
!                int verify[2 * (sizeof int_fast8_t == sizof int64_t) - 1];
!                ]], [result=INT64_MAX])
!            fi
!          fi
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([INT_FAST8_MAX], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef UINT_FAST8_MAX
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stdint.h>
!          int verify[2 * (sizeof uint_fast8_t == sizof uint8_t) - 1];
!          ]], [result=UINT8_MAX])
!        if test -z "$result"; then
!          AC_COMPILE_IFELSE([[#include <stdint.h>
!            int verify[2 * (sizeof uint_fast8_t == sizof uint16_t) - 1];
!            ]], [result=UINT16_MAX])
!          if test -z "$result"; then
!            AC_COMPILE_IFELSE([[#include <stdint.h>
!              int verify[2 * (sizeof uint_fast8_t == sizof uint32_t) - 1];
!              ]], [result=UINT32_MAX])
!            if test -z "$result"; then
!              AC_COMPILE_IFELSE([[#include <stdint.h>
!                int verify[2 * (sizeof uint_fast8_t == sizof uint64_t) - 1];
!                ]], [result=UINT64_MAX])
!            fi
!          fi
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([UINT_FAST8_MAX], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT_FAST16_MIN
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stdint.h>
!          int verify[2 * (sizeof int_fast16_t == sizof int16_t) - 1];
!          ]], [result=INT16_MIN])
!        if test -z "$result"; then
!          AC_COMPILE_IFELSE([[#include <stdint.h>
!            int verify[2 * (sizeof int_fast16_t == sizof int32_t) - 1];
!            ]], [result=INT32_MIN])
!          if test -z "$result"; then
!            AC_COMPILE_IFELSE([[#include <stdint.h>
!              int verify[2 * (sizeof int_fast16_t == sizof int64_t) - 1];
!              ]], [result=INT64_MIN])
!          fi
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([INT_FAST16_MIN], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT_FAST16_MAX
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stdint.h>
!          int verify[2 * (sizeof int_fast16_t == sizof int16_t) - 1];
!          ]], [result=INT16_MAX])
!        if test -z "$result"; then
!          AC_COMPILE_IFELSE([[#include <stdint.h>
!            int verify[2 * (sizeof int_fast16_t == sizof int32_t) - 1];
!            ]], [result=INT32_MAX])
!          if test -z "$result"; then
!            AC_COMPILE_IFELSE([[#include <stdint.h>
!              int verify[2 * (sizeof int_fast16_t == sizof int64_t) - 1];
!              ]], [result=INT64_MAX])
!          fi
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([INT_FAST16_MAX], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef UINT_FAST16_MAX
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stdint.h>
!          int verify[2 * (sizeof uint_fast16_t == sizof uint16_t) - 1];
!          ]], [result=UINT16_MAX])
!        if test -z "$result"; then
!          AC_COMPILE_IFELSE([[#include <stdint.h>
!            int verify[2 * (sizeof uint_fast16_t == sizof uint32_t) - 1];
!            ]], [result=UINT32_MAX])
!          if test -z "$result"; then
!            AC_COMPILE_IFELSE([[#include <stdint.h>
!              int verify[2 * (sizeof uint_fast16_t == sizof uint64_t) - 1];
!              ]], [result=UINT64_MAX])
!          fi
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([UINT_FAST16_MAX], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT_FAST32_MIN
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stdint.h>
!          int verify[2 * (sizeof int_fast32_t == sizof int32_t) - 1];
!          ]], [result=INT32_MIN])
!        if test -z "$result"; then
!          AC_COMPILE_IFELSE([[#include <stdint.h>
!            int verify[2 * (sizeof int_fast32_t == sizof int64_t) - 1];
!            ]], [result=INT64_MIN])
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([INT_FAST32_MIN], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT_FAST32_MAX
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stdint.h>
!          int verify[2 * (sizeof int_fast32_t == sizof int32_t) - 1];
!          ]], [result=INT32_MAX])
!        if test -z "$result"; then
!          AC_COMPILE_IFELSE([[#include <stdint.h>
!            int verify[2 * (sizeof int_fast32_t == sizof int64_t) - 1];
!            ]], [result=INT64_MAX])
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([INT_FAST32_MAX], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef UINT_FAST32_MAX
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stdint.h>
!          int verify[2 * (sizeof uint_fast32_t == sizof uint32_t) - 1];
!          ]], [result=UINT32_MAX])
!        if test -z "$result"; then
!          AC_COMPILE_IFELSE([[#include <stdint.h>
!            int verify[2 * (sizeof uint_fast32_t == sizof uint64_t) - 1];
!            ]], [result=UINT64_MAX])
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([UINT_FAST32_MAX], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     if test $gl_cv_stdint_uint_fast64_t = yes; then
!       AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT_FAST64_MIN
! found it
! #endif
!         ], ,
!         [result=
!          AC_COMPILE_IFELSE([[#include <stdint.h>
!            int verify[2 * (sizeof int_fast64_t == sizof int64_t) - 1];
!            ]], [result=INT32_MIN])
!          if test -n "$result"; then
!            AC_DEFINE_UNQUOTED([INT_FAST64_MIN], [$result],
!              [Define if <stdint.h> doesn't define it.])
!          fi
!         ])
!       AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INT_FAST64_MAX
! found it
! #endif
!         ], ,
!         [result=
!          AC_COMPILE_IFELSE([[#include <stdint.h>
!            int verify[2 * (sizeof int_fast64_t == sizof int64_t) - 1];
!            ]], [result=INT32_MAX])
!          if test -n "$result"; then
!            AC_DEFINE_UNQUOTED([INT_FAST64_MAX], [$result],
!              [Define if <stdint.h> doesn't define it.])
!          fi
!         ])
!     fi
!     if test $gl_cv_stdint_uint_fast64_t = yes; then
!       AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef UINT_FAST64_MAX
! found it
! #endif
!         ], ,
!         [result=
!          AC_COMPILE_IFELSE([[#include <stdint.h>
!            int verify[2 * (sizeof uint_fast64_t == sizof uint64_t) - 1];
!            ]], [result=UINT32_MAX])
!          if test -n "$result"; then
!            AC_DEFINE_UNQUOTED([UINT_FAST64_MAX], [$result],
!              [Define if <stdint.h> doesn't define it.])
!          fi
!         ])
!     fi
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INTPTR_MIN
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stdint.h>
!          int verify[2 * (sizeof intptr_t == sizof int32_t) - 1];
!          ]], [result=INT32_MIN])
!        if test -z "$result"; then
!          AC_COMPILE_IFELSE([[#include <stdint.h>
!            int verify[2 * (sizeof intptr_t == sizof int64_t) - 1];
!            ]], [result=INT64_MIN])
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([INTPTR_MIN], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INTPTR_MAX
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stdint.h>
!          int verify[2 * (sizeof intptr_t == sizof int32_t) - 1];
!          ]], [result=INT32_MAX])
!        if test -z "$result"; then
!          AC_COMPILE_IFELSE([[#include <stdint.h>
!            int verify[2 * (sizeof intptr_t == sizof int64_t) - 1];
!            ]], [result=INT64_MAX])
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([INTPTR_MAX], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef UINTPTR_MAX
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stdint.h>
!          int verify[2 * (sizeof uintptr_t == sizof uint32_t) - 1];
!          ]], [result=UINT32_MAX])
!        if test -z "$result"; then
!          AC_COMPILE_IFELSE([[#include <stdint.h>
!            int verify[2 * (sizeof uintptr_t == sizof uint64_t) - 1];
!            ]], [result=UINT64_MAX])
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([UINTPTR_MAX], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INTMAX_MIN
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stdint.h>
!          int verify[2 * (sizeof intmax_t == sizof int32_t) - 1];
!          ]], [result=INT32_MIN])
!        if test -z "$result"; then
!          AC_COMPILE_IFELSE([[#include <stdint.h>
!            int verify[2 * (sizeof intmax_t == sizof int64_t) - 1];
!            ]], [result=INT64_MIN])
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([INTMAX_MIN], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef INTMAX_MAX
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stdint.h>
!          int verify[2 * (sizeof intmax_t == sizof int32_t) - 1];
!          ]], [result=INT32_MAX])
!        if test -z "$result"; then
!          AC_COMPILE_IFELSE([[#include <stdint.h>
!            int verify[2 * (sizeof intmax_t == sizof int64_t) - 1];
!            ]], [result=INT64_MAX])
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([INTMAX_MAX], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef UINTMAX_MAX
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stdint.h>
!          int verify[2 * (sizeof uintmax_t == sizof uint32_t) - 1];
!          ]], [result=UINT32_MAX])
!        if test -z "$result"; then
!          AC_COMPILE_IFELSE([[#include <stdint.h>
!            int verify[2 * (sizeof uintmax_t == sizof uint64_t) - 1];
!            ]], [result=UINT64_MAX])
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([UINTMAX_MAX], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef PTRDIFF_MIN
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stddef.h>
! #include <stdint.h>
!          int verify[2 * (sizeof ptrdiff_t == sizof int32_t) - 1];
!          ]], [result=INT32_MIN])
!        if test -z "$result"; then
!          AC_COMPILE_IFELSE([[#include <stddef.h>
! #include <stdint.h>
!            int verify[2 * (sizeof ptrdiff_t == sizof int64_t) - 1];
!            ]], [result=INT64_MIN])
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([PTRDIFF_MIN], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef PTRDIFF_MAX
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stddef.h>
! #include <stdint.h>
!          int verify[2 * (sizeof ptrdiff_t == sizof int32_t) - 1];
!          ]], [result=INT32_MAX])
!        if test -z "$result"; then
!          AC_COMPILE_IFELSE([[#include <stddef.h>
! #include <stdint.h>
!            int verify[2 * (sizeof ptrdiff_t == sizof int64_t) - 1];
!            ]], [result=INT64_MAX])
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([PTRDIFF_MAX], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     gl_SIZE_MAX
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef SIG_ATOMIC_MIN
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <signal.h>
!          int verify[2 * ((sig_atomic_t) -1 >= (sig_atomic_t) 0) - 1];
!          ]], gl_cv_sig_atomic_signed=no, gl_cv_sig_atomic_signed=yes)
!        if test $gl_cv_sig_atomic_signed = yes; then
!          AC_COMPILE_IFELSE([[#include <signal.h>
! #include <stdint.h>
!            int verify[2 * (sizeof sig_atomic_t == sizof int8_t) - 1];
!            ]], [result=INT8_MIN])
!          if test -z "$result"; then
!            AC_COMPILE_IFELSE([[#include <signal.h>
! #include <stdint.h>
!              int verify[2 * (sizeof sig_atomic_t == sizof int16_t) - 1];
!              ]], [result=INT16_MIN])
!            if test -z "$result"; then
!              AC_COMPILE_IFELSE([[#include <signal.h>
! #include <stdint.h>
!                int verify[2 * (sizeof sig_atomic_t == sizof int32_t) - 1];
!                ]], [result=INT32_MIN])
!              if test -z "$result"; then
!                AC_COMPILE_IFELSE([[#include <signal.h>
! #include <stdint.h>
!                  int verify[2 * (sizeof sig_atomic_t == sizof int64_t) - 1];
!                  ]], [result=INT64_MIN])
!              fi
!            fi
!          fi
!        else
!          result=0
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([SIG_ATOMIC_MIN], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef SIG_ATOMIC_MAX
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <signal.h>
!          int verify[2 * ((sig_atomic_t) -1 >= (sig_atomic_t) 0) - 1];
!          ]], gl_cv_sig_atomic_signed=no, gl_cv_sig_atomic_signed=yes)
!        if test $gl_cv_sig_atomic_signed = yes; then
!          AC_COMPILE_IFELSE([[#include <signal.h>
! #include <stdint.h>
!            int verify[2 * (sizeof sig_atomic_t == sizof int8_t) - 1];
!            ]], [result=INT8_MAX])
!          if test -z "$result"; then
!            AC_COMPILE_IFELSE([[#include <signal.h>
! #include <stdint.h>
!              int verify[2 * (sizeof sig_atomic_t == sizof int16_t) - 1];
!              ]], [result=INT16_MAX])
!            if test -z "$result"; then
!              AC_COMPILE_IFELSE([[#include <signal.h>
! #include <stdint.h>
!                int verify[2 * (sizeof sig_atomic_t == sizof int32_t) - 1];
!                ]], [result=INT32_MAX])
!              if test -z "$result"; then
!                AC_COMPILE_IFELSE([[#include <signal.h>
! #include <stdint.h>
!                  int verify[2 * (sizeof sig_atomic_t == sizof int64_t) - 1];
!                  ]], [result=INT64_MAX])
!              fi
!            fi
!          fi
!        else
!          AC_COMPILE_IFELSE([[#include <signal.h>
! #include <stdint.h>
!            int verify[2 * (sizeof sig_atomic_t == sizof uint8_t) - 1];
!            ]], [result=UINT8_MAX])
!          if test -z "$result"; then
!            AC_COMPILE_IFELSE([[#include <signal.h>
! #include <stdint.h>
!              int verify[2 * (sizeof sig_atomic_t == sizof uint16_t) - 1];
!              ]], [result=UINT16_MAX])
!            if test -z "$result"; then
!              AC_COMPILE_IFELSE([[#include <signal.h>
! #include <stdint.h>
!                int verify[2 * (sizeof sig_atomic_t == sizof uint32_t) - 1];
!                ]], [result=UINT32_MAX])
!              if test -z "$result"; then
!                AC_COMPILE_IFELSE([[#include <signal.h>
! #include <stdint.h>
!                  int verify[2 * (sizeof sig_atomic_t == sizof uint64_t) - 1];
!                  ]], [result=UINT64_MAX])
!              fi
!            fi
!          fi
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([SIG_ATOMIC_MAX], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     dnl Don't bother defining WCHAR_MIN and WCHAR_MAX, since they should
!     dnl already be defined in <stddef.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>.
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef WINT_MIN
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stdio.h>
! #include <time.h>
! #include <wchar.h>
!          int verify[2 * ((wint_t) -1 >= (wint_t) 0) - 1];
!          ]], gl_cv_wint_signed=no, gl_cv_wint_signed=yes)
!        if test $gl_cv_wint_signed = yes; then
!          AC_COMPILE_IFELSE([[#include <stdio.h>
! #include <time.h>
! #include <wchar.h>
! #include <stdint.h>
!            int verify[2 * (sizeof wint_t == sizof int8_t) - 1];
!            ]], [result=INT8_MIN])
!          if test -z "$result"; then
!            AC_COMPILE_IFELSE([[#include <stdio.h>
! #include <time.h>
! #include <wchar.h>
! #include <stdint.h>
!              int verify[2 * (sizeof wint_t == sizof int16_t) - 1];
!              ]], [result=INT16_MIN])
!            if test -z "$result"; then
!              AC_COMPILE_IFELSE([[#include <stdio.h>
! #include <time.h>
! #include <wchar.h>
! #include <stdint.h>
!                int verify[2 * (sizeof wint_t == sizof int32_t) - 1];
!                ]], [result=INT32_MIN])
!              if test -z "$result"; then
!                AC_COMPILE_IFELSE([[#include <stdio.h>
! #include <time.h>
! #include <wchar.h>
! #include <stdint.h>
!                  int verify[2 * (sizeof wint_t == sizof int64_t) - 1];
!                  ]], [result=INT64_MIN])
!              fi
!            fi
!          fi
!        else
!          result=0
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([WINT_MIN], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     AC_EGREP_CPP([found it], [#include <stdint.h>
! #ifdef WINT_MAX
! found it
! #endif
!       ], ,
!       [result=
!        AC_COMPILE_IFELSE([[#include <stdio.h>
! #include <time.h>
! #include <wchar.h>
!          int verify[2 * ((wint_t) -1 >= (wint_t) 0) - 1];
!          ]], gl_cv_wint_signed=no, gl_cv_wint_signed=yes)
!        if test $gl_cv_wint_signed = yes; then
!          AC_COMPILE_IFELSE([[#include <stdio.h>
! #include <time.h>
! #include <wchar.h>
! #include <stdint.h>
!            int verify[2 * (sizeof wint_t == sizof int8_t) - 1];
!            ]], [result=INT8_MAX])
!          if test -z "$result"; then
!            AC_COMPILE_IFELSE([[#include <stdio.h>
! #include <time.h>
! #include <wchar.h>
! #include <stdint.h>
!              int verify[2 * (sizeof wint_t == sizof int16_t) - 1];
!              ]], [result=INT16_MAX])
!            if test -z "$result"; then
!              AC_COMPILE_IFELSE([[#include <stdio.h>
! #include <time.h>
! #include <wchar.h>
! #include <stdint.h>
!                int verify[2 * (sizeof wint_t == sizof int32_t) - 1];
!                ]], [result=INT32_MAX])
!              if test -z "$result"; then
!                AC_COMPILE_IFELSE([[#include <stdio.h>
! #include <time.h>
! #include <wchar.h>
! #include <stdint.h>
!                  int verify[2 * (sizeof wint_t == sizof int64_t) - 1];
!                  ]], [result=INT64_MAX])
!              fi
!            fi
!          fi
!        else
!          AC_COMPILE_IFELSE([[#include <wchar.h>
! #include <stdint.h>
!            int verify[2 * (sizeof wint_t == sizof uint8_t) - 1];
!            ]], [result=UINT8_MAX])
!          if test -z "$result"; then
!            AC_COMPILE_IFELSE([[#include <wchar.h>
! #include <stdint.h>
!              int verify[2 * (sizeof wint_t == sizof uint16_t) - 1];
!              ]], [result=UINT16_MAX])
!            if test -z "$result"; then
!              AC_COMPILE_IFELSE([[#include <wchar.h>
! #include <stdint.h>
!                int verify[2 * (sizeof wint_t == sizof uint32_t) - 1];
!                ]], [result=UINT32_MAX])
!              if test -z "$result"; then
!                AC_COMPILE_IFELSE([[#include <wchar.h>
! #include <stdint.h>
!                  int verify[2 * (sizeof wint_t == sizof uint64_t) - 1];
!                  ]], [result=UINT64_MAX])
!              fi
!            fi
!          fi
!        fi
!        if test -n "$result"; then
!          AC_DEFINE_UNQUOTED([WINT_MAX], [$result],
!            [Define if <stdint.h> doesn't define it.])
!        fi
!       ])
!     STDINT_H=''
!   else
!     AC_FOREACH([type],
!                [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],
!       [if test $gl_cv_type_[]type = yes; then
!          AC_CHECK_SIZEOF(type, , [$other_includes
! #include <stdio.h>
! ])
!        fi
! ])
!     AC_CHECK_SIZEOF([long])
!     AC_CHECK_SIZEOF([unsigned long])
!     AC_CHECK_SIZEOF([ptrdiff_t], , [#include <stddef.h>
! #include <stdio.h>
! ])
!     AC_CHECK_SIZEOF([sig_atomic_t], , [#include <signal.h>
! #include <stdio.h>
! ])
!     gl_CHECK_TYPE_SIGNED([sig_atomic_t], [#include <signal.h>])
!     AC_CHECK_SIZEOF([size_t], , [#include <stddef.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>.
!     AC_FOREACH([type], [wchar_t wint_t],
!       [AC_CHECK_SIZEOF(type, , [#include <stdio.h>
! #include <time.h>
! #include <wchar.h>
! ])
!        gl_CHECK_TYPE_SIGNED(type, [#include <stdio.h>
! #include <time.h>
! #include <wchar.h>
! ])
!       ])
!     STDINT_H='stdint.h'
!   fi
!   AC_SUBST(STDINT_H)
! ])
! 
! dnl gl_CHECK_TYPE_SIGNED(type, INCLUDES) defines HAVE_SIGNED_TYPE if type
! dnl is signed.
! AC_DEFUN([gl_CHECK_TYPE_SIGNED],
! [
!   AC_COMPILE_IFELSE(
!     [AC_LANG_PROGRAM([$2
!        int verify[2 * (($1) -1 < ($1) 0) - 1];])],
!     result=yes, result=no)
!   if test "$result" = yes; then
!     AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_SIGNED_$1]), 1,
!       [Define to 1 if '$1' is a signed integer type.])
!   fi
  ])




reply via email to

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