delete trailing whitespace from control files
[debian/gzip] / m4 / printf.m4
index ef44f785186071b918b912c8a5ac6e7db46b6c03..e5f7b39a1227d09af1dd4705a83a7b3cf7e1c280 100644 (file)
@@ -1,5 +1,5 @@
-# printf.m4 serial 50
-dnl Copyright (C) 2003, 2007-2013 Free Software Foundation, Inc.
+# printf.m4 serial 59
+dnl Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -38,6 +38,8 @@ int main ()
   if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0
       || strcmp (buf, "12345671 33") != 0)
     result |= 1;
+#else
+  result |= 1;
 #endif
   buf[0] = '\0';
   if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0
@@ -56,12 +58,12 @@ int main ()
         [gl_cv_func_printf_sizes_c99=yes],
         [gl_cv_func_printf_sizes_c99=no],
         [
-changequote(,)dnl
          case "$host_os" in
+changequote(,)dnl
                                  # Guess yes on glibc systems.
-           *-gnu*)               gl_cv_func_printf_sizes_c99="guessing yes";;
+           *-gnu* | gnu*)        gl_cv_func_printf_sizes_c99="guessing yes";;
                                  # Guess yes on FreeBSD >= 5.
-           freebsd[1-4]*)        gl_cv_func_printf_sizes_c99="guessing no";;
+           freebsd[1-4].*)       gl_cv_func_printf_sizes_c99="guessing no";;
            freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
                                  # Guess yes on Mac OS X >= 10.3.
            darwin[1-6].*)        gl_cv_func_printf_sizes_c99="guessing no";;
@@ -77,10 +79,19 @@ changequote(,)dnl
            netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
                                  gl_cv_func_printf_sizes_c99="guessing no";;
            netbsd*)              gl_cv_func_printf_sizes_c99="guessing yes";;
+changequote([,])dnl
+                                 # Guess yes on MSVC, no on mingw.
+           mingw*)               AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+                                   ],
+                                   [gl_cv_func_printf_sizes_c99="guessing yes"],
+                                   [gl_cv_func_printf_sizes_c99="guessing no"])
+                                 ;;
                                  # If we don't know, assume the worst.
            *)                    gl_cv_func_printf_sizes_c99="guessing no";;
          esac
-changequote([,])dnl
         ])
     ])
 ])
@@ -120,14 +131,19 @@ int main ()
 }]])],
         [gl_cv_func_printf_long_double=yes],
         [gl_cv_func_printf_long_double=no],
-        [
-changequote(,)dnl
-         case "$host_os" in
-           beos*)        gl_cv_func_printf_long_double="guessing no";;
-           mingw* | pw*) gl_cv_func_printf_long_double="guessing no";;
-           *)            gl_cv_func_printf_long_double="guessing yes";;
+        [case "$host_os" in
+           beos*)  gl_cv_func_printf_long_double="guessing no";;
+                   # Guess yes on MSVC, no on mingw.
+           mingw*) AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+                     ],
+                     [gl_cv_func_printf_long_double="guessing yes"],
+                     [gl_cv_func_printf_long_double="guessing no"])
+                   ;;
+           *)      gl_cv_func_printf_long_double="guessing yes";;
          esac
-changequote([,])dnl
         ])
     ])
 ])
@@ -215,12 +231,12 @@ int main ()
         [gl_cv_func_printf_infinite=yes],
         [gl_cv_func_printf_infinite=no],
         [
-changequote(,)dnl
          case "$host_os" in
+changequote(,)dnl
                                  # Guess yes on glibc systems.
-           *-gnu*)               gl_cv_func_printf_infinite="guessing yes";;
+           *-gnu* | gnu*)        gl_cv_func_printf_infinite="guessing yes";;
                                  # Guess yes on FreeBSD >= 6.
-           freebsd[1-5]*)        gl_cv_func_printf_infinite="guessing no";;
+           freebsd[1-5].*)       gl_cv_func_printf_infinite="guessing no";;
            freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";;
                                  # Guess yes on Mac OS X >= 10.3.
            darwin[1-6].*)        gl_cv_func_printf_infinite="guessing no";;
@@ -234,10 +250,19 @@ changequote(,)dnl
            netbsd*)              gl_cv_func_printf_infinite="guessing yes";;
                                  # Guess yes on BeOS.
            beos*)                gl_cv_func_printf_infinite="guessing yes";;
