Blame gnulib/m4/stdint.m4

Packit eba2e2
# stdint.m4 serial 43
Packit eba2e2
dnl Copyright (C) 2001-2014 Free Software Foundation, Inc.
Packit eba2e2
dnl This file is free software; the Free Software Foundation
Packit eba2e2
dnl gives unlimited permission to copy and/or distribute it,
Packit eba2e2
dnl with or without modifications, as long as this notice is preserved.
Packit eba2e2
Packit eba2e2
dnl From Paul Eggert and Bruno Haible.
Packit eba2e2
dnl Test whether <stdint.h> is supported or must be substituted.
Packit eba2e2
Packit eba2e2
AC_DEFUN_ONCE([gl_STDINT_H],
Packit eba2e2
[
Packit eba2e2
  AC_PREREQ([2.59])dnl
Packit eba2e2
Packit eba2e2
  dnl Check for long long int and unsigned long long int.
Packit eba2e2
  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
Packit eba2e2
  if test $ac_cv_type_long_long_int = yes; then
Packit eba2e2
    HAVE_LONG_LONG_INT=1
Packit eba2e2
  else
Packit eba2e2
    HAVE_LONG_LONG_INT=0
Packit eba2e2
  fi
Packit eba2e2
  AC_SUBST([HAVE_LONG_LONG_INT])
Packit eba2e2
  AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
Packit eba2e2
  if test $ac_cv_type_unsigned_long_long_int = yes; then
Packit eba2e2
    HAVE_UNSIGNED_LONG_LONG_INT=1
Packit eba2e2
  else
Packit eba2e2
    HAVE_UNSIGNED_LONG_LONG_INT=0
Packit eba2e2
  fi
Packit eba2e2
  AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT])
Packit eba2e2
Packit eba2e2
  dnl Check for <wchar.h>, in the same way as gl_WCHAR_H does.
Packit eba2e2
  AC_CHECK_HEADERS_ONCE([wchar.h])
Packit eba2e2
  if test $ac_cv_header_wchar_h = yes; then
Packit eba2e2
    HAVE_WCHAR_H=1
Packit eba2e2
  else
Packit eba2e2
    HAVE_WCHAR_H=0
Packit eba2e2
  fi
Packit eba2e2
  AC_SUBST([HAVE_WCHAR_H])
Packit eba2e2
Packit eba2e2
  dnl Check for <inttypes.h>.
Packit eba2e2
  dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h.
Packit eba2e2
  if test $ac_cv_header_inttypes_h = yes; then
Packit eba2e2
    HAVE_INTTYPES_H=1
Packit eba2e2
  else
Packit eba2e2
    HAVE_INTTYPES_H=0
Packit eba2e2
  fi
Packit eba2e2
  AC_SUBST([HAVE_INTTYPES_H])
Packit eba2e2
Packit eba2e2
  dnl Check for <sys/types.h>.
Packit eba2e2
  dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h.
Packit eba2e2
  if test $ac_cv_header_sys_types_h = yes; then
Packit eba2e2
    HAVE_SYS_TYPES_H=1
Packit eba2e2
  else
Packit eba2e2
    HAVE_SYS_TYPES_H=0
Packit eba2e2
  fi
Packit eba2e2
  AC_SUBST([HAVE_SYS_TYPES_H])
Packit eba2e2
Packit eba2e2
  gl_CHECK_NEXT_HEADERS([stdint.h])
Packit eba2e2
  if test $ac_cv_header_stdint_h = yes; then
Packit eba2e2
    HAVE_STDINT_H=1
Packit eba2e2
  else
Packit eba2e2
    HAVE_STDINT_H=0
Packit eba2e2
  fi
Packit eba2e2
  AC_SUBST([HAVE_STDINT_H])
Packit eba2e2
Packit eba2e2
  dnl Now see whether we need a substitute <stdint.h>.
Packit eba2e2
  if test $ac_cv_header_stdint_h = yes; then
