summaryrefslogtreecommitdiff
path: root/gnulib-m4/inttypes.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gnulib-m4/inttypes.m4')
-rw-r--r--gnulib-m4/inttypes.m457
1 files changed, 39 insertions, 18 deletions
diff --git a/gnulib-m4/inttypes.m4 b/gnulib-m4/inttypes.m4
index d756f01..df25a21 100644
--- a/gnulib-m4/inttypes.m4
+++ b/gnulib-m4/inttypes.m4
@@ -1,5 +1,5 @@
-# inttypes.m4 serial 27
-dnl Copyright (C) 2006-2018 Free Software Foundation, Inc.
+# inttypes.m4 serial 36
+dnl Copyright (C) 2006-2022 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.
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
dnl From Derek Price, Bruno Haible.
dnl Test whether <inttypes.h> is supported or must be substituted.
-AC_DEFUN([gl_INTTYPES_H],
+AC_DEFUN_ONCE([gl_INTTYPES_H],
[
AC_REQUIRE([gl_INTTYPES_INCOMPLETE])
gl_INTTYPES_PRI_SCN
@@ -28,17 +28,26 @@ AC_DEFUN_ONCE([gl_INTTYPES_INCOMPLETE],
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[#include <inttypes.h>
]], [imaxabs imaxdiv strtoimax strtoumax])
+
+ AC_REQUIRE([AC_C_RESTRICT])
])
# Ensure that the PRI* and SCN* macros are defined appropriately.
AC_DEFUN([gl_INTTYPES_PRI_SCN],
[
- AC_REQUIRE([gt_INTTYPES_PRI])
-
PRIPTR_PREFIX=
- if test -n "$STDINT_H"; then
- dnl Using the gnulib <stdint.h>. It always defines intptr_t to 'long'.
- PRIPTR_PREFIX='"l"'
+ if $GL_GENERATE_STDINT_H; then
+ dnl Using the gnulib <stdint.h>. It defines intptr_t to 'long' or
+ dnl 'long long', depending on _WIN64.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[
+ #ifdef _WIN64
+ LLP64
+ #endif
+ ]])
+ ],
+ [PRIPTR_PREFIX='"l"'],
+ [PRIPTR_PREFIX='"ll"'])
else
dnl Using the system's <stdint.h>.
for glpfx in '' l ll I64; do
@@ -113,10 +122,8 @@ AC_DEFUN([gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION],
#if $2
#define CONDITION ($3)
- #elif HAVE_LONG_LONG_INT
- #define CONDITION ($4)
#else
- #define CONDITION 0
+ #define CONDITION ($4)
#endif
int test[CONDITION ? 1 : -1];]])],
[gl_cv_test_$1=yes],
@@ -129,19 +136,34 @@ AC_DEFUN([gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION],
AC_SUBST([$1])
])
+# gl_INTTYPES_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_INTTYPES_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_INTTYPES_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
])
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_INTTYPES_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_INTTYPES_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IMAXABS])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IMAXDIV])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOIMAX])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOUMAX])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_INTTYPES_H_MODULE_INDICATOR_DEFAULTS])
+ AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
+])
+
AC_DEFUN([gl_INTTYPES_H_DEFAULTS],
[
- GNULIB_IMAXABS=0; AC_SUBST([GNULIB_IMAXABS])
- GNULIB_IMAXDIV=0; AC_SUBST([GNULIB_IMAXDIV])
- GNULIB_STRTOIMAX=0; AC_SUBST([GNULIB_STRTOIMAX])
- GNULIB_STRTOUMAX=0; AC_SUBST([GNULIB_STRTOUMAX])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_DECL_IMAXABS=1; AC_SUBST([HAVE_DECL_IMAXABS])
HAVE_DECL_IMAXDIV=1; AC_SUBST([HAVE_DECL_IMAXDIV])
@@ -152,7 +174,6 @@ AC_DEFUN([gl_INTTYPES_H_DEFAULTS],
REPLACE_STRTOUMAX=0; AC_SUBST([REPLACE_STRTOUMAX])
INT32_MAX_LT_INTMAX_MAX=1; AC_SUBST([INT32_MAX_LT_INTMAX_MAX])
INT64_MAX_EQ_LONG_MAX='defined _LP64'; AC_SUBST([INT64_MAX_EQ_LONG_MAX])
- PRI_MACROS_BROKEN=0; AC_SUBST([PRI_MACROS_BROKEN])
PRIPTR_PREFIX=__PRIPTR_PREFIX; AC_SUBST([PRIPTR_PREFIX])
UINT32_MAX_LT_UINTMAX_MAX=1; AC_SUBST([UINT32_MAX_LT_UINTMAX_MAX])
UINT64_MAX_EQ_ULONG_MAX='defined _LP64'; AC_SUBST([UINT64_MAX_EQ_ULONG_MAX])