+changequote([,])dnl
+                                 # Guess yes on MSVC, no on mingw.
+           mingw*)               AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+                                   ],
+                                   [gl_cv_func_printf_infinite="guessing yes"],
+                                   [gl_cv_func_printf_infinite="guessing no"])
+                                 ;;
                                  # If we don't know, assume the worst.
            *)                    gl_cv_func_printf_infinite="guessing no";;
          esac
-changequote([,])dnl
         ])
     ])
 ])
@@ -328,7 +353,7 @@ int main ()
 # ifdef WORDS_BIGENDIAN
 #  define LDBL80_WORDS(exponent,manthi,mantlo) \
      { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \
-       ((unsigned int) (manthi) << 16) | (unsigned int) (mantlo) >> 16),    \
+       ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16),   \
        (unsigned int) (mantlo) << 16                                        \
      }
 # else
@@ -365,66 +390,51 @@ int main ()
   { /* Pseudo-NaN.  */
     static union { unsigned int word[4]; long double value; } x =
       { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) };
-    if (sprintf (buf, "%Lf", x.value) < 0
-        || !strisnan (buf, 0, strlen (buf)))
+    if (sprintf (buf, "%Lf", x.value) <= 0)
       result |= 4;
-    if (sprintf (buf, "%Le", x.value) < 0
-        || !strisnan (buf, 0, strlen (buf)))
+    if (sprintf (buf, "%Le", x.value) <= 0)
       result |= 4;
-    if (sprintf (buf, "%Lg", x.value) < 0
-        || !strisnan (buf, 0, strlen (buf)))
+    if (sprintf (buf, "%Lg", x.value) <= 0)
       result |= 4;
   }
   { /* Pseudo-Infinity.  */
     static union { unsigned int word[4]; long double value; } x =
       { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) };
-    if (sprintf (buf, "%Lf", x.value) < 0
-        || !strisnan (buf, 0, strlen (buf)))
+    if (sprintf (buf, "%Lf", x.value) <= 0)
       result |= 8;
-    if (sprintf (buf, "%Le", x.value) < 0
-        || !strisnan (buf, 0, strlen (buf)))
+    if (sprintf (buf, "%Le", x.value) <= 0)
       result |= 8;
-    if (sprintf (buf, "%Lg", x.value) < 0
-        || !strisnan (buf, 0, strlen (buf)))
+    if (sprintf (buf, "%Lg", x.value) <= 0)
       result |= 8;
   }
   { /* Pseudo-Zero.  */
     static union { unsigned int word[4]; long double value; } x =
       { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) };
-    if (sprintf (buf, "%Lf", x.value) < 0
-        || !strisnan (buf, 0, strlen (buf)))
+    if (sprintf (buf, "%Lf", x.value) <= 0)
       result |= 16;
-    if (sprintf (buf, "%Le", x.value) < 0
-        || !strisnan (buf, 0, strlen (buf)))
+    if (sprintf (buf, "%Le", x.value) <= 0)
       result |= 16;
-    if (sprintf (buf, "%Lg", x.value) < 0
-        || !strisnan (buf, 0, strlen (buf)))
+    if (sprintf (buf, "%Lg", x.value) <= 0)
       result |= 16;
   }
   { /* Unnormalized number.  */
     static union { unsigned int word[4]; long double value; } x =
       { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) };
-    if (sprintf (buf, "%Lf", x.value) < 0
-        || !strisnan (buf, 0, strlen (buf)))
+    if (sprintf (buf, "%Lf", x.value) <= 0)
       result |= 32;
-    if (sprintf (buf, "%Le", x.value) < 0
-        || !strisnan (buf, 0, strlen (buf)))
+    if (sprintf (buf, "%Le", x.value) <= 0)
       result |= 32;
-    if (sprintf (buf, "%Lg", x.value) < 0
-        || !strisnan (buf, 0, strlen (buf)))
+    if (sprintf (buf, "%Lg", x.value) <= 0)
       result |= 32;
   }
   { /* Pseudo-Denormal.  */
     static union { unsigned int word[4]; long double value; } x =
       { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) };
