version 1.1.1.2, 2012/05/29 09:29:44
|
version 1.1.1.3, 2021/03/17 13:38:46
|
Line 1
|
Line 1
|
# stdint.m4 serial 41 | # stdint.m4 serial 53 |
dnl Copyright (C) 2001-2011 Free Software Foundation, Inc. | dnl Copyright (C) 2001-2019 Free Software Foundation, Inc. |
dnl This file is free software; the Free Software Foundation |
dnl This file is free software; the Free Software Foundation |
dnl gives unlimited permission to copy and/or distribute it, |
dnl gives unlimited permission to copy and/or distribute it, |
dnl with or without modifications, as long as this notice is preserved. |
dnl with or without modifications, as long as this notice is preserved. |
Line 7 dnl with or without modifications, as long as this not
|
Line 7 dnl with or without modifications, as long as this not
|
dnl From Paul Eggert and Bruno Haible. |
dnl From Paul Eggert and Bruno Haible. |
dnl Test whether <stdint.h> is supported or must be substituted. |
dnl Test whether <stdint.h> is supported or must be substituted. |
|
|
|
AC_PREREQ([2.61]) |
|
|
AC_DEFUN_ONCE([gl_STDINT_H], |
AC_DEFUN_ONCE([gl_STDINT_H], |
[ |
[ |
AC_PREREQ([2.59])dnl |
AC_PREREQ([2.59])dnl |
|
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
|
|
|
AC_REQUIRE([gl_LIMITS_H]) |
|
AC_REQUIRE([gt_TYPE_WINT_T]) |
|
|
dnl Check for long long int and unsigned long long int. |
dnl Check for long long int and unsigned long long int. |
AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) |
AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) |
if test $ac_cv_type_long_long_int = yes; then |
if test $ac_cv_type_long_long_int = yes; then |
Line 69 AC_DEFUN_ONCE([gl_STDINT_H],
|
Line 75 AC_DEFUN_ONCE([gl_STDINT_H],
|
[gl_cv_header_working_stdint_h=no |
[gl_cv_header_working_stdint_h=no |
AC_COMPILE_IFELSE([ |
AC_COMPILE_IFELSE([ |
AC_LANG_PROGRAM([[ |
AC_LANG_PROGRAM([[ |
#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ |
|
#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ |
|
#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ |
#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ |
|
#define __STDC_CONSTANT_MACROS 1 |
|
#define __STDC_LIMIT_MACROS 1 |
#include <stdint.h> |
#include <stdint.h> |
/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */ |
/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */ |
#if !(defined WCHAR_MIN && defined WCHAR_MAX) |
#if !(defined WCHAR_MIN && defined WCHAR_MAX) |
Line 152 uintptr_t h = UINTPTR_MAX;
|
Line 158 uintptr_t h = UINTPTR_MAX;
|
intmax_t i = INTMAX_MAX; |
intmax_t i = INTMAX_MAX; |
uintmax_t j = UINTMAX_MAX; |
uintmax_t j = UINTMAX_MAX; |
|
|
|
/* Check that SIZE_MAX has the correct type, if possible. */ |
|
#if 201112 <= __STDC_VERSION__ |
|
int k = _Generic (SIZE_MAX, size_t: 0); |
|
#elif (2 <= __GNUC__ || defined __IBM__TYPEOF__ \ |
|
|| (0x5110 <= __SUNPRO_C && !__STDC__)) |
|
extern size_t k; |
|
extern __typeof__ (SIZE_MAX) k; |
|
#endif |
|
|
#include <limits.h> /* for CHAR_BIT */ |
#include <limits.h> /* for CHAR_BIT */ |
#define TYPE_MINIMUM(t) \ |
#define TYPE_MINIMUM(t) \ |
((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) |
((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) |
Line 219 struct s {
|
Line 234 struct s {
|
dnl This detects a bug on HP-UX 11.23/ia64. |
dnl This detects a bug on HP-UX 11.23/ia64. |
AC_RUN_IFELSE([ |
AC_RUN_IFELSE([ |
AC_LANG_PROGRAM([[ |
AC_LANG_PROGRAM([[ |
#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ |
|
#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ |
|
#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ |
#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ |
|
#define __STDC_CONSTANT_MACROS 1 |
|
#define __STDC_LIMIT_MACROS 1 |
#include <stdint.h> |
#include <stdint.h> |
] |
] |
gl_STDINT_INCLUDES |
gl_STDINT_INCLUDES |
Line 276 static const char *macro_values[] =
|
Line 291 static const char *macro_values[] =
|
]])], |
]])], |
[gl_cv_header_working_stdint_h=yes], |
[gl_cv_header_working_stdint_h=yes], |
[], |
[], |
[dnl When cross-compiling, assume it works. | [case "$host_os" in |
gl_cv_header_working_stdint_h=yes | # Guess yes on native Windows. |
| mingw*) gl_cv_header_working_stdint_h="guessing yes" ;; |
| # In general, assume it works. |
| *) gl_cv_header_working_stdint_h="guessing yes" ;; |
| esac |
]) |
]) |
]) |
]) |
]) |
]) |
fi |
fi |
if test "$gl_cv_header_working_stdint_h" = yes; then |
|
STDINT_H= |
|
else |
|
dnl Check for <sys/inttypes.h>, and for |
|
dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5). |
|
AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) |
|
if test $ac_cv_header_sys_inttypes_h = yes; then |
|
HAVE_SYS_INTTYPES_H=1 |
|
else |
|
HAVE_SYS_INTTYPES_H=0 |
|
fi |
|
AC_SUBST([HAVE_SYS_INTTYPES_H]) |
|
if test $ac_cv_header_sys_bitypes_h = yes; then |
|
HAVE_SYS_BITYPES_H=1 |
|
else |
|
HAVE_SYS_BITYPES_H=0 |
|
fi |
|
AC_SUBST([HAVE_SYS_BITYPES_H]) |
|
|
|
gl_STDINT_TYPE_PROPERTIES | HAVE_C99_STDINT_H=0 |
STDINT_H=stdint.h | HAVE_SYS_BITYPES_H=0 |
fi | HAVE_SYS_INTTYPES_H=0 |
| STDINT_H=stdint.h |
| case "$gl_cv_header_working_stdint_h" in |
| *yes) |
| HAVE_C99_STDINT_H=1 |
| dnl Now see whether the system <stdint.h> works without |
| dnl __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS defined. |
| AC_CACHE_CHECK([whether stdint.h predates C++11], |
| [gl_cv_header_stdint_predates_cxx11_h], |
| [gl_cv_header_stdint_predates_cxx11_h=yes |
| AC_COMPILE_IFELSE([ |
| AC_LANG_PROGRAM([[ |
| #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ |
| #include <stdint.h> |
| ] |
| gl_STDINT_INCLUDES |
| [ |
| intmax_t im = INTMAX_MAX; |
| int32_t i32 = INT32_C (0x7fffffff); |
| ]])], |
| [gl_cv_header_stdint_predates_cxx11_h=no])]) |
| |
| if test "$gl_cv_header_stdint_predates_cxx11_h" = yes; then |
| AC_DEFINE([__STDC_CONSTANT_MACROS], [1], |
| [Define to 1 if the system <stdint.h> predates C++11.]) |
| AC_DEFINE([__STDC_LIMIT_MACROS], [1], |
| [Define to 1 if the system <stdint.h> predates C++11.]) |
| fi |
| AC_CACHE_CHECK([whether stdint.h has UINTMAX_WIDTH etc.], |
| [gl_cv_header_stdint_width], |
| [gl_cv_header_stdint_width=no |
| AC_COMPILE_IFELSE( |
| [AC_LANG_PROGRAM([[ |
| /* Work if build is not clean. */ |
| #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 |
| #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ |
| #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 |
| #endif |
| #include <stdint.h> |
| ]gl_STDINT_INCLUDES[ |
| int iw = UINTMAX_WIDTH; |
| ]])], |
| [gl_cv_header_stdint_width=yes])]) |
| if test "$gl_cv_header_stdint_width" = yes; then |
| STDINT_H= |
| fi |
| ;; |
| *) |
| dnl Check for <sys/inttypes.h>, and for |
| dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5). |
| AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) |
| if test $ac_cv_header_sys_inttypes_h = yes; then |
| HAVE_SYS_INTTYPES_H=1 |
| fi |
| if test $ac_cv_header_sys_bitypes_h = yes; then |
| HAVE_SYS_BITYPES_H=1 |
| fi |
| gl_STDINT_TYPE_PROPERTIES |
| ;; |
| esac |
| |
| dnl The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH. |
| gl_REPLACE_LIMITS_H |
| |
| AC_SUBST([HAVE_C99_STDINT_H]) |
| AC_SUBST([HAVE_SYS_BITYPES_H]) |
| AC_SUBST([HAVE_SYS_INTTYPES_H]) |
AC_SUBST([STDINT_H]) |
AC_SUBST([STDINT_H]) |
AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"]) |
AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"]) |
]) |
]) |
Line 466 AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
|
Line 533 AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
|
fi |
fi |
gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t], |
gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t], |
[gl_STDINT_INCLUDES]) |
[gl_STDINT_INCLUDES]) |
]) |
|
|
|
dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. | dnl If wint_t is smaller than 'int', it cannot satisfy the ISO C 99 |
dnl Remove this when we can assume autoconf >= 2.61. | dnl requirement that wint_t is "unchanged by default argument promotions". |
m4_ifdef([AC_COMPUTE_INT], [], [ | dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t. |
AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) | dnl Set the variable BITSIZEOF_WINT_T accordingly. |
| if test $GNULIB_OVERRIDES_WINT_T = 1; then |
| BITSIZEOF_WINT_T=32 |
| fi |
]) |
]) |
|
|
# Hey Emacs! |
|
# Local Variables: |
|
# indent-tabs-mode: nil |
|
# End: |
|