Catch a bug of printf "%a" on FreeBSD 6.1.
[gnulib.git] / m4 / printf.m4
1 # printf.m4 serial 3
2 dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 dnl Test whether the *printf family of functions supports the 'j', 'z', 't',
8 dnl 'L' size specifiers. (ISO C99, POSIX:2001)
9 dnl Result is gl_cv_func_printf_sizes_c99.
10
11 AC_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([gt_TYPE_LONGDOUBLE])
17   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
18   AC_CACHE_CHECK([whether printf supports size specifiers as in C99],
19     [gl_cv_func_printf_sizes_c99], 
20     [
21       AC_TRY_RUN([
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
32 static char buf[100];
33 int main ()
34 {
35 #if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX
36   buf[0] = '\0';
37   if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0
38       || strcmp (buf, "12345671 33") != 0)
39     return 1;
40 #endif
41   buf[0] = '\0';
42   if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0
43       || strcmp (buf, "12345672 33") != 0)
44     return 1;
45   buf[0] = '\0';
46   if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0
47       || strcmp (buf, "12345673 33") != 0)
48     return 1;
49 #if HAVE_LONG_DOUBLE
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)
53     return 1;
54 #endif
55   return 0;
56 }], [gl_cv_func_printf_sizes_c99=yes], [gl_cv_func_printf_sizes_c99=no],
57       [
58 changequote(,)dnl
59        case "$host_os" in
60                                # Guess yes on glibc systems.
61          *-gnu*)               gl_cv_func_printf_sizes_c99="guessing yes";;
62                                # Guess yes on FreeBSD >= 5.
63          freebsd[1-4]*)        gl_cv_func_printf_sizes_c99="guessing no";;
64          freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
65                                # Guess yes on MacOS X >= 10.3.
66          darwin[1-6].*)        gl_cv_func_printf_sizes_c99="guessing no";;
67          darwin*)              gl_cv_func_printf_sizes_c99="guessing yes";;
68                                # Guess yes on OpenBSD >= 3.9.
69          openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
70                                gl_cv_func_printf_sizes_c99="guessing no";;
71          openbsd*)             gl_cv_func_printf_sizes_c99="guessing yes";;
72                                # Guess yes on Solaris >= 2.10.
73          solaris2.[0-9]*)      gl_cv_func_printf_sizes_c99="guessing no";;
74          solaris*)             gl_cv_func_printf_sizes_c99="guessing yes";;
75                                # Guess yes on NetBSD >= 3.
76          netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
77                                gl_cv_func_printf_sizes_c99="guessing no";;
78          netbsd*)              gl_cv_func_printf_sizes_c99="guessing yes";;
79                                # If we don't know, assume the worst.
80          *)                    gl_cv_func_printf_sizes_c99="guessing no";;
81        esac
82 changequote([,])dnl
83       ])
84     ])
85 ])
86
87 dnl Test whether the *printf family of functions supports the 'a' and 'A'
88 dnl conversion specifier for hexadecimal output of floating-point numbers.
89 dnl (ISO C99, POSIX:2001)
90 dnl Result is gl_cv_func_printf_directive_a.
91
92 AC_DEFUN([gl_PRINTF_DIRECTIVE_A],
93 [
94   AC_REQUIRE([AC_PROG_CC])
95   AC_REQUIRE([gt_TYPE_LONGDOUBLE])
96   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
97   AC_CACHE_CHECK([whether printf supports the 'a' and 'A' directives],
98     [gl_cv_func_printf_directive_a], 
99     [
100       AC_TRY_RUN([
101 #include <stdio.h>
102 #include <string.h>
103 static char buf[100];
104 int main ()
105 {
106   if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0
107       || (strcmp (buf, "0x1.922p+1 33") != 0
108           && strcmp (buf, "0x3.244p+0 33") != 0
109           && strcmp (buf, "0x6.488p-1 33") != 0
110           && strcmp (buf, "0xc.91p-2 33") != 0))
111     return 1;
112   if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0
113       || (strcmp (buf, "-0X1.922P+1 33") != 0
114           && strcmp (buf, "-0X3.244P+0 33") != 0
115           && strcmp (buf, "-0X6.488P-1 33") != 0
116           && strcmp (buf, "-0XC.91P-2 33") != 0))
117     return 1;
118   /* This catches a FreeBSD 6.1 bug: it doesn't round.  */
119   if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0
120       || (strcmp (result, "0x1.83p+0 33") != 0
121           && strcmp (result, "0x3.05p-1 33") != 0
122           && strcmp (result, "0x6.0ap-2 33") != 0
123           && strcmp (result, "0xc.14p-3 33") != 0))
124     return 1;
125   /* This catches a MacOS X 10.3.9 (Darwin 7.9) bug.  */
126   if (sprintf (buf, "%.1a", 1.999) < 0
127       || (strcmp (buf, "0x1.0p+1") != 0
128           && strcmp (buf, "0x2.0p+0") != 0
129           && strcmp (buf, "0x4.0p-1") != 0
130           && strcmp (buf, "0x8.0p-2") != 0))
131     return 1;
132 #if HAVE_LONG_DOUBLE
133   /* This catches the same MacOS X 10.3.9 (Darwin 7.9) bug and also a
134      glibc 2.4 bug <http://sourceware.org/bugzilla/show_bug.cgi?id=2908>.  */
135   if (sprintf (buf, "%.1La", 1.999L) < 0
136       || (strcmp (buf, "0x1.0p+1") != 0
137           && strcmp (buf, "0x2.0p+0") != 0
138           && strcmp (buf, "0x4.0p-1") != 0
139           && strcmp (buf, "0x8.0p-2") != 0))
140     return 1;
141 #endif
142   return 0;
143 }], [gl_cv_func_printf_directive_a=yes], [gl_cv_func_printf_directive_a=no],
144       [
145        case "$host_os" in
146                                # Guess yes on glibc >= 2.5 systems.
147          *-gnu*)
148            AC_EGREP_CPP([BZ2908], [
149              #include <features.h>
150              #ifdef __GNU_LIBRARY__
151               #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)
152                BZ2908
153               #endif
154              #endif
155              ],
156              [gl_cv_func_printf_directive_a="guessing yes"],
157              [gl_cv_func_printf_directive_a="guessing no"])
158            ;;
159                                # If we don't know, assume the worst.
160          *)                    gl_cv_func_printf_directive_a="guessing no";;
161        esac
162       ])
163     ])
164 ])
165
166 dnl Test whether the *printf family of functions supports the %n format
167 dnl directive. (ISO C99, POSIX:2001)
168 dnl Result is gl_cv_func_printf_directive_n.
169
170 AC_DEFUN([gl_PRINTF_DIRECTIVE_N],
171 [
172   AC_REQUIRE([AC_PROG_CC])
173   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
174   AC_CACHE_CHECK([whether printf supports the 'n' directive],
175     [gl_cv_func_printf_directive_n], 
176     [
177       AC_TRY_RUN([
178 #include <stdio.h>
179 #include <string.h>
180 static char buf[100];
181 int main ()
182 {
183   int count = -1;
184   if (sprintf (buf, "%d %n", 123, &count, 33, 44, 55) < 0
185       || strcmp (buf, "123 ") != 0
186       || count != 4)
187     return 1;
188   return 0;
189 }], [gl_cv_func_printf_directive_n=yes], [gl_cv_func_printf_directive_n=no],
190       [
191 changequote(,)dnl
192        case "$host_os" in
193          *)     gl_cv_func_printf_directive_n="guessing yes";;
194        esac
195 changequote([,])dnl
196       ])
197     ])
198 ])
199
200 dnl Test whether the *printf family of functions supports POSIX/XSI format
201 dnl strings with positions. (POSIX:2001)
202 dnl Result is gl_cv_func_printf_positions.
203
204 AC_DEFUN([gl_PRINTF_POSITIONS],
205 [
206   AC_REQUIRE([AC_PROG_CC])
207   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
208   AC_CACHE_CHECK([whether printf supports POSIX/XSI format strings with positions],
209     [gl_cv_func_printf_positions], 
210     [
211       AC_TRY_RUN([
212 #include <stdio.h>
213 #include <string.h>
214 /* The string "%2$d %1$d", with dollar characters protected from the shell's
215    dollar expansion (possibly an autoconf bug).  */
216 static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' };
217 static char buf[100];
218 int main ()
219 {
220   sprintf (buf, format, 33, 55);
221   return (strcmp (buf, "55 33") != 0);
222 }], [gl_cv_func_printf_positions=yes], [gl_cv_func_printf_positions=no],
223       [
224 changequote(,)dnl
225        case "$host_os" in
226          netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*)
227                        gl_cv_func_printf_positions="guessing no";;
228          beos*)        gl_cv_func_printf_positions="guessing no";;
229          mingw* | pw*) gl_cv_func_printf_positions="guessing no";;
230          *)            gl_cv_func_printf_positions="guessing yes";;
231        esac
232 changequote([,])dnl
233       ])
234     ])
235 ])
236
237 dnl Test whether the snprintf function exists. (ISO C99, POSIX:2001)
238 dnl Result is ac_cv_func_snprintf.
239
240 AC_DEFUN([gl_SNPRINTF_PRESENCE],
241 [
242   AC_CHECK_FUNCS_ONCE([snprintf])
243 ])
244
245 dnl Test whether the string produced by the snprintf function is always NUL
246 dnl terminated. (ISO C99, POSIX:2001)
247 dnl Result is gl_cv_func_snprintf_truncation_c99.
248
249 AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99],
250 [
251   AC_REQUIRE([AC_PROG_CC])
252   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
253   AC_CACHE_CHECK([whether snprintf truncates the result as in C99],
254     [gl_cv_func_snprintf_truncation_c99], 
255     [
256       AC_TRY_RUN([
257 #include <stdio.h>
258 #include <string.h>
259 static char buf[100];
260 int main ()
261 {
262   strcpy (buf, "ABCDEF");
263   snprintf (buf, 3, "%d %d", 4567, 89);
264   if (memcmp (buf, "45\0DEF", 6) != 0)
265     return 1;
266   return 0;
267 }], [gl_cv_func_snprintf_truncation_c99=yes], [gl_cv_func_snprintf_truncation_c99=no],
268       [
269 changequote(,)dnl
270        case "$host_os" in
271                                # Guess yes on glibc systems.
272          *-gnu*)               gl_cv_func_snprintf_truncation_c99="guessing yes";;
273                                # Guess yes on FreeBSD >= 5.
274          freebsd[1-4]*)        gl_cv_func_snprintf_truncation_c99="guessing no";;
275          freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
276                                # Guess yes on MacOS X >= 10.3.
277          darwin[1-6].*)        gl_cv_func_snprintf_truncation_c99="guessing no";;
278          darwin*)              gl_cv_func_snprintf_truncation_c99="guessing yes";;
279                                # Guess yes on OpenBSD >= 3.9.
280          openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
281                                gl_cv_func_snprintf_truncation_c99="guessing no";;
282          openbsd*)             gl_cv_func_snprintf_truncation_c99="guessing yes";;
283                                # Guess yes on Solaris >= 2.6.
284          solaris2.[0-5]*)      gl_cv_func_snprintf_truncation_c99="guessing no";;
285          solaris*)             gl_cv_func_snprintf_truncation_c99="guessing yes";;
286                                # Guess yes on AIX >= 4.
287          aix[1-3]*)            gl_cv_func_snprintf_truncation_c99="guessing no";;
288          aix*)                 gl_cv_func_snprintf_truncation_c99="guessing yes";;
289                                # Guess yes on HP-UX >= 11.
290          hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";;
291          hpux*)                gl_cv_func_snprintf_truncation_c99="guessing yes";;
292                                # Guess yes on IRIX >= 6.5.
293          irix6.5)              gl_cv_func_snprintf_truncation_c99="guessing yes";;
294                                # Guess yes on OSF/1 >= 5.
295          osf[3-4]*)            gl_cv_func_snprintf_truncation_c99="guessing no";;
296          osf*)                 gl_cv_func_snprintf_truncation_c99="guessing yes";;
297                                # Guess yes on NetBSD >= 3.
298          netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
299                                gl_cv_func_snprintf_truncation_c99="guessing no";;
300          netbsd*)              gl_cv_func_snprintf_truncation_c99="guessing yes";;
301                                # Guess yes on BeOS.
302          beos*)                gl_cv_func_snprintf_truncation_c99="guessing yes";;
303                                # If we don't know, assume the worst.
304          *)                    gl_cv_func_snprintf_truncation_c99="guessing no";;
305        esac
306 changequote([,])dnl
307       ])
308     ])
309 ])
310
311 dnl Test whether the return value of the snprintf function is the number
312 dnl of bytes (excluding the terminating NUL) that would have been produced
313 dnl if the buffer had been large enough. (ISO C99, POSIX:2001)
314 dnl Result is gl_cv_func_snprintf_retval_c99.
315
316 AC_DEFUN([gl_SNPRINTF_RETVAL_C99],
317 [
318   AC_REQUIRE([AC_PROG_CC])
319   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
320   AC_CACHE_CHECK([whether snprintf returns a byte count as in C99],
321     [gl_cv_func_snprintf_retval_c99], 
322     [
323       AC_TRY_RUN([
324 #include <stdio.h>
325 #include <string.h>
326 static char buf[100];
327 int main ()
328 {
329   strcpy (buf, "ABCDEF");
330   if (snprintf (buf, 3, "%d %d", 4567, 89) != 7)
331     return 1;
332   return 0;
333 }], [gl_cv_func_snprintf_retval_c99=yes], [gl_cv_func_snprintf_retval_c99=no],
334       [
335 changequote(,)dnl
336        case "$host_os" in
337                                # Guess yes on glibc systems.
338          *-gnu*)               gl_cv_func_snprintf_retval_c99="guessing yes";;
339                                # Guess yes on FreeBSD >= 5.
340          freebsd[1-4]*)        gl_cv_func_snprintf_retval_c99="guessing no";;
341          freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
342                                # Guess yes on MacOS X >= 10.3.
343          darwin[1-6].*)        gl_cv_func_snprintf_retval_c99="guessing no";;
344          darwin*)              gl_cv_func_snprintf_retval_c99="guessing yes";;
345                                # Guess yes on OpenBSD >= 3.9.
346          openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
347                                gl_cv_func_snprintf_retval_c99="guessing no";;
348          openbsd*)             gl_cv_func_snprintf_retval_c99="guessing yes";;
349                                # Guess yes on Solaris >= 2.6.
350          solaris2.[0-5]*)      gl_cv_func_snprintf_retval_c99="guessing no";;
351          solaris*)             gl_cv_func_snprintf_retval_c99="guessing yes";;
352                                # Guess yes on AIX >= 4.
353          aix[1-3]*)            gl_cv_func_snprintf_retval_c99="guessing no";;
354          aix*)                 gl_cv_func_snprintf_retval_c99="guessing yes";;
355                                # Guess yes on NetBSD >= 3.
356          netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
357                                gl_cv_func_snprintf_retval_c99="guessing no";;
358          netbsd*)              gl_cv_func_snprintf_retval_c99="guessing yes";;
359                                # Guess yes on BeOS.
360          beos*)                gl_cv_func_snprintf_retval_c99="guessing yes";;
361                                # If we don't know, assume the worst.
362          *)                    gl_cv_func_snprintf_retval_c99="guessing no";;
363        esac
364 changequote([,])dnl
365       ])
366     ])
367 ])
368
369 dnl Test whether the snprintf function supports the %n format directive
370 dnl also in truncated portions of the format string. (ISO C99, POSIX:2001)
371 dnl Result is gl_cv_func_snprintf_directive_n.
372
373 AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N],
374 [
375   AC_REQUIRE([AC_PROG_CC])
376   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
377   AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive],
378     [gl_cv_func_snprintf_directive_n], 
379     [
380       AC_TRY_RUN([
381 #include <stdio.h>
382 #include <string.h>
383 static char buf[100];
384 int main ()
385 {
386   int count = -1;
387   snprintf (buf, 4, "%d %n", 12345, &count, 33, 44, 55);
388   if (count != 6)
389     return 1;
390   return 0;
391 }], [gl_cv_func_snprintf_directive_n=yes], [gl_cv_func_snprintf_directive_n=no],
392       [
393 changequote(,)dnl
394        case "$host_os" in
395                                # Guess yes on glibc systems.
396          *-gnu*)               gl_cv_func_snprintf_directive_n="guessing yes";;
397                                # Guess yes on FreeBSD >= 5.
398          freebsd[1-4]*)        gl_cv_func_snprintf_directive_n="guessing no";;
399          freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
400                                # Guess yes on MacOS X >= 10.3.
401          darwin[1-6].*)        gl_cv_func_snprintf_directive_n="guessing no";;
402          darwin*)              gl_cv_func_snprintf_directive_n="guessing yes";;
403                                # Guess yes on Solaris >= 2.6.
404          solaris2.[0-5]*)      gl_cv_func_snprintf_directive_n="guessing no";;
405          solaris*)             gl_cv_func_snprintf_directive_n="guessing yes";;
406                                # Guess yes on AIX >= 4.
407          aix[1-3]*)            gl_cv_func_snprintf_directive_n="guessing no";;
408          aix*)                 gl_cv_func_snprintf_directive_n="guessing yes";;
409                                # Guess yes on IRIX >= 6.5.
410          irix6.5)              gl_cv_func_snprintf_directive_n="guessing yes";;
411                                # Guess yes on OSF/1 >= 5.
412          osf[3-4]*)            gl_cv_func_snprintf_directive_n="guessing no";;
413          osf*)                 gl_cv_func_snprintf_directive_n="guessing yes";;
414                                # Guess yes on NetBSD >= 3.
415          netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
416                                gl_cv_func_snprintf_directive_n="guessing no";;
417          netbsd*)              gl_cv_func_snprintf_directive_n="guessing yes";;
418                                # Guess yes on BeOS.
419          beos*)                gl_cv_func_snprintf_directive_n="guessing yes";;
420                                # If we don't know, assume the worst.
421          *)                    gl_cv_func_snprintf_directive_n="guessing no";;
422        esac
423 changequote([,])dnl
424       ])
425     ])
426 ])
427
428 dnl The results of these tests on various platforms are:
429 dnl
430 dnl 1 = gl_PRINTF_SIZES_C99
431 dnl 2 = gl_PRINTF_DIRECTIVE_A
432 dnl 3 = gl_PRINTF_DIRECTIVE_N
433 dnl 4 = gl_PRINTF_POSITIONS
434 dnl 5 = gl_SNPRINTF_PRESENCE
435 dnl 6 = gl_SNPRINTF_TRUNCATION_C99
436 dnl 7 = gl_SNPRINTF_RETVAL_C99
437 dnl 8 = gl_SNPRINTF_DIRECTIVE_N
438 dnl
439 dnl 1 = checking whether printf supports size specifiers as in C99...
440 dnl 2 = checking whether printf supports the 'a' and 'A' directives...
441 dnl 3 = checking whether printf supports the 'n' directive...
442 dnl 4 = checking whether printf supports POSIX/XSI format strings with positions...
443 dnl 5 = checking for snprintf...
444 dnl 6 = checking whether snprintf truncates the result as in C99...
445 dnl 7 = checking whether snprintf returns a byte count as in C99...
446 dnl 8 = checking whether snprintf fully supports the 'n' directive...
447 dnl
448 dnl . = yes, # = no.
449 dnl
450 dnl                                        1  2  3  4  5  6  7  8
451 dnl   glibc 2.5                            .  .  .  .  .  .  .  .
452 dnl   glibc 2.3.6                          .  #  .  .  .  .  .  .
453 dnl   FreeBSD 5.4, 6.1                     .  ?  .  .  .  .  .  .
454 dnl   MacOS X 10.3.9                       .  #  .  .  .  .  .  .
455 dnl   OpenBSD 3.9, 4.0                     .  #  .  .  .  .  .  ?
456 dnl   Cygwin 2007                          .  #  .  .  .  .  .  ?
457 dnl   Cygwin 2006                          #  #  .  .  .  .  .  ?
458 dnl   Solaris 10                           .  #  .  .  .  .  .  .
459 dnl   Solaris 2.6 ... 9                    #  #  .  .  .  .  .  .
460 dnl   Solaris 2.5.1                        #  #  .  .  #  #  #  #
461 dnl   AIX 4.3.2, 5.1                       #  #  .  .  .  .  .  .
462 dnl   HP-UX 11.31                          .  #  .  .  .  .  #  #
463 dnl   HP-UX 10.20, 11.00, 11.11, 11.23     #  #  .  .  .  .  #  #
464 dnl   IRIX 6.5                             #  #  .  .  .  .  #  .
465 dnl   OSF/1 5.1                            #  #  .  .  .  .  #  .
466 dnl   OSF/1 4.0d                           #  #  .  .  #  #  #  #
467 dnl   NetBSD 4.0                           .  ?  .  .  .  .  .  ?
468 dnl   NetBSD 3.0                           .  #  .  #  .  .  .  .
469 dnl   BeOS                                 #  #  .  #  .  .  .  .
470 dnl   mingw                                #  #  .  #  .  #  #  #