-    if (sprintf (buf, "%Lf", x.value) < 0
-        || !strisnan (buf, 0, strlen (buf)))
+    if (sprintf (buf, "%Lf", x.value) <= 0)
       result |= 64;
-    if (sprintf (buf, "%Le", x.value) < 0
-        || !strisnan (buf, 0, strlen (buf)))
+    if (sprintf (buf, "%Le", x.value) <= 0)
       result |= 64;
-    if (sprintf (buf, "%Lg", x.value) < 0
-        || !strisnan (buf, 0, strlen (buf)))
+    if (sprintf (buf, "%Lg", x.value) <= 0)
       result |= 64;
   }
 #endif
@@ -432,27 +442,35 @@ int main ()
 }]])],
             [gl_cv_func_printf_infinite_long_double=yes],
             [gl_cv_func_printf_infinite_long_double=no],
-            [
-changequote(,)dnl
-             case "$host_cpu" in
+            [case "$host_cpu" in
                                      # Guess no on ia64, x86_64, i386.
                ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";;
                *)
                  case "$host_os" in
+changequote(,)dnl
                                          # Guess yes on glibc systems.
-                   *-gnu*)               gl_cv_func_printf_infinite_long_double="guessing yes";;
+                   *-gnu* | gnu*)        gl_cv_func_printf_infinite_long_double="guessing yes";;
                                          # Guess yes on FreeBSD >= 6.
-                   freebsd[1-5]*)        gl_cv_func_printf_infinite_long_double="guessing no";;
+                   freebsd[1-5].*)       gl_cv_func_printf_infinite_long_double="guessing no";;
                    freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
                                          # Guess yes on HP-UX >= 11.
                    hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";;
                    hpux*)                gl_cv_func_printf_infinite_long_double="guessing yes";;
+changequote([,])dnl
+                                         # Guess yes on MSVC, no on mingw.
+                   mingw*)               AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+                                           ],
+                                           [gl_cv_func_printf_infinite_long_double="guessing yes"],
+                                           [gl_cv_func_printf_infinite_long_double="guessing no"])
+                                         ;;
                                          # If we don't know, assume the worst.
                    *)                    gl_cv_func_printf_infinite_long_double="guessing no";;
                  esac
                  ;;
              esac
-changequote([,])dnl
             ])
         ])
       ;;
@@ -502,8 +520,15 @@ int main ()
           && strcmp (buf, "0x6.0ap-2 33") != 0
           && strcmp (buf, "0xc.14p-3 33") != 0))
     result |= 4;
+  /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round.  */
+  if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0
+      || (strcmp (buf, "0x2p+0 33") != 0
+          && strcmp (buf, "0x3p-1 33") != 0
+          && strcmp (buf, "0x6p-2 33") != 0
+          && strcmp (buf, "0xcp-3 33") != 0))
+    result |= 4;
   /* This catches a FreeBSD 6.1 bug.  See
-     <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
+     <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */
   if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0
       || buf[0] == '0')
     result |= 8;
@@ -515,7 +540,7 @@ int main ()
           && strcmp (buf, "0x8.0p-2") != 0))
     result |= 16;
   /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a
-     glibc 2.4 bug <http://sourceware.org/bugzilla/show_bug.cgi?id=2908>.  */
+     glibc 2.4 bug <https://sourceware.org/bugzilla/show_bug.cgi?id=2908>.  */
   if (sprintf (buf, "%.1La", 1.999L) < 0
       || (strcmp (buf, "0x1.0p+1") != 0
           && strcmp (buf, "0x2.0p+0") != 0
@@ -529,7 +554,7 @@ int main ()
         [
          case "$host_os" in
                                  # Guess yes on glibc >= 2.5 systems.
-           *-gnu*)
+           *-gnu* | gnu*)
              AC_EGREP_CPP([BZ2908], [
                #include <features.h>
                #ifdef __GNU_LIBRARY__
@@ -541,6 +566,8 @@ int main ()
                [gl_cv_func_printf_directive_a="guessing yes"],
                [gl_cv_func_printf_directive_a="guessing no"])
              ;;
+                                 # Guess no on native Windows.
+           mingw*)               gl_cv_func_printf_directive_a="guessing no";;
                                  # If we don't know, assume the worst.
            *)                    gl_cv_func_printf_directive_a="guessing no";;
          esac
