diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-10-31 15:27:12 (GMT) |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-10-31 15:27:12 (GMT) |
commit | 5be04ec2ceb1df77afbca4fcbf9e92a712612d6f (patch) | |
tree | 2b2e1c71dffae827c8e45cd4cccc375093d03486 /gl/m4/printf.m4 | |
parent | 6d1d1dac32841d5ca6ee51bb09b30a6c604b17e2 (diff) | |
download | monitoring-plugins-5be04ec2ceb1df77afbca4fcbf9e92a712612d6f.tar.gz |
Sync with the latest Gnulib code (d4ec02b3cc)refs/pull/2037/head
Diffstat (limited to 'gl/m4/printf.m4')
-rw-r--r-- | gl/m4/printf.m4 | 931 |
1 files changed, 718 insertions, 213 deletions
diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4 index 4e65abc..0cb14d6 100644 --- a/gl/m4/printf.m4 +++ b/gl/m4/printf.m4 | |||
@@ -1,5 +1,6 @@ | |||
1 | # printf.m4 serial 73 | 1 | # printf.m4 |
2 | dnl Copyright (C) 2003, 2007-2023 Free Software Foundation, Inc. | 2 | # serial 91 |
3 | dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
@@ -63,7 +64,7 @@ changequote(,)dnl | |||
63 | # Guess yes on glibc systems. | 64 | # Guess yes on glibc systems. |
64 | *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; | 65 | *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; |
65 | # Guess yes on musl systems. | 66 | # Guess yes on musl systems. |
66 | *-musl*) gl_cv_func_printf_sizes_c99="guessing yes";; | 67 | *-musl* | midipix*) gl_cv_func_printf_sizes_c99="guessing yes";; |
67 | # Guess yes on FreeBSD >= 5. | 68 | # Guess yes on FreeBSD >= 5. |
68 | freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; | 69 | freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; |
69 | freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; | 70 | freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; |
@@ -86,7 +87,8 @@ changequote(,)dnl | |||
86 | linux*-android*) gl_cv_func_printf_sizes_c99="guessing yes";; | 87 | linux*-android*) gl_cv_func_printf_sizes_c99="guessing yes";; |
87 | changequote([,])dnl | 88 | changequote([,])dnl |
88 | # Guess yes on MSVC, no on mingw. | 89 | # Guess yes on MSVC, no on mingw. |
89 | mingw*) AC_EGREP_CPP([Known], [ | 90 | windows*-msvc*) gl_cv_func_printf_sizes_c99="guessing yes" ;; |
91 | mingw* | windows*) AC_EGREP_CPP([Known], [ | ||
90 | #ifdef _MSC_VER | 92 | #ifdef _MSC_VER |
91 | Known | 93 | Known |
92 | #endif | 94 | #endif |
@@ -101,6 +103,92 @@ changequote([,])dnl | |||
101 | ]) | 103 | ]) |
102 | ]) | 104 | ]) |
103 | 105 | ||
106 | dnl Test whether the *printf family of functions supports the 'w8', 'w16', | ||
107 | dnl 'w32', 'w64', 'wf8', 'wf16', 'wf32', 'wf64' size specifiers. (ISO C23) | ||
108 | dnl Result is gl_cv_func_printf_sizes_c23. | ||
109 | |||
110 | AC_DEFUN([gl_PRINTF_SIZES_C23], | ||
111 | [ | ||
112 | AC_REQUIRE([AC_PROG_CC]) | ||
113 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) | ||
114 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) | ||
115 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
116 | AC_CACHE_CHECK([whether printf supports size specifiers as in C23], | ||
117 | [gl_cv_func_printf_sizes_c23], | ||
118 | [ | ||
119 | AC_RUN_IFELSE( | ||
120 | [AC_LANG_SOURCE([[ | ||
121 | #include <stddef.h> | ||
122 | #include <stdio.h> | ||
123 | #include <string.h> | ||
124 | #include <sys/types.h> | ||
125 | #if HAVE_STDINT_H_WITH_UINTMAX | ||
126 | # include <stdint.h> | ||
127 | #endif | ||
128 | #if HAVE_INTTYPES_H_WITH_UINTMAX | ||
129 | # include <inttypes.h> | ||
130 | #endif | ||
131 | static char buf[100]; | ||
132 | int main () | ||
133 | { | ||
134 | int result = 0; | ||
135 | buf[0] = '\0'; | ||
136 | if (sprintf (buf, "%w8u %d", (uint8_t) 123, 33, 44, 55) < 0 | ||
137 | || strcmp (buf, "123 33") != 0) | ||
138 | result |= 1; | ||
139 | buf[0] = '\0'; | ||
140 | if (sprintf (buf, "%wf8u %d", (uint_fast8_t) 123, 33, 44, 55) < 0 | ||
141 | || strcmp (buf, "123 33") != 0) | ||
142 | result |= 1; | ||
143 | buf[0] = '\0'; | ||
144 | if (sprintf (buf, "%w16u %d", (uint16_t) 12345, 33, 44, 55) < 0 | ||
145 | || strcmp (buf, "12345 33") != 0) | ||
146 | result |= 2; | ||
147 | buf[0] = '\0'; | ||
148 | if (sprintf (buf, "%wf16u %d", (uint_fast16_t) 12345, 33, 44, 55) < 0 | ||
149 | || strcmp (buf, "12345 33") != 0) | ||
150 | result |= 2; | ||
151 | buf[0] = '\0'; | ||
152 | if (sprintf (buf, "%w32u %d", (uint32_t) 12345671, 33, 44, 55) < 0 | ||
153 | || strcmp (buf, "12345671 33") != 0) | ||
154 | result |= 4; | ||
155 | buf[0] = '\0'; | ||
156 | if (sprintf (buf, "%wf32u %d", (uint_fast32_t) 12345671, 33, 44, 55) < 0 | ||
157 | || strcmp (buf, "12345671 33") != 0) | ||
158 | result |= 4; | ||
159 | #if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX | ||
160 | buf[0] = '\0'; | ||
161 | if (sprintf (buf, "%w64u %d", (uint64_t) 12345671, 33, 44, 55) < 0 | ||
162 | || strcmp (buf, "12345671 33") != 0) | ||
163 | result |= 8; | ||
164 | buf[0] = '\0'; | ||
165 | if (sprintf (buf, "%wf64u %d", (uint_fast64_t) 12345671, 33, 44, 55) < 0 | ||
166 | || strcmp (buf, "12345671 33") != 0) | ||
167 | result |= 8; | ||
168 | #else | ||
169 | result |= 8; | ||
170 | #endif | ||
171 | return result; | ||
172 | }]])], | ||
173 | [gl_cv_func_printf_sizes_c23=yes], | ||
174 | [gl_cv_func_printf_sizes_c23=no], | ||
175 | [ | ||
176 | case "$host_os" in | ||
177 | # Guess no on glibc systems. | ||
178 | *-gnu* | gnu*) gl_cv_func_printf_sizes_c23="guessing no";; | ||
179 | # Guess no on musl systems. | ||
180 | *-musl* | midipix*) gl_cv_func_printf_sizes_c23="guessing no";; | ||
181 | # Guess no on Android. | ||
182 | linux*-android*) gl_cv_func_printf_sizes_c23="guessing no";; | ||
183 | # Guess no on native Windows. | ||
184 | mingw* | windows*) gl_cv_func_printf_sizes_c23="guessing no";; | ||
185 | # If we don't know, obey --enable-cross-guesses. | ||
186 | *) gl_cv_func_printf_sizes_c23="$gl_cross_guess_normal";; | ||
187 | esac | ||
188 | ]) | ||
189 | ]) | ||
190 | ]) | ||
191 | |||
104 | dnl Test whether the *printf family of functions supports 'long double' | 192 | dnl Test whether the *printf family of functions supports 'long double' |
105 | dnl arguments together with the 'L' size specifier. (ISO C99, POSIX:2001) | 193 | dnl arguments together with the 'L' size specifier. (ISO C99, POSIX:2001) |
106 | dnl Result is gl_cv_func_printf_long_double. | 194 | dnl Result is gl_cv_func_printf_long_double. |
@@ -137,20 +225,21 @@ int main () | |||
137 | [gl_cv_func_printf_long_double=yes], | 225 | [gl_cv_func_printf_long_double=yes], |
138 | [gl_cv_func_printf_long_double=no], | 226 | [gl_cv_func_printf_long_double=no], |
139 | [case "$host_os" in | 227 | [case "$host_os" in |
140 | # Guess no on BeOS. | 228 | # Guess no on BeOS. |
141 | beos*) gl_cv_func_printf_long_double="guessing no";; | 229 | beos*) gl_cv_func_printf_long_double="guessing no";; |
142 | # Guess yes on Android. | 230 | # Guess yes on Android. |
143 | linux*-android*) gl_cv_func_printf_long_double="guessing yes";; | 231 | linux*-android*) gl_cv_func_printf_long_double="guessing yes";; |
144 | # Guess yes on MSVC, no on mingw. | 232 | # Guess yes on MSVC, no on mingw. |
145 | mingw*) AC_EGREP_CPP([Known], [ | 233 | windows*-msvc*) gl_cv_func_printf_long_double="guessing yes" ;; |
234 | mingw* | windows*) AC_EGREP_CPP([Known], [ | ||
146 | #ifdef _MSC_VER | 235 | #ifdef _MSC_VER |
147 | Known | 236 | Known |
148 | #endif | 237 | #endif |
149 | ], | 238 | ], |
150 | [gl_cv_func_printf_long_double="guessing yes"], | 239 | [gl_cv_func_printf_long_double="guessing yes"], |
151 | [gl_cv_func_printf_long_double="guessing no"]) | 240 | [gl_cv_func_printf_long_double="guessing no"]) |
152 | ;; | 241 | ;; |
153 | *) gl_cv_func_printf_long_double="guessing yes";; | 242 | *) gl_cv_func_printf_long_double="guessing yes";; |
154 | esac | 243 | esac |
155 | ]) | 244 | ]) |
156 | ]) | 245 | ]) |
@@ -244,7 +333,7 @@ changequote(,)dnl | |||
244 | # Guess yes on glibc systems. | 333 | # Guess yes on glibc systems. |
245 | *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";; | 334 | *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";; |
246 | # Guess yes on musl systems. | 335 | # Guess yes on musl systems. |
247 | *-musl*) gl_cv_func_printf_infinite="guessing yes";; | 336 | *-musl* | midipix*) gl_cv_func_printf_infinite="guessing yes";; |
248 | # Guess yes on FreeBSD >= 6. | 337 | # Guess yes on FreeBSD >= 6. |
249 | freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; | 338 | freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; |
250 | freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; | 339 | freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; |
@@ -268,7 +357,8 @@ changequote(,)dnl | |||
268 | linux*-android*) gl_cv_func_printf_infinite="guessing no";; | 357 | linux*-android*) gl_cv_func_printf_infinite="guessing no";; |
269 | changequote([,])dnl | 358 | changequote([,])dnl |
270 | # Guess yes on MSVC, no on mingw. | 359 | # Guess yes on MSVC, no on mingw. |
271 | mingw*) AC_EGREP_CPP([Known], [ | 360 | windows*-msvc*) gl_cv_func_printf_infinite="guessing yes" ;; |
361 | mingw* | windows*) AC_EGREP_CPP([Known], [ | ||
272 | #ifdef _MSC_VER | 362 | #ifdef _MSC_VER |
273 | Known | 363 | Known |
274 | #endif | 364 | #endif |
@@ -467,7 +557,7 @@ changequote(,)dnl | |||
467 | # Guess yes on glibc systems. | 557 | # Guess yes on glibc systems. |
468 | *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; | 558 | *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; |
469 | # Guess yes on musl systems. | 559 | # Guess yes on musl systems. |
470 | *-musl*) gl_cv_func_printf_infinite_long_double="guessing yes";; | 560 | *-musl* | midipix*) gl_cv_func_printf_infinite_long_double="guessing yes";; |
471 | # Guess yes on FreeBSD >= 6. | 561 | # Guess yes on FreeBSD >= 6. |
472 | freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; | 562 | freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; |
473 | freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; | 563 | freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; |
@@ -482,7 +572,8 @@ changequote(,)dnl | |||
482 | linux*-android*) gl_cv_func_printf_infinite_long_double="guessing no";; | 572 | linux*-android*) gl_cv_func_printf_infinite_long_double="guessing no";; |
483 | changequote([,])dnl | 573 | changequote([,])dnl |
484 | # Guess yes on MSVC, no on mingw. | 574 | # Guess yes on MSVC, no on mingw. |
485 | mingw*) AC_EGREP_CPP([Known], [ | 575 | windows*-msvc*) gl_cv_func_printf_infinite_long_double="guessing yes" ;; |
576 | mingw* | windows*) AC_EGREP_CPP([Known], [ | ||
486 | #ifdef _MSC_VER | 577 | #ifdef _MSC_VER |
487 | Known | 578 | Known |
488 | #endif | 579 | #endif |
@@ -591,11 +682,11 @@ int main () | |||
591 | [gl_cv_func_printf_directive_a="guessing no"]) | 682 | [gl_cv_func_printf_directive_a="guessing no"]) |
592 | ;; | 683 | ;; |
593 | # Guess yes on musl systems. | 684 | # Guess yes on musl systems. |
594 | *-musl*) gl_cv_func_printf_directive_a="guessing yes";; | 685 | *-musl* | midipix*) gl_cv_func_printf_directive_a="guessing yes";; |
595 | # Guess no on Android. | 686 | # Guess no on Android. |
596 | linux*-android*) gl_cv_func_printf_directive_a="guessing no";; | 687 | linux*-android*) gl_cv_func_printf_directive_a="guessing no";; |
597 | # Guess no on native Windows. | 688 | # Guess no on native Windows. |
598 | mingw*) gl_cv_func_printf_directive_a="guessing no";; | 689 | mingw* | windows*) gl_cv_func_printf_directive_a="guessing no";; |
599 | # If we don't know, obey --enable-cross-guesses. | 690 | # If we don't know, obey --enable-cross-guesses. |
600 | *) gl_cv_func_printf_directive_a="$gl_cross_guess_normal";; | 691 | *) gl_cv_func_printf_directive_a="$gl_cross_guess_normal";; |
601 | esac | 692 | esac |
@@ -603,6 +694,116 @@ int main () | |||
603 | ]) | 694 | ]) |
604 | ]) | 695 | ]) |
605 | 696 | ||
697 | dnl Test whether the *printf family of functions supports the 'b' conversion | ||
698 | dnl specifier for binary output of integers. | ||
699 | dnl (ISO C23) | ||
700 | dnl Result is gl_cv_func_printf_directive_b. | ||
701 | |||
702 | AC_DEFUN([gl_PRINTF_DIRECTIVE_B], | ||
703 | [ | ||
704 | AC_REQUIRE([AC_PROG_CC]) | ||
705 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
706 | AC_CACHE_CHECK([whether printf supports the 'b' directive], | ||
707 | [gl_cv_func_printf_directive_b], | ||
708 | [ | ||
709 | AC_RUN_IFELSE( | ||
710 | [AC_LANG_SOURCE([[ | ||
711 | #include <stdio.h> | ||
712 | #include <string.h> | ||
713 | static char buf[100]; | ||
714 | int main () | ||
715 | { | ||
716 | int result = 0; | ||
717 | if (sprintf (buf, "%b %d", 12345, 33, 44, 55) < 0 | ||
718 | || strcmp (buf, "11000000111001 33") != 0) | ||
719 | result |= 1; | ||
720 | return result; | ||
721 | }]])], | ||
722 | [gl_cv_func_printf_directive_b=yes], | ||
723 | [gl_cv_func_printf_directive_b=no], | ||
724 | [ | ||
725 | case "$host_os" in | ||
726 | # Guess yes on glibc >= 2.35 systems. | ||
727 | *-gnu* | gnu*) | ||
728 | AC_EGREP_CPP([Lucky], [ | ||
729 | #include <features.h> | ||
730 | #ifdef __GNU_LIBRARY__ | ||
731 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 35) || (__GLIBC__ > 2) | ||
732 | Lucky user | ||
733 | #endif | ||
734 | #endif | ||
735 | ], | ||
736 | [gl_cv_func_printf_directive_uppercase_b="guessing yes"], | ||
737 | [gl_cv_func_printf_directive_uppercase_b="guessing no"]) | ||
738 | ;; | ||
739 | # Guess no on musl systems. | ||
740 | *-musl* | midipix*) gl_cv_func_printf_directive_b="guessing no";; | ||
741 | # Guess no on Android. | ||
742 | linux*-android*) gl_cv_func_printf_directive_b="guessing no";; | ||
743 | # Guess no on native Windows. | ||
744 | mingw* | windows*) gl_cv_func_printf_directive_b="guessing no";; | ||
745 | # If we don't know, obey --enable-cross-guesses. | ||
746 | *) gl_cv_func_printf_directive_b="$gl_cross_guess_normal";; | ||
747 | esac | ||
748 | ]) | ||
749 | ]) | ||
750 | ]) | ||
751 | |||
752 | dnl Test whether the *printf family of functions supports the 'B' conversion | ||
753 | dnl specifier for binary output of integers. | ||
754 | dnl (GNU, encouraged by ISO C23 § 7.23.6.1) | ||
755 | dnl Result is gl_cv_func_printf_directive_uppercase_b. | ||
756 | |||
757 | AC_DEFUN([gl_PRINTF_DIRECTIVE_UPPERCASE_B], | ||
758 | [ | ||
759 | AC_REQUIRE([AC_PROG_CC]) | ||
760 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
761 | AC_CACHE_CHECK([whether printf supports the 'B' directive], | ||
762 | [gl_cv_func_printf_directive_uppercase_b], | ||
763 | [ | ||
764 | AC_RUN_IFELSE( | ||
765 | [AC_LANG_SOURCE([[ | ||
766 | #include <stdio.h> | ||
767 | #include <string.h> | ||
768 | static char buf[100]; | ||
769 | int main () | ||
770 | { | ||
771 | int result = 0; | ||
772 | if (sprintf (buf, "%#B %d", 12345, 33, 44, 55) < 0 | ||
773 | || strcmp (buf, "0B11000000111001 33") != 0) | ||
774 | result |= 1; | ||
775 | return result; | ||
776 | }]])], | ||
777 | [gl_cv_func_printf_directive_uppercase_b=yes], | ||
778 | [gl_cv_func_printf_directive_uppercase_b=no], | ||
779 | [ | ||
780 | case "$host_os" in | ||
781 | # Guess yes on glibc >= 2.35 systems. | ||
782 | *-gnu* | gnu*) | ||
783 | AC_EGREP_CPP([Lucky], [ | ||
784 | #include <features.h> | ||
785 | #ifdef __GNU_LIBRARY__ | ||
786 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 35) || (__GLIBC__ > 2) | ||
787 | Lucky user | ||
788 | #endif | ||
789 | #endif | ||
790 | ], | ||
791 | [gl_cv_func_printf_directive_uppercase_b="guessing yes"], | ||
792 | [gl_cv_func_printf_directive_uppercase_b="guessing no"]) | ||
793 | ;; | ||
794 | # Guess no on musl systems. | ||
795 | *-musl* | midipix*) gl_cv_func_printf_directive_uppercase_b="guessing no";; | ||
796 | # Guess no on Android. | ||
797 | linux*-android*) gl_cv_func_printf_directive_uppercase_b="guessing no";; | ||
798 | # Guess no on native Windows. | ||
799 | mingw* | windows*) gl_cv_func_printf_directive_uppercase_b="guessing no";; | ||
800 | # If we don't know, obey --enable-cross-guesses. | ||
801 | *) gl_cv_func_printf_directive_uppercase_b="$gl_cross_guess_normal";; | ||
802 | esac | ||
803 | ]) | ||
804 | ]) | ||
805 | ]) | ||
806 | |||
606 | dnl Test whether the *printf family of functions supports the %F format | 807 | dnl Test whether the *printf family of functions supports the %F format |
607 | dnl directive. (ISO C99, POSIX:2001) | 808 | dnl directive. (ISO C99, POSIX:2001) |
608 | dnl Result is gl_cv_func_printf_directive_f. | 809 | dnl Result is gl_cv_func_printf_directive_f. |
@@ -643,7 +844,7 @@ changequote(,)dnl | |||
643 | # Guess yes on glibc systems. | 844 | # Guess yes on glibc systems. |
644 | *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";; | 845 | *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";; |
645 | # Guess yes on musl systems. | 846 | # Guess yes on musl systems. |
646 | *-musl*) gl_cv_func_printf_directive_f="guessing yes";; | 847 | *-musl* | midipix*) gl_cv_func_printf_directive_f="guessing yes";; |
647 | # Guess yes on FreeBSD >= 6. | 848 | # Guess yes on FreeBSD >= 6. |
648 | freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; | 849 | freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; |
649 | freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; | 850 | freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; |
@@ -661,7 +862,8 @@ changequote(,)dnl | |||
661 | linux*-android*) gl_cv_func_printf_directive_f="guessing no";; | 862 | linux*-android*) gl_cv_func_printf_directive_f="guessing no";; |
662 | changequote([,])dnl | 863 | changequote([,])dnl |
663 | # Guess yes on MSVC, no on mingw. | 864 | # Guess yes on MSVC, no on mingw. |
664 | mingw*) AC_EGREP_CPP([Known], [ | 865 | windows*-msvc*) gl_cv_func_printf_directive_f="guessing yes" ;; |
866 | mingw* | windows*) AC_EGREP_CPP([Known], [ | ||
665 | #ifdef _MSC_VER | 867 | #ifdef _MSC_VER |
666 | Known | 868 | Known |
667 | #endif | 869 | #endif |
@@ -689,6 +891,7 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N], | |||
689 | [ | 891 | [ |
690 | AC_RUN_IFELSE( | 892 | AC_RUN_IFELSE( |
691 | [AC_LANG_SOURCE([[ | 893 | [AC_LANG_SOURCE([[ |
894 | #include <signal.h> | ||
692 | #include <stdio.h> | 895 | #include <stdio.h> |
693 | #include <stdlib.h> | 896 | #include <stdlib.h> |
694 | #include <string.h> | 897 | #include <string.h> |
@@ -706,6 +909,12 @@ invalid_parameter_handler (const wchar_t *expression, | |||
706 | exit (1); | 909 | exit (1); |
707 | } | 910 | } |
708 | #endif | 911 | #endif |
912 | static void | ||
913 | abort_handler (int sig) | ||
914 | { | ||
915 | (void) sig; | ||
916 | _exit (1); | ||
917 | } | ||
709 | static char fmtstring[10]; | 918 | static char fmtstring[10]; |
710 | static char buf[100]; | 919 | static char buf[100]; |
711 | int main () | 920 | int main () |
@@ -714,6 +923,7 @@ int main () | |||
714 | #ifdef _MSC_VER | 923 | #ifdef _MSC_VER |
715 | _set_invalid_parameter_handler (invalid_parameter_handler); | 924 | _set_invalid_parameter_handler (invalid_parameter_handler); |
716 | #endif | 925 | #endif |
926 | signal (SIGABRT, abort_handler); | ||
717 | /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) | 927 | /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) |
718 | support %n in format strings in read-only memory but not in writable | 928 | support %n in format strings in read-only memory but not in writable |
719 | memory. */ | 929 | memory. */ |
@@ -727,21 +937,21 @@ int main () | |||
727 | [gl_cv_func_printf_directive_n=yes], | 937 | [gl_cv_func_printf_directive_n=yes], |
728 | [gl_cv_func_printf_directive_n=no], | 938 | [gl_cv_func_printf_directive_n=no], |
729 | [case "$host_os" in | 939 | [case "$host_os" in |
730 | # Guess no on glibc when _FORTIFY_SOURCE >= 2. | 940 | # Guess no on glibc when _FORTIFY_SOURCE >= 2. |
731 | *-gnu* | gnu*) AC_COMPILE_IFELSE( | 941 | *-gnu* | gnu*) AC_COMPILE_IFELSE( |
732 | [AC_LANG_SOURCE( | 942 | [AC_LANG_SOURCE( |
733 | [[#if _FORTIFY_SOURCE >= 2 | 943 | [[#if _FORTIFY_SOURCE >= 2 |
734 | error fail | 944 | error fail |
735 | #endif | 945 | #endif |
736 | ]])], | 946 | ]])], |
737 | [gl_cv_func_printf_directive_n="guessing yes"], | 947 | [gl_cv_func_printf_directive_n="guessing yes"], |
738 | [gl_cv_func_printf_directive_n="guessing no"]) | 948 | [gl_cv_func_printf_directive_n="guessing no"]) |
739 | ;; | 949 | ;; |
740 | # Guess no on Android. | 950 | # Guess no on Android. |
741 | linux*-android*) gl_cv_func_printf_directive_n="guessing no";; | 951 | linux*-android*) gl_cv_func_printf_directive_n="guessing no";; |
742 | # Guess no on native Windows. | 952 | # Guess no on native Windows. |
743 | mingw*) gl_cv_func_printf_directive_n="guessing no";; | 953 | mingw* | windows*) gl_cv_func_printf_directive_n="guessing no";; |
744 | *) gl_cv_func_printf_directive_n="guessing yes";; | 954 | *) gl_cv_func_printf_directive_n="guessing yes";; |
745 | esac | 955 | esac |
746 | ]) | 956 | ]) |
747 | ]) | 957 | ]) |
@@ -811,18 +1021,64 @@ int main () | |||
811 | [ | 1021 | [ |
812 | changequote(,)dnl | 1022 | changequote(,)dnl |
813 | case "$host_os" in | 1023 | case "$host_os" in |
814 | # Guess yes on OpenBSD >= 6.0. | 1024 | # Guess yes on OpenBSD >= 6.0. |
815 | openbsd[1-5].*) gl_cv_func_printf_directive_ls="guessing no";; | 1025 | openbsd[1-5].*) gl_cv_func_printf_directive_ls="guessing no";; |
816 | openbsd*) gl_cv_func_printf_directive_ls="guessing yes";; | 1026 | openbsd*) gl_cv_func_printf_directive_ls="guessing yes";; |
817 | irix*) gl_cv_func_printf_directive_ls="guessing no";; | 1027 | irix*) gl_cv_func_printf_directive_ls="guessing no";; |
818 | solaris*) gl_cv_func_printf_directive_ls="guessing no";; | 1028 | solaris*) gl_cv_func_printf_directive_ls="guessing no";; |
819 | cygwin*) gl_cv_func_printf_directive_ls="guessing no";; | 1029 | cygwin*) gl_cv_func_printf_directive_ls="guessing no";; |
820 | beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; | 1030 | beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; |
821 | # Guess no on Android. | 1031 | # Guess no on Android. |
822 | linux*-android*) gl_cv_func_printf_directive_ls="guessing no";; | 1032 | linux*-android*) gl_cv_func_printf_directive_ls="guessing no";; |
823 | # Guess yes on native Windows. | 1033 | # Guess yes on native Windows. |
824 | mingw*) gl_cv_func_printf_directive_ls="guessing yes";; | 1034 | mingw* | windows*) gl_cv_func_printf_directive_ls="guessing yes";; |
825 | *) gl_cv_func_printf_directive_ls="guessing yes";; | 1035 | *) gl_cv_func_printf_directive_ls="guessing yes";; |
1036 | esac | ||
1037 | changequote([,])dnl | ||
1038 | ]) | ||
1039 | ]) | ||
1040 | ]) | ||
1041 | |||
1042 | dnl Test whether the *printf family of functions supports the %lc format | ||
1043 | dnl directive and in particular, when the argument is a null wide character, | ||
1044 | dnl whether the functions produce a NUL byte, as specified in ISO C 23 | ||
1045 | dnl after the issue GB-141 was fixed. | ||
1046 | dnl Result is gl_cv_func_printf_directive_lc. | ||
1047 | |||
1048 | AC_DEFUN([gl_PRINTF_DIRECTIVE_LC], | ||
1049 | [ | ||
1050 | AC_REQUIRE([AC_PROG_CC]) | ||
1051 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
1052 | AC_CACHE_CHECK([whether printf supports the 'lc' directive correctly], | ||
1053 | [gl_cv_func_printf_directive_lc], | ||
1054 | [ | ||
1055 | AC_RUN_IFELSE( | ||
1056 | [AC_LANG_SOURCE([[ | ||
1057 | #include <stdio.h> | ||
1058 | #include <wchar.h> | ||
1059 | #include <string.h> | ||
1060 | int main () | ||
1061 | { | ||
1062 | int result = 0; | ||
1063 | char buf[100]; | ||
1064 | /* This test fails on musl libc 1.2.4. */ | ||
1065 | { | ||
1066 | buf[0] = '\0'; | ||
1067 | if (sprintf (buf, "%lc%lc%lc", (wint_t) 'a', (wint_t) 0, (wint_t) 'z') < 0 | ||
1068 | || memcmp (buf, "a\0z", 4) != 0) | ||
1069 | result |= 1; | ||
1070 | } | ||
1071 | return result; | ||
1072 | }]])], | ||
1073 | [gl_cv_func_printf_directive_lc=yes], | ||
1074 | [gl_cv_func_printf_directive_lc=no], | ||
1075 | [ | ||
1076 | changequote(,)dnl | ||
1077 | case "$host_os" in | ||
1078 | # Guess no on musl libc. | ||
1079 | *-musl* | midipix*) gl_cv_func_printf_directive_lc="guessing no";; | ||
1080 | # Guess yes otherwise. | ||
1081 | *) gl_cv_func_printf_directive_lc="guessing yes";; | ||
826 | esac | 1082 | esac |
827 | changequote([,])dnl | 1083 | changequote([,])dnl |
828 | ]) | 1084 | ]) |
@@ -833,7 +1089,7 @@ dnl Test whether the *printf family of functions supports POSIX/XSI format | |||
833 | dnl strings with positions. (POSIX:2001) | 1089 | dnl strings with positions. (POSIX:2001) |
834 | dnl Result is gl_cv_func_printf_positions. | 1090 | dnl Result is gl_cv_func_printf_positions. |
835 | 1091 | ||
836 | AC_DEFUN([gl_PRINTF_POSITIONS], | 1092 | AC_DEFUN_ONCE([gl_PRINTF_POSITIONS], |
837 | [ | 1093 | [ |
838 | AC_REQUIRE([AC_PROG_CC]) | 1094 | AC_REQUIRE([AC_PROG_CC]) |
839 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 1095 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
@@ -859,13 +1115,17 @@ int main () | |||
859 | changequote(,)dnl | 1115 | changequote(,)dnl |
860 | case "$host_os" in | 1116 | case "$host_os" in |
861 | netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) | 1117 | netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) |
862 | gl_cv_func_printf_positions="guessing no";; | 1118 | gl_cv_func_printf_positions="guessing no";; |
863 | beos*) gl_cv_func_printf_positions="guessing no";; | 1119 | beos*) |
864 | # Guess yes on Android. | 1120 | gl_cv_func_printf_positions="guessing no";; |
865 | linux*-android*) gl_cv_func_printf_positions="guessing yes";; | 1121 | # Guess yes on Android. |
866 | # Guess no on native Windows. | 1122 | linux*-android*) |
867 | mingw* | pw*) gl_cv_func_printf_positions="guessing no";; | 1123 | gl_cv_func_printf_positions="guessing yes";; |
868 | *) gl_cv_func_printf_positions="guessing yes";; | 1124 | # Guess no on native Windows. |
1125 | mingw* | windows* | pw*) | ||
1126 | gl_cv_func_printf_positions="guessing no";; | ||
1127 | *) | ||
1128 | gl_cv_func_printf_positions="guessing yes";; | ||
869 | esac | 1129 | esac |
870 | changequote([,])dnl | 1130 | changequote([,])dnl |
871 | ]) | 1131 | ]) |
@@ -900,13 +1160,13 @@ int main () | |||
900 | [ | 1160 | [ |
901 | changequote(,)dnl | 1161 | changequote(,)dnl |
902 | case "$host_os" in | 1162 | case "$host_os" in |
903 | cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; | 1163 | cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; |
904 | netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; | 1164 | netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; |
905 | # Guess no on Android. | 1165 | # Guess no on Android. |
906 | linux*-android*) gl_cv_func_printf_flag_grouping="guessing no";; | 1166 | linux*-android*) gl_cv_func_printf_flag_grouping="guessing no";; |
907 | # Guess no on native Windows. | 1167 | # Guess no on native Windows. |
908 | mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; | 1168 | mingw* | windows* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; |
909 | *) gl_cv_func_printf_flag_grouping="guessing yes";; | 1169 | *) gl_cv_func_printf_flag_grouping="guessing yes";; |
910 | esac | 1170 | esac |
911 | changequote([,])dnl | 1171 | changequote([,])dnl |
912 | ]) | 1172 | ]) |
@@ -943,16 +1203,16 @@ int main () | |||
943 | [ | 1203 | [ |
944 | changequote(,)dnl | 1204 | changequote(,)dnl |
945 | case "$host_os" in | 1205 | case "$host_os" in |
946 | # Guess yes on HP-UX 11. | 1206 | # Guess yes on HP-UX 11. |
947 | hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; | 1207 | hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; |
948 | # Guess no on HP-UX 10 and older. | 1208 | # Guess no on HP-UX 10 and older. |
949 | hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; | 1209 | hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; |
950 | # Guess yes on Android. | 1210 | # Guess yes on Android. |
951 | linux*-android*) gl_cv_func_printf_flag_leftadjust="guessing yes";; | 1211 | linux*-android*) gl_cv_func_printf_flag_leftadjust="guessing yes";; |
952 | # Guess yes on native Windows. | 1212 | # Guess yes on native Windows. |
953 | mingw*) gl_cv_func_printf_flag_leftadjust="guessing yes";; | 1213 | mingw* | windows*) gl_cv_func_printf_flag_leftadjust="guessing yes";; |
954 | # Guess yes otherwise. | 1214 | # Guess yes otherwise. |
955 | *) gl_cv_func_printf_flag_leftadjust="guessing yes";; | 1215 | *) gl_cv_func_printf_flag_leftadjust="guessing yes";; |
956 | esac | 1216 | esac |
957 | changequote([,])dnl | 1217 | changequote([,])dnl |
958 | ]) | 1218 | ]) |
@@ -990,18 +1250,62 @@ int main () | |||
990 | [ | 1250 | [ |
991 | changequote(,)dnl | 1251 | changequote(,)dnl |
992 | case "$host_os" in | 1252 | case "$host_os" in |
993 | # Guess yes on glibc systems. | 1253 | # Guess yes on glibc systems. |
994 | *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; | 1254 | *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; |
995 | # Guess yes on musl systems. | 1255 | # Guess yes on musl systems. |
996 | *-musl*) gl_cv_func_printf_flag_zero="guessing yes";; | 1256 | *-musl* | midipix*) gl_cv_func_printf_flag_zero="guessing yes";; |
997 | # Guess yes on BeOS. | 1257 | # Guess yes on BeOS. |
998 | beos*) gl_cv_func_printf_flag_zero="guessing yes";; | 1258 | beos*) gl_cv_func_printf_flag_zero="guessing yes";; |
999 | # Guess no on Android. | 1259 | # Guess no on Android. |
1000 | linux*-android*) gl_cv_func_printf_flag_zero="guessing no";; | 1260 | linux*-android*) gl_cv_func_printf_flag_zero="guessing no";; |
1001 | # Guess no on native Windows. | 1261 | # Guess no on native Windows. |
1002 | mingw*) gl_cv_func_printf_flag_zero="guessing no";; | 1262 | mingw* | windows*) gl_cv_func_printf_flag_zero="guessing no";; |
1003 | # If we don't know, obey --enable-cross-guesses. | 1263 | # If we don't know, obey --enable-cross-guesses. |
1004 | *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";; | 1264 | *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";; |
1265 | esac | ||
1266 | changequote([,])dnl | ||
1267 | ]) | ||
1268 | ]) | ||
1269 | ]) | ||
1270 | |||
1271 | dnl Test whether the *printf family of functions supports the # flag with a | ||
1272 | dnl zero precision and a zero value in the 'x' and 'X' directives correctly. | ||
1273 | dnl ISO C and POSIX specify that for the 'd', 'i', 'b', 'o', 'u', 'x', 'X' | ||
1274 | dnl directives: "The result of converting a zero value with a precision of | ||
1275 | dnl zero is no characters." But on Mac OS X 10.5, for the 'x', 'X' directives, | ||
1276 | dnl when a # flag is present, the output is "0" instead of "". | ||
1277 | dnl Result is gl_cv_func_printf_flag_alt_precision_zero. | ||
1278 | |||
1279 | AC_DEFUN([gl_PRINTF_FLAG_ALT_PRECISION_ZERO], | ||
1280 | [ | ||
1281 | AC_REQUIRE([AC_PROG_CC]) | ||
1282 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
1283 | AC_CACHE_CHECK([whether printf supports the alternative flag with a zero precision], | ||
1284 | [gl_cv_func_printf_flag_alt_precision_zero], | ||
1285 | [ | ||
1286 | AC_RUN_IFELSE( | ||
1287 | [AC_LANG_SOURCE([[ | ||
1288 | #include <stdio.h> | ||
1289 | static char buf[10]; | ||
1290 | int main () | ||
1291 | { | ||
1292 | int result = 0; | ||
1293 | if (sprintf (buf, "%#.0x %d", 0, 33, 44) > 0 + 3) | ||
1294 | result |= 1; | ||
1295 | return result; | ||
1296 | }]])], | ||
1297 | [gl_cv_func_printf_flag_alt_precision_zero=yes], | ||
1298 | [gl_cv_func_printf_flag_alt_precision_zero=no], | ||
1299 | [ | ||
1300 | changequote(,)dnl | ||
1301 | case "$host_os" in | ||
1302 | # Guess no only on macOS 10..12 systems. | ||
1303 | darwin[0-9] | darwin[0-9].* | \ | ||
1304 | darwin1[0-9] | darwin1[0-9].* | \ | ||
1305 | darwin2[0-1] | darwin2[0-1].*) | ||
1306 | gl_cv_func_printf_flag_alt_precision_zero="guessing no" ;; | ||
1307 | darwin*) gl_cv_func_printf_flag_alt_precision_zero="guessing yes" ;; | ||
1308 | *) gl_cv_func_printf_flag_alt_precision_zero="guessing yes" ;; | ||
1005 | esac | 1309 | esac |
1006 | changequote([,])dnl | 1310 | changequote([,])dnl |
1007 | ]) | 1311 | ]) |
@@ -1054,12 +1358,12 @@ int main () | |||
1054 | changequote(,)dnl | 1358 | changequote(,)dnl |
1055 | case "$host_os" in | 1359 | case "$host_os" in |
1056 | # Guess no only on Solaris, native Windows, and BeOS systems. | 1360 | # Guess no only on Solaris, native Windows, and BeOS systems. |
1057 | solaris*) gl_cv_func_printf_precision="guessing no" ;; | 1361 | solaris*) gl_cv_func_printf_precision="guessing no" ;; |
1058 | mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; | 1362 | mingw* | windows* | pw*) gl_cv_func_printf_precision="guessing no" ;; |
1059 | beos*) gl_cv_func_printf_precision="guessing no" ;; | 1363 | beos*) gl_cv_func_printf_precision="guessing no" ;; |
1060 | # Guess yes on Android. | 1364 | # Guess yes on Android. |
1061 | linux*-android*) gl_cv_func_printf_precision="guessing yes" ;; | 1365 | linux*-android*) gl_cv_func_printf_precision="guessing yes" ;; |
1062 | *) gl_cv_func_printf_precision="guessing yes" ;; | 1366 | *) gl_cv_func_printf_precision="guessing yes" ;; |
1063 | esac | 1367 | esac |
1064 | changequote([,])dnl | 1368 | changequote([,])dnl |
1065 | ]) | 1369 | ]) |
@@ -1239,7 +1543,7 @@ changequote(,)dnl | |||
1239 | # Guess yes on glibc systems. | 1543 | # Guess yes on glibc systems. |
1240 | *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | 1544 | *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; |
1241 | # Guess yes on musl systems. | 1545 | # Guess yes on musl systems. |
1242 | *-musl*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | 1546 | *-musl* | midipix*) gl_cv_func_snprintf_truncation_c99="guessing yes";; |
1243 | # Guess yes on FreeBSD >= 5. | 1547 | # Guess yes on FreeBSD >= 5. |
1244 | freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; | 1548 | freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; |
1245 | freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | 1549 | freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; |
@@ -1275,7 +1579,7 @@ changequote(,)dnl | |||
1275 | # Guess yes on Android. | 1579 | # Guess yes on Android. |
1276 | linux*-android*) gl_cv_func_snprintf_truncation_c99="guessing yes";; | 1580 | linux*-android*) gl_cv_func_snprintf_truncation_c99="guessing yes";; |
1277 | # Guess no on native Windows. | 1581 | # Guess no on native Windows. |
1278 | mingw*) gl_cv_func_snprintf_truncation_c99="guessing no";; | 1582 | mingw* | windows*) gl_cv_func_snprintf_truncation_c99="guessing no";; |
1279 | # If we don't know, obey --enable-cross-guesses. | 1583 | # If we don't know, obey --enable-cross-guesses. |
1280 | *) gl_cv_func_snprintf_truncation_c99="$gl_cross_guess_normal";; | 1584 | *) gl_cv_func_snprintf_truncation_c99="$gl_cross_guess_normal";; |
1281 | esac | 1585 | esac |
@@ -1344,7 +1648,7 @@ changequote(,)dnl | |||
1344 | # Guess yes on glibc systems. | 1648 | # Guess yes on glibc systems. |
1345 | *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; | 1649 | *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; |
1346 | # Guess yes on musl systems. | 1650 | # Guess yes on musl systems. |
1347 | *-musl*) gl_cv_func_snprintf_retval_c99="guessing yes";; | 1651 | *-musl* | midipix*) gl_cv_func_snprintf_retval_c99="guessing yes";; |
1348 | # Guess yes on FreeBSD >= 5. | 1652 | # Guess yes on FreeBSD >= 5. |
1349 | freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; | 1653 | freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; |
1350 | freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; | 1654 | freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; |
@@ -1372,7 +1676,8 @@ changequote(,)dnl | |||
1372 | linux*-android*) gl_cv_func_snprintf_retval_c99="guessing yes";; | 1676 | linux*-android*) gl_cv_func_snprintf_retval_c99="guessing yes";; |
1373 | changequote([,])dnl | 1677 | changequote([,])dnl |
1374 | # Guess yes on MSVC, no on mingw. | 1678 | # Guess yes on MSVC, no on mingw. |
1375 | mingw*) AC_EGREP_CPP([Known], [ | 1679 | windows*-msvc*) gl_cv_func_snprintf_retval_c99="guessing yes" ;; |
1680 | mingw* | windows*) AC_EGREP_CPP([Known], [ | ||
1376 | #ifdef _MSC_VER | 1681 | #ifdef _MSC_VER |
1377 | Known | 1682 | Known |
1378 | #endif | 1683 | #endif |
@@ -1401,6 +1706,7 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], | |||
1401 | [ | 1706 | [ |
1402 | AC_RUN_IFELSE( | 1707 | AC_RUN_IFELSE( |
1403 | [AC_LANG_SOURCE([[ | 1708 | [AC_LANG_SOURCE([[ |
1709 | #include <signal.h> | ||
1404 | #include <stdio.h> | 1710 | #include <stdio.h> |
1405 | #include <string.h> | 1711 | #include <string.h> |
1406 | #if HAVE_SNPRINTF | 1712 | #if HAVE_SNPRINTF |
@@ -1417,11 +1723,18 @@ static int my_snprintf (char *buf, int size, const char *format, ...) | |||
1417 | return ret; | 1723 | return ret; |
1418 | } | 1724 | } |
1419 | #endif | 1725 | #endif |
1726 | static void | ||
1727 | abort_handler (int sig) | ||
1728 | { | ||
1729 | (void) sig; | ||
1730 | _exit (1); | ||
1731 | } | ||
1420 | static char fmtstring[10]; | 1732 | static char fmtstring[10]; |
1421 | static char buf[100]; | 1733 | static char buf[100]; |
1422 | int main () | 1734 | int main () |
1423 | { | 1735 | { |
1424 | int count = -1; | 1736 | int count = -1; |
1737 | signal (SIGABRT, abort_handler); | ||
1425 | /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) | 1738 | /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) |
1426 | support %n in format strings in read-only memory but not in writable | 1739 | support %n in format strings in read-only memory but not in writable |
1427 | memory. */ | 1740 | memory. */ |
@@ -1447,7 +1760,7 @@ int main () | |||
1447 | ;; | 1760 | ;; |
1448 | changequote(,)dnl | 1761 | changequote(,)dnl |
1449 | # Guess yes on musl systems. | 1762 | # Guess yes on musl systems. |
1450 | *-musl*) gl_cv_func_snprintf_directive_n="guessing yes";; | 1763 | *-musl* | midipix*) gl_cv_func_snprintf_directive_n="guessing yes";; |
1451 | # Guess yes on FreeBSD >= 5. | 1764 | # Guess yes on FreeBSD >= 5. |
1452 | freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; | 1765 | freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; |
1453 | freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; | 1766 | freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; |
@@ -1476,7 +1789,7 @@ changequote(,)dnl | |||
1476 | # Guess no on Android. | 1789 | # Guess no on Android. |
1477 | linux*-android*) gl_cv_func_snprintf_directive_n="guessing no";; | 1790 | linux*-android*) gl_cv_func_snprintf_directive_n="guessing no";; |
1478 | # Guess no on native Windows. | 1791 | # Guess no on native Windows. |
1479 | mingw*) gl_cv_func_snprintf_directive_n="guessing no";; | 1792 | mingw* | windows*) gl_cv_func_snprintf_directive_n="guessing no";; |
1480 | # If we don't know, obey --enable-cross-guesses. | 1793 | # If we don't know, obey --enable-cross-guesses. |
1481 | *) gl_cv_func_snprintf_directive_n="$gl_cross_guess_normal";; | 1794 | *) gl_cv_func_snprintf_directive_n="$gl_cross_guess_normal";; |
1482 | changequote([,])dnl | 1795 | changequote([,])dnl |
@@ -1524,11 +1837,11 @@ int main() | |||
1524 | [gl_cv_func_snprintf_size1=yes], | 1837 | [gl_cv_func_snprintf_size1=yes], |
1525 | [gl_cv_func_snprintf_size1=no], | 1838 | [gl_cv_func_snprintf_size1=no], |
1526 | [case "$host_os" in | 1839 | [case "$host_os" in |
1527 | # Guess yes on Android. | 1840 | # Guess yes on Android. |
1528 | linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; | 1841 | linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; |
1529 | # Guess yes on native Windows. | 1842 | # Guess yes on native Windows. |
1530 | mingw*) gl_cv_func_snprintf_size1="guessing yes" ;; | 1843 | mingw* | windows*) gl_cv_func_snprintf_size1="guessing yes" ;; |
1531 | *) gl_cv_func_snprintf_size1="guessing yes" ;; | 1844 | *) gl_cv_func_snprintf_size1="guessing yes" ;; |
1532 | esac | 1845 | esac |
1533 | ]) | 1846 | ]) |
1534 | ]) | 1847 | ]) |
@@ -1601,128 +1914,320 @@ int main() | |||
1601 | [ | 1914 | [ |
1602 | changequote(,)dnl | 1915 | changequote(,)dnl |
1603 | case "$host_os" in | 1916 | case "$host_os" in |
1604 | # Guess yes on glibc systems. | 1917 | # Guess yes on glibc systems. |
1605 | *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1918 | *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1606 | # Guess yes on musl systems. | 1919 | # Guess yes on musl systems. |
1607 | *-musl*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1920 | *-musl* | midipix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1608 | # Guess yes on FreeBSD >= 5. | 1921 | # Guess yes on FreeBSD >= 5. |
1609 | freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | 1922 | freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; |
1610 | freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1923 | freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1611 | midnightbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1924 | midnightbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1612 | # Guess yes on Mac OS X >= 10.3. | 1925 | # Guess yes on Mac OS X >= 10.3. |
1613 | darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | 1926 | darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; |
1614 | darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1927 | darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1615 | # Guess yes on Cygwin. | 1928 | # Guess yes on Cygwin. |
1616 | cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1929 | cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1617 | # Guess yes on Solaris >= 2.6. | 1930 | # Guess yes on Solaris >= 2.6. |
1618 | solaris2.[0-5] | solaris2.[0-5].*) | 1931 | solaris2.[0-5] | solaris2.[0-5].*) |
1619 | gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | 1932 | gl_cv_func_vsnprintf_zerosize_c99="guessing no";; |
1620 | solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1933 | solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1621 | # Guess yes on AIX >= 4. | 1934 | # Guess yes on AIX >= 4. |
1622 | aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | 1935 | aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; |
1623 | aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1936 | aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1624 | # Guess yes on IRIX >= 6.5. | 1937 | # Guess yes on IRIX >= 6.5. |
1625 | irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1938 | irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1626 | # Guess yes on NetBSD >= 3. | 1939 | # Guess yes on NetBSD >= 3. |
1627 | netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) | 1940 | netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) |
1628 | gl_cv_func_vsnprintf_zerosize_c99="guessing no";; | 1941 | gl_cv_func_vsnprintf_zerosize_c99="guessing no";; |
1629 | netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1942 | netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1630 | # Guess yes on BeOS. | 1943 | # Guess yes on BeOS. |
1631 | beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1944 | beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1632 | # Guess yes on Android. | 1945 | # Guess yes on Android. |
1633 | linux*-android*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1946 | linux*-android*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1634 | # Guess yes on native Windows. | 1947 | # Guess yes on native Windows. |
1635 | mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; | 1948 | mingw* | windows* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; |
1636 | # If we don't know, obey --enable-cross-guesses. | 1949 | # If we don't know, obey --enable-cross-guesses. |
1637 | *) gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";; | 1950 | *) gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";; |
1638 | esac | 1951 | esac |
1639 | changequote([,])dnl | 1952 | changequote([,])dnl |
1640 | ]) | 1953 | ]) |
1641 | ]) | 1954 | ]) |
1642 | ]) | 1955 | ]) |
1643 | 1956 | ||
1957 | dnl Test whether the swprintf function works correctly when it produces output | ||
1958 | dnl that contains null wide characters. | ||
1959 | dnl Result is gl_cv_func_swprintf_works. | ||
1960 | |||
1961 | AC_DEFUN([gl_SWPRINTF_WORKS], | ||
1962 | [ | ||
1963 | AC_REQUIRE([AC_PROG_CC]) | ||
1964 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
1965 | AC_CHECK_FUNCS_ONCE([swprintf]) | ||
1966 | AC_CACHE_CHECK([whether swprintf works], | ||
1967 | [gl_cv_func_swprintf_works], | ||
1968 | [ | ||
1969 | AC_RUN_IFELSE( | ||
1970 | [AC_LANG_SOURCE([[ | ||
1971 | #ifndef __USE_MINGW_ANSI_STDIO | ||
1972 | # define __USE_MINGW_ANSI_STDIO 1 | ||
1973 | #endif | ||
1974 | #include <stdio.h> | ||
1975 | #include <wchar.h> | ||
1976 | int main() | ||
1977 | { | ||
1978 | int result = 0; | ||
1979 | { /* This test fails on musl libc 1.2.3, FreeBSD, NetBSD, OpenBSD, macOS, AIX. */ | ||
1980 | wchar_t buf[5] = { 0xBEEF, 0xBEEF, 0xBEEF, 0xBEEF, 0xBEEF }; | ||
1981 | int ret = swprintf (buf, 4, L"%cz", '\0'); | ||
1982 | /* Expected result: | ||
1983 | ret = 2, buf[0] = 0x0, buf[1] = 0x7a, buf[2] = 0x0, buf[3] = 0xbeef | ||
1984 | musl libc 1.2.3: | ||
1985 | ret = 2, buf[0] = 0x0, buf[1] = 0x0, buf[2] = 0x0, buf[3] = 0x0 | ||
1986 | Reported at <https://www.openwall.com/lists/musl/2023/03/22/9>. | ||
1987 | FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2: | ||
1988 | ret = 2, buf[0] = 0x0, buf[1] = 0xbeef, buf[2] = 0xbeef, buf[3] = 0xbeef | ||
1989 | */ | ||
1990 | if (ret < 0 || buf[1] != 'z') | ||
1991 | result |= 1; | ||
1992 | } | ||
1993 | { /* This test fails on mingw. */ | ||
1994 | wchar_t buf[2]; | ||
1995 | int ret = swprintf (buf, 2, L"%lc", (wint_t)0); | ||
1996 | /* Expected: ret = 1 | ||
1997 | mingw: ret = 0 | ||
1998 | */ | ||
1999 | if (ret != 1) | ||
2000 | result |= 2; | ||
2001 | } | ||
2002 | return result; | ||
2003 | }]])], | ||
2004 | [gl_cv_func_swprintf_works=yes], | ||
2005 | [gl_cv_func_swprintf_works=no], | ||
2006 | [case "$host_os" in | ||
2007 | # Guess yes on glibc systems. | ||
2008 | *-gnu* | gnu*) gl_cv_func_swprintf_works="guessing yes";; | ||
2009 | # Guess no on musl systems. | ||
2010 | *-musl* | midipix*) gl_cv_func_swprintf_works="guessing no";; | ||
2011 | # Guess no on FreeBSD, NetBSD, OpenBSD, macOS, AIX. | ||
2012 | freebsd* | midnightbsd* | netbsd* | openbsd* | darwin* | aix*) | ||
2013 | gl_cv_func_swprintf_works="guessing no";; | ||
2014 | # Guess no on native Windows. | ||
2015 | mingw* | windows* | pw*) gl_cv_func_swprintf_works="guessing no";; | ||
2016 | # If we don't know, obey --enable-cross-guesses. | ||
2017 | *) gl_cv_func_swprintf_works="$gl_cross_guess_normal";; | ||
2018 | esac | ||
2019 | ]) | ||
2020 | ]) | ||
2021 | ]) | ||
2022 | |||
2023 | dnl Test whether the *wprintf family of functions supports the 'a' and 'A' | ||
2024 | dnl conversion specifier for hexadecimal output of 'long double' numbers. | ||
2025 | dnl (ISO C99, POSIX:2001) | ||
2026 | dnl Result is gl_cv_func_swprintf_directive_la. | ||
2027 | |||
2028 | AC_DEFUN([gl_SWPRINTF_DIRECTIVE_LA], | ||
2029 | [ | ||
2030 | AC_REQUIRE([AC_PROG_CC]) | ||
2031 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
2032 | AC_CACHE_CHECK([whether swprintf supports the 'La' and 'LA' directives], | ||
2033 | [gl_cv_func_swprintf_directive_la], | ||
2034 | [ | ||
2035 | AC_RUN_IFELSE( | ||
2036 | [AC_LANG_SOURCE([[ | ||
2037 | #include <stdio.h> | ||
2038 | #include <wchar.h> | ||
2039 | static wchar_t buf[100]; | ||
2040 | int main () | ||
2041 | { | ||
2042 | int result = 0; | ||
2043 | /* This catches a glibc 2.15, Haiku 2022, NetBSD 10.0 bug. */ | ||
2044 | if (swprintf (buf, sizeof (buf) / sizeof (wchar_t), | ||
2045 | L"%La %d", 3.1416015625L, 33, 44, 55) < 0 | ||
2046 | || (wcscmp (buf, L"0x1.922p+1 33") != 0 | ||
2047 | && wcscmp (buf, L"0x3.244p+0 33") != 0 | ||
2048 | && wcscmp (buf, L"0x6.488p-1 33") != 0 | ||
2049 | && wcscmp (buf, L"0xc.91p-2 33") != 0)) | ||
2050 | result |= 1; | ||
2051 | return result; | ||
2052 | }]])], | ||
2053 | [gl_cv_func_swprintf_directive_la=yes], | ||
2054 | [gl_cv_func_swprintf_directive_la=no], | ||
2055 | [case "$host_os" in | ||
2056 | # Guess yes on glibc >= 2.17 systems. | ||
2057 | *-gnu* | gnu*) | ||
2058 | AC_EGREP_CPP([Unlucky], [ | ||
2059 | #include <features.h> | ||
2060 | #ifdef __GNU_LIBRARY__ | ||
2061 | #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16) || (__GLIBC__ > 2)) && !defined __UCLIBC__ | ||
2062 | Unlucky | ||
2063 | #endif | ||
2064 | #endif | ||
2065 | ], | ||
2066 | [gl_cv_func_swprintf_directive_la="guessing yes"], | ||
2067 | [gl_cv_func_swprintf_directive_la="guessing no"]) | ||
2068 | ;; | ||
2069 | # Guess yes on musl systems. | ||
2070 | *-musl* | midipix*) gl_cv_func_swprintf_directive_la="guessing yes";; | ||
2071 | # Guess yes on Android. | ||
2072 | linux*-android*) gl_cv_func_swprintf_directive_la="guessing yes";; | ||
2073 | # Guess no on NetBSD. | ||
2074 | netbsd*) gl_cv_func_swprintf_directive_la="guessing no";; | ||
2075 | # Guess no on native Windows. | ||
2076 | mingw* | windows*) gl_cv_func_swprintf_directive_la="guessing no";; | ||
2077 | # If we don't know, obey --enable-cross-guesses. | ||
2078 | *) gl_cv_func_swprintf_directive_la="$gl_cross_guess_normal";; | ||
2079 | esac | ||
2080 | ]) | ||
2081 | ]) | ||
2082 | ]) | ||
2083 | |||
2084 | dnl Test whether the *wprintf family of functions supports the 'lc' conversion | ||
2085 | dnl specifier for all wide characters. | ||
2086 | dnl (ISO C11, POSIX:2001) | ||
2087 | dnl Result is gl_cv_func_swprintf_directive_lc. | ||
2088 | |||
2089 | AC_DEFUN([gl_SWPRINTF_DIRECTIVE_LC], | ||
2090 | [ | ||
2091 | AC_REQUIRE([AC_PROG_CC]) | ||
2092 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
2093 | AC_CACHE_CHECK([whether swprintf supports the 'lc' directive], | ||
2094 | [gl_cv_func_swprintf_directive_lc], | ||
2095 | [ | ||
2096 | AC_RUN_IFELSE( | ||
2097 | [AC_LANG_SOURCE([[ | ||
2098 | #include <stdio.h> | ||
2099 | #include <wchar.h> | ||
2100 | static wchar_t buf[100]; | ||
2101 | static wint_t L_invalid = (wchar_t) 0x76543210; | ||
2102 | int main () | ||
2103 | { | ||
2104 | int result = 0; | ||
2105 | /* This catches a musl libc 1.2.4, Android bug. | ||
2106 | Reported at <https://www.openwall.com/lists/musl/2023/06/12/3>. */ | ||
2107 | if (swprintf (buf, sizeof (buf) / sizeof (wchar_t), | ||
2108 | L"%lc %d", L_invalid, 33, 44, 55) < 0) | ||
2109 | result |= 1; | ||
2110 | return result; | ||
2111 | }]])], | ||
2112 | [gl_cv_func_swprintf_directive_lc=yes], | ||
2113 | [gl_cv_func_swprintf_directive_lc=no], | ||
2114 | [case "$host_os" in | ||
2115 | # Guess yes on glibc systems. | ||
2116 | *-gnu* | gnu*) gl_cv_func_swprintf_directive_lc="guessing yes";; | ||
2117 | # Guess no on musl systems. | ||
2118 | *-musl* | midipix*) gl_cv_func_swprintf_directive_lc="guessing no";; | ||
2119 | # Guess no on Android. | ||
2120 | linux*-android*) gl_cv_func_swprintf_directive_lc="guessing no";; | ||
2121 | # Guess yes on native Windows. | ||
2122 | mingw* | windows*) gl_cv_func_swprintf_directive_lc="guessing yes";; | ||
2123 | # If we don't know, obey --enable-cross-guesses. | ||
2124 | *) gl_cv_func_swprintf_directive_lc="$gl_cross_guess_normal";; | ||
2125 | esac | ||
2126 | ]) | ||
2127 | ]) | ||
2128 | ]) | ||
2129 | |||
1644 | dnl The results of these tests on various platforms are: | 2130 | dnl The results of these tests on various platforms are: |
1645 | dnl | 2131 | dnl |
1646 | dnl 1 = gl_PRINTF_SIZES_C99 | 2132 | dnl 1 = gl_PRINTF_SIZES_C99 |
1647 | dnl 2 = gl_PRINTF_LONG_DOUBLE | 2133 | dnl 2 = gl_PRINTF_SIZES_C23 |
1648 | dnl 3 = gl_PRINTF_INFINITE | 2134 | dnl 3 = gl_PRINTF_LONG_DOUBLE |
1649 | dnl 4 = gl_PRINTF_INFINITE_LONG_DOUBLE | 2135 | dnl 4 = gl_PRINTF_INFINITE |
1650 | dnl 5 = gl_PRINTF_DIRECTIVE_A | 2136 | dnl 5 = gl_PRINTF_INFINITE_LONG_DOUBLE |
1651 | dnl 6 = gl_PRINTF_DIRECTIVE_F | 2137 | dnl 6 = gl_PRINTF_DIRECTIVE_A |
1652 | dnl 7 = gl_PRINTF_DIRECTIVE_N | 2138 | dnl 7 = gl_PRINTF_DIRECTIVE_B |
1653 | dnl 8 = gl_PRINTF_DIRECTIVE_LS | 2139 | dnl 8 = gl_PRINTF_DIRECTIVE_UPPERCASE_B |
1654 | dnl 9 = gl_PRINTF_POSITIONS | 2140 | dnl 9 = gl_PRINTF_DIRECTIVE_F |
1655 | dnl 10 = gl_PRINTF_FLAG_GROUPING | 2141 | dnl 10 = gl_PRINTF_DIRECTIVE_N |
1656 | dnl 11 = gl_PRINTF_FLAG_LEFTADJUST | 2142 | dnl 11 = gl_PRINTF_DIRECTIVE_LS |
1657 | dnl 12 = gl_PRINTF_FLAG_ZERO | 2143 | dnl 12 = gl_PRINTF_DIRECTIVE_LC |
1658 | dnl 13 = gl_PRINTF_PRECISION | 2144 | dnl 13 = gl_PRINTF_POSITIONS |
1659 | dnl 14 = gl_PRINTF_ENOMEM | 2145 | dnl 14 = gl_PRINTF_FLAG_GROUPING |
1660 | dnl 15 = gl_SNPRINTF_PRESENCE | 2146 | dnl 15 = gl_PRINTF_FLAG_LEFTADJUST |
1661 | dnl 16 = gl_SNPRINTF_TRUNCATION_C99 | 2147 | dnl 16 = gl_PRINTF_FLAG_ZERO |
1662 | dnl 17 = gl_SNPRINTF_RETVAL_C99 | 2148 | dnl 17 = gl_PRINTF_FLAG_ALT_PRECISION_ZERO |
1663 | dnl 18 = gl_SNPRINTF_DIRECTIVE_N | 2149 | dnl 18 = gl_PRINTF_PRECISION |
1664 | dnl 19 = gl_SNPRINTF_SIZE1 | 2150 | dnl 19 = gl_PRINTF_ENOMEM |
1665 | dnl 20 = gl_VSNPRINTF_ZEROSIZE_C99 | 2151 | dnl 20 = gl_SNPRINTF_PRESENCE |
2152 | dnl 21 = gl_SNPRINTF_TRUNCATION_C99 | ||
2153 | dnl 22 = gl_SNPRINTF_RETVAL_C99 | ||
2154 | dnl 23 = gl_SNPRINTF_DIRECTIVE_N | ||
2155 | dnl 24 = gl_SNPRINTF_SIZE1 | ||
2156 | dnl 25 = gl_VSNPRINTF_ZEROSIZE_C99 | ||
2157 | dnl 26 = gl_SWPRINTF_WORKS | ||
2158 | dnl 27 = gl_SWPRINTF_DIRECTIVE_LA | ||
2159 | dnl 28 = gl_SWPRINTF_DIRECTIVE_LC | ||
1666 | dnl | 2160 | dnl |
1667 | dnl 1 = checking whether printf supports size specifiers as in C99... | 2161 | dnl 1 = checking whether printf supports size specifiers as in C99... |
1668 | dnl 2 = checking whether printf supports 'long double' arguments... | 2162 | dnl 2 = checking whether printf supports size specifiers as in C23... |
1669 | dnl 3 = checking whether printf supports infinite 'double' arguments... | 2163 | dnl 3 = checking whether printf supports 'long double' arguments... |
1670 | dnl 4 = checking whether printf supports infinite 'long double' arguments... | 2164 | dnl 4 = checking whether printf supports infinite 'double' arguments... |
1671 | dnl 5 = checking whether printf supports the 'a' and 'A' directives... | 2165 | dnl 5 = checking whether printf supports infinite 'long double' arguments... |
1672 | dnl 6 = checking whether printf supports the 'F' directive... | 2166 | dnl 6 = checking whether printf supports the 'a' and 'A' directives... |
1673 | dnl 7 = checking whether printf supports the 'n' directive... | 2167 | dnl 7 = checking whether printf supports the 'b' directive... |
1674 | dnl 8 = checking whether printf supports the 'ls' directive... | 2168 | dnl 8 = checking whether printf supports the 'B' directive... |
1675 | dnl 9 = checking whether printf supports POSIX/XSI format strings with positions... | 2169 | dnl 9 = checking whether printf supports the 'F' directive... |
1676 | dnl 10 = checking whether printf supports the grouping flag... | 2170 | dnl 10 = checking whether printf supports the 'n' directive... |
1677 | dnl 11 = checking whether printf supports the left-adjust flag correctly... | 2171 | dnl 11 = checking whether printf supports the 'ls' directive... |
1678 | dnl 12 = checking whether printf supports the zero flag correctly... | 2172 | dnl 12 = checking whether printf supports the 'lc' directive correctly... |
1679 | dnl 13 = checking whether printf supports large precisions... | 2173 | dnl 13 = checking whether printf supports POSIX/XSI format strings with positions... |
1680 | dnl 14 = checking whether printf survives out-of-memory conditions... | 2174 | dnl 14 = checking whether printf supports the grouping flag... |
1681 | dnl 15 = checking for snprintf... | 2175 | dnl 15 = checking whether printf supports the left-adjust flag correctly... |
1682 | dnl 16 = checking whether snprintf truncates the result as in C99... | 2176 | dnl 16 = checking whether printf supports the zero flag correctly... |
1683 | dnl 17 = checking whether snprintf returns a byte count as in C99... | 2177 | dnl 17 = checking whether printf supports the alternative flag with a zero precision... |
1684 | dnl 18 = checking whether snprintf fully supports the 'n' directive... | 2178 | dnl 18 = checking whether printf supports large precisions... |
1685 | dnl 19 = checking whether snprintf respects a size of 1... | 2179 | dnl 19 = checking whether printf survives out-of-memory conditions... |
1686 | dnl 20 = checking whether vsnprintf respects a zero size as in C99... | 2180 | dnl 20 = checking for snprintf... |
2181 | dnl 21 = checking whether snprintf truncates the result as in C99... | ||
2182 | dnl 22 = checking whether snprintf returns a byte count as in C99... | ||
2183 | dnl 23 = checking whether snprintf fully supports the 'n' directive... | ||
2184 | dnl 24 = checking whether snprintf respects a size of 1... | ||
2185 | dnl 25 = checking whether vsnprintf respects a zero size as in C99... | ||
2186 | dnl 26 = checking whether swprintf works... | ||
2187 | dnl 27 = checking whether swprintf supports the 'La' and 'LA' directives... | ||
2188 | dnl 28 = checking whether swprintf supports the 'lc' directive... | ||
1687 | dnl | 2189 | dnl |
1688 | dnl . = yes, # = no. | 2190 | dnl . = yes, # = no. |
1689 | dnl | 2191 | dnl |
1690 | dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 2192 | dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
1691 | dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . . | 2193 | dnl musl libc 1.2.3 . # . . . . # # . . . # . . . . ? . . . . . . . . # . # |
1692 | dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . . | 2194 | dnl glibc 2.35 . # . . . . . . . . . . . . . . . . . . . . . . . . . . |
1693 | dnl FreeBSD 13.0 . . . . # . . . . . . . . # . . . . . . | 2195 | dnl glibc 2.5 . # . . . . # # . . . . . . . . . . . . . . . . . . # . |
1694 | dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . . | 2196 | dnl glibc 2.3.6 . # . . . # # # . . . . . . . . . . . . . . . . . . # . |
1695 | dnl Mac OS X 10.13.5 . . . # # . # . . . . . . . . . . # . . | 2197 | dnl FreeBSD 14.0 . . . . . # . . . . . . . . . . . . # . . . . . . # . # |
1696 | dnl Mac OS X 10.5.8 . . . # # . . . . . . # . . . . . . . . | 2198 | dnl FreeBSD 13.0 . # . . . # # # . . . . . . . . . . # . . . . . . # . # |
1697 | dnl Mac OS X 10.3.9 . . . . # . . . . . . # . # . . . . . . | 2199 | dnl FreeBSD 5.4, 6.1 . # . . . # # # . . . . . . . # ? . # . . . . . . # ? ? |
1698 | dnl OpenBSD 6.0, 6.7 . . . . # . . . . . . . . # . . . . . . | 2200 | dnl Mac OS X 10.13.5 . # . . # # # # . # . . . . . . . . . . . . # . . # ? ? |
1699 | dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . . | 2201 | dnl Mac OS X 10.5.8 . # . . # # # # . . . . . . . # # . . . . . . . . # ? ? |
1700 | dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . . | 2202 | dnl Mac OS X 10.3.9 . # . . . # # # . . . . . . . # # . # . . . . . . # ? ? |
1701 | dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . . | 2203 | dnl OpenBSD 6.0, 6.7 . # . . . # # # . . . . . . . . . . # . . . . . . # . # |
1702 | dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . . | 2204 | dnl OpenBSD 3.9, 4.0 . # . # # # # # # . # . . # . # ? . # . . . . . . # ? ? |
1703 | dnl Solaris 11.4 . . # # # . . # . . . # . . . . . . . . | 2205 | dnl Cygwin 1.7.0 (2009) . # . . # . # # . . ? ? . . . . ? . ? . . . . . . ? ? ? |
1704 | dnl Solaris 11.3 . . . . # . . # . . . . . . . . . . . . | 2206 | dnl Cygwin 1.5.25 (2008) . # . . # # # # . . # ? . . . . ? . # . . . . . . ? ? ? |
1705 | dnl Solaris 11.0 . . # # # . . # . . . # . . . . . . . . | 2207 | dnl Cygwin 1.5.19 (2006) # # . . # # # # # . # ? . # . # ? # # . . . . . . ? ? ? |
1706 | dnl Solaris 10 . . # # # . . # . . . # # . . . . . . . | 2208 | dnl Solaris 11.4 . # . # # # # # . . # . . . . # . . . . . . . . . . # . |
1707 | dnl Solaris 2.6 ... 9 # . # # # # . # . . . # # . . . # . . . | 2209 | dnl Solaris 11.3 . # . . . # # # . . # . . . . . . . . . . . . . . . # . |
1708 | dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # # | 2210 | dnl Solaris 11.0 . # . # # # # # . . # . . . . # . . . . . . . . . ? ? ? |
1709 | dnl AIX 7.1 . . # # # . . . . . . # # . . . . . . . | 2211 | dnl Solaris 10 . # . # # # # # . . # . . . . # . # . . . . . . . . # . |
1710 | dnl AIX 5.2 . . # # # . . . . . . # . . . . . . . . | 2212 | dnl Solaris 2.6 ... 9 # # . # # # # # # . # . . . . # ? # . . . # . . . ? ? ? |
1711 | dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . # . . . | 2213 | dnl Solaris 2.5.1 # # . # # # # # # . # . . . . # ? . . # # # # # # ? ? ? |
1712 | dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . . | 2214 | dnl AIX 7.1 . # . # # # # # . . . . . . . # . # . . . . . . . # . . |
1713 | dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . # | 2215 | dnl AIX 5.2 . # . # # # # # . . . . . . . # ? . . . . . . . . # ? ? |
1714 | dnl HP-UX 10.20 # . # . # # . ? . . # # . . . . # # ? # | 2216 | dnl AIX 4.3.2, 5.1 # # . # # # # # # . . . . . . # ? . . . . # . . . # ? ? |
1715 | dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . . | 2217 | dnl HP-UX 11.31 . # . . . # # # . . . ? . . . # ? . . . . # # . . ? ? ? |
1716 | dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . # | 2218 | dnl HP-UX 11.{00,11,23} # # . . . # # # # . . ? . . . # ? . . . . # # . # ? ? ? |
1717 | dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # # | 2219 | dnl HP-UX 10.20 # # . # . # # # # . ? ? . . # # ? . . . . # # ? # ? ? ? |
1718 | dnl NetBSD 9.0 . . . . # . . . . . . . . . . . . . . . | 2220 | dnl IRIX 6.5 # # . # # # # # # . # . . . . # ? . . . . # . . . # ? ? |
1719 | dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . . | 2221 | dnl OSF/1 5.1 # # . # # # # # # . . ? . . . # ? . . . . # . . # ? ? ? |
1720 | dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ? | 2222 | dnl OSF/1 4.0d # # . # # # # # # . . ? . . . # ? . . # # # # # # ? ? ? |
1721 | dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . . | 2223 | dnl NetBSD 9.0 . # . . . # # # . . . . . . . . . . . . . . . . . # . # |
1722 | dnl Haiku . . . # # # . # . . . . . ? . . ? . . . | 2224 | dnl NetBSD 5.0 . # . . # # # # . . . . . . . # ? . # . . . . . . # ? ? |
1723 | dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . . | 2225 | dnl NetBSD 4.0 . # ? ? ? ? # # ? . ? . . ? ? ? ? ? ? . . . ? ? ? # ? ? |
1724 | dnl Android 4.3 . . # # # # # # . # . # . # . . . # . . | 2226 | dnl NetBSD 3.0 . # . . . # # # # . ? . # # ? # ? . # . . . . . . # ? ? |
1725 | dnl old mingw / msvcrt # # # # # # . . # # . # # ? . # # # . . | 2227 | dnl Haiku . # . . # # # # # . # ? . . . . ? . ? . . ? . . . . # . |
1726 | dnl MSVC 9 # # # # # # # . # # . # # ? # # # # . . | 2228 | dnl BeOS # # # . # # # # # . ? ? # . ? . ? # ? . . ? . . . ? ? ? |
1727 | dnl mingw 2009-2011 . # . # . . . . # # . . . ? . . . . . . | 2229 | dnl Android 4.3 . # . # # # # # # # # ? . # . # ? . # . . . # . . ? ? ? |
1728 | dnl mingw-w64 2011 # # # # # # . . # # . # # ? . # # # . . | 2230 | dnl old mingw / msvcrt # # # # # # # # # . . ? # # . # ? # ? . # # # . . # ? ? |
2231 | dnl MSVC 9 # # # # # # # # # # . ? # # . # ? # ? # # # # . . # ? ? | ||
2232 | dnl mingw 2009-2011 . # # . # . # # . . . ? # # . . ? . ? . . . . . . # ? ? | ||
2233 | dnl mingw-w64 2011 # # # # # # # # # . . ? # # . # ? # ? . # # # . . # ? ? | ||