Packit eba2e2
    AC_CACHE_CHECK([whether stdint.h conforms to C99],
Packit eba2e2
      [gl_cv_header_working_stdint_h],
Packit eba2e2
      [gl_cv_header_working_stdint_h=no
Packit eba2e2
       AC_COMPILE_IFELSE([
Packit eba2e2
         AC_LANG_PROGRAM([[
Packit eba2e2
#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
Packit eba2e2
#include <stdint.h>
Packit eba2e2
/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>.  */
Packit eba2e2
#if !(defined WCHAR_MIN && defined WCHAR_MAX)
Packit eba2e2
#error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>"
Packit eba2e2
#endif
Packit eba2e2
]
Packit eba2e2
gl_STDINT_INCLUDES
Packit eba2e2
[
Packit eba2e2
#ifdef INT8_MAX
Packit eba2e2
int8_t a1 = INT8_MAX;
Packit eba2e2
int8_t a1min = INT8_MIN;
Packit eba2e2
#endif
Packit eba2e2
#ifdef INT16_MAX
Packit eba2e2
int16_t a2 = INT16_MAX;
Packit eba2e2
int16_t a2min = INT16_MIN;
Packit eba2e2
#endif
Packit eba2e2
#ifdef INT32_MAX
Packit eba2e2
int32_t a3 = INT32_MAX;
Packit eba2e2
int32_t a3min = INT32_MIN;
Packit eba2e2
#endif
Packit eba2e2
#ifdef INT64_MAX
Packit eba2e2
int64_t a4 = INT64_MAX;
Packit eba2e2
int64_t a4min = INT64_MIN;
Packit eba2e2
#endif
Packit eba2e2
#ifdef UINT8_MAX
Packit eba2e2
uint8_t b1 = UINT8_MAX;
Packit eba2e2
#else
Packit eba2e2
typedef int b1[(unsigned char) -1 != 255 ? 1 : -1];
Packit eba2e2
#endif
Packit eba2e2
#ifdef UINT16_MAX
Packit eba2e2
uint16_t b2 = UINT16_MAX;
Packit eba2e2
#endif
Packit eba2e2
#ifdef UINT32_MAX
Packit eba2e2
uint32_t b3 = UINT32_MAX;
Packit eba2e2
#endif
Packit eba2e2
#ifdef UINT64_MAX
Packit eba2e2
uint64_t b4 = UINT64_MAX;
Packit eba2e2
#endif
Packit eba2e2
int_least8_t c1 = INT8_C (0x7f);
Packit eba2e2
int_least8_t c1max = INT_LEAST8_MAX;
Packit eba2e2
int_least8_t c1min = INT_LEAST8_MIN;
Packit eba2e2
int_least16_t c2 = INT16_C (0x7fff);
Packit eba2e2
int_least16_t c2max = INT_LEAST16_MAX;
Packit eba2e2
int_least16_t c2min = INT_LEAST16_MIN;
Packit eba2e2
int_least32_t c3 = INT32_C (0x7fffffff);
Packit eba2e2
int_least32_t c3max = INT_LEAST32_MAX;
Packit eba2e2
int_least32_t c3min = INT_LEAST32_MIN;
Packit eba2e2
int_least64_t c4 = INT64_C (0x7fffffffffffffff);
Packit eba2e2
int_least64_t c4max = INT_LEAST64_MAX;
Packit eba2e2
int_least64_t c4min = INT_LEAST64_MIN;
Packit eba2e2
uint_least8_t d1 = UINT8_C (0xff);
Packit eba2e2
uint_least8_t d1max = UINT_LEAST8_MAX;
Packit eba2e2
uint_least16_t d2 = UINT16_C (0xffff);
Packit eba2e2
uint_least16_t d2max = UINT_LEAST16_MAX;
Packit eba2e2
uint_least32_t d3 = UINT32_C (0xffffffff);
Packit eba2e2
uint_least32_t d3max = UINT_LEAST32_MAX;
Packit eba2e2
uint_least64_t d4 = UINT64_C (0xffffffffffffffff);
Packit eba2e2
uint_least64_t d4max = UINT_LEAST64_MAX;
Packit eba2e2
int_fast8_t e1 = INT_FAST8_MAX;
Packit eba2e2
int_fast8_t e1min = INT_FAST8_MIN;
Packit eba2e2
int_fast16_t e2 = INT_FAST16_MAX;
Packit eba2e2
int_fast16_t e2min = INT_FAST16_MIN;
Packit eba2e2
int_fast32_t e3 = INT_FAST32_MAX;
Packit eba2e2
int_fast32_t e3min = INT_FAST32_MIN;
Packit eba2e2
int_fast64_t e4 = INT_FAST64_MAX;
Packit eba2e2
int_fast64_t e4min = INT_FAST64_MIN;
Packit eba2e2
uint_fast8_t f1 = UINT_FAST8_MAX;
Packit eba2e2
uint_fast16_t f2 = UINT_FAST16_MAX;
Packit eba2e2
uint_fast32_t f3 = UINT_FAST32_MAX;
Packit eba2e2
uint_fast64_t f4 = UINT_FAST64_MAX;
Packit eba2e2
#ifdef INTPTR_MAX
Packit eba2e2
intptr_t g = INTPTR_MAX;
Packit eba2e2
intptr_t gmin = INTPTR_MIN;
Packit eba2e2
#endif
Packit eba2e2
#ifdef UINTPTR_MAX
Packit eba2e2
uintptr_t h = UINTPTR_MAX;
Packit eba2e2
#endif
Packit eba2e2
intmax_t i = INTMAX_MAX;
Packit eba2e2
uintmax_t j = UINTMAX_MAX;
Packit eba2e2
Packit eba2e2
#include <limits.h> /* for CHAR_BIT */
Packit eba2e2
#define TYPE_MINIMUM(t) \
Packit eba2e2
  ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t)))
Packit eba2e2
#define TYPE_MAXIMUM(t) \
Packit eba2e2
  ((t) ((t) 0 < (t) -1 \
Packit eba2e2
        ? (t) -1 \
Packit eba2e2
        : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
Packit eba2e2
struct s {
Packit eba2e2
  int check_PTRDIFF:
Packit eba2e2
      PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t)
Packit eba2e2
      && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t)
Packit eba2e2
      ? 1 : -1;
Packit eba2e2
  /* Detect bug in FreeBSD 6.0 / ia64.  */
Packit eba2e2
  int check_SIG_ATOMIC:
Packit eba2e2
      SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t)
Packit eba2e2
      && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t)
Packit eba2e2
      ? 1 : -1;
Packit eba2e2
  int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1;
Packit eba2e2
  int check_WCHAR:
Packit eba2e2
      WCHAR_MIN == TYPE_MINIMUM (wchar_t)
Packit eba2e2
      && WCHAR_MAX == TYPE_MAXIMUM (wchar_t)
Packit eba2e2
      ? 1 : -1;
Packit eba2e2
  /* Detect bug in mingw.  */
Packit eba2e2
  int check_WINT:
Packit eba2e2
      WINT_MIN == TYPE_MINIMUM (wint_t)
Packit eba2e2
      && WINT_MAX == TYPE_MAXIMUM (wint_t)
Packit eba2e2
      ? 1 : -1;
Packit eba2e2
Packit eba2e2
  /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others.  */
Packit eba2e2
  int check_UINT8_C:
Packit eba2e2
        (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1;
Packit eba2e2
  int check_UINT16_C:
Packit eba2e2
        (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1;
Packit eba2e2
Packit eba2e2
  /* Detect bugs in OpenBSD 3.9 stdint.h.  */
Packit eba2e2
#ifdef UINT8_MAX
Packit eba2e2
  int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1;
Packit eba2e2
#endif
Packit eba2e2
#ifdef UINT16_MAX
Packit eba2e2
  int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1;
Packit eba2e2
#endif
Packit eba2e2
#ifdef UINT32_MAX
Packit eba2e2
  int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1;
Packit eba2e2
#endif
Packit eba2e2
#ifdef UINT64_MAX
Packit eba2e2
  int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1;
Packit eba2e2
#endif
Packit eba2e2
  int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1;
Packit eba2e2
  int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1;
Packit eba2e2
  int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1;
Packit eba2e2
  int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1;
Packit eba2e2
  int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1;
Packit eba2e2
  int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1;
Packit eba2e2
  int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1;
Packit eba2e2
  int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1;
Packit eba2e2
  int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1;
Packit eba2e2
  int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1;
Packit eba2e2
  int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
Packit eba2e2
};
Packit eba2e2
         ]])],