@@ -583,23 +610,32 @@ int main ()
         [gl_cv_func_printf_directive_f=yes],
         [gl_cv_func_printf_directive_f=no],
         [
-changequote(,)dnl
          case "$host_os" in
+changequote(,)dnl
                                  # Guess yes on glibc systems.
-           *-gnu*)               gl_cv_func_printf_directive_f="guessing yes";;
+           *-gnu* | gnu*)        gl_cv_func_printf_directive_f="guessing yes";;
                                  # Guess yes on FreeBSD >= 6.
-           freebsd[1-5]*)        gl_cv_func_printf_directive_f="guessing no";;
+           freebsd[1-5].*)       gl_cv_func_printf_directive_f="guessing no";;
            freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";;
                                  # Guess yes on Mac OS X >= 10.3.
            darwin[1-6].*)        gl_cv_func_printf_directive_f="guessing no";;
            darwin*)              gl_cv_func_printf_directive_f="guessing yes";;
                                  # Guess yes on Solaris >= 2.10.
-           solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";;
-           solaris*)             gl_cv_func_printf_sizes_c99="guessing no";;
+           solaris2.[1-9][0-9]*) gl_cv_func_printf_directive_f="guessing yes";;
+           solaris*)             gl_cv_func_printf_directive_f="guessing no";;
+changequote([,])dnl
+                                 # Guess yes on MSVC, no on mingw.
+           mingw*)               AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+                                   ],
+                                   [gl_cv_func_printf_directive_f="guessing yes"],
+                                   [gl_cv_func_printf_directive_f="guessing no"])
+                                 ;;
                                  # If we don't know, assume the worst.
            *)                    gl_cv_func_printf_directive_f="guessing no";;
          esac
-changequote([,])dnl
         ])
     ])
 ])
@@ -651,13 +687,11 @@ int main ()
 }]])],
         [gl_cv_func_printf_directive_n=yes],
         [gl_cv_func_printf_directive_n=no],
-        [
-changequote(,)dnl
-         case "$host_os" in
+        [case "$host_os" in
+                   # Guess no on native Windows.
            mingw*) gl_cv_func_printf_directive_n="guessing no";;
            *)      gl_cv_func_printf_directive_n="guessing yes";;
          esac
-changequote([,])dnl
         ])
     ])
 ])
@@ -732,12 +766,14 @@ int main ()
         [
 changequote(,)dnl
          case "$host_os" in
-           openbsd*)        gl_cv_func_printf_directive_ls="guessing no";;
-           irix*)           gl_cv_func_printf_directive_ls="guessing no";;
-           solaris*)        gl_cv_func_printf_directive_ls="guessing no";;
-           cygwin*)         gl_cv_func_printf_directive_ls="guessing no";;
-           beos* | haiku*)  gl_cv_func_printf_directive_ls="guessing no";;
-           *)               gl_cv_func_printf_directive_ls="guessing yes";;
+           openbsd*)       gl_cv_func_printf_directive_ls="guessing no";;
+           irix*)          gl_cv_func_printf_directive_ls="guessing no";;
+           solaris*)       gl_cv_func_printf_directive_ls="guessing no";;
+           cygwin*)        gl_cv_func_printf_directive_ls="guessing no";;
+           beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";;
+                           # Guess yes on native Windows.
+           mingw*)         gl_cv_func_printf_directive_ls="guessing yes";;
+           *)              gl_cv_func_printf_directive_ls="guessing yes";;
          esac
 changequote([,])dnl
         ])
@@ -776,6 +812,7 @@ changequote(,)dnl
            netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*)
                          gl_cv_func_printf_positions="guessing no";;
            beos*)        gl_cv_func_printf_positions="guessing no";;
+                         # Guess no on native Windows.
            mingw* | pw*) gl_cv_func_printf_positions="guessing no";;
            *)            gl_cv_func_printf_positions="guessing yes";;
          esac
@@ -814,6 +851,7 @@ changequote(,)dnl
          case "$host_os" in
            cygwin*)      gl_cv_func_printf_flag_grouping="guessing no";;
            netbsd*)      gl_cv_func_printf_flag_grouping="guessing no";;
+                         # Guess no on native Windows.
            mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";;
            *)            gl_cv_func_printf_flag_grouping="guessing yes";;
          esac
