New upstream version 1.9
[debian/gzip] / m4 / perror.m4
index 743ab7a692c0cc47937e56d1f5dd13801fecccf5..60568a7ad90a8836633535187b1264dff6d7aeb4 100644 (file)
@@ -1,5 +1,5 @@
-# perror.m4 serial 6
-dnl Copyright (C) 2008-2016 Free Software Foundation, Inc.
+# perror.m4 serial 7
+dnl Copyright (C) 2008-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.
@@ -10,6 +10,7 @@ AC_DEFUN([gl_FUNC_PERROR],
   AC_REQUIRE([gl_HEADER_ERRNO_H])
   AC_REQUIRE([gl_FUNC_STRERROR_R])
   AC_REQUIRE([gl_FUNC_STRERROR_0])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   dnl We intentionally do not check for the broader REPLACE_STRERROR_R,
   dnl since on glibc systems, strerror_r is replaced only for signature
   dnl issues, and perror is just fine.  Rather, we only want to
@@ -46,13 +47,18 @@ AC_DEFUN([gl_FUNC_PERROR],
             fi
             rm -rf conftest.txt1 conftest.txt2],
            [gl_cv_func_perror_works=no],
-           [dnl Guess no when cross-compiling.
-            gl_cv_func_perror_works="guessing no"
+           [case "$host_os" in
+                      # Guess yes on native Windows.
+              mingw*) gl_cv_func_perror_works="guessing yes" ;;
+                      # Otherwise guess no.
+              *)      gl_cv_func_perror_works="guessing no" ;;
+            esac
            ])
         ])
-      if test "$gl_cv_func_perror_works" != yes; then
-        REPLACE_PERROR=1
-      fi
+      case "$gl_cv_func_perror_works" in
+        *yes) ;;
+        *) REPLACE_PERROR=1 ;;
+      esac
       ;;
     *)
       dnl The system's perror() probably inherits the bugs in the