Packit eba2e2
         [dnl Determine whether the various *_MIN, *_MAX macros are usable
Packit eba2e2
          dnl in preprocessor expression. We could do it by compiling a test
Packit eba2e2
          dnl program for each of these macros. It is faster to run a program
Packit eba2e2
          dnl that inspects the macro expansion.
Packit eba2e2
          dnl This detects a bug on HP-UX 11.23/ia64.
Packit eba2e2
          AC_RUN_IFELSE([
Packit eba2e2
            AC_LANG_PROGRAM([[
Packit eba2e2
#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
Packit eba2e2
#include <stdint.h>
Packit eba2e2
]
Packit eba2e2
gl_STDINT_INCLUDES
Packit eba2e2
[
Packit eba2e2
#include <stdio.h>
Packit eba2e2
#include <string.h>
Packit eba2e2
#define MVAL(macro) MVAL1(macro)
Packit eba2e2
#define MVAL1(expression) #expression
Packit eba2e2
static const char *macro_values[] =
Packit eba2e2
  {
Packit eba2e2
#ifdef INT8_MAX
Packit eba2e2
    MVAL (INT8_MAX),
Packit eba2e2
#endif
Packit eba2e2
#ifdef INT16_MAX
Packit eba2e2
    MVAL (INT16_MAX),
Packit eba2e2
#endif
Packit eba2e2
#ifdef INT32_MAX
Packit eba2e2
    MVAL (INT32_MAX),
Packit eba2e2
#endif
Packit eba2e2
#ifdef INT64_MAX
Packit eba2e2
    MVAL (INT64_MAX),
Packit eba2e2
#endif
Packit eba2e2
#ifdef UINT8_MAX
Packit eba2e2
    MVAL (UINT8_MAX),
Packit eba2e2
#endif
Packit eba2e2
#ifdef UINT16_MAX
Packit eba2e2
    MVAL (UINT16_MAX),
Packit eba2e2
#endif
Packit eba2e2
#ifdef UINT32_MAX
Packit eba2e2
    MVAL (UINT32_MAX),
Packit eba2e2
#endif
Packit eba2e2
#ifdef UINT64_MAX
Packit eba2e2
    MVAL (UINT64_MAX),
Packit eba2e2
#endif
Packit eba2e2
    NULL
Packit eba2e2
  };
Packit eba2e2
]], [[
Packit eba2e2
  const char **mv;
Packit eba2e2
  for (mv = macro_values; *mv != NULL; mv++)
Packit eba2e2
    {
Packit eba2e2
      const char *value = *mv;
Packit eba2e2
      /* Test whether it looks like a cast expression.  */
Packit eba2e2
      if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0
Packit eba2e2
          || strncmp (value, "((unsigned short)"/*)*/, 17) == 0
Packit eba2e2
          || strncmp (value, "((unsigned char)"/*)*/, 16) == 0
Packit eba2e2
          || strncmp (value, "((int)"/*)*/, 6) == 0
Packit eba2e2
          || strncmp (value, "((signed short)"/*)*/, 15) == 0
Packit eba2e2
          || strncmp (value, "((signed char)"/*)*/, 14) == 0)
Packit eba2e2
        return mv - macro_values + 1;
Packit eba2e2
    }
Packit eba2e2
  return 0;
Packit eba2e2
]])],
Packit eba2e2
              [gl_cv_header_working_stdint_h=yes],
Packit eba2e2
              [],
Packit eba2e2
              [dnl When cross-compiling, assume it works.
Packit eba2e2
               gl_cv_header_working_stdint_h=yes
Packit eba2e2
              ])
