summaryrefslogtreecommitdiff
path: root/m4/stdint.m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-07-13 19:24:06 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-07-13 19:24:49 -0700
commit3128d5d10e702ccb0732d947370e539a54046fc9 (patch)
treea2a3c95dcf1263d55ca63fb4675b43286a8351de /m4/stdint.m4
parentab87dbad1d26fba4e33b62b4b5a840be77ae9aa5 (diff)
downloademacs-3128d5d10e702ccb0732d947370e539a54046fc9.tar.gz
Merge from gnulib
This incorporates: 2017-07-13 Improve cross-compilation guesses for native Windows 2017-07-11 More systematic m4 quoting and indentation 2017-07-10 Make sure $host and $host_os are defined when used 2017-07-03 stdioext: Port to OpenVMS 2017-06-24 xalloc-oversized: port to icc * doc/misc/texinfo.tex, lib/fpending.c, lib/stdio-impl.h: * lib/xalloc-oversized.h, m4/dirfd.m4, m4/gettimeofday.m4: * m4/lstat.m4, m4/mktime.m4, m4/pselect.m4, m4/putenv.m4: * m4/stdint.m4, m4/strtoimax.m4, m4/utimes.m4: Copy from Gnulib.
Diffstat (limited to 'm4/stdint.m4')
-rw-r--r--m4/stdint.m4108
1 files changed, 58 insertions, 50 deletions
diff --git a/m4/stdint.m4 b/m4/stdint.m4
index 4ac854d5198..4bf3e474515 100644
--- a/m4/stdint.m4
+++ b/m4/stdint.m4
@@ -1,4 +1,4 @@
-# stdint.m4 serial 50
+# stdint.m4 serial 51
dnl Copyright (C) 2001-2017 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -10,6 +10,7 @@ dnl Test whether <stdint.h> is supported or must be substituted.
AC_DEFUN_ONCE([gl_STDINT_H],
[
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])
@@ -288,8 +289,12 @@ static const char *macro_values[] =
]])],
[gl_cv_header_working_stdint_h=yes],
[],
- [dnl When cross-compiling, assume it works.
- gl_cv_header_working_stdint_h=yes
+ [case "$host_os" in
+ # 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
])
])
])
@@ -299,15 +304,16 @@ static const char *macro_values[] =
HAVE_SYS_BITYPES_H=0
HAVE_SYS_INTTYPES_H=0
STDINT_H=stdint.h
- if test "$gl_cv_header_working_stdint_h" = yes; then
- 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([[
+ 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>
]
@@ -315,45 +321,47 @@ gl_STDINT_INCLUDES
[
intmax_t im = INTMAX_MAX;
int32_t i32 = INT32_C (0x7fffffff);
- ]])],
- [gl_cv_header_stdint_predates_cxx11_h=no])])
+ ]])],
+ [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
- 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
- fi
- if test $ac_cv_header_sys_bitypes_h = yes; then
- HAVE_SYS_BITYPES_H=1
- fi
- gl_STDINT_TYPE_PROPERTIES
- fi
+ 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.
LIMITS_H=limits.h