doc: Document the `sitedir' and `extensiondir' pkg-config variables.
[bpt/guile.git] / m4 / printf.m4
CommitLineData
231c0e0e 1# printf.m4 serial 43
49114fd4 2dnl Copyright (C) 2003, 2007-2011 Free Software Foundation, Inc.
c4b681fd
LC
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl Test whether the *printf family of functions supports the 'j', 'z', 't',
8dnl 'L' size specifiers. (ISO C99, POSIX:2001)
9dnl Result is gl_cv_func_printf_sizes_c99.
10
11AC_DEFUN([gl_PRINTF_SIZES_C99],
12[
13 AC_REQUIRE([AC_PROG_CC])
14 AC_REQUIRE([gl_AC_HEADER_STDINT_H])
15 AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
16 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
17 AC_CACHE_CHECK([whether printf supports size specifiers as in C99],
18 [gl_cv_func_printf_sizes_c99],
19 [
9157d901
LC
20 AC_RUN_IFELSE(
21 [AC_LANG_SOURCE([[
c4b681fd
LC
22#include <stddef.h>
23#include <stdio.h>
24#include <string.h>
25#include <sys/types.h>
26#if HAVE_STDINT_H_WITH_UINTMAX
27# include <stdint.h>
28#endif
29#if HAVE_INTTYPES_H_WITH_UINTMAX
30# include <inttypes.h>
31#endif
32static char buf[100];
33int main ()
34{
0f00f2c3 35 int result = 0;
c4b681fd
LC
36#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX
37 buf[0] = '\0';
38 if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0
39 || strcmp (buf, "12345671 33") != 0)
0f00f2c3 40 result |= 1;
c4b681fd
LC
41#endif
42 buf[0] = '\0';
43 if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0
44 || strcmp (buf, "12345672 33") != 0)
0f00f2c3 45 result |= 2;
c4b681fd
LC
46 buf[0] = '\0';
47 if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0
48 || strcmp (buf, "12345673 33") != 0)
0f00f2c3 49 result |= 4;
c4b681fd
LC
50 buf[0] = '\0';
51 if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0
52 || strcmp (buf, "1.5 33") != 0)
0f00f2c3
LC
53 result |= 8;
54 return result;
9157d901
LC
55}]])],
56 [gl_cv_func_printf_sizes_c99=yes],
57 [gl_cv_func_printf_sizes_c99=no],
58 [
c4b681fd 59changequote(,)dnl
9157d901
LC
60 case "$host_os" in
61 # Guess yes on glibc systems.
62 *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";;
63 # Guess yes on FreeBSD >= 5.
64 freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";;
65 freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
66 # Guess yes on MacOS X >= 10.3.
67 darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";;
68 darwin*) gl_cv_func_printf_sizes_c99="guessing yes";;
69 # Guess yes on OpenBSD >= 3.9.
70 openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
71 gl_cv_func_printf_sizes_c99="guessing no";;
72 openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
73 # Guess yes on Solaris >= 2.10.
49114fd4
LC
74 solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";;
75 solaris*) gl_cv_func_printf_sizes_c99="guessing no";;
9157d901
LC
76 # Guess yes on NetBSD >= 3.
77 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
78 gl_cv_func_printf_sizes_c99="guessing no";;
79 netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
80 # If we don't know, assume the worst.
81 *) gl_cv_func_printf_sizes_c99="guessing no";;
82 esac
c4b681fd 83changequote([,])dnl
9157d901 84 ])
c4b681fd
LC
85 ])
86])
87
88dnl Test whether the *printf family of functions supports 'long double'
89dnl arguments together with the 'L' size specifier. (ISO C99, POSIX:2001)
90dnl Result is gl_cv_func_printf_long_double.
91
92AC_DEFUN([gl_PRINTF_LONG_DOUBLE],
93[
94 AC_REQUIRE([AC_PROG_CC])
95 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
96 AC_CACHE_CHECK([whether printf supports 'long double' arguments],
97 [gl_cv_func_printf_long_double],
98 [
9157d901
LC
99 AC_RUN_IFELSE(
100 [AC_LANG_SOURCE([[
c4b681fd
LC
101#include <stdio.h>
102#include <string.h>
103static char buf[10000];
104int main ()
105{
0f00f2c3 106 int result = 0;
c4b681fd
LC
107 buf[0] = '\0';
108 if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0
109 || strcmp (buf, "1.750000 33") != 0)
0f00f2c3 110 result |= 1;
c4b681fd
LC
111 buf[0] = '\0';
112 if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0
113 || strcmp (buf, "1.750000e+00 33") != 0)
0f00f2c3 114 result |= 2;
c4b681fd
LC
115 buf[0] = '\0';
116 if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0
117 || strcmp (buf, "1.75 33") != 0)
0f00f2c3
LC
118 result |= 4;
119 return result;
9157d901
LC
120}]])],
121 [gl_cv_func_printf_long_double=yes],
122 [gl_cv_func_printf_long_double=no],
123 [
c4b681fd 124changequote(,)dnl
9157d901
LC
125 case "$host_os" in
126 beos*) gl_cv_func_printf_long_double="guessing no";;
127 mingw* | pw*) gl_cv_func_printf_long_double="guessing no";;
128 *) gl_cv_func_printf_long_double="guessing yes";;
129 esac
c4b681fd 130changequote([,])dnl
9157d901 131 ])
c4b681fd
LC
132 ])
133])
134
135dnl Test whether the *printf family of functions supports infinite and NaN
136dnl 'double' arguments and negative zero arguments in the %f, %e, %g
137dnl directives. (ISO C99, POSIX:2001)
138dnl Result is gl_cv_func_printf_infinite.
139
140AC_DEFUN([gl_PRINTF_INFINITE],
141[
142 AC_REQUIRE([AC_PROG_CC])
143 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
144 AC_CACHE_CHECK([whether printf supports infinite 'double' arguments],
145 [gl_cv_func_printf_infinite],
146 [
9157d901
LC
147 AC_RUN_IFELSE(
148 [AC_LANG_SOURCE([[
c4b681fd
LC
149#include <stdio.h>
150#include <string.h>
151static int
152strisnan (const char *string, size_t start_index, size_t end_index)
153{
154 if (start_index < end_index)
155 {
156 if (string[start_index] == '-')
157 start_index++;
158 if (start_index + 3 <= end_index
159 && memcmp (string + start_index, "nan", 3) == 0)
160 {
161 start_index += 3;
162 if (start_index == end_index
163 || (string[start_index] == '(' && string[end_index - 1] == ')'))
164 return 1;
165 }
166 }
167 return 0;
168}
169static int
170have_minus_zero ()
171{
172 static double plus_zero = 0.0;
173 double minus_zero = - plus_zero;
174 return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0;
175}
176static char buf[10000];
177static double zero = 0.0;
178int main ()
179{
0f00f2c3 180 int result = 0;
c4b681fd
LC
181 if (sprintf (buf, "%f", 1.0 / 0.0) < 0
182 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
0f00f2c3 183 result |= 1;
c4b681fd
LC
184 if (sprintf (buf, "%f", -1.0 / 0.0) < 0
185 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
0f00f2c3 186 result |= 1;
c4b681fd
LC
187 if (sprintf (buf, "%f", zero / zero) < 0
188 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 189 result |= 2;
c4b681fd
LC
190 if (sprintf (buf, "%e", 1.0 / 0.0) < 0
191 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
0f00f2c3 192 result |= 4;
c4b681fd
LC
193 if (sprintf (buf, "%e", -1.0 / 0.0) < 0
194 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
0f00f2c3 195 result |= 4;
c4b681fd
LC
196 if (sprintf (buf, "%e", zero / zero) < 0
197 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 198 result |= 8;
c4b681fd
LC
199 if (sprintf (buf, "%g", 1.0 / 0.0) < 0
200 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
0f00f2c3 201 result |= 16;
c4b681fd
LC
202 if (sprintf (buf, "%g", -1.0 / 0.0) < 0
203 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
0f00f2c3 204 result |= 16;
c4b681fd
LC
205 if (sprintf (buf, "%g", zero / zero) < 0
206 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 207 result |= 32;
c4b681fd
LC
208 /* This test fails on HP-UX 10.20. */
209 if (have_minus_zero ())
210 if (sprintf (buf, "%g", - zero) < 0
211 || strcmp (buf, "-0") != 0)
0f00f2c3
LC
212 result |= 64;
213 return result;
9157d901
LC
214}]])],
215 [gl_cv_func_printf_infinite=yes],
216 [gl_cv_func_printf_infinite=no],
217 [
c4b681fd 218changequote(,)dnl
9157d901
LC
219 case "$host_os" in
220 # Guess yes on glibc systems.
221 *-gnu*) gl_cv_func_printf_infinite="guessing yes";;
222 # Guess yes on FreeBSD >= 6.
223 freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";;
224 freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";;
225 # Guess yes on MacOS X >= 10.3.
226 darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";;
227 darwin*) gl_cv_func_printf_infinite="guessing yes";;
228 # Guess yes on HP-UX >= 11.
229 hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";;
230 hpux*) gl_cv_func_printf_infinite="guessing yes";;
231 # Guess yes on NetBSD >= 3.
232 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
233 gl_cv_func_printf_infinite="guessing no";;
234 netbsd*) gl_cv_func_printf_infinite="guessing yes";;
235 # Guess yes on BeOS.
236 beos*) gl_cv_func_printf_infinite="guessing yes";;
237 # If we don't know, assume the worst.
238 *) gl_cv_func_printf_infinite="guessing no";;
239 esac
c4b681fd 240changequote([,])dnl
9157d901 241 ])
c4b681fd
LC
242 ])
243])
244
245dnl Test whether the *printf family of functions supports infinite and NaN
246dnl 'long double' arguments in the %f, %e, %g directives. (ISO C99, POSIX:2001)
247dnl Result is gl_cv_func_printf_infinite_long_double.
248
249AC_DEFUN([gl_PRINTF_INFINITE_LONG_DOUBLE],
250[
251 AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
252 AC_REQUIRE([AC_PROG_CC])
253 AC_REQUIRE([gl_BIGENDIAN])
254 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
255 dnl The user can set or unset the variable gl_printf_safe to indicate
256 dnl that he wishes a safe handling of non-IEEE-754 'long double' values.
257 if test -n "$gl_printf_safe"; then
258 AC_DEFINE([CHECK_PRINTF_SAFE], [1],
259 [Define if you wish *printf() functions that have a safe handling of
260 non-IEEE-754 'long double' values.])
261 fi
262 case "$gl_cv_func_printf_long_double" in
263 *yes)
264 AC_CACHE_CHECK([whether printf supports infinite 'long double' arguments],
265 [gl_cv_func_printf_infinite_long_double],
266 [
9157d901
LC
267 AC_RUN_IFELSE(
268 [AC_LANG_SOURCE([[
c4b681fd
LC
269]GL_NOCRASH[
270#include <float.h>
271#include <stdio.h>
272#include <string.h>
273static int
274strisnan (const char *string, size_t start_index, size_t end_index)
275{
276 if (start_index < end_index)
277 {
278 if (string[start_index] == '-')
279 start_index++;
280 if (start_index + 3 <= end_index
281 && memcmp (string + start_index, "nan", 3) == 0)
282 {
283 start_index += 3;
284 if (start_index == end_index
285 || (string[start_index] == '(' && string[end_index - 1] == ')'))
286 return 1;
287 }
288 }
289 return 0;
290}
291static char buf[10000];
292static long double zeroL = 0.0L;
293int main ()
294{
0f00f2c3 295 int result = 0;
c4b681fd
LC
296 nocrash_init();
297 if (sprintf (buf, "%Lf", 1.0L / 0.0L) < 0
298 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
0f00f2c3 299 result |= 1;
c4b681fd
LC
300 if (sprintf (buf, "%Lf", -1.0L / 0.0L) < 0
301 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
0f00f2c3 302 result |= 1;
c4b681fd
LC
303 if (sprintf (buf, "%Lf", zeroL / zeroL) < 0
304 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 305 result |= 1;
c4b681fd
LC
306 if (sprintf (buf, "%Le", 1.0L / 0.0L) < 0
307 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
0f00f2c3 308 result |= 1;
c4b681fd
LC
309 if (sprintf (buf, "%Le", -1.0L / 0.0L) < 0
310 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
0f00f2c3 311 result |= 1;
c4b681fd
LC
312 if (sprintf (buf, "%Le", zeroL / zeroL) < 0
313 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 314 result |= 1;
c4b681fd
LC
315 if (sprintf (buf, "%Lg", 1.0L / 0.0L) < 0
316 || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0))
0f00f2c3 317 result |= 1;
c4b681fd
LC
318 if (sprintf (buf, "%Lg", -1.0L / 0.0L) < 0
319 || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0))
0f00f2c3 320 result |= 1;
c4b681fd
LC
321 if (sprintf (buf, "%Lg", zeroL / zeroL) < 0
322 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 323 result |= 1;
c4b681fd
LC
324#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_))
325/* Representation of an 80-bit 'long double' as an initializer for a sequence
326 of 'unsigned int' words. */
327# ifdef WORDS_BIGENDIAN
328# define LDBL80_WORDS(exponent,manthi,mantlo) \
329 { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \
330 ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16), \
331 (unsigned int) (mantlo) << 16 \
332 }
333# else
334# define LDBL80_WORDS(exponent,manthi,mantlo) \
335 { mantlo, manthi, exponent }
336# endif
337 { /* Quiet NaN. */
338 static union { unsigned int word[4]; long double value; } x =
339 { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) };
340 if (sprintf (buf, "%Lf", x.value) < 0
341 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 342 result |= 2;
c4b681fd
LC
343 if (sprintf (buf, "%Le", x.value) < 0
344 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 345 result |= 2;
c4b681fd
LC
346 if (sprintf (buf, "%Lg", x.value) < 0
347 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 348 result |= 2;
c4b681fd
LC
349 }
350 {
351 /* Signalling NaN. */
352 static union { unsigned int word[4]; long double value; } x =
353 { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
354 if (sprintf (buf, "%Lf", x.value) < 0
355 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 356 result |= 2;
c4b681fd
LC
357 if (sprintf (buf, "%Le", x.value) < 0
358 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 359 result |= 2;
c4b681fd
LC
360 if (sprintf (buf, "%Lg", x.value) < 0
361 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 362 result |= 2;
c4b681fd
LC
363 }
364 { /* Pseudo-NaN. */
365 static union { unsigned int word[4]; long double value; } x =
366 { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
367 if (sprintf (buf, "%Lf", x.value) < 0
368 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 369 result |= 4;
c4b681fd
LC
370 if (sprintf (buf, "%Le", x.value) < 0
371 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 372 result |= 4;
c4b681fd
LC
373 if (sprintf (buf, "%Lg", x.value) < 0
374 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 375 result |= 4;
c4b681fd
LC
376 }
377 { /* Pseudo-Infinity. */
378 static union { unsigned int word[4]; long double value; } x =
379 { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
380 if (sprintf (buf, "%Lf", x.value) < 0
381 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 382 result |= 8;
c4b681fd
LC
383 if (sprintf (buf, "%Le", x.value) < 0
384 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 385 result |= 8;
c4b681fd
LC
386 if (sprintf (buf, "%Lg", x.value) < 0
387 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 388 result |= 8;
c4b681fd
LC
389 }
390 { /* Pseudo-Zero. */
391 static union { unsigned int word[4]; long double value; } x =
392 { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
393 if (sprintf (buf, "%Lf", x.value) < 0
394 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 395 result |= 16;
c4b681fd
LC
396 if (sprintf (buf, "%Le", x.value) < 0
397 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 398 result |= 16;
c4b681fd
LC
399 if (sprintf (buf, "%Lg", x.value) < 0
400 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 401 result |= 16;
c4b681fd
LC
402 }
403 { /* Unnormalized number. */
404 static union { unsigned int word[4]; long double value; } x =
405 { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
406 if (sprintf (buf, "%Lf", x.value) < 0
407 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 408 result |= 32;
c4b681fd
LC
409 if (sprintf (buf, "%Le", x.value) < 0
410 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 411 result |= 32;
c4b681fd
LC
412 if (sprintf (buf, "%Lg", x.value) < 0
413 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 414 result |= 32;
c4b681fd
LC
415 }
416 { /* Pseudo-Denormal. */
417 static union { unsigned int word[4]; long double value; } x =
418 { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
419 if (sprintf (buf, "%Lf", x.value) < 0
420 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 421 result |= 64;
c4b681fd
LC
422 if (sprintf (buf, "%Le", x.value) < 0
423 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 424 result |= 64;
c4b681fd
LC
425 if (sprintf (buf, "%Lg", x.value) < 0
426 || !strisnan (buf, 0, strlen (buf)))
0f00f2c3 427 result |= 64;
c4b681fd
LC
428 }
429#endif
0f00f2c3 430 return result;
9157d901
LC
431}]])],
432 [gl_cv_func_printf_infinite_long_double=yes],
433 [gl_cv_func_printf_infinite_long_double=no],
434 [
c4b681fd 435changequote(,)dnl
9157d901
LC
436 case "$host_cpu" in
437 # Guess no on ia64, x86_64, i386.
438 ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";;
439 *)
440 case "$host_os" in
441 # Guess yes on glibc systems.
442 *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";;
443 # Guess yes on FreeBSD >= 6.
444 freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";;
445 freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
9157d901
LC
446 # Guess yes on HP-UX >= 11.
447 hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";;
448 hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";;
9157d901
LC
449 # If we don't know, assume the worst.
450 *) gl_cv_func_printf_infinite_long_double="guessing no";;
451 esac
452 ;;
453 esac
c4b681fd 454changequote([,])dnl
9157d901 455 ])
c4b681fd
LC
456 ])
457 ;;
458 *)
459 gl_cv_func_printf_infinite_long_double="irrelevant"
460 ;;
461 esac
462])
463
464dnl Test whether the *printf family of functions supports the 'a' and 'A'
465dnl conversion specifier for hexadecimal output of floating-point numbers.
466dnl (ISO C99, POSIX:2001)
467dnl Result is gl_cv_func_printf_directive_a.
468
469AC_DEFUN([gl_PRINTF_DIRECTIVE_A],
470[
471 AC_REQUIRE([AC_PROG_CC])
472 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
473 AC_CACHE_CHECK([whether printf supports the 'a' and 'A' directives],
474 [gl_cv_func_printf_directive_a],
475 [
9157d901
LC
476 AC_RUN_IFELSE(
477 [AC_LANG_SOURCE([[
c4b681fd
LC
478#include <stdio.h>
479#include <string.h>
480static char buf[100];
481int main ()
482{
0f00f2c3 483 int result = 0;
c4b681fd
LC
484 if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0
485 || (strcmp (buf, "0x1.922p+1 33") != 0
486 && strcmp (buf, "0x3.244p+0 33") != 0
487 && strcmp (buf, "0x6.488p-1 33") != 0
488 && strcmp (buf, "0xc.91p-2 33") != 0))
0f00f2c3 489 result |= 1;
c4b681fd
LC
490 if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0
491 || (strcmp (buf, "-0X1.922P+1 33") != 0
492 && strcmp (buf, "-0X3.244P+0 33") != 0
493 && strcmp (buf, "-0X6.488P-1 33") != 0
494 && strcmp (buf, "-0XC.91P-2 33") != 0))
0f00f2c3 495 result |= 2;
c4b681fd
LC
496 /* This catches a FreeBSD 6.1 bug: it doesn't round. */
497 if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0
498 || (strcmp (buf, "0x1.83p+0 33") != 0
499 && strcmp (buf, "0x3.05p-1 33") != 0
500 && strcmp (buf, "0x6.0ap-2 33") != 0
501 && strcmp (buf, "0xc.14p-3 33") != 0))
0f00f2c3 502 result |= 4;
c4b681fd
LC
503 /* This catches a FreeBSD 6.1 bug. See
504 <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
505 if (sprintf (buf, "%010a %d", 1.0 / 0.0, 33, 44, 55) < 0
506 || buf[0] == '0')
0f00f2c3 507 result |= 8;
c4b681fd
LC
508 /* This catches a MacOS X 10.3.9 (Darwin 7.9) bug. */
509 if (sprintf (buf, "%.1a", 1.999) < 0
510 || (strcmp (buf, "0x1.0p+1") != 0
511 && strcmp (buf, "0x2.0p+0") != 0
512 && strcmp (buf, "0x4.0p-1") != 0
513 && strcmp (buf, "0x8.0p-2") != 0))
0f00f2c3 514 result |= 16;
c4b681fd
LC
515 /* This catches the same MacOS X 10.3.9 (Darwin 7.9) bug and also a
516 glibc 2.4 bug <http://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */
517 if (sprintf (buf, "%.1La", 1.999L) < 0
518 || (strcmp (buf, "0x1.0p+1") != 0
519 && strcmp (buf, "0x2.0p+0") != 0
520 && strcmp (buf, "0x4.0p-1") != 0
521 && strcmp (buf, "0x8.0p-2") != 0))
0f00f2c3
LC
522 result |= 32;
523 return result;
9157d901
LC
524}]])],
525 [gl_cv_func_printf_directive_a=yes],
526 [gl_cv_func_printf_directive_a=no],
527 [
528 case "$host_os" in
529 # Guess yes on glibc >= 2.5 systems.
530 *-gnu*)
531 AC_EGREP_CPP([BZ2908], [
532 #include <features.h>
533 #ifdef __GNU_LIBRARY__
0f00f2c3 534 #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)) && !defined __UCLIBC__
9157d901
LC
535 BZ2908
536 #endif
537 #endif
538 ],
539 [gl_cv_func_printf_directive_a="guessing yes"],
540 [gl_cv_func_printf_directive_a="guessing no"])
541 ;;
542 # If we don't know, assume the worst.
543 *) gl_cv_func_printf_directive_a="guessing no";;
544 esac
545 ])
c4b681fd
LC
546 ])
547])
548
549dnl Test whether the *printf family of functions supports the %F format
550dnl directive. (ISO C99, POSIX:2001)
551dnl Result is gl_cv_func_printf_directive_f.
552
553AC_DEFUN([gl_PRINTF_DIRECTIVE_F],
554[
555 AC_REQUIRE([AC_PROG_CC])
556 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
557 AC_CACHE_CHECK([whether printf supports the 'F' directive],
558 [gl_cv_func_printf_directive_f],
559 [
9157d901
LC
560 AC_RUN_IFELSE(
561 [AC_LANG_SOURCE([[
c4b681fd
LC
562#include <stdio.h>
563#include <string.h>
564static char buf[100];
565int main ()
566{
0f00f2c3 567 int result = 0;
c4b681fd
LC
568 if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0
569 || strcmp (buf, "1234567.000000 33") != 0)
0f00f2c3 570 result |= 1;
c4b681fd
LC
571 if (sprintf (buf, "%F", 1.0 / 0.0) < 0
572 || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0))
0f00f2c3 573 result |= 2;
c4b681fd
LC
574 /* This catches a Cygwin 1.5.x bug. */
575 if (sprintf (buf, "%.F", 1234.0) < 0
576 || strcmp (buf, "1234") != 0)
0f00f2c3
LC
577 result |= 4;
578 return result;
9157d901
LC
579}]])],
580 [gl_cv_func_printf_directive_f=yes],
581 [gl_cv_func_printf_directive_f=no],
582 [
c4b681fd 583changequote(,)dnl
9157d901
LC
584 case "$host_os" in
585 # Guess yes on glibc systems.
586 *-gnu*) gl_cv_func_printf_directive_f="guessing yes";;
587 # Guess yes on FreeBSD >= 6.
588 freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";;
589 freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";;
590 # Guess yes on MacOS X >= 10.3.
591 darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";;
592 darwin*) gl_cv_func_printf_directive_f="guessing yes";;
593 # Guess yes on Solaris >= 2.10.
49114fd4
LC
594 solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";;
595 solaris*) gl_cv_func_printf_sizes_c99="guessing no";;
9157d901
LC
596 # If we don't know, assume the worst.
597 *) gl_cv_func_printf_directive_f="guessing no";;
598 esac
c4b681fd 599changequote([,])dnl
9157d901 600 ])
c4b681fd
LC
601 ])
602])
603
604dnl Test whether the *printf family of functions supports the %n format
605dnl directive. (ISO C99, POSIX:2001)
606dnl Result is gl_cv_func_printf_directive_n.
607
608AC_DEFUN([gl_PRINTF_DIRECTIVE_N],
609[
610 AC_REQUIRE([AC_PROG_CC])
611 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
612 AC_CACHE_CHECK([whether printf supports the 'n' directive],
613 [gl_cv_func_printf_directive_n],
614 [
9157d901
LC
615 AC_RUN_IFELSE(
616 [AC_LANG_SOURCE([[
c4b681fd
LC
617#include <stdio.h>
618#include <string.h>
619static char fmtstring[10];
620static char buf[100];
621int main ()
622{
623 int count = -1;
624 /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2)
625 support %n in format strings in read-only memory but not in writable
626 memory. */
627 strcpy (fmtstring, "%d %n");
628 if (sprintf (buf, fmtstring, 123, &count, 33, 44, 55) < 0
629 || strcmp (buf, "123 ") != 0
630 || count != 4)
631 return 1;
632 return 0;
9157d901
LC
633}]])],
634 [gl_cv_func_printf_directive_n=yes],
635 [gl_cv_func_printf_directive_n=no],
636 [
c4b681fd 637changequote(,)dnl
9157d901
LC
638 case "$host_os" in
639 *) gl_cv_func_printf_directive_n="guessing yes";;
640 esac
c4b681fd 641changequote([,])dnl
9157d901 642 ])
c4b681fd
LC
643 ])
644])
645
646dnl Test whether the *printf family of functions supports the %ls format
647dnl directive and in particular, when a precision is specified, whether
648dnl the functions stop converting the wide string argument when the number
649dnl of bytes that have been produced by this conversion equals or exceeds
650dnl the precision.
651dnl Result is gl_cv_func_printf_directive_ls.
652
653AC_DEFUN([gl_PRINTF_DIRECTIVE_LS],
654[
655 AC_REQUIRE([AC_PROG_CC])
656 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
657 AC_CACHE_CHECK([whether printf supports the 'ls' directive],
658 [gl_cv_func_printf_directive_ls],
659 [
9157d901
LC
660 AC_RUN_IFELSE(
661 [AC_LANG_SOURCE([[
c4b681fd
LC
662/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
663 <wchar.h>.
664 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
665 included before <wchar.h>. */
666#include <stddef.h>
667#include <stdio.h>
668#include <time.h>
669#include <wchar.h>
670#include <string.h>
671int main ()
672{
0f00f2c3 673 int result = 0;
c4b681fd
LC
674 char buf[100];
675 /* Test whether %ls works at all.
676 This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on
677 Cygwin 1.5. */
678 {
679 static const wchar_t wstring[] = { 'a', 'b', 'c', 0 };
680 buf[0] = '\0';
681 if (sprintf (buf, "%ls", wstring) < 0
682 || strcmp (buf, "abc") != 0)
0f00f2c3 683 result |= 1;
c4b681fd
LC
684 }
685 /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an
686 assertion failure inside libc), but not on OpenBSD 4.0. */
687 {
688 static const wchar_t wstring[] = { 'a', 0 };
689 buf[0] = '\0';
690 if (sprintf (buf, "%ls", wstring) < 0
691 || strcmp (buf, "a") != 0)
0f00f2c3 692 result |= 2;
c4b681fd
LC
693 }
694 /* Test whether precisions in %ls are supported as specified in ISO C 99
695 section 7.19.6.1:
696 "If a precision is specified, no more than that many bytes are written
697 (including shift sequences, if any), and the array shall contain a
698 null wide character if, to equal the multibyte character sequence
699 length given by the precision, the function would need to access a
700 wide character one past the end of the array."
701 This test fails on Solaris 10. */
702 {
703 static const wchar_t wstring[] = { 'a', 'b', (wchar_t) 0xfdfdfdfd, 0 };
704 buf[0] = '\0';
705 if (sprintf (buf, "%.2ls", wstring) < 0
706 || strcmp (buf, "ab") != 0)
0f00f2c3 707 result |= 8;
c4b681fd 708 }
0f00f2c3 709 return result;
9157d901
LC
710}]])],
711 [gl_cv_func_printf_directive_ls=yes],
712 [gl_cv_func_printf_directive_ls=no],
713 [
c4b681fd 714changequote(,)dnl
9157d901
LC
715 case "$host_os" in
716 openbsd*) gl_cv_func_printf_directive_ls="guessing no";;
717 irix*) gl_cv_func_printf_directive_ls="guessing no";;
718 solaris*) gl_cv_func_printf_directive_ls="guessing no";;
719 cygwin*) gl_cv_func_printf_directive_ls="guessing no";;
720 beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";;
721 *) gl_cv_func_printf_directive_ls="guessing yes";;
722 esac
c4b681fd 723changequote([,])dnl
9157d901 724 ])
c4b681fd
LC
725 ])
726])
727
728dnl Test whether the *printf family of functions supports POSIX/XSI format
729dnl strings with positions. (POSIX:2001)
730dnl Result is gl_cv_func_printf_positions.
731
732AC_DEFUN([gl_PRINTF_POSITIONS],
733[
734 AC_REQUIRE([AC_PROG_CC])
735 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
736 AC_CACHE_CHECK([whether printf supports POSIX/XSI format strings with positions],
737 [gl_cv_func_printf_positions],
738 [
9157d901
LC
739 AC_RUN_IFELSE(
740 [AC_LANG_SOURCE([[
c4b681fd
LC
741#include <stdio.h>
742#include <string.h>
743/* The string "%2$d %1$d", with dollar characters protected from the shell's
744 dollar expansion (possibly an autoconf bug). */
745static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' };
746static char buf[100];
747int main ()
748{
749 sprintf (buf, format, 33, 55);
750 return (strcmp (buf, "55 33") != 0);
9157d901
LC
751}]])],
752 [gl_cv_func_printf_positions=yes],
753 [gl_cv_func_printf_positions=no],
754 [
c4b681fd 755changequote(,)dnl
9157d901
LC
756 case "$host_os" in
757 netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*)
758 gl_cv_func_printf_positions="guessing no";;
759 beos*) gl_cv_func_printf_positions="guessing no";;
760 mingw* | pw*) gl_cv_func_printf_positions="guessing no";;
761 *) gl_cv_func_printf_positions="guessing yes";;
762 esac
c4b681fd 763changequote([,])dnl
9157d901 764 ])
c4b681fd
LC
765 ])
766])
767
768dnl Test whether the *printf family of functions supports POSIX/XSI format
769dnl strings with the ' flag for grouping of decimal digits. (POSIX:2001)
770dnl Result is gl_cv_func_printf_flag_grouping.
771
772AC_DEFUN([gl_PRINTF_FLAG_GROUPING],
773[
774 AC_REQUIRE([AC_PROG_CC])
775 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
776 AC_CACHE_CHECK([whether printf supports the grouping flag],
777 [gl_cv_func_printf_flag_grouping],
778 [
9157d901
LC
779 AC_RUN_IFELSE(
780 [AC_LANG_SOURCE([[
c4b681fd
LC
781#include <stdio.h>
782#include <string.h>
783static char buf[100];
784int main ()
785{
786 if (sprintf (buf, "%'d %d", 1234567, 99) < 0
787 || buf[strlen (buf) - 1] != '9')
788 return 1;
789 return 0;
9157d901
LC
790}]])],
791 [gl_cv_func_printf_flag_grouping=yes],
792 [gl_cv_func_printf_flag_grouping=no],
793 [
c4b681fd 794changequote(,)dnl
9157d901
LC
795 case "$host_os" in
796 cygwin*) gl_cv_func_printf_flag_grouping="guessing no";;
797 netbsd*) gl_cv_func_printf_flag_grouping="guessing no";;
798 mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";;
799 *) gl_cv_func_printf_flag_grouping="guessing yes";;
800 esac
c4b681fd 801changequote([,])dnl
9157d901 802 ])
c4b681fd
LC
803 ])
804])
805
806dnl Test whether the *printf family of functions supports the - flag correctly.
807dnl (ISO C99.) See
808dnl <http://lists.gnu.org/archive/html/bug-coreutils/2008-02/msg00035.html>
809dnl Result is gl_cv_func_printf_flag_leftadjust.
810
811AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST],
812[
813 AC_REQUIRE([AC_PROG_CC])
814 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
815 AC_CACHE_CHECK([whether printf supports the left-adjust flag correctly],
816 [gl_cv_func_printf_flag_leftadjust],
817 [
9157d901
LC
818 AC_RUN_IFELSE(
819 [AC_LANG_SOURCE([[
c4b681fd
LC
820#include <stdio.h>
821#include <string.h>
822static char buf[100];
823int main ()
824{
825 /* Check that a '-' flag is not annihilated by a negative width. */
826 if (sprintf (buf, "a%-*sc", -3, "b") < 0
827 || strcmp (buf, "ab c") != 0)
828 return 1;
829 return 0;
9157d901 830}]])],
c4b681fd
LC
831 [gl_cv_func_printf_flag_leftadjust=yes],
832 [gl_cv_func_printf_flag_leftadjust=no],
833 [
834changequote(,)dnl
835 case "$host_os" in
836 # Guess yes on HP-UX 11.
837 hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";;
838 # Guess no on HP-UX 10 and older.
839 hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";;
840 # Guess yes otherwise.
841 *) gl_cv_func_printf_flag_leftadjust="guessing yes";;
842 esac
843changequote([,])dnl
844 ])
845 ])
846])
847
848dnl Test whether the *printf family of functions supports padding of non-finite
849dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See
850dnl <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html>
851dnl Result is gl_cv_func_printf_flag_zero.
852
853AC_DEFUN([gl_PRINTF_FLAG_ZERO],
854[
855 AC_REQUIRE([AC_PROG_CC])
856 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
857 AC_CACHE_CHECK([whether printf supports the zero flag correctly],
858 [gl_cv_func_printf_flag_zero],
859 [
9157d901
LC
860 AC_RUN_IFELSE(
861 [AC_LANG_SOURCE([[
c4b681fd
LC
862#include <stdio.h>
863#include <string.h>
864static char buf[100];
865int main ()
866{
867 if (sprintf (buf, "%010f", 1.0 / 0.0, 33, 44, 55) < 0
868 || (strcmp (buf, " inf") != 0
869 && strcmp (buf, " infinity") != 0))
870 return 1;
871 return 0;
9157d901
LC
872}]])],
873 [gl_cv_func_printf_flag_zero=yes],
874 [gl_cv_func_printf_flag_zero=no],
875 [
c4b681fd 876changequote(,)dnl
9157d901
LC
877 case "$host_os" in
878 # Guess yes on glibc systems.
879 *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";;
880 # Guess yes on BeOS.
881 beos*) gl_cv_func_printf_flag_zero="guessing yes";;
882 # If we don't know, assume the worst.
883 *) gl_cv_func_printf_flag_zero="guessing no";;
884 esac
c4b681fd 885changequote([,])dnl
9157d901 886 ])
c4b681fd
LC
887 ])
888])
889
890dnl Test whether the *printf family of functions supports large precisions.
891dnl On mingw, precisions larger than 512 are treated like 512, in integer,
0f00f2c3 892dnl floating-point or pointer output. On Solaris 10/x86, precisions larger
49114fd4
LC
893dnl than 510 in floating-point output crash the program. On Solaris 10/SPARC,
894dnl precisions larger than 510 in floating-point output yield wrong results.
231c0e0e
LC
895dnl On AIX 7.1, precisions larger than 998 in floating-point output yield
896dnl wrong results. On BeOS, precisions larger than 1044 crash the program.
c4b681fd
LC
897dnl Result is gl_cv_func_printf_precision.
898
899AC_DEFUN([gl_PRINTF_PRECISION],
900[
901 AC_REQUIRE([AC_PROG_CC])
902 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
903 AC_CACHE_CHECK([whether printf supports large precisions],
904 [gl_cv_func_printf_precision],
905 [
9157d901
LC
906 AC_RUN_IFELSE(
907 [AC_LANG_SOURCE([[
c4b681fd
LC
908#include <stdio.h>
909#include <string.h>
910static char buf[5000];
911int main ()
912{
0f00f2c3 913 int result = 0;
c4b681fd
LC
914#ifdef __BEOS__
915 /* On BeOS, this would crash and show a dialog box. Avoid the crash. */
916 return 1;
917#endif
918 if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3)
0f00f2c3
LC
919 result |= 1;
920 if (sprintf (buf, "%.4000f %d", 1.0, 33, 44) < 4000 + 5)
921 result |= 2;
49114fd4
LC
922 if (sprintf (buf, "%.511f %d", 1.0, 33, 44) < 511 + 5
923 || buf[0] != '1')
924 result |= 4;
231c0e0e
LC
925 if (sprintf (buf, "%.999f %d", 1.0, 33, 44) < 999 + 5
926 || buf[0] != '1')
927 result |= 4;
0f00f2c3 928 return result;
9157d901
LC
929}]])],
930 [gl_cv_func_printf_precision=yes],
931 [gl_cv_func_printf_precision=no],
932 [
c4b681fd 933changequote(,)dnl
9157d901 934 case "$host_os" in
0f00f2c3
LC
935 # Guess no only on Solaris, native Win32, and BeOS systems.
936 solaris*) gl_cv_func_printf_precision="guessing no" ;;
9157d901
LC
937 mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;;
938 beos*) gl_cv_func_printf_precision="guessing no" ;;
939 *) gl_cv_func_printf_precision="guessing yes" ;;
940 esac
c4b681fd 941changequote([,])dnl
9157d901 942 ])
c4b681fd
LC
943 ])
944])
945
946dnl Test whether the *printf family of functions recovers gracefully in case
947dnl of an out-of-memory condition, or whether it crashes the entire program.
948dnl Result is gl_cv_func_printf_enomem.
949
950AC_DEFUN([gl_PRINTF_ENOMEM],
951[
952 AC_REQUIRE([AC_PROG_CC])
953 AC_REQUIRE([gl_MULTIARCH])
954 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
955 AC_CACHE_CHECK([whether printf survives out-of-memory conditions],
956 [gl_cv_func_printf_enomem],
957 [
958 gl_cv_func_printf_enomem="guessing no"
959 if test "$cross_compiling" = no; then
960 if test $APPLE_UNIVERSAL_BUILD = 0; then
961 AC_LANG_CONFTEST([AC_LANG_SOURCE([
962]GL_NOCRASH[
963changequote(,)dnl
964#include <stdio.h>
965#include <sys/types.h>
966#include <sys/time.h>
967#include <sys/resource.h>
968#include <errno.h>
969int main()
970{
971 struct rlimit limit;
972 int ret;
973 nocrash_init ();
974 /* Some printf implementations allocate temporary space with malloc. */
975 /* On BSD systems, malloc() is limited by RLIMIT_DATA. */
976#ifdef RLIMIT_DATA
977 if (getrlimit (RLIMIT_DATA, &limit) < 0)
978 return 77;
979 if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
980 limit.rlim_max = 5000000;
981 limit.rlim_cur = limit.rlim_max;
982 if (setrlimit (RLIMIT_DATA, &limit) < 0)
983 return 77;
984#endif
985 /* On Linux systems, malloc() is limited by RLIMIT_AS. */
986#ifdef RLIMIT_AS
987 if (getrlimit (RLIMIT_AS, &limit) < 0)
988 return 77;
989 if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
990 limit.rlim_max = 5000000;
991 limit.rlim_cur = limit.rlim_max;
992 if (setrlimit (RLIMIT_AS, &limit) < 0)
993 return 77;
994#endif
995 /* Some printf implementations allocate temporary space on the stack. */
996#ifdef RLIMIT_STACK
997 if (getrlimit (RLIMIT_STACK, &limit) < 0)
998 return 77;
999 if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000)
1000 limit.rlim_max = 5000000;
1001 limit.rlim_cur = limit.rlim_max;
1002 if (setrlimit (RLIMIT_STACK, &limit) < 0)
1003 return 77;
1004#endif
1005 ret = printf ("%.5000000f", 1.0);
1006 return !(ret == 5000002 || (ret < 0 && errno == ENOMEM));
1007}
1008changequote([,])dnl
1009 ])])
1010 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
1011 (./conftest
1012 result=$?
1013 if test $result != 0 && test $result != 77; then result=1; fi
1014 exit $result
1015 ) >/dev/null 2>/dev/null
1016 case $? in
1017 0) gl_cv_func_printf_enomem="yes" ;;
1018 77) gl_cv_func_printf_enomem="guessing no" ;;
1019 *) gl_cv_func_printf_enomem="no" ;;
1020 esac
1021 else
1022 gl_cv_func_printf_enomem="guessing no"
1023 fi
1024 rm -fr conftest*
1025 else
1026 dnl A universal build on Apple MacOS X platforms.
1027 dnl The result would be 'no' in 32-bit mode and 'yes' in 64-bit mode.
1028 dnl But we need a configuration result that is valid in both modes.
1029 gl_cv_func_printf_enomem="guessing no"
1030 fi
1031 fi
1032 if test "$gl_cv_func_printf_enomem" = "guessing no"; then
1033changequote(,)dnl
1034 case "$host_os" in
1035 # Guess yes on glibc systems.
1036 *-gnu*) gl_cv_func_printf_enomem="guessing yes";;
1037 # Guess yes on Solaris.
1038 solaris*) gl_cv_func_printf_enomem="guessing yes";;
1039 # Guess yes on AIX.
1040 aix*) gl_cv_func_printf_enomem="guessing yes";;
1041 # Guess yes on HP-UX/hppa.
1042 hpux*) case "$host_cpu" in
1043 hppa*) gl_cv_func_printf_enomem="guessing yes";;
1044 *) gl_cv_func_printf_enomem="guessing no";;
1045 esac
1046 ;;
1047 # Guess yes on IRIX.
1048 irix*) gl_cv_func_printf_enomem="guessing yes";;
1049 # Guess yes on OSF/1.
1050 osf*) gl_cv_func_printf_enomem="guessing yes";;
1051 # Guess yes on BeOS.
1052 beos*) gl_cv_func_printf_enomem="guessing yes";;
1053 # Guess yes on Haiku.
1054 haiku*) gl_cv_func_printf_enomem="guessing yes";;
1055 # If we don't know, assume the worst.
1056 *) gl_cv_func_printf_enomem="guessing no";;
1057 esac
1058changequote([,])dnl
1059 fi
1060 ])
1061])
1062
1063dnl Test whether the snprintf function exists. (ISO C99, POSIX:2001)
1064dnl Result is ac_cv_func_snprintf.
1065
1066AC_DEFUN([gl_SNPRINTF_PRESENCE],
1067[
1068 AC_CHECK_FUNCS_ONCE([snprintf])
1069])
1070
1071dnl Test whether the string produced by the snprintf function is always NUL
1072dnl terminated. (ISO C99, POSIX:2001)
1073dnl Result is gl_cv_func_snprintf_truncation_c99.
1074
1075AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99],
1076[
1077 AC_REQUIRE([AC_PROG_CC])
1078 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
1079 AC_CACHE_CHECK([whether snprintf truncates the result as in C99],
1080 [gl_cv_func_snprintf_truncation_c99],
1081 [
9157d901
LC
1082 AC_RUN_IFELSE(
1083 [AC_LANG_SOURCE([[
c4b681fd
LC
1084#include <stdio.h>
1085#include <string.h>
1086static char buf[100];
1087int main ()
1088{
1089 strcpy (buf, "ABCDEF");
1090 snprintf (buf, 3, "%d %d", 4567, 89);
1091 if (memcmp (buf, "45\0DEF", 6) != 0)
1092 return 1;
1093 return 0;
9157d901
LC
1094}]])],
1095 [gl_cv_func_snprintf_truncation_c99=yes],
1096 [gl_cv_func_snprintf_truncation_c99=no],
1097 [
c4b681fd 1098changequote(,)dnl
9157d901
LC
1099 case "$host_os" in
1100 # Guess yes on glibc systems.
1101 *-gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1102 # Guess yes on FreeBSD >= 5.
1103 freebsd[1-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
1104 freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1105 # Guess yes on MacOS X >= 10.3.
1106 darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";;
1107 darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1108 # Guess yes on OpenBSD >= 3.9.
1109 openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
1110 gl_cv_func_snprintf_truncation_c99="guessing no";;
1111 openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1112 # Guess yes on Solaris >= 2.6.
49114fd4
LC
1113 solaris2.[0-5] | solaris2.[0-5].*)
1114 gl_cv_func_snprintf_truncation_c99="guessing no";;
9157d901
LC
1115 solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1116 # Guess yes on AIX >= 4.
1117 aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
1118 aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1119 # Guess yes on HP-UX >= 11.
1120 hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";;
1121 hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1122 # Guess yes on IRIX >= 6.5.
1123 irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1124 # Guess yes on OSF/1 >= 5.
1125 osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
1126 osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1127 # Guess yes on NetBSD >= 3.
1128 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
1129 gl_cv_func_snprintf_truncation_c99="guessing no";;
1130 netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1131 # Guess yes on BeOS.
1132 beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1133 # If we don't know, assume the worst.
1134 *) gl_cv_func_snprintf_truncation_c99="guessing no";;
1135 esac
c4b681fd 1136changequote([,])dnl
9157d901 1137 ])
c4b681fd
LC
1138 ])
1139])
1140
1141dnl Test whether the return value of the snprintf function is the number
1142dnl of bytes (excluding the terminating NUL) that would have been produced
1143dnl if the buffer had been large enough. (ISO C99, POSIX:2001)
1144dnl For example, this test program fails on IRIX 6.5:
1145dnl ---------------------------------------------------------------------
1146dnl #include <stdio.h>
1147dnl int main()
1148dnl {
1149dnl static char buf[8];
1150dnl int retval = snprintf (buf, 3, "%d", 12345);
1151dnl return retval >= 0 && retval < 3;
1152dnl }
1153dnl ---------------------------------------------------------------------
1154dnl Result is gl_cv_func_snprintf_retval_c99.
1155
9157d901 1156AC_DEFUN_ONCE([gl_SNPRINTF_RETVAL_C99],
c4b681fd
LC
1157[
1158 AC_REQUIRE([AC_PROG_CC])
1159 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
1160 AC_CACHE_CHECK([whether snprintf returns a byte count as in C99],
1161 [gl_cv_func_snprintf_retval_c99],
1162 [
9157d901
LC
1163 AC_RUN_IFELSE(
1164 [AC_LANG_SOURCE([[
c4b681fd
LC
1165#include <stdio.h>
1166#include <string.h>
1167static char buf[100];
1168int main ()
1169{
1170 strcpy (buf, "ABCDEF");
1171 if (snprintf (buf, 3, "%d %d", 4567, 89) != 7)
1172 return 1;
49114fd4
LC
1173 if (snprintf (buf, 0, "%d %d", 4567, 89) != 7)
1174 return 2;
1175 if (snprintf (NULL, 0, "%d %d", 4567, 89) != 7)
1176 return 3;
c4b681fd 1177 return 0;
9157d901
LC
1178}]])],
1179 [gl_cv_func_snprintf_retval_c99=yes],
1180 [gl_cv_func_snprintf_retval_c99=no],
1181 [
c4b681fd 1182changequote(,)dnl
9157d901
LC
1183 case "$host_os" in
1184 # Guess yes on glibc systems.
1185 *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1186 # Guess yes on FreeBSD >= 5.
1187 freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";;
1188 freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1189 # Guess yes on MacOS X >= 10.3.
1190 darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";;
1191 darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1192 # Guess yes on OpenBSD >= 3.9.
1193 openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
1194 gl_cv_func_snprintf_retval_c99="guessing no";;
1195 openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
49114fd4
LC
1196 # Guess yes on Solaris >= 2.10.
1197 solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";;
1198 solaris*) gl_cv_func_printf_sizes_c99="guessing no";;
9157d901
LC
1199 # Guess yes on AIX >= 4.
1200 aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";;
1201 aix*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1202 # Guess yes on NetBSD >= 3.
1203 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
1204 gl_cv_func_snprintf_retval_c99="guessing no";;
1205 netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1206 # Guess yes on BeOS.
1207 beos*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1208 # If we don't know, assume the worst.
1209 *) gl_cv_func_snprintf_retval_c99="guessing no";;
1210 esac
c4b681fd 1211changequote([,])dnl
9157d901 1212 ])
c4b681fd
LC
1213 ])
1214])
1215
1216dnl Test whether the snprintf function supports the %n format directive
1217dnl also in truncated portions of the format string. (ISO C99, POSIX:2001)
1218dnl Result is gl_cv_func_snprintf_directive_n.
1219
1220AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N],
1221[
1222 AC_REQUIRE([AC_PROG_CC])
1223 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
1224 AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive],
1225 [gl_cv_func_snprintf_directive_n],
1226 [
9157d901
LC
1227 AC_RUN_IFELSE(
1228 [AC_LANG_SOURCE([[
c4b681fd
LC
1229#include <stdio.h>
1230#include <string.h>
1231static char fmtstring[10];
1232static char buf[100];
1233int main ()
1234{
1235 int count = -1;
1236 /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2)
1237 support %n in format strings in read-only memory but not in writable
1238 memory. */
1239 strcpy (fmtstring, "%d %n");
1240 snprintf (buf, 4, fmtstring, 12345, &count, 33, 44, 55);
1241 if (count != 6)
1242 return 1;
1243 return 0;
9157d901
LC
1244}]])],
1245 [gl_cv_func_snprintf_directive_n=yes],
1246 [gl_cv_func_snprintf_directive_n=no],
1247 [
c4b681fd 1248changequote(,)dnl
9157d901
LC
1249 case "$host_os" in
1250 # Guess yes on glibc systems.
1251 *-gnu*) gl_cv_func_snprintf_directive_n="guessing yes";;
1252 # Guess yes on FreeBSD >= 5.
1253 freebsd[1-4]*) gl_cv_func_snprintf_directive_n="guessing no";;
1254 freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
1255 # Guess yes on MacOS X >= 10.3.
1256 darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";;
1257 darwin*) gl_cv_func_snprintf_directive_n="guessing yes";;
1258 # Guess yes on Solaris >= 2.6.
49114fd4
LC
1259 solaris2.[0-5] | solaris2.[0-5].*)
1260 gl_cv_func_snprintf_directive_n="guessing no";;
9157d901
LC
1261 solaris*) gl_cv_func_snprintf_directive_n="guessing yes";;
1262 # Guess yes on AIX >= 4.
1263 aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";;
1264 aix*) gl_cv_func_snprintf_directive_n="guessing yes";;
1265 # Guess yes on IRIX >= 6.5.
1266 irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";;
1267 # Guess yes on OSF/1 >= 5.
1268 osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";;
1269 osf*) gl_cv_func_snprintf_directive_n="guessing yes";;
1270 # Guess yes on NetBSD >= 3.
1271 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
1272 gl_cv_func_snprintf_directive_n="guessing no";;
1273 netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
1274 # Guess yes on BeOS.
1275 beos*) gl_cv_func_snprintf_directive_n="guessing yes";;
1276 # If we don't know, assume the worst.
1277 *) gl_cv_func_snprintf_directive_n="guessing no";;
1278 esac
c4b681fd 1279changequote([,])dnl
9157d901 1280 ])
c4b681fd
LC
1281 ])
1282])
1283
1284dnl Test whether the snprintf function, when passed a size = 1, writes any
1285dnl output without bounds in this case, behaving like sprintf. This is the
1286dnl case on Linux libc5.
1287dnl Result is gl_cv_func_snprintf_size1.
1288
1289AC_DEFUN([gl_SNPRINTF_SIZE1],
1290[
1291 AC_REQUIRE([AC_PROG_CC])
1292 AC_CACHE_CHECK([whether snprintf respects a size of 1],
1293 [gl_cv_func_snprintf_size1],
1294 [
9157d901
LC
1295 AC_RUN_IFELSE(
1296 [AC_LANG_SOURCE([[
c4b681fd
LC
1297#include <stdio.h>
1298int main()
1299{
1300 static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' };
1301 snprintf (buf, 1, "%d", 12345);
1302 return buf[1] != 'E';
9157d901
LC
1303}]])],
1304 [gl_cv_func_snprintf_size1=yes],
1305 [gl_cv_func_snprintf_size1=no],
1306 [gl_cv_func_snprintf_size1="guessing yes"])
c4b681fd
LC
1307 ])
1308])
1309
1310dnl Test whether the vsnprintf function, when passed a zero size, produces no
1311dnl output. (ISO C99, POSIX:2001)
1312dnl For example, snprintf nevertheless writes a NUL byte in this case
1313dnl on OSF/1 5.1:
1314dnl ---------------------------------------------------------------------
1315dnl #include <stdio.h>
1316dnl int main()
1317dnl {
1318dnl static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' };
1319dnl snprintf (buf, 0, "%d", 12345);
1320dnl return buf[0] != 'D';
1321dnl }
1322dnl ---------------------------------------------------------------------
1323dnl And vsnprintf writes any output without bounds in this case, behaving like
1324dnl vsprintf, on HP-UX 11 and OSF/1 5.1:
1325dnl ---------------------------------------------------------------------
1326dnl #include <stdarg.h>
1327dnl #include <stdio.h>
1328dnl static int my_snprintf (char *buf, int size, const char *format, ...)
1329dnl {
1330dnl va_list args;
1331dnl int ret;
1332dnl va_start (args, format);
1333dnl ret = vsnprintf (buf, size, format, args);
1334dnl va_end (args);
1335dnl return ret;
1336dnl }
1337dnl int main()
1338dnl {
1339dnl static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' };
1340dnl my_snprintf (buf, 0, "%d", 12345);
1341dnl return buf[0] != 'D';
1342dnl }
1343dnl ---------------------------------------------------------------------
1344dnl Result is gl_cv_func_vsnprintf_zerosize_c99.
1345
1346AC_DEFUN([gl_VSNPRINTF_ZEROSIZE_C99],
1347[
1348 AC_REQUIRE([AC_PROG_CC])
1349 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
1350 AC_CACHE_CHECK([whether vsnprintf respects a zero size as in C99],
1351 [gl_cv_func_vsnprintf_zerosize_c99],
1352 [
9157d901
LC
1353 AC_RUN_IFELSE(
1354 [AC_LANG_SOURCE([[
c4b681fd
LC
1355#include <stdarg.h>
1356#include <stdio.h>
1357static int my_snprintf (char *buf, int size, const char *format, ...)
1358{
1359 va_list args;
1360 int ret;
1361 va_start (args, format);
1362 ret = vsnprintf (buf, size, format, args);
1363 va_end (args);
1364 return ret;
1365}
1366int main()
1367{
1368 static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' };
1369 my_snprintf (buf, 0, "%d", 12345);
1370 return buf[0] != 'D';
9157d901
LC
1371}]])],
1372 [gl_cv_func_vsnprintf_zerosize_c99=yes],
1373 [gl_cv_func_vsnprintf_zerosize_c99=no],
1374 [
c4b681fd 1375changequote(,)dnl
9157d901
LC
1376 case "$host_os" in
1377 # Guess yes on glibc systems.
1378 *-gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1379 # Guess yes on FreeBSD >= 5.
1380 freebsd[1-4]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
1381 freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1382 # Guess yes on MacOS X >= 10.3.
1383 darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
1384 darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1385 # Guess yes on Cygwin.
1386 cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1387 # Guess yes on Solaris >= 2.6.
49114fd4
LC
1388 solaris2.[0-5] | solaris2.[0-5].*)
1389 gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
9157d901
LC
1390 solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1391 # Guess yes on AIX >= 4.
1392 aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
1393 aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1394 # Guess yes on IRIX >= 6.5.
1395 irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1396 # Guess yes on NetBSD >= 3.
1397 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
1398 gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
1399 netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1400 # Guess yes on BeOS.
1401 beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1402 # Guess yes on mingw.
1403 mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1404 # If we don't know, assume the worst.
1405 *) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
1406 esac
c4b681fd 1407changequote([,])dnl
9157d901 1408 ])
c4b681fd
LC
1409 ])
1410])
1411
1412dnl The results of these tests on various platforms are:
1413dnl
1414dnl 1 = gl_PRINTF_SIZES_C99
1415dnl 2 = gl_PRINTF_LONG_DOUBLE
1416dnl 3 = gl_PRINTF_INFINITE
1417dnl 4 = gl_PRINTF_INFINITE_LONG_DOUBLE
1418dnl 5 = gl_PRINTF_DIRECTIVE_A
1419dnl 6 = gl_PRINTF_DIRECTIVE_F
1420dnl 7 = gl_PRINTF_DIRECTIVE_N
1421dnl 8 = gl_PRINTF_DIRECTIVE_LS
1422dnl 9 = gl_PRINTF_POSITIONS
1423dnl 10 = gl_PRINTF_FLAG_GROUPING
1424dnl 11 = gl_PRINTF_FLAG_LEFTADJUST
1425dnl 12 = gl_PRINTF_FLAG_ZERO
1426dnl 13 = gl_PRINTF_PRECISION
1427dnl 14 = gl_PRINTF_ENOMEM
1428dnl 15 = gl_SNPRINTF_PRESENCE
1429dnl 16 = gl_SNPRINTF_TRUNCATION_C99
1430dnl 17 = gl_SNPRINTF_RETVAL_C99
1431dnl 18 = gl_SNPRINTF_DIRECTIVE_N
1432dnl 19 = gl_SNPRINTF_SIZE1
1433dnl 20 = gl_VSNPRINTF_ZEROSIZE_C99
1434dnl
1435dnl 1 = checking whether printf supports size specifiers as in C99...
1436dnl 2 = checking whether printf supports 'long double' arguments...
1437dnl 3 = checking whether printf supports infinite 'double' arguments...
1438dnl 4 = checking whether printf supports infinite 'long double' arguments...
1439dnl 5 = checking whether printf supports the 'a' and 'A' directives...
1440dnl 6 = checking whether printf supports the 'F' directive...
1441dnl 7 = checking whether printf supports the 'n' directive...
1442dnl 8 = checking whether printf supports the 'ls' directive...
1443dnl 9 = checking whether printf supports POSIX/XSI format strings with positions...
1444dnl 10 = checking whether printf supports the grouping flag...
1445dnl 11 = checking whether printf supports the left-adjust flag correctly...
1446dnl 12 = checking whether printf supports the zero flag correctly...
1447dnl 13 = checking whether printf supports large precisions...
1448dnl 14 = checking whether printf survives out-of-memory conditions...
1449dnl 15 = checking for snprintf...
1450dnl 16 = checking whether snprintf truncates the result as in C99...
1451dnl 17 = checking whether snprintf returns a byte count as in C99...
1452dnl 18 = checking whether snprintf fully supports the 'n' directive...
1453dnl 19 = checking whether snprintf respects a size of 1...
1454dnl 20 = checking whether vsnprintf respects a zero size as in C99...
1455dnl
1456dnl . = yes, # = no.
1457dnl
1458dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1459dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . .
1460dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . .
1461dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . .
0f00f2c3 1462dnl MacOS X 10.5.8 . . . # # . . . . . . # . . . . . . . .
c4b681fd
LC
1463dnl MacOS X 10.3.9 . . . . # . . . . . . # . # . . . . . .
1464dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . .
1465dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . .
1466dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . .
1467dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . .
0f00f2c3
LC
1468dnl Solaris 11 2010-11 . . # # # . . # . . . # . . . . . . . .
1469dnl Solaris 10 . . # # # . . # . . . # # . . . . . . .
49114fd4 1470dnl Solaris 2.6 ... 9 # . # # # # . # . . . # # . . . # . . .
c4b681fd 1471dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # #
231c0e0e
LC
1472dnl AIX 7.1 . . # # # . . . . . . # # . . . . . . .
1473dnl AIX 5.2 . . # # # . . . . . . # . . . . . . . .
49114fd4 1474dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . # . . .
c4b681fd
LC
1475dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . .
1476dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . #
1477dnl HP-UX 10.20 # . # . # # . ? . . # # . . . . # # ? #
1478dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . .
1479dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . #
1480dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # #
0f00f2c3 1481dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . .
c4b681fd
LC
1482dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ?
1483dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . .
49114fd4
LC
1484dnl Haiku . . . # # # . # . . . . . ? . . ? . . .
1485dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . .
c4b681fd 1486dnl mingw # # # # # # . . # # . # # ? . # # # . .