@@ -824,7 +862,7 @@ changequote([,])dnl
 
 dnl Test whether the *printf family of functions supports the - flag correctly.
 dnl (ISO C99.) See
-dnl <http://lists.gnu.org/archive/html/bug-coreutils/2008-02/msg00035.html>
+dnl <https://lists.gnu.org/r/bug-coreutils/2008-02/msg00035.html>
 dnl Result is gl_cv_func_printf_flag_leftadjust.
 
 AC_DEFUN([gl_PRINTF_FLAG_LEFTADJUST],
@@ -856,6 +894,8 @@ changequote(,)dnl
            hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";;
                     # Guess no on HP-UX 10 and older.
            hpux*)   gl_cv_func_printf_flag_leftadjust="guessing no";;
+                    # Guess yes on native Windows.
+           mingw*)  gl_cv_func_printf_flag_leftadjust="guessing yes";;
                     # Guess yes otherwise.
            *)       gl_cv_func_printf_flag_leftadjust="guessing yes";;
          esac
@@ -866,7 +906,7 @@ changequote([,])dnl
 
 dnl Test whether the *printf family of functions supports padding of non-finite
 dnl values with the 0 flag correctly. (ISO C99 + TC1 + TC2.) See
-dnl <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html>
+dnl <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html>
 dnl Result is gl_cv_func_printf_flag_zero.
 
 AC_DEFUN([gl_PRINTF_FLAG_ZERO],
@@ -895,12 +935,14 @@ int main ()
         [
 changequote(,)dnl
          case "$host_os" in
-                   # Guess yes on glibc systems.
-           *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";;
-                   # Guess yes on BeOS.
-           beos*)  gl_cv_func_printf_flag_zero="guessing yes";;
-                   # If we don't know, assume the worst.
-           *)      gl_cv_func_printf_flag_zero="guessing no";;
+                          # Guess yes on glibc systems.
+           *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";;
+                          # Guess yes on BeOS.
+           beos*)         gl_cv_func_printf_flag_zero="guessing yes";;
+                          # Guess no on native Windows.
+           mingw*)        gl_cv_func_printf_flag_zero="guessing no";;
+                          # If we don't know, assume the worst.
+           *)             gl_cv_func_printf_flag_zero="guessing no";;
          esac
 changequote([,])dnl
         ])
@@ -1053,28 +1095,28 @@ changequote([,])dnl
       if test "$gl_cv_func_printf_enomem" = "guessing no"; then
 changequote(,)dnl
         case "$host_os" in
-                    # Guess yes on glibc systems.
-          *-gnu*)   gl_cv_func_printf_enomem="guessing yes";;
-                    # Guess yes on Solaris.
-          solaris*) gl_cv_func_printf_enomem="guessing yes";;
-                    # Guess yes on AIX.
-          aix*)     gl_cv_func_printf_enomem="guessing yes";;
-                    # Guess yes on HP-UX/hppa.
-          hpux*)    case "$host_cpu" in
-                      hppa*) gl_cv_func_printf_enomem="guessing yes";;
-                      *)     gl_cv_func_printf_enomem="guessing no";;
-                    esac
-                    ;;
-                    # Guess yes on IRIX.
-          irix*)    gl_cv_func_printf_enomem="guessing yes";;
-                    # Guess yes on OSF/1.
-          osf*)     gl_cv_func_printf_enomem="guessing yes";;
-                    # Guess yes on BeOS.
-          beos*)    gl_cv_func_printf_enomem="guessing yes";;
-                    # Guess yes on Haiku.
-          haiku*)   gl_cv_func_printf_enomem="guessing yes";;
-                    # If we don't know, assume the worst.
-          *)        gl_cv_func_printf_enomem="guessing no";;
+                         # Guess yes on glibc systems.
+          *-gnu* | gnu*) gl_cv_func_printf_enomem="guessing yes";;
+                         # Guess yes on Solaris.
+          solaris*)      gl_cv_func_printf_enomem="guessing yes";;
+                         # Guess yes on AIX.
+          aix*)          gl_cv_func_printf_enomem="guessing yes";;
+                         # Guess yes on HP-UX/hppa.
+          hpux*)         case "$host_cpu" in
+                           hppa*) gl_cv_func_printf_enomem="guessing yes";;
+                           *)     gl_cv_func_printf_enomem="guessing no";;
+                         esac
+                         ;;
+                         # Guess yes on IRIX.
+          irix*)         gl_cv_func_printf_enomem="guessing yes";;
+                         # Guess yes on OSF/1.
+          osf*)          gl_cv_func_printf_enomem="guessing yes";;
+                         # Guess yes on BeOS.
+          beos*)         gl_cv_func_printf_enomem="guessing yes";;
+                         # Guess yes on Haiku.
+          haiku*)        gl_cv_func_printf_enomem="guessing yes";;
+                         # If we don't know, assume the worst.
+          *)             gl_cv_func_printf_enomem="guessing no";;
         esac
 changequote([,])dnl
       fi
