summaryrefslogtreecommitdiffstats
path: root/gl/m4/printf.m4
diff options
context:
space:
mode:
authorKristian Schuster <116557017+KriSchu@users.noreply.github.com>2023-02-19 22:49:18 (GMT)
committerKristian Schuster <116557017+KriSchu@users.noreply.github.com>2023-02-19 22:49:18 (GMT)
commita0d42777217296c0a7bdb1e1be8d8f6de1b24dd7 (patch)
tree8effe94c57b2f9796ba36090b07551baa8f1e1cb /gl/m4/printf.m4
parentca3d59cd6918c9e2739e783b721d4c1122640fd3 (diff)
parentc07206f2ccc2356aa74bc6813a94c2190017d44e (diff)
downloadmonitoring-plugins-a0d42777217296c0a7bdb1e1be8d8f6de1b24dd7.tar.gz
Merge remote-tracking branch 'origin/master' into feature_check_disk_add_ignore_missing_option
Diffstat (limited to 'gl/m4/printf.m4')
-rw-r--r--gl/m4/printf.m4490
1 files changed, 324 insertions, 166 deletions
diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4
index ef44f78..4e65abc 100644
--- a/gl/m4/printf.m4
+++ b/gl/m4/printf.m4
@@ -1,5 +1,5 @@
1# printf.m4 serial 50 1# printf.m4 serial 73
2dnl Copyright (C) 2003, 2007-2013 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2007-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -38,6 +38,8 @@ int main ()
38 if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 38 if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0
39 || strcmp (buf, "12345671 33") != 0) 39 || strcmp (buf, "12345671 33") != 0)
40 result |= 1; 40 result |= 1;
41#else
42 result |= 1;
41#endif 43#endif
42 buf[0] = '\0'; 44 buf[0] = '\0';
43 if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 45 if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0
@@ -56,13 +58,16 @@ int main ()
56 [gl_cv_func_printf_sizes_c99=yes], 58 [gl_cv_func_printf_sizes_c99=yes],
57 [gl_cv_func_printf_sizes_c99=no], 59 [gl_cv_func_printf_sizes_c99=no],
58 [ 60 [
59changequote(,)dnl
60 case "$host_os" in 61 case "$host_os" in
62changequote(,)dnl
61 # Guess yes on glibc systems. 63 # Guess yes on glibc systems.
62 *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; 64 *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";;
65 # Guess yes on musl systems.
66 *-musl*) gl_cv_func_printf_sizes_c99="guessing yes";;
63 # Guess yes on FreeBSD >= 5. 67 # Guess yes on FreeBSD >= 5.
64 freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";; 68 freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";;
65 freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; 69 freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
70 midnightbsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
66 # Guess yes on Mac OS X >= 10.3. 71 # Guess yes on Mac OS X >= 10.3.
67 darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; 72 darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";;
68 darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; 73 darwin*) gl_cv_func_printf_sizes_c99="guessing yes";;
@@ -77,10 +82,21 @@ changequote(,)dnl
77 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) 82 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
78 gl_cv_func_printf_sizes_c99="guessing no";; 83 gl_cv_func_printf_sizes_c99="guessing no";;
79 netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; 84 netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
80 # If we don't know, assume the worst. 85 # Guess yes on Android.
81 *) gl_cv_func_printf_sizes_c99="guessing no";; 86 linux*-android*) gl_cv_func_printf_sizes_c99="guessing yes";;
82 esac
83changequote([,])dnl 87changequote([,])dnl
88 # Guess yes on MSVC, no on mingw.
89 mingw*) AC_EGREP_CPP([Known], [
90#ifdef _MSC_VER
91 Known
92#endif
93 ],
94 [gl_cv_func_printf_sizes_c99="guessing yes"],
95 [gl_cv_func_printf_sizes_c99="guessing no"])
96 ;;
97 # If we don't know, obey --enable-cross-guesses.
98 *) gl_cv_func_printf_sizes_c99="$gl_cross_guess_normal";;
99 esac
84 ]) 100 ])
85 ]) 101 ])
86]) 102])
@@ -120,14 +136,22 @@ int main ()
120}]])], 136}]])],
121 [gl_cv_func_printf_long_double=yes], 137 [gl_cv_func_printf_long_double=yes],
122 [gl_cv_func_printf_long_double=no], 138 [gl_cv_func_printf_long_double=no],
123 [ 139 [case "$host_os" in
124changequote(,)dnl 140 # Guess no on BeOS.
125 case "$host_os" in 141 beos*) gl_cv_func_printf_long_double="guessing no";;
126 beos*) gl_cv_func_printf_long_double="guessing no";; 142 # Guess yes on Android.
127 mingw* | pw*) gl_cv_func_printf_long_double="guessing no";; 143 linux*-android*) gl_cv_func_printf_long_double="guessing yes";;
128 *) gl_cv_func_printf_long_double="guessing yes";; 144 # Guess yes on MSVC, no on mingw.
145 mingw*) AC_EGREP_CPP([Known], [
146#ifdef _MSC_VER
147 Known
148#endif
149 ],
150 [gl_cv_func_printf_long_double="guessing yes"],
151 [gl_cv_func_printf_long_double="guessing no"])
152 ;;
153 *) gl_cv_func_printf_long_double="guessing yes";;
129 esac 154 esac
130changequote([,])dnl
131 ]) 155 ])
132 ]) 156 ])
133]) 157])
@@ -215,13 +239,16 @@ int main ()
215 [gl_cv_func_printf_infinite=yes], 239 [gl_cv_func_printf_infinite=yes],
216 [gl_cv_func_printf_infinite=no], 240 [gl_cv_func_printf_infinite=no],
217 [ 241 [
218changequote(,)dnl
219 case "$host_os" in 242 case "$host_os" in
243changequote(,)dnl
220 # Guess yes on glibc systems. 244 # Guess yes on glibc systems.
221 *-gnu*) gl_cv_func_printf_infinite="guessing yes";; 245 *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";;
246 # Guess yes on musl systems.
247 *-musl*) gl_cv_func_printf_infinite="guessing yes";;
222 # Guess yes on FreeBSD >= 6. 248 # Guess yes on FreeBSD >= 6.
223 freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";; 249 freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";;
224 freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; 250 freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";;
251 midnightbsd*) gl_cv_func_printf_infinite="guessing yes";;
225 # Guess yes on Mac OS X >= 10.3. 252 # Guess yes on Mac OS X >= 10.3.
226 darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; 253 darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";;
227 darwin*) gl_cv_func_printf_infinite="guessing yes";; 254 darwin*) gl_cv_func_printf_infinite="guessing yes";;
@@ -232,12 +259,26 @@ changequote(,)dnl
232 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) 259 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
233 gl_cv_func_printf_infinite="guessing no";; 260 gl_cv_func_printf_infinite="guessing no";;
234 netbsd*) gl_cv_func_printf_infinite="guessing yes";; 261 netbsd*) gl_cv_func_printf_infinite="guessing yes";;
262 # Guess yes on OpenBSD >= 6.0.
263 openbsd[1-5].*) gl_cv_func_printf_infinite="guessing no";;
264 openbsd*) gl_cv_func_printf_infinite="guessing yes";;
235 # Guess yes on BeOS. 265 # Guess yes on BeOS.
236 beos*) gl_cv_func_printf_infinite="guessing yes";; 266 beos*) gl_cv_func_printf_infinite="guessing yes";;
237 # If we don't know, assume the worst. 267 # Guess no on Android.
238 *) gl_cv_func_printf_infinite="guessing no";; 268 linux*-android*) gl_cv_func_printf_infinite="guessing no";;
239 esac
240changequote([,])dnl 269changequote([,])dnl
270 # Guess yes on MSVC, no on mingw.
271 mingw*) AC_EGREP_CPP([Known], [
272#ifdef _MSC_VER
273 Known
274#endif
275 ],
276 [gl_cv_func_printf_infinite="guessing yes"],
277 [gl_cv_func_printf_infinite="guessing no"])
278 ;;
279 # If we don't know, obey --enable-cross-guesses.
280 *) gl_cv_func_printf_infinite="$gl_cross_guess_normal";;
281 esac
241 ]) 282 ])
242 ]) 283 ])
243]) 284])
@@ -328,7 +369,7 @@ int main ()
328# ifdef WORDS_BIGENDIAN 369# ifdef WORDS_BIGENDIAN
329# define LDBL80_WORDS(exponent,manthi,mantlo) \ 370# define LDBL80_WORDS(exponent,manthi,mantlo) \
330 { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ 371 { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \
331 ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16), \ 372 ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16), \
332 (unsigned int) (mantlo) << 16 \ 373 (unsigned int) (mantlo) << 16 \
333 } 374 }
334# else 375# else
@@ -365,66 +406,51 @@ int main ()
365 { /* Pseudo-NaN. */ 406 { /* Pseudo-NaN. */
366 static union { unsigned int word[4]; long double value; } x = 407 static union { unsigned int word[4]; long double value; } x =
367 { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; 408 { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
368 if (sprintf (buf, "%Lf", x.value) < 0 409 if (sprintf (buf, "%Lf", x.value) <= 0)
369 || !strisnan (buf, 0, strlen (buf)))
370 result |= 4; 410 result |= 4;
371 if (sprintf (buf, "%Le", x.value) < 0 411 if (sprintf (buf, "%Le", x.value) <= 0)
372 || !strisnan (buf, 0, strlen (buf)))
373 result |= 4; 412 result |= 4;
374 if (sprintf (buf, "%Lg", x.value) < 0 413 if (sprintf (buf, "%Lg", x.value) <= 0)
375 || !strisnan (buf, 0, strlen (buf)))
376 result |= 4; 414 result |= 4;
377 } 415 }
378 { /* Pseudo-Infinity. */ 416 { /* Pseudo-Infinity. */
379 static union { unsigned int word[4]; long double value; } x = 417 static union { unsigned int word[4]; long double value; } x =
380 { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; 418 { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
381 if (sprintf (buf, "%Lf", x.value) < 0 419 if (sprintf (buf, "%Lf", x.value) <= 0)
382 || !strisnan (buf, 0, strlen (buf)))
383 result |= 8; 420 result |= 8;
384 if (sprintf (buf, "%Le", x.value) < 0 421 if (sprintf (buf, "%Le", x.value) <= 0)
385 || !strisnan (buf, 0, strlen (buf)))
386 result |= 8; 422 result |= 8;
387 if (sprintf (buf, "%Lg", x.value) < 0 423 if (sprintf (buf, "%Lg", x.value) <= 0)
388 || !strisnan (buf, 0, strlen (buf)))
389 result |= 8; 424 result |= 8;
390 } 425 }
391 { /* Pseudo-Zero. */ 426 { /* Pseudo-Zero. */
392 static union { unsigned int word[4]; long double value; } x = 427 static union { unsigned int word[4]; long double value; } x =
393 { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; 428 { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
394 if (sprintf (buf, "%Lf", x.value) < 0 429 if (sprintf (buf, "%Lf", x.value) <= 0)
395 || !strisnan (buf, 0, strlen (buf)))
396 result |= 16; 430 result |= 16;
397 if (sprintf (buf, "%Le", x.value) < 0 431 if (sprintf (buf, "%Le", x.value) <= 0)
398 || !strisnan (buf, 0, strlen (buf)))
399 result |= 16; 432 result |= 16;
400 if (sprintf (buf, "%Lg", x.value) < 0 433 if (sprintf (buf, "%Lg", x.value) <= 0)
401 || !strisnan (buf, 0, strlen (buf)))
402 result |= 16; 434 result |= 16;
403 } 435 }
404 { /* Unnormalized number. */ 436 { /* Unnormalized number. */
405 static union { unsigned int word[4]; long double value; } x = 437 static union { unsigned int word[4]; long double value; } x =
406 { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; 438 { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
407 if (sprintf (buf, "%Lf", x.value) < 0 439 if (sprintf (buf, "%Lf", x.value) <= 0)
408 || !strisnan (buf, 0, strlen (buf)))
409 result |= 32; 440 result |= 32;
410 if (sprintf (buf, "%Le", x.value) < 0 441 if (sprintf (buf, "%Le", x.value) <= 0)
411 || !strisnan (buf, 0, strlen (buf)))
412 result |= 32; 442 result |= 32;
413 if (sprintf (buf, "%Lg", x.value) < 0 443 if (sprintf (buf, "%Lg", x.value) <= 0)
414 || !strisnan (buf, 0, strlen (buf)))
415 result |= 32; 444 result |= 32;
416 } 445 }
417 { /* Pseudo-Denormal. */ 446 { /* Pseudo-Denormal. */
418 static union { unsigned int word[4]; long double value; } x = 447 static union { unsigned int word[4]; long double value; } x =
419 { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; 448 { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
420 if (sprintf (buf, "%Lf", x.value) < 0 449 if (sprintf (buf, "%Lf", x.value) <= 0)
421 || !strisnan (buf, 0, strlen (buf)))
422 result |= 64; 450 result |= 64;
423 if (sprintf (buf, "%Le", x.value) < 0 451 if (sprintf (buf, "%Le", x.value) <= 0)
424 || !strisnan (buf, 0, strlen (buf)))
425 result |= 64; 452 result |= 64;
426 if (sprintf (buf, "%Lg", x.value) < 0 453 if (sprintf (buf, "%Lg", x.value) <= 0)
427 || !strisnan (buf, 0, strlen (buf)))
428 result |= 64; 454 result |= 64;
429 } 455 }
430#endif 456#endif
@@ -432,27 +458,43 @@ int main ()
432}]])], 458}]])],
433 [gl_cv_func_printf_infinite_long_double=yes], 459 [gl_cv_func_printf_infinite_long_double=yes],
434 [gl_cv_func_printf_infinite_long_double=no], 460 [gl_cv_func_printf_infinite_long_double=no],
435 [ 461 [case "$host_cpu" in
436changequote(,)dnl
437 case "$host_cpu" in
438 # Guess no on ia64, x86_64, i386. 462 # Guess no on ia64, x86_64, i386.
439 ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; 463 ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";;
440 *) 464 *)
441 case "$host_os" in 465 case "$host_os" in
466changequote(,)dnl
442 # Guess yes on glibc systems. 467 # Guess yes on glibc systems.
443 *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; 468 *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";;
469 # Guess yes on musl systems.
470 *-musl*) gl_cv_func_printf_infinite_long_double="guessing yes";;
444 # Guess yes on FreeBSD >= 6. 471 # Guess yes on FreeBSD >= 6.
445 freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";; 472 freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";;
446 freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; 473 freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
474 midnightbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
447 # Guess yes on HP-UX >= 11. 475 # Guess yes on HP-UX >= 11.
448 hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; 476 hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";;
449 hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; 477 hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";;
450 # If we don't know, assume the worst. 478 # Guess yes on OpenBSD >= 6.0.
451 *) gl_cv_func_printf_infinite_long_double="guessing no";; 479 openbsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";;
480 openbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
481 # Guess no on Android.
482 linux*-android*) gl_cv_func_printf_infinite_long_double="guessing no";;
483changequote([,])dnl
484 # Guess yes on MSVC, no on mingw.
485 mingw*) AC_EGREP_CPP([Known], [
486#ifdef _MSC_VER
487 Known
488#endif
489 ],
490 [gl_cv_func_printf_infinite_long_double="guessing yes"],
491 [gl_cv_func_printf_infinite_long_double="guessing no"])
492 ;;
493 # If we don't know, obey --enable-cross-guesses.
494 *) gl_cv_func_printf_infinite_long_double="$gl_cross_guess_normal";;
452 esac 495 esac
453 ;; 496 ;;
454 esac 497 esac
455changequote([,])dnl
456 ]) 498 ])
457 ]) 499 ])
458 ;; 500 ;;
@@ -495,15 +537,22 @@ int main ()
495 && strcmp (buf, "-0X6.488P-1 33") != 0 537 && strcmp (buf, "-0X6.488P-1 33") != 0
496 && strcmp (buf, "-0XC.91P-2 33") != 0)) 538 && strcmp (buf, "-0XC.91P-2 33") != 0))
497 result |= 2; 539 result |= 2;
498 /* This catches a FreeBSD 6.1 bug: it doesn't round. */ 540 /* This catches a FreeBSD 13.0 bug: it doesn't round. */
499 if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 541 if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0
500 || (strcmp (buf, "0x1.83p+0 33") != 0 542 || (strcmp (buf, "0x1.83p+0 33") != 0
501 && strcmp (buf, "0x3.05p-1 33") != 0 543 && strcmp (buf, "0x3.05p-1 33") != 0
502 && strcmp (buf, "0x6.0ap-2 33") != 0 544 && strcmp (buf, "0x6.0ap-2 33") != 0
503 && strcmp (buf, "0xc.14p-3 33") != 0)) 545 && strcmp (buf, "0xc.14p-3 33") != 0))
504 result |= 4; 546 result |= 4;
547 /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */
548 if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0
549 || (strcmp (buf, "0x2p+0 33") != 0
550 && strcmp (buf, "0x3p-1 33") != 0
551 && strcmp (buf, "0x6p-2 33") != 0
552 && strcmp (buf, "0xcp-3 33") != 0))
553 result |= 4;
505 /* This catches a FreeBSD 6.1 bug. See 554 /* This catches a FreeBSD 6.1 bug. See
506 <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */ 555 <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */
507 if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 556 if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0
508 || buf[0] == '0') 557 || buf[0] == '0')
509 result |= 8; 558 result |= 8;
@@ -515,7 +564,7 @@ int main ()
515 && strcmp (buf, "0x8.0p-2") != 0)) 564 && strcmp (buf, "0x8.0p-2") != 0))
516 result |= 16; 565 result |= 16;
517 /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a 566 /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a
518 glibc 2.4 bug <http://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */ 567 glibc 2.4 bug <https://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */
519 if (sprintf (buf, "%.1La", 1.999L) < 0 568 if (sprintf (buf, "%.1La", 1.999L) < 0
520 || (strcmp (buf, "0x1.0p+1") != 0 569 || (strcmp (buf, "0x1.0p+1") != 0
521 && strcmp (buf, "0x2.0p+0") != 0 570 && strcmp (buf, "0x2.0p+0") != 0
@@ -529,7 +578,7 @@ int main ()
529 [ 578 [
530 case "$host_os" in 579 case "$host_os" in
531 # Guess yes on glibc >= 2.5 systems. 580 # Guess yes on glibc >= 2.5 systems.
532 *-gnu*) 581 *-gnu* | gnu*)
533 AC_EGREP_CPP([BZ2908], [ 582 AC_EGREP_CPP([BZ2908], [
534 #include <features.h> 583 #include <features.h>
535 #ifdef __GNU_LIBRARY__ 584 #ifdef __GNU_LIBRARY__
@@ -541,8 +590,14 @@ int main ()
541 [gl_cv_func_printf_directive_a="guessing yes"], 590 [gl_cv_func_printf_directive_a="guessing yes"],
542 [gl_cv_func_printf_directive_a="guessing no"]) 591 [gl_cv_func_printf_directive_a="guessing no"])
543 ;; 592 ;;
544 # If we don't know, assume the worst. 593 # Guess yes on musl systems.
545 *) gl_cv_func_printf_directive_a="guessing no";; 594 *-musl*) gl_cv_func_printf_directive_a="guessing yes";;
595 # Guess no on Android.
596 linux*-android*) gl_cv_func_printf_directive_a="guessing no";;
597 # Guess no on native Windows.
598 mingw*) gl_cv_func_printf_directive_a="guessing no";;
599 # If we don't know, obey --enable-cross-guesses.
600 *) gl_cv_func_printf_directive_a="$gl_cross_guess_normal";;
546 esac 601 esac
547 ]) 602 ])
548 ]) 603 ])
@@ -583,23 +638,40 @@ int main ()
583 [gl_cv_func_printf_directive_f=yes], 638 [gl_cv_func_printf_directive_f=yes],
584 [gl_cv_func_printf_directive_f=no], 639 [gl_cv_func_printf_directive_f=no],
585 [ 640 [
586changequote(,)dnl
587 case "$host_os" in 641 case "$host_os" in
642changequote(,)dnl
588 # Guess yes on glibc systems. 643 # Guess yes on glibc systems.
589 *-gnu*) gl_cv_func_printf_directive_f="guessing yes";; 644 *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";;
645 # Guess yes on musl systems.
646 *-musl*) gl_cv_func_printf_directive_f="guessing yes";;
590 # Guess yes on FreeBSD >= 6. 647 # Guess yes on FreeBSD >= 6.
591 freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";; 648 freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";;
592 freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; 649 freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";;
650 midnightbsd*) gl_cv_func_printf_directive_f="guessing yes";;
593 # Guess yes on Mac OS X >= 10.3. 651 # Guess yes on Mac OS X >= 10.3.
594 darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; 652 darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";;
595 darwin*) gl_cv_func_printf_directive_f="guessing yes";; 653 darwin*) gl_cv_func_printf_directive_f="guessing yes";;
654 # Guess yes on OpenBSD >= 6.0.
655 openbsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";;
656 openbsd*) gl_cv_func_printf_directive_f="guessing yes";;
596 # Guess yes on Solaris >= 2.10. 657 # Guess yes on Solaris >= 2.10.
597 solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; 658 solaris2.[1-9][0-9]*) gl_cv_func_printf_directive_f="guessing yes";;
598 solaris*) gl_cv_func_printf_sizes_c99="guessing no";; 659 solaris*) gl_cv_func_printf_directive_f="guessing no";;
599 # If we don't know, assume the worst. 660 # Guess no on Android.
600 *) gl_cv_func_printf_directive_f="guessing no";; 661 linux*-android*) gl_cv_func_printf_directive_f="guessing no";;
601 esac
602changequote([,])dnl 662changequote([,])dnl
663 # Guess yes on MSVC, no on mingw.
664 mingw*) AC_EGREP_CPP([Known], [
665#ifdef _MSC_VER
666 Known
667#endif
668 ],
669 [gl_cv_func_printf_directive_f="guessing yes"],
670 [gl_cv_func_printf_directive_f="guessing no"])
671 ;;
672 # If we don't know, obey --enable-cross-guesses.
673 *) gl_cv_func_printf_directive_f="$gl_cross_guess_normal";;
674 esac
603 ]) 675 ])
604 ]) 676 ])
605]) 677])
@@ -621,7 +693,10 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N],
621#include <stdlib.h> 693#include <stdlib.h>
622#include <string.h> 694#include <string.h>
623#ifdef _MSC_VER 695#ifdef _MSC_VER
624/* See page about "Parameter Validation" on msdn.microsoft.com. */ 696#include <inttypes.h>
697/* See page about "Parameter Validation" on msdn.microsoft.com.
698 <https://docs.microsoft.com/en-us/cpp/c-runtime-library/parameter-validation>
699 <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/set-invalid-parameter-handler-set-thread-local-invalid-parameter-handler> */
625static void cdecl 700static void cdecl
626invalid_parameter_handler (const wchar_t *expression, 701invalid_parameter_handler (const wchar_t *expression,
627 const wchar_t *function, 702 const wchar_t *function,
@@ -651,13 +726,23 @@ int main ()
651}]])], 726}]])],
652 [gl_cv_func_printf_directive_n=yes], 727 [gl_cv_func_printf_directive_n=yes],
653 [gl_cv_func_printf_directive_n=no], 728 [gl_cv_func_printf_directive_n=no],
654 [ 729 [case "$host_os" in
655changequote(,)dnl 730 # Guess no on glibc when _FORTIFY_SOURCE >= 2.
656 case "$host_os" in 731 *-gnu* | gnu*) AC_COMPILE_IFELSE(
657 mingw*) gl_cv_func_printf_directive_n="guessing no";; 732 [AC_LANG_SOURCE(
658 *) gl_cv_func_printf_directive_n="guessing yes";; 733 [[#if _FORTIFY_SOURCE >= 2
734 error fail
735 #endif
736 ]])],
737 [gl_cv_func_printf_directive_n="guessing yes"],
738 [gl_cv_func_printf_directive_n="guessing no"])
739 ;;
740 # Guess no on Android.
741 linux*-android*) gl_cv_func_printf_directive_n="guessing no";;
742 # Guess no on native Windows.
743 mingw*) gl_cv_func_printf_directive_n="guessing no";;
744 *) gl_cv_func_printf_directive_n="guessing yes";;
659 esac 745 esac
660changequote([,])dnl
661 ]) 746 ])
662 ]) 747 ])
663]) 748])
@@ -678,13 +763,7 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_LS],
678 [ 763 [
679 AC_RUN_IFELSE( 764 AC_RUN_IFELSE(
680 [AC_LANG_SOURCE([[ 765 [AC_LANG_SOURCE([[
681/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
682 <wchar.h>.
683 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
684 included before <wchar.h>. */
685#include <stddef.h>
686#include <stdio.h> 766#include <stdio.h>
687#include <time.h>
688#include <wchar.h> 767#include <wchar.h>
689#include <string.h> 768#include <string.h>
690int main () 769int main ()
@@ -732,11 +811,17 @@ int main ()
732 [ 811 [
733changequote(,)dnl 812changequote(,)dnl
734 case "$host_os" in 813 case "$host_os" in
735 openbsd*) gl_cv_func_printf_directive_ls="guessing no";; 814 # Guess yes on OpenBSD >= 6.0.
815 openbsd[1-5].*) gl_cv_func_printf_directive_ls="guessing no";;
816 openbsd*) gl_cv_func_printf_directive_ls="guessing yes";;
736 irix*) gl_cv_func_printf_directive_ls="guessing no";; 817 irix*) gl_cv_func_printf_directive_ls="guessing no";;
737 solaris*) gl_cv_func_printf_directive_ls="guessing no";; 818 solaris*) gl_cv_func_printf_directive_ls="guessing no";;
738 cygwin*) gl_cv_func_printf_directive_ls="guessing no";; 819 cygwin*) gl_cv_func_printf_directive_ls="guessing no";;
739 beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; 820 beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";;
821 # Guess no on Android.
822 linux*-android*) gl_cv_func_printf_directive_ls="guessing no";;
823 # Guess yes on native Windows.
824 mingw*) gl_cv_func_printf_directive_ls="guessing yes";;
740 *) gl_cv_func_printf_directive_ls="guessing yes";; 825 *) gl_cv_func_printf_directive_ls="guessing yes";;
741 esac 826 esac
742changequote([,])dnl 827changequote([,])dnl
@@ -774,10 +859,13 @@ int main ()
774changequote(,)dnl 859changequote(,)dnl
775 case "$host_os" in 860 case "$host_os" in
776 netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) 861 netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*)
777 gl_cv_func_printf_positions="guessing no";; 862 gl_cv_func_printf_positions="guessing no";;
778 beos*) gl_cv_func_printf_positions="guessing no";; 863 beos*) gl_cv_func_printf_positions="guessing no";;
779 mingw* | pw*) gl_cv_func_printf_positions="guessing no";; 864 # Guess yes on Android.
780 *) gl_cv_func_printf_positions="guessing yes";; 865 linux*-android*) gl_cv_func_printf_positions="guessing yes";;
866 # Guess no on native Windows.
867 mingw* | pw*) gl_cv_func_printf_positions="guessing no";;
868 *) gl_cv_func_printf_positions="guessing yes";;
781 esac 869 esac
782changequote([,])dnl 870changequote([,])dnl
783 ]) 871 ])
@@ -812,10 +900,13 @@ int main ()
812 [ 900 [
813changequote(,)dnl 901changequote(,)dnl
814 case "$host_os" in 902 case "$host_os" in
815 cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; 903 cygwin*) gl_cv_func_printf_flag_grouping="guessing no";;
816 netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; 904 netbsd*) gl_cv_func_printf_flag_grouping="guessing no";;
817 mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; 905 # Guess no on Android.
818 *) gl_cv_func_printf_flag_grouping="guessing yes";; 906 linux*-android*) gl_cv_func_printf_flag_grouping="guessing no";;
907 # Guess no on native Windows.
908 mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";;
909 *) gl_cv_func_printf_flag_grouping="guessing yes";;
819 esac 910 esac
820changequote([,])dnl 911changequote([,])dnl
821 ]) 912 ])
@@ -824,7 +915,7 @@ changequote([,])dnl
824 915
825dnl Test whether the *printf family of functions supports the - flag correctly. 916dnl Test whether the *printf family of functions supports the - flag correctly.
826dnl (ISO C99.) See 917dnl (ISO C99.) See
827dnl <http://lists.gnu.org/archive/html/bug-coreutils/2008-02/msg00035.html> 918dnl <https://lists.gnu.org/r/bug-coreutils/2008-02/msg00035.html>
828dnl Result is gl_cv_func_printf_flag_leftadjust. 919dnl Result is gl_cv_func_printf_flag_leftadjust.
829 920
830AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST], 921AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST],
@@ -852,12 +943,16 @@ int main ()
852 [ 943 [
853changequote(,)dnl 944changequote(,)dnl
854 case "$host_os" in 945 case "$host_os" in
855 # Guess yes on HP-UX 11. 946 # Guess yes on HP-UX 11.
856 hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; 947 hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";;
857 # Guess no on HP-UX 10 and older. 948 # Guess no on HP-UX 10 and older.
858 hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; 949 hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";;
859 # Guess yes otherwise. 950 # Guess yes on Android.
860 *) gl_cv_func_printf_flag_leftadjust="guessing yes";; 951 linux*-android*) gl_cv_func_printf_flag_leftadjust="guessing yes";;
952 # Guess yes on native Windows.
953 mingw*) gl_cv_func_printf_flag_leftadjust="guessing yes";;
954 # Guess yes otherwise.
955 *) gl_cv_func_printf_flag_leftadjust="guessing yes";;
861 esac 956 esac
862changequote([,])dnl 957changequote([,])dnl
863 ]) 958 ])
@@ -866,7 +961,7 @@ changequote([,])dnl
866 961
867dnl Test whether the *printf family of functions supports padding of non-finite 962dnl Test whether the *printf family of functions supports padding of non-finite
868dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See 963dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See
869dnl <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> 964dnl <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html>
870dnl Result is gl_cv_func_printf_flag_zero. 965dnl Result is gl_cv_func_printf_flag_zero.
871 966
872AC_DEFUN([gl_PRINTF_FLAG_ZERO], 967AC_DEFUN([gl_PRINTF_FLAG_ZERO],
@@ -895,12 +990,18 @@ int main ()
895 [ 990 [
896changequote(,)dnl 991changequote(,)dnl
897 case "$host_os" in 992 case "$host_os" in
898 # Guess yes on glibc systems. 993 # Guess yes on glibc systems.
899 *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";; 994 *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";;
900 # Guess yes on BeOS. 995 # Guess yes on musl systems.
901 beos*) gl_cv_func_printf_flag_zero="guessing yes";; 996 *-musl*) gl_cv_func_printf_flag_zero="guessing yes";;
902 # If we don't know, assume the worst. 997 # Guess yes on BeOS.
903 *) gl_cv_func_printf_flag_zero="guessing no";; 998 beos*) gl_cv_func_printf_flag_zero="guessing yes";;
999 # Guess no on Android.
1000 linux*-android*) gl_cv_func_printf_flag_zero="guessing no";;
1001 # Guess no on native Windows.
1002 mingw*) gl_cv_func_printf_flag_zero="guessing no";;
1003 # If we don't know, obey --enable-cross-guesses.
1004 *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";;
904 esac 1005 esac
905changequote([,])dnl 1006changequote([,])dnl
906 ]) 1007 ])
@@ -953,10 +1054,12 @@ int main ()
953changequote(,)dnl 1054changequote(,)dnl
954 case "$host_os" in 1055 case "$host_os" in
955 # Guess no only on Solaris, native Windows, and BeOS systems. 1056 # Guess no only on Solaris, native Windows, and BeOS systems.
956 solaris*) gl_cv_func_printf_precision="guessing no" ;; 1057 solaris*) gl_cv_func_printf_precision="guessing no" ;;
957 mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; 1058 mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;;
958 beos*) gl_cv_func_printf_precision="guessing no" ;; 1059 beos*) gl_cv_func_printf_precision="guessing no" ;;
959 *) gl_cv_func_printf_precision="guessing yes" ;; 1060 # Guess yes on Android.
1061 linux*-android*) gl_cv_func_printf_precision="guessing yes" ;;
1062 *) gl_cv_func_printf_precision="guessing yes" ;;
960 esac 1063 esac
961changequote([,])dnl 1064changequote([,])dnl
962 ]) 1065 ])
@@ -978,9 +1081,8 @@ AC_DEFUN([gl_PRINTF_ENOMEM],
978 gl_cv_func_printf_enomem="guessing no" 1081 gl_cv_func_printf_enomem="guessing no"
979 if test "$cross_compiling" = no; then 1082 if test "$cross_compiling" = no; then
980 if test $APPLE_UNIVERSAL_BUILD = 0; then 1083 if test $APPLE_UNIVERSAL_BUILD = 0; then
981 AC_LANG_CONFTEST([AC_LANG_SOURCE([ 1084 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
982]GL_NOCRASH[ 1085]GL_NOCRASH[
983changequote(,)dnl
984#include <stdio.h> 1086#include <stdio.h>
985#include <sys/types.h> 1087#include <sys/types.h>
986#include <sys/time.h> 1088#include <sys/time.h>
@@ -1025,8 +1127,7 @@ int main()
1025 ret = printf ("%.5000000f", 1.0); 1127 ret = printf ("%.5000000f", 1.0);
1026 return !(ret == 5000002 || (ret < 0 && errno == ENOMEM)); 1128 return !(ret == 5000002 || (ret < 0 && errno == ENOMEM));
1027} 1129}
1028changequote([,])dnl 1130 ]])])
1029 ])])
1030 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then 1131 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
1031 (./conftest 2>&AS_MESSAGE_LOG_FD 1132 (./conftest 2>&AS_MESSAGE_LOG_FD
1032 result=$? 1133 result=$?
@@ -1053,28 +1154,30 @@ changequote([,])dnl
1053 if test "$gl_cv_func_printf_enomem" = "guessing no"; then 1154 if test "$gl_cv_func_printf_enomem" = "guessing no"; then
1054changequote(,)dnl 1155changequote(,)dnl
1055 case "$host_os" in 1156 case "$host_os" in
1056 # Guess yes on glibc systems. 1157 # Guess yes on glibc systems.
1057 *-gnu*) gl_cv_func_printf_enomem="guessing yes";; 1158 *-gnu* | gnu*) gl_cv_func_printf_enomem="guessing yes";;
1058 # Guess yes on Solaris. 1159 # Guess yes on Solaris.
1059 solaris*) gl_cv_func_printf_enomem="guessing yes";; 1160 solaris*) gl_cv_func_printf_enomem="guessing yes";;
1060 # Guess yes on AIX. 1161 # Guess yes on AIX.
1061 aix*) gl_cv_func_printf_enomem="guessing yes";; 1162 aix*) gl_cv_func_printf_enomem="guessing yes";;
1062 # Guess yes on HP-UX/hppa. 1163 # Guess yes on HP-UX/hppa.
1063 hpux*) case "$host_cpu" in 1164 hpux*) case "$host_cpu" in
1064 hppa*) gl_cv_func_printf_enomem="guessing yes";; 1165 hppa*) gl_cv_func_printf_enomem="guessing yes";;
1065 *) gl_cv_func_printf_enomem="guessing no";; 1166 *) gl_cv_func_printf_enomem="guessing no";;
1066 esac 1167 esac
1067 ;; 1168 ;;
1068 # Guess yes on IRIX. 1169 # Guess yes on IRIX.
1069 irix*) gl_cv_func_printf_enomem="guessing yes";; 1170 irix*) gl_cv_func_printf_enomem="guessing yes";;
1070 # Guess yes on OSF/1. 1171 # Guess yes on OSF/1.
1071 osf*) gl_cv_func_printf_enomem="guessing yes";; 1172 osf*) gl_cv_func_printf_enomem="guessing yes";;
1072 # Guess yes on BeOS. 1173 # Guess yes on BeOS.
1073 beos*) gl_cv_func_printf_enomem="guessing yes";; 1174 beos*) gl_cv_func_printf_enomem="guessing yes";;
1074 # Guess yes on Haiku. 1175 # Guess yes on Haiku.
1075 haiku*) gl_cv_func_printf_enomem="guessing yes";; 1176 haiku*) gl_cv_func_printf_enomem="guessing yes";;
1076 # If we don't know, assume the worst. 1177 # Guess no on Android.
1077 *) gl_cv_func_printf_enomem="guessing no";; 1178 linux*-android*) gl_cv_func_printf_enomem="guessing no";;
1179 # If we don't know, obey --enable-cross-guesses.
1180 *) gl_cv_func_printf_enomem="$gl_cross_guess_normal";;
1078 esac 1181 esac
1079changequote([,])dnl 1182changequote([,])dnl
1080 fi 1183 fi
@@ -1093,7 +1196,7 @@ dnl Test whether the string produced by the snprintf function is always NUL
1093dnl terminated. (ISO C99, POSIX:2001) 1196dnl terminated. (ISO C99, POSIX:2001)
1094dnl Result is gl_cv_func_snprintf_truncation_c99. 1197dnl Result is gl_cv_func_snprintf_truncation_c99.
1095 1198
1096AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99], 1199AC_DEFUN_ONCE([gl_SNPRINTF_TRUNCATION_C99],
1097[ 1200[
1098 AC_REQUIRE([AC_PROG_CC]) 1201 AC_REQUIRE([AC_PROG_CC])
1099 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 1202 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
@@ -1134,10 +1237,13 @@ int main ()
1134changequote(,)dnl 1237changequote(,)dnl
1135 case "$host_os" in 1238 case "$host_os" in
1136 # Guess yes on glibc systems. 1239 # Guess yes on glibc systems.
1137 *-gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1240 *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1241 # Guess yes on musl systems.
1242 *-musl*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1138 # Guess yes on FreeBSD >= 5. 1243 # Guess yes on FreeBSD >= 5.
1139 freebsd[1-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";; 1244 freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";;
1140 freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1245 freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1246 midnightbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1141 # Guess yes on Mac OS X >= 10.3. 1247 # Guess yes on Mac OS X >= 10.3.
1142 darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; 1248 darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";;
1143 darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1249 darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
@@ -1166,8 +1272,12 @@ changequote(,)dnl
1166 netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1272 netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1167 # Guess yes on BeOS. 1273 # Guess yes on BeOS.
1168 beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1274 beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1169 # If we don't know, assume the worst. 1275 # Guess yes on Android.
1170 *) gl_cv_func_snprintf_truncation_c99="guessing no";; 1276 linux*-android*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1277 # Guess no on native Windows.
1278 mingw*) gl_cv_func_snprintf_truncation_c99="guessing no";;
1279 # If we don't know, obey --enable-cross-guesses.
1280 *) gl_cv_func_snprintf_truncation_c99="$gl_cross_guess_normal";;
1171 esac 1281 esac
1172changequote([,])dnl 1282changequote([,])dnl
1173 ]) 1283 ])
@@ -1229,14 +1339,16 @@ int main ()
1229}]])], 1339}]])],
1230 [gl_cv_func_snprintf_retval_c99=yes], 1340 [gl_cv_func_snprintf_retval_c99=yes],
1231 [gl_cv_func_snprintf_retval_c99=no], 1341 [gl_cv_func_snprintf_retval_c99=no],
1232 [ 1342 [case "$host_os" in
1233changequote(,)dnl 1343changequote(,)dnl
1234 case "$host_os" in
1235 # Guess yes on glibc systems. 1344 # Guess yes on glibc systems.
1236 *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; 1345 *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1346 # Guess yes on musl systems.
1347 *-musl*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1237 # Guess yes on FreeBSD >= 5. 1348 # Guess yes on FreeBSD >= 5.
1238 freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";; 1349 freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";;
1239 freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; 1350 freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1351 midnightbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1240 # Guess yes on Mac OS X >= 10.3. 1352 # Guess yes on Mac OS X >= 10.3.
1241 darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; 1353 darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";;
1242 darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; 1354 darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";;
@@ -1256,10 +1368,21 @@ changequote(,)dnl
1256 netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; 1368 netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1257 # Guess yes on BeOS. 1369 # Guess yes on BeOS.
1258 beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; 1370 beos*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1259 # If we don't know, assume the worst. 1371 # Guess yes on Android.
1260 *) gl_cv_func_snprintf_retval_c99="guessing no";; 1372 linux*-android*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1261 esac
1262changequote([,])dnl 1373changequote([,])dnl
1374 # Guess yes on MSVC, no on mingw.
1375 mingw*) AC_EGREP_CPP([Known], [
1376#ifdef _MSC_VER
1377 Known
1378#endif
1379 ],
1380 [gl_cv_func_snprintf_retval_c99="guessing yes"],
1381 [gl_cv_func_snprintf_retval_c99="guessing no"])
1382 ;;
1383 # If we don't know, obey --enable-cross-guesses.
1384 *) gl_cv_func_snprintf_retval_c99="$gl_cross_guess_normal";;
1385 esac
1263 ]) 1386 ])
1264 ]) 1387 ])
1265]) 1388])
@@ -1311,13 +1434,24 @@ int main ()
1311 [gl_cv_func_snprintf_directive_n=yes], 1434 [gl_cv_func_snprintf_directive_n=yes],
1312 [gl_cv_func_snprintf_directive_n=no], 1435 [gl_cv_func_snprintf_directive_n=no],
1313 [ 1436 [
1314changequote(,)dnl
1315 case "$host_os" in 1437 case "$host_os" in
1316 # Guess yes on glibc systems. 1438 # Guess no on glibc when _FORTIFY_SOURCE >= 2.
1317 *-gnu*) gl_cv_func_snprintf_directive_n="guessing yes";; 1439 *-gnu* | gnu*) AC_COMPILE_IFELSE(
1440 [AC_LANG_SOURCE(
1441 [[#if _FORTIFY_SOURCE >= 2
1442 error fail
1443 #endif
1444 ]])],
1445 [gl_cv_func_snprintf_directive_n="guessing yes"],
1446 [gl_cv_func_snprintf_directive_n="guessing no"])
1447 ;;
1448changequote(,)dnl
1449 # Guess yes on musl systems.
1450 *-musl*) gl_cv_func_snprintf_directive_n="guessing yes";;
1318 # Guess yes on FreeBSD >= 5. 1451 # Guess yes on FreeBSD >= 5.
1319 freebsd[1-4]*) gl_cv_func_snprintf_directive_n="guessing no";; 1452 freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";;
1320 freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; 1453 freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
1454 midnightbsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
1321 # Guess yes on Mac OS X >= 10.3. 1455 # Guess yes on Mac OS X >= 10.3.
1322 darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; 1456 darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";;
1323 darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; 1457 darwin*) gl_cv_func_snprintf_directive_n="guessing yes";;
@@ -1339,10 +1473,14 @@ changequote(,)dnl
1339 netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; 1473 netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
1340 # Guess yes on BeOS. 1474 # Guess yes on BeOS.
1341 beos*) gl_cv_func_snprintf_directive_n="guessing yes";; 1475 beos*) gl_cv_func_snprintf_directive_n="guessing yes";;
1342 # If we don't know, assume the worst. 1476 # Guess no on Android.
1343 *) gl_cv_func_snprintf_directive_n="guessing no";; 1477 linux*-android*) gl_cv_func_snprintf_directive_n="guessing no";;
1344 esac 1478 # Guess no on native Windows.
1479 mingw*) gl_cv_func_snprintf_directive_n="guessing no";;
1480 # If we don't know, obey --enable-cross-guesses.
1481 *) gl_cv_func_snprintf_directive_n="$gl_cross_guess_normal";;
1345changequote([,])dnl 1482changequote([,])dnl
1483 esac
1346 ]) 1484 ])
1347 ]) 1485 ])
1348]) 1486])
@@ -1355,6 +1493,7 @@ dnl Result is gl_cv_func_snprintf_size1.
1355AC_DEFUN([gl_SNPRINTF_SIZE1], 1493AC_DEFUN([gl_SNPRINTF_SIZE1],
1356[ 1494[
1357 AC_REQUIRE([AC_PROG_CC]) 1495 AC_REQUIRE([AC_PROG_CC])
1496 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
1358 AC_REQUIRE([gl_SNPRINTF_PRESENCE]) 1497 AC_REQUIRE([gl_SNPRINTF_PRESENCE])
1359 AC_CACHE_CHECK([whether snprintf respects a size of 1], 1498 AC_CACHE_CHECK([whether snprintf respects a size of 1],
1360 [gl_cv_func_snprintf_size1], 1499 [gl_cv_func_snprintf_size1],
@@ -1384,7 +1523,14 @@ int main()
1384}]])], 1523}]])],
1385 [gl_cv_func_snprintf_size1=yes], 1524 [gl_cv_func_snprintf_size1=yes],
1386 [gl_cv_func_snprintf_size1=no], 1525 [gl_cv_func_snprintf_size1=no],
1387 [gl_cv_func_snprintf_size1="guessing yes"]) 1526 [case "$host_os" in
1527 # Guess yes on Android.
1528 linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;;
1529 # Guess yes on native Windows.
1530 mingw*) gl_cv_func_snprintf_size1="guessing yes" ;;
1531 *) gl_cv_func_snprintf_size1="guessing yes" ;;
1532 esac
1533 ])
1388 ]) 1534 ])
1389]) 1535])
1390 1536
@@ -1456,10 +1602,13 @@ int main()
1456changequote(,)dnl 1602changequote(,)dnl
1457 case "$host_os" in 1603 case "$host_os" in
1458 # Guess yes on glibc systems. 1604 # Guess yes on glibc systems.
1459 *-gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1605 *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1606 # Guess yes on musl systems.
1607 *-musl*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1460 # Guess yes on FreeBSD >= 5. 1608 # Guess yes on FreeBSD >= 5.
1461 freebsd[1-4]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; 1609 freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
1462 freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1610 freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1611 midnightbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1463 # Guess yes on Mac OS X >= 10.3. 1612 # Guess yes on Mac OS X >= 10.3.
1464 darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; 1613 darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
1465 darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1614 darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
@@ -1480,10 +1629,12 @@ changequote(,)dnl
1480 netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1629 netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1481 # Guess yes on BeOS. 1630 # Guess yes on BeOS.
1482 beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1631 beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1483 # Guess yes on mingw. 1632 # Guess yes on Android.
1633 linux*-android*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1634 # Guess yes on native Windows.
1484 mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1635 mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1485 # If we don't know, assume the worst. 1636 # If we don't know, obey --enable-cross-guesses.
1486 *) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; 1637 *) gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";;
1487 esac 1638 esac
1488changequote([,])dnl 1639changequote([,])dnl
1489 ]) 1640 ])
@@ -1539,14 +1690,19 @@ dnl
1539dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1690dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1540dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . . 1691dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . .
1541dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . . 1692dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . .
1693dnl FreeBSD 13.0 . . . . # . . . . . . . . # . . . . . .
1542dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . . 1694dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . .
1695dnl Mac OS X 10.13.5 . . . # # . # . . . . . . . . . . # . .
1543dnl Mac OS X 10.5.8 . . . # # . . . . . . # . . . . . . . . 1696dnl Mac OS X 10.5.8 . . . # # . . . . . . # . . . . . . . .
1544dnl Mac OS X 10.3.9 . . . . # . . . . . . # . # . . . . . . 1697dnl Mac OS X 10.3.9 . . . . # . . . . . . # . # . . . . . .
1698dnl OpenBSD 6.0, 6.7 . . . . # . . . . . . . . # . . . . . .
1545dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . . 1699dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . .
1546dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . . 1700dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . .
1547dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . . 1701dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . .
1548dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . . 1702dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . .
1549dnl Solaris 11 2011-11 . . # # # . . # . . . # . . . . . . . . 1703dnl Solaris 11.4 . . # # # . . # . . . # . . . . . . . .
1704dnl Solaris 11.3 . . . . # . . # . . . . . . . . . . . .
1705dnl Solaris 11.0 . . # # # . . # . . . # . . . . . . . .
1550dnl Solaris 10 . . # # # . . # . . . # # . . . . . . . 1706dnl Solaris 10 . . # # # . . # . . . # # . . . . . . .
1551dnl Solaris 2.6 ... 9 # . # # # # . # . . . # # . . . # . . . 1707dnl Solaris 2.6 ... 9 # . # # # # . # . . . # # . . . # . . .
1552dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # # 1708dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # #
@@ -1559,11 +1715,13 @@ dnl HP-UX 10.20 # . # . # # . ? . . # # . . .
1559dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . . 1715dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . .
1560dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . # 1716dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . #
1561dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # # 1717dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # #
1718dnl NetBSD 9.0 . . . . # . . . . . . . . . . . . . . .
1562dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . . 1719dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . .
1563dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ? 1720dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ?
1564dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . . 1721dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . .
1565dnl Haiku . . . # # # . # . . . . . ? . . ? . . . 1722dnl Haiku . . . # # # . # . . . . . ? . . ? . . .
1566dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . . 1723dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . .
1724dnl Android 4.3 . . # # # # # # . # . # . # . . . # . .
1567dnl old mingw / msvcrt # # # # # # . . # # . # # ? . # # # . . 1725dnl old mingw / msvcrt # # # # # # . . # # . # # ? . # # # . .
1568dnl MSVC 9 # # # # # # # . # # . # # ? # # # # . . 1726dnl MSVC 9 # # # # # # # . # # . # # ? # # # # . .
1569dnl mingw 2009-2011 . # . # . . . . # # . . . ? . . . . . . 1727dnl mingw 2009-2011 . # . # . . . . # # . . . ? . . . . . .