Packit eba2e2
         ])
Packit eba2e2
      ])
Packit eba2e2
  fi
Packit eba2e2
  if test "$gl_cv_header_working_stdint_h" = yes; then
Packit eba2e2
    STDINT_H=
Packit eba2e2
  else
Packit eba2e2
    dnl Check for <sys/inttypes.h>, and for
Packit eba2e2
    dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
Packit eba2e2
    AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h])
Packit eba2e2
    if test $ac_cv_header_sys_inttypes_h = yes; then
Packit eba2e2
      HAVE_SYS_INTTYPES_H=1
Packit eba2e2
    else
Packit eba2e2
      HAVE_SYS_INTTYPES_H=0
Packit eba2e2
    fi
Packit eba2e2
    AC_SUBST([HAVE_SYS_INTTYPES_H])
Packit eba2e2
    if test $ac_cv_header_sys_bitypes_h = yes; then
Packit eba2e2
      HAVE_SYS_BITYPES_H=1
Packit eba2e2
    else
Packit eba2e2
      HAVE_SYS_BITYPES_H=0
Packit eba2e2
    fi
Packit eba2e2
    AC_SUBST([HAVE_SYS_BITYPES_H])
Packit eba2e2
Packit eba2e2
    gl_STDINT_TYPE_PROPERTIES