@@ -1134,9 +1176,9 @@ int main ()
 changequote(,)dnl
          case "$host_os" in
                                  # Guess yes on glibc systems.
-           *-gnu*)               gl_cv_func_snprintf_truncation_c99="guessing yes";;
+           *-gnu* | gnu*)        gl_cv_func_snprintf_truncation_c99="guessing yes";;
                                  # Guess yes on FreeBSD >= 5.
-           freebsd[1-4]*)        gl_cv_func_snprintf_truncation_c99="guessing no";;
+           freebsd[1-4].*)       gl_cv_func_snprintf_truncation_c99="guessing no";;
            freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
                                  # Guess yes on Mac OS X >= 10.3.
            darwin[1-6].*)        gl_cv_func_snprintf_truncation_c99="guessing no";;
@@ -1166,6 +1208,8 @@ changequote(,)dnl
            netbsd*)              gl_cv_func_snprintf_truncation_c99="guessing yes";;
                                  # Guess yes on BeOS.
            beos*)                gl_cv_func_snprintf_truncation_c99="guessing yes";;
+                                 # Guess no on native Windows.
+           mingw*)               gl_cv_func_snprintf_truncation_c99="guessing no";;
                                  # If we don't know, assume the worst.
            *)                    gl_cv_func_snprintf_truncation_c99="guessing no";;
          esac
@@ -1229,13 +1273,12 @@ int main ()
 }]])],
         [gl_cv_func_snprintf_retval_c99=yes],
         [gl_cv_func_snprintf_retval_c99=no],
-        [
+        [case "$host_os" in
 changequote(,)dnl
-         case "$host_os" in
                                  # Guess yes on glibc systems.
-           *-gnu*)               gl_cv_func_snprintf_retval_c99="guessing yes";;
+           *-gnu* | gnu*)        gl_cv_func_snprintf_retval_c99="guessing yes";;
                                  # Guess yes on FreeBSD >= 5.
-           freebsd[1-4]*)        gl_cv_func_snprintf_retval_c99="guessing no";;
+           freebsd[1-4].*)       gl_cv_func_snprintf_retval_c99="guessing no";;
            freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
                                  # Guess yes on Mac OS X >= 10.3.
            darwin[1-6].*)        gl_cv_func_snprintf_retval_c99="guessing no";;
@@ -1256,10 +1299,19 @@ changequote(,)dnl
            netbsd*)              gl_cv_func_snprintf_retval_c99="guessing yes";;
                                  # Guess yes on BeOS.
            beos*)                gl_cv_func_snprintf_retval_c99="guessing yes";;
+changequote([,])dnl
+                                 # Guess yes on MSVC, no on mingw.
+           mingw*)               AC_EGREP_CPP([Known], [
+#ifdef _MSC_VER
+ Known
+#endif
+                                   ],
+                                   [gl_cv_func_snprintf_retval_c99="guessing yes"],
+                                   [gl_cv_func_snprintf_retval_c99="guessing no"])
+                                 ;;
                                  # If we don't know, assume the worst.
            *)                    gl_cv_func_snprintf_retval_c99="guessing no";;
          esac
-changequote([,])dnl
         ])
     ])
 ])
@@ -1314,9 +1366,9 @@ int main ()
 changequote(,)dnl
          case "$host_os" in
                                  # Guess yes on glibc systems.
-           *-gnu*)               gl_cv_func_snprintf_directive_n="guessing yes";;
+           *-gnu* | gnu*)        gl_cv_func_snprintf_directive_n="guessing yes";;
                                  # Guess yes on FreeBSD >= 5.
