diff options
author | Lorenz <12514511+RincewindsHat@users.noreply.github.com> | 2023-02-10 10:43:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-10 10:43:20 (GMT) |
commit | c07206f2ccc2356aa74bc6813a94c2190017d44e (patch) | |
tree | 1677e5fdca5c3ce544e92c5484e16a0b68df1cc9 /gl/m4/stdint.m4 | |
parent | e92046f810658016b7c373677efefda3b21400e4 (diff) | |
parent | d2fcf49ad4afc15f37d082d7bc96a808369ec2d4 (diff) | |
download | monitoring-plugins-c07206f.tar.gz |
Merge pull request #1832 from RincewindsHat/gnulib_update_2023
Gnulib update 2023 and attendant fixes
Diffstat (limited to 'gl/m4/stdint.m4')
-rw-r--r-- | gl/m4/stdint.m4 | 169 |
1 files changed, 108 insertions, 61 deletions
diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4 index 27cdcdb..d6961b0 100644 --- a/gl/m4/stdint.m4 +++ b/gl/m4/stdint.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # stdint.m4 serial 43 | 1 | # stdint.m4 serial 61 |
2 | dnl Copyright (C) 2001-2013 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2001-2023 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -7,25 +7,22 @@ dnl with or without modifications, as long as this notice is preserved. | |||
7 | dnl From Paul Eggert and Bruno Haible. | 7 | dnl From Paul Eggert and Bruno Haible. |
8 | dnl Test whether <stdint.h> is supported or must be substituted. | 8 | dnl Test whether <stdint.h> is supported or must be substituted. |
9 | 9 | ||
10 | AC_PREREQ([2.61]) | ||
11 | |||
10 | AC_DEFUN_ONCE([gl_STDINT_H], | 12 | AC_DEFUN_ONCE([gl_STDINT_H], |
11 | [ | 13 | [ |
12 | AC_PREREQ([2.59])dnl | 14 | AC_PREREQ([2.59])dnl |
15 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
13 | 16 | ||
14 | dnl Check for long long int and unsigned long long int. | 17 | AC_REQUIRE([gl_LIMITS_H]) |
15 | AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) | 18 | AC_REQUIRE([gt_TYPE_WINT_T]) |
16 | if test $ac_cv_type_long_long_int = yes; then | 19 | |
17 | HAVE_LONG_LONG_INT=1 | 20 | dnl For backward compatibility. Some packages may still be testing these |
18 | else | 21 | dnl macros. |
19 | HAVE_LONG_LONG_INT=0 | 22 | AC_DEFINE([HAVE_LONG_LONG_INT], [1], |
20 | fi | 23 | [Define to 1 if the system has the type 'long long int'.]) |
21 | AC_SUBST([HAVE_LONG_LONG_INT]) | 24 | AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], |
22 | AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) | 25 | [Define to 1 if the system has the type 'unsigned long long int'.]) |
23 | if test $ac_cv_type_unsigned_long_long_int = yes; then | ||
24 | HAVE_UNSIGNED_LONG_LONG_INT=1 | ||
25 | else | ||
26 | HAVE_UNSIGNED_LONG_LONG_INT=0 | ||
27 | fi | ||
28 | AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT]) | ||
29 | 26 | ||
30 | dnl Check for <wchar.h>, in the same way as gl_WCHAR_H does. | 27 | dnl Check for <wchar.h>, in the same way as gl_WCHAR_H does. |
31 | AC_CHECK_HEADERS_ONCE([wchar.h]) | 28 | AC_CHECK_HEADERS_ONCE([wchar.h]) |
@@ -37,7 +34,7 @@ AC_DEFUN_ONCE([gl_STDINT_H], | |||
37 | AC_SUBST([HAVE_WCHAR_H]) | 34 | AC_SUBST([HAVE_WCHAR_H]) |
38 | 35 | ||
39 | dnl Check for <inttypes.h>. | 36 | dnl Check for <inttypes.h>. |
40 | dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h. | 37 | AC_CHECK_HEADERS_ONCE([inttypes.h]) |
41 | if test $ac_cv_header_inttypes_h = yes; then | 38 | if test $ac_cv_header_inttypes_h = yes; then |
42 | HAVE_INTTYPES_H=1 | 39 | HAVE_INTTYPES_H=1 |
43 | else | 40 | else |
@@ -46,7 +43,7 @@ AC_DEFUN_ONCE([gl_STDINT_H], | |||
46 | AC_SUBST([HAVE_INTTYPES_H]) | 43 | AC_SUBST([HAVE_INTTYPES_H]) |
47 | 44 | ||
48 | dnl Check for <sys/types.h>. | 45 | dnl Check for <sys/types.h>. |
49 | dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h. | 46 | AC_CHECK_HEADERS_ONCE([sys/types.h]) |
50 | if test $ac_cv_header_sys_types_h = yes; then | 47 | if test $ac_cv_header_sys_types_h = yes; then |
51 | HAVE_SYS_TYPES_H=1 | 48 | HAVE_SYS_TYPES_H=1 |
52 | else | 49 | else |
@@ -70,6 +67,8 @@ AC_DEFUN_ONCE([gl_STDINT_H], | |||
70 | AC_COMPILE_IFELSE([ | 67 | AC_COMPILE_IFELSE([ |
71 | AC_LANG_PROGRAM([[ | 68 | AC_LANG_PROGRAM([[ |
72 | #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ | 69 | #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ |
70 | #define __STDC_CONSTANT_MACROS 1 | ||
71 | #define __STDC_LIMIT_MACROS 1 | ||
73 | #include <stdint.h> | 72 | #include <stdint.h> |
74 | /* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */ | 73 | /* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */ |
75 | #if !(defined WCHAR_MIN && defined WCHAR_MAX) | 74 | #if !(defined WCHAR_MIN && defined WCHAR_MAX) |
@@ -150,6 +149,15 @@ uintptr_t h = UINTPTR_MAX; | |||
150 | intmax_t i = INTMAX_MAX; | 149 | intmax_t i = INTMAX_MAX; |
151 | uintmax_t j = UINTMAX_MAX; | 150 | uintmax_t j = UINTMAX_MAX; |
152 | 151 | ||
152 | /* Check that SIZE_MAX has the correct type, if possible. */ | ||
153 | #if 201112 <= __STDC_VERSION__ | ||
154 | int k = _Generic (SIZE_MAX, size_t: 0); | ||
155 | #elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ | ||
156 | || (0x5110 <= __SUNPRO_C && !__STDC__)) | ||
157 | extern size_t k; | ||
158 | extern __typeof__ (SIZE_MAX) k; | ||
159 | #endif | ||
160 | |||
153 | #include <limits.h> /* for CHAR_BIT */ | 161 | #include <limits.h> /* for CHAR_BIT */ |
154 | #define TYPE_MINIMUM(t) \ | 162 | #define TYPE_MINIMUM(t) \ |
155 | ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) | 163 | ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) |
@@ -162,7 +170,7 @@ struct s { | |||
162 | PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) | 170 | PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) |
163 | && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) | 171 | && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) |
164 | ? 1 : -1; | 172 | ? 1 : -1; |
165 | /* Detect bug in FreeBSD 6.0 / ia64. */ | 173 | /* Detect bug in FreeBSD 6.0/ia64 and FreeBSD 13.0/arm64. */ |
166 | int check_SIG_ATOMIC: | 174 | int check_SIG_ATOMIC: |
167 | SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) | 175 | SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) |
168 | && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) | 176 | && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) |
@@ -218,6 +226,8 @@ struct s { | |||
218 | AC_RUN_IFELSE([ | 226 | AC_RUN_IFELSE([ |
219 | AC_LANG_PROGRAM([[ | 227 | AC_LANG_PROGRAM([[ |
220 | #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ | 228 | #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ |
229 | #define __STDC_CONSTANT_MACROS 1 | ||
230 | #define __STDC_LIMIT_MACROS 1 | ||
221 | #include <stdint.h> | 231 | #include <stdint.h> |
222 | ] | 232 | ] |
223 | gl_STDINT_INCLUDES | 233 | gl_STDINT_INCLUDES |
@@ -272,36 +282,88 @@ static const char *macro_values[] = | |||
272 | ]])], | 282 | ]])], |
273 | [gl_cv_header_working_stdint_h=yes], | 283 | [gl_cv_header_working_stdint_h=yes], |
274 | [], | 284 | [], |
275 | [dnl When cross-compiling, assume it works. | 285 | [case "$host_os" in |
276 | gl_cv_header_working_stdint_h=yes | 286 | # Guess yes on native Windows. |
287 | mingw*) gl_cv_header_working_stdint_h="guessing yes" ;; | ||
288 | # In general, assume it works. | ||
289 | *) gl_cv_header_working_stdint_h="guessing yes" ;; | ||
290 | esac | ||
277 | ]) | 291 | ]) |
278 | ]) | 292 | ]) |
279 | ]) | 293 | ]) |
280 | fi | 294 | fi |
281 | if test "$gl_cv_header_working_stdint_h" = yes; then | ||
282 | STDINT_H= | ||
283 | else | ||
284 | dnl Check for <sys/inttypes.h>, and for | ||
285 | dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5). | ||
286 | AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) | ||
287 | if test $ac_cv_header_sys_inttypes_h = yes; then | ||
288 | HAVE_SYS_INTTYPES_H=1 | ||
289 | else | ||
290 | HAVE_SYS_INTTYPES_H=0 | ||
291 | fi | ||
292 | AC_SUBST([HAVE_SYS_INTTYPES_H]) | ||
293 | if test $ac_cv_header_sys_bitypes_h = yes; then | ||
294 | HAVE_SYS_BITYPES_H=1 | ||
295 | else | ||
296 | HAVE_SYS_BITYPES_H=0 | ||
297 | fi | ||
298 | AC_SUBST([HAVE_SYS_BITYPES_H]) | ||
299 | 295 | ||
300 | gl_STDINT_TYPE_PROPERTIES | 296 | HAVE_C99_STDINT_H=0 |
301 | STDINT_H=stdint.h | 297 | HAVE_SYS_BITYPES_H=0 |
302 | fi | 298 | HAVE_SYS_INTTYPES_H=0 |
303 | AC_SUBST([STDINT_H]) | 299 | GL_GENERATE_STDINT_H=true |
304 | AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"]) | 300 | case "$gl_cv_header_working_stdint_h" in |
301 | *yes) | ||
302 | HAVE_C99_STDINT_H=1 | ||
303 | dnl Now see whether the system <stdint.h> works without | ||
304 | dnl __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS defined. | ||
305 | dnl If not, there would be problems when stdint.h is included from C++. | ||
306 | AC_CACHE_CHECK([whether stdint.h works without ISO C predefines], | ||
307 | [gl_cv_header_stdint_without_STDC_macros], | ||
308 | [gl_cv_header_stdint_without_STDC_macros=no | ||
309 | AC_COMPILE_IFELSE([ | ||
310 | AC_LANG_PROGRAM([[ | ||
311 | #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ | ||
312 | #include <stdint.h> | ||
313 | ] | ||
314 | gl_STDINT_INCLUDES | ||
315 | [ | ||
316 | intmax_t im = INTMAX_MAX; | ||
317 | int32_t i32 = INT32_C (0x7fffffff); | ||
318 | ]])], | ||
319 | [gl_cv_header_stdint_without_STDC_macros=yes]) | ||
320 | ]) | ||
321 | |||
322 | if test $gl_cv_header_stdint_without_STDC_macros = no; then | ||
323 | AC_DEFINE([__STDC_CONSTANT_MACROS], [1], | ||
324 | [Define to 1 if the system <stdint.h> predates C++11.]) | ||
325 | AC_DEFINE([__STDC_LIMIT_MACROS], [1], | ||
326 | [Define to 1 if the system <stdint.h> predates C++11.]) | ||
327 | fi | ||
328 | AC_CACHE_CHECK([whether stdint.h has UINTMAX_WIDTH etc.], | ||
329 | [gl_cv_header_stdint_width], | ||
330 | [gl_cv_header_stdint_width=no | ||
331 | AC_COMPILE_IFELSE( | ||
332 | [AC_LANG_PROGRAM([[ | ||
333 | /* Work if build is not clean. */ | ||
334 | #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 | ||
335 | #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ | ||
336 | #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 | ||
337 | #endif | ||
338 | #include <stdint.h> | ||
339 | ]gl_STDINT_INCLUDES[ | ||
340 | int iw = UINTMAX_WIDTH; | ||
341 | ]])], | ||
342 | [gl_cv_header_stdint_width=yes])]) | ||
343 | if test "$gl_cv_header_stdint_width" = yes; then | ||
344 | GL_GENERATE_STDINT_H=false | ||
345 | fi | ||
346 | ;; | ||
347 | *) | ||
348 | dnl Check for <sys/inttypes.h>, and for | ||
349 | dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5). | ||
350 | AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) | ||
351 | if test $ac_cv_header_sys_inttypes_h = yes; then | ||
352 | HAVE_SYS_INTTYPES_H=1 | ||
353 | fi | ||
354 | if test $ac_cv_header_sys_bitypes_h = yes; then | ||
355 | HAVE_SYS_BITYPES_H=1 | ||
356 | fi | ||
357 | gl_STDINT_TYPE_PROPERTIES | ||
358 | ;; | ||
359 | esac | ||
360 | |||
361 | dnl The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH. | ||
362 | gl_REPLACE_LIMITS_H | ||
363 | |||
364 | AC_SUBST([HAVE_C99_STDINT_H]) | ||
365 | AC_SUBST([HAVE_SYS_BITYPES_H]) | ||
366 | AC_SUBST([HAVE_SYS_INTTYPES_H]) | ||
305 | ]) | 367 | ]) |
306 | 368 | ||
307 | dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) | 369 | dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) |
@@ -429,13 +491,9 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX], | |||
429 | dnl gl_STDINT_INCLUDES | 491 | dnl gl_STDINT_INCLUDES |
430 | AC_DEFUN([gl_STDINT_INCLUDES], | 492 | AC_DEFUN([gl_STDINT_INCLUDES], |
431 | [[ | 493 | [[ |
432 | /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
433 | included before <wchar.h>. */ | ||
434 | #include <stddef.h> | 494 | #include <stddef.h> |
435 | #include <signal.h> | 495 | #include <signal.h> |
436 | #if HAVE_WCHAR_H | 496 | #if HAVE_WCHAR_H |
437 | # include <stdio.h> | ||
438 | # include <time.h> | ||
439 | # include <wchar.h> | 497 | # include <wchar.h> |
440 | #endif | 498 | #endif |
441 | ]]) | 499 | ]]) |
@@ -467,18 +525,7 @@ AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], | |||
467 | dnl requirement that wint_t is "unchanged by default argument promotions". | 525 | dnl requirement that wint_t is "unchanged by default argument promotions". |
468 | dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t. | 526 | dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t. |
469 | dnl Set the variable BITSIZEOF_WINT_T accordingly. | 527 | dnl Set the variable BITSIZEOF_WINT_T accordingly. |
470 | if test $BITSIZEOF_WINT_T -lt 32; then | 528 | if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then |
471 | BITSIZEOF_WINT_T=32 | 529 | BITSIZEOF_WINT_T=32 |
472 | fi | 530 | fi |
473 | ]) | 531 | ]) |
474 | |||
475 | dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. | ||
476 | dnl Remove this when we can assume autoconf >= 2.61. | ||
477 | m4_ifdef([AC_COMPUTE_INT], [], [ | ||
478 | AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) | ||
479 | ]) | ||
480 | |||
481 | # Hey Emacs! | ||
482 | # Local Variables: | ||
483 | # indent-tabs-mode: nil | ||
484 | # End: | ||