Packit eba2e2
    STDINT_H=stdint.h
Packit eba2e2
  fi
Packit eba2e2
  AC_SUBST([STDINT_H])
Packit eba2e2
  AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"])
Packit eba2e2
])
Packit eba2e2
Packit eba2e2
dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
Packit eba2e2
dnl Determine the size of each of the given types in bits.
Packit eba2e2
AC_DEFUN([gl_STDINT_BITSIZEOF],
Packit eba2e2
[
Packit eba2e2
  dnl Use a shell loop, to avoid bloating configure, and
Packit eba2e2
  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
Packit eba2e2
  dnl   config.h.in,
Packit eba2e2
  dnl - extra AC_SUBST calls, so that the right substitutions are made.
Packit eba2e2
  m4_foreach_w([gltype], [$1],
Packit eba2e2
    [AH_TEMPLATE([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
Packit eba2e2
       [Define to the number of bits in type ']gltype['.])])
Packit eba2e2
  for gltype in $1 ; do
Packit eba2e2
    AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}],
Packit eba2e2
      [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT],
Packit eba2e2
         [$2
Packit eba2e2
#include <limits.h>], [result=unknown])
Packit eba2e2
       eval gl_cv_bitsizeof_${gltype}=\$result
Packit eba2e2
      ])
Packit eba2e2
    eval result=\$gl_cv_bitsizeof_${gltype}
Packit eba2e2
    if test $result = unknown; then
Packit eba2e2
      dnl Use a nonempty default, because some compilers, such as IRIX 5 cc,
Packit eba2e2
      dnl do a syntax check even on unused #if conditions and give an error
Packit eba2e2
      dnl on valid C code like this:
Packit eba2e2
      dnl   #if 0
Packit eba2e2
      dnl   # if  > 32
Packit eba2e2
      dnl   # endif
Packit eba2e2
      dnl   #endif
Packit eba2e2
      result=0
Packit eba2e2
    fi
Packit eba2e2
    GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
Packit eba2e2
    AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
Packit eba2e2
    eval BITSIZEOF_${GLTYPE}=\$result
Packit eba2e2
  done