-           freebsd[1-4]*)        gl_cv_func_snprintf_directive_n="guessing no";;
+           freebsd[1-4].*)       gl_cv_func_snprintf_directive_n="guessing no";;
            freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
                                  # Guess yes on Mac OS X >= 10.3.
            darwin[1-6].*)        gl_cv_func_snprintf_directive_n="guessing no";;
@@ -1339,6 +1391,8 @@ changequote(,)dnl
            netbsd*)              gl_cv_func_snprintf_directive_n="guessing yes";;
                                  # Guess yes on BeOS.
            beos*)                gl_cv_func_snprintf_directive_n="guessing yes";;
+                                 # Guess no on native Windows.
+           mingw*)               gl_cv_func_snprintf_directive_n="guessing no";;
                                  # If we don't know, assume the worst.
            *)                    gl_cv_func_snprintf_directive_n="guessing no";;
          esac
@@ -1355,6 +1409,7 @@ dnl Result is gl_cv_func_snprintf_size1.
 AC_DEFUN([gl_SNPRINTF_SIZE1],
 [
   AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_REQUIRE([gl_SNPRINTF_PRESENCE])
   AC_CACHE_CHECK([whether snprintf respects a size of 1],
     [gl_cv_func_snprintf_size1],
@@ -1384,7 +1439,12 @@ int main()
 }]])],
         [gl_cv_func_snprintf_size1=yes],
         [gl_cv_func_snprintf_size1=no],
-        [gl_cv_func_snprintf_size1="guessing yes"])
+        [case "$host_os" in
+                   # Guess yes on native Windows.
+           mingw*) gl_cv_func_snprintf_size1="guessing yes" ;;
+           *)      gl_cv_func_snprintf_size1="guessing yes" ;;
+         esac
+        ])
     ])
 ])
 
@@ -1456,9 +1516,9 @@ int main()
 changequote(,)dnl
          case "$host_os" in
                                  # Guess yes on glibc systems.
-           *-gnu*)               gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+           *-gnu* | gnu*)        gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
                                  # Guess yes on FreeBSD >= 5.
-           freebsd[1-4]*)        gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+           freebsd[1-4].*)       gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
            freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
                                  # Guess yes on Mac OS X >= 10.3.
            darwin[1-6].*)        gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
@@ -1480,7 +1540,7 @@ changequote(,)dnl
            netbsd*)              gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
                                  # Guess yes on BeOS.
            beos*)                gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
-                                 # Guess yes on mingw.
+                                 # Guess yes on native Windows.
            mingw* | pw*)         gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
                                  # If we don't know, assume the worst.
            *)                    gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
@@ -1546,7 +1606,9 @@ dnl   OpenBSD 3.9, 4.0               .  .  #  #  #  #  .  #  .  #  .  #  .  #  .
 dnl   Cygwin 1.7.0 (2009)            .  .  .  #  .  .  .  ?  .  .  .  .  .  ?  .  .  .  .  .  .
 dnl   Cygwin 1.5.25 (2008)           .  .  .  #  #  .  .  #  .  .  .  .  .  #  .  .  .  .  .  .
 dnl   Cygwin 1.5.19 (2006)           #  .  .  #  #  #  .  #  .  #  .  #  #  #  .  .  .  .  .  .
-dnl   Solaris 11 2011-11             .  .  #  #  #  .  .  #  .  .  .  #  .  .  .  .  .  .  .  .
+dnl   Solaris 11.4                   .  .  #  #  #  .  .  #  .  .  .  #  .  .  .  .  .  .  .  .
+dnl   Solaris 11.3                   .  .  .  .  #  .  .  #  .  .  .  .  .  .  .  .  .  .  .  .
+dnl   Solaris 11.0                   .  .  #  #  #  .  .  #  .  .  .  #  .  .  .  .  .  .  .  .
 dnl   Solaris 10                     .  .  #  #  #  .  .  #  .  .  .  #  #  .  .  .  .  .  .  .
 dnl   Solaris 2.6 ... 9              #  .  #  #  #  #  .  #  .  .  .  #  #  .  .  .  #  .  .  .
 dnl   Solaris 2.5.1                  #  .  #  #  #  #  .  #  .  .  .  #  .  .  #  #  #  #  #  #