Packit eba2e2
  m4_foreach_w([gltype], [$1],
Packit eba2e2
    [AC_SUBST([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
Packit eba2e2
])
Packit eba2e2
Packit eba2e2
dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES)
Packit eba2e2
dnl Determine the signedness of each of the given types.
Packit eba2e2
dnl Define HAVE_SIGNED_TYPE if type is signed.
Packit eba2e2
AC_DEFUN([gl_CHECK_TYPES_SIGNED],
Packit eba2e2
[
Packit eba2e2
  dnl Use a shell loop, to avoid bloating configure, and
Packit eba2e2
  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
Packit eba2e2
  dnl   config.h.in,
Packit eba2e2
  dnl - extra AC_SUBST calls, so that the right substitutions are made.
Packit eba2e2
  m4_foreach_w([gltype], [$1],
Packit eba2e2
    [AH_TEMPLATE([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
Packit eba2e2
       [Define to 1 if ']gltype[' is a signed integer type.])])
Packit eba2e2
  for gltype in $1 ; do
Packit eba2e2
    AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed],
Packit eba2e2
      [AC_COMPILE_IFELSE(
Packit eba2e2
         [AC_LANG_PROGRAM([$2[
Packit eba2e2
            int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])],
Packit eba2e2
         result=yes, result=no)
Packit eba2e2
       eval gl_cv_type_${gltype}_signed=\$result
Packit eba2e2
      ])
Packit eba2e2
    eval result=\$gl_cv_type_${gltype}_signed
Packit eba2e2
    GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
Packit eba2e2
    if test "$result" = yes; then
Packit eba2e2
      AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], [1])
Packit eba2e2
      eval HAVE_SIGNED_${GLTYPE}=1
Packit eba2e2
    else
Packit eba2e2
      eval HAVE_SIGNED_${GLTYPE}=0
Packit eba2e2
    fi
Packit eba2e2
  done
Packit eba2e2
  m4_foreach_w([gltype], [$1],
Packit eba2e2
    [AC_SUBST([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
Packit eba2e2
])
Packit eba2e2
Packit eba2e2
dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES)
Packit eba2e2
dnl Determine the suffix to use for integer constants of the given types.
Packit eba2e2
dnl Define t_SUFFIX for each such type.
Packit eba2e2
AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
Packit eba2e2
[
Packit eba2e2
  dnl Use a shell loop, to avoid bloating configure, and
Packit eba2e2
  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
Packit eba2e2
  dnl   config.h.in,
Packit eba2e2
  dnl - extra AC_SUBST calls, so that the right substitutions are made.
Packit eba2e2
  m4_foreach_w([gltype], [$1],
Packit eba2e2
    [AH_TEMPLATE(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
Packit eba2e2
       [Define to l, ll, u, ul, ull, etc., as suitable for
Packit eba2e2
        constants of type ']gltype['.])])
Packit eba2e2
  for gltype in $1 ; do
Packit eba2e2
    AC_CACHE_CHECK([for $gltype integer literal suffix],
Packit eba2e2
      [gl_cv_type_${gltype}_suffix],
Packit eba2e2
      [eval gl_cv_type_${gltype}_suffix=no
Packit eba2e2
       eval result=\$gl_cv_type_${gltype}_signed
Packit eba2e2
       if test "$result" = yes; then
Packit eba2e2
         glsufu=
Packit eba2e2
       else
Packit eba2e2
         glsufu=u
Packit eba2e2
       fi
Packit eba2e2
       for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
Packit eba2e2
         case $glsuf in
Packit eba2e2
           '')  gltype1='int';;
Packit eba2e2
           l)   gltype1='long int';;
Packit eba2e2
           ll)  gltype1='long long int';;
Packit eba2e2
           i64) gltype1='__int64';;
Packit eba2e2
           u)   gltype1='unsigned int';;
Packit eba2e2
           ul)  gltype1='unsigned long int';;
Packit eba2e2
           ull) gltype1='unsigned long long int';;
Packit eba2e2
           ui64)gltype1='unsigned __int64';;
Packit eba2e2
         esac
Packit eba2e2
         AC_COMPILE_IFELSE(
Packit eba2e2
           [AC_LANG_PROGRAM([$2[
Packit eba2e2
              extern $gltype foo;
Packit eba2e2
              extern $gltype1 foo;]])],
Packit eba2e2
           [eval gl_cv_type_${gltype}_suffix=\$glsuf])
Packit eba2e2
         eval result=\$gl_cv_type_${gltype}_suffix
Packit eba2e2
         test "$result" != no && break
Packit eba2e2
       done])
Packit eba2e2
    GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
Packit eba2e2
    eval result=\$gl_cv_type_${gltype}_suffix
Packit eba2e2
    test "$result" = no && result=
Packit eba2e2
    eval ${GLTYPE}_SUFFIX=\$result
Packit eba2e2
    AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result])
Packit eba2e2
  done
Packit eba2e2
  m4_foreach_w([gltype], [$1],
Packit eba2e2
    [AC_SUBST(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
Packit eba2e2
])
Packit eba2e2
Packit eba2e2
dnl gl_STDINT_INCLUDES
Packit eba2e2
AC_DEFUN([gl_STDINT_INCLUDES],
Packit eba2e2
[[
Packit eba2e2
  /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
Packit eba2e2
     included before <wchar.h>.  */
Packit eba2e2
  #include <stddef.h>
Packit eba2e2
  #include <signal.h>
Packit eba2e2
  #if HAVE_WCHAR_H
Packit eba2e2
  # include <stdio.h>
Packit eba2e2
  # include <time.h>
Packit eba2e2
  # include <wchar.h>
Packit eba2e2
  #endif
Packit eba2e2
]])
Packit eba2e2
Packit eba2e2
dnl gl_STDINT_TYPE_PROPERTIES
Packit eba2e2
dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t
Packit eba2e2
dnl of interest to stdint.in.h.
Packit eba2e2
AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
Packit eba2e2
[
Packit eba2e2
  AC_REQUIRE([gl_MULTIARCH])
Packit eba2e2
  if test $APPLE_UNIVERSAL_BUILD = 0; then
Packit eba2e2
    gl_STDINT_BITSIZEOF([ptrdiff_t size_t],
Packit eba2e2
      [gl_STDINT_INCLUDES])
Packit eba2e2
  fi
Packit eba2e2
  gl_STDINT_BITSIZEOF([sig_atomic_t wchar_t wint_t],
Packit eba2e2
    [gl_STDINT_INCLUDES])
Packit eba2e2
  gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t],
Packit eba2e2
    [gl_STDINT_INCLUDES])
Packit eba2e2
  gl_cv_type_ptrdiff_t_signed=yes
Packit eba2e2
  gl_cv_type_size_t_signed=no
Packit eba2e2
  if test $APPLE_UNIVERSAL_BUILD = 0; then
Packit eba2e2
    gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t],
Packit eba2e2
      [gl_STDINT_INCLUDES])
Packit eba2e2
  fi
Packit eba2e2
  gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t],
Packit eba2e2
    [gl_STDINT_INCLUDES])
Packit eba2e2
Packit eba2e2
  dnl If wint_t is smaller than 'int', it cannot satisfy the ISO C 99
Packit eba2e2
  dnl requirement that wint_t is "unchanged by default argument promotions".
Packit eba2e2
  dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t.
Packit eba2e2
  dnl Set the variable BITSIZEOF_WINT_T accordingly.
Packit eba2e2
  if test $BITSIZEOF_WINT_T -lt 32; then
Packit eba2e2
    BITSIZEOF_WINT_T=32
Packit eba2e2
  fi
Packit eba2e2
])
Packit eba2e2
Packit eba2e2
dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
Packit eba2e2
dnl Remove this when we can assume autoconf >= 2.61.
Packit eba2e2
m4_ifdef([AC_COMPUTE_INT], [], [
Packit eba2e2
  AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
Packit eba2e2
])
Packit eba2e2
Packit eba2e2
# Hey Emacs!
Packit eba2e2
# Local Variables:
Packit eba2e2
# indent-tabs-mode: nil
Packit eba2e2
# End: