]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
Improve cross-compilation guesses for native Windows.
authorBruno Haible <bruno@clisp.org>
Thu, 13 Jul 2017 17:42:10 +0000 (19:42 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 13 Jul 2017 17:42:10 +0000 (19:42 +0200)
* m4/fflush.m4 (gl_FUNC_FFLUSH_STDIN): Add cross-compilation guess for
native Windows.
(gl_FUNC_FFLUSH): Update accordingly.
* m4/fclose.m4 (gl_FUNC_FCLOSE): Likewise.
* m4/fseeko.m4 (gl_FUNC_FFLUSH_STDIN): Likewise.

ChangeLog
m4/fclose.m4
m4/fflush.m4
m4/fseeko.m4

index 32c254f5b38f0221c74cc442d78f316a9958d9ea..5519ae2a2b6a9ee813e1c0fa564a444d845cf889 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-07-13  Bruno Haible  <bruno@clisp.org>
+
+       Improve cross-compilation guesses for native Windows.
+       * m4/fflush.m4 (gl_FUNC_FFLUSH_STDIN): Add cross-compilation guess for
+       native Windows.
+       (gl_FUNC_FFLUSH): Update accordingly.
+       * m4/fclose.m4 (gl_FUNC_FCLOSE): Likewise.
+       * m4/fseeko.m4 (gl_FUNC_FFLUSH_STDIN): Likewise.
+
 2017-07-11  Bruno Haible  <bruno@clisp.org>
 
        More systematic m4 quoting and indentation.
index a2f9c5f0ef6c562654bb517b2b89f6635e299ccf..0855c23eb460fff740bfca9f7daae565d571804a 100644 (file)
@@ -1,4 +1,4 @@
-# fclose.m4 serial 7
+# fclose.m4 serial 8
 dnl Copyright (C) 2008-2017 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,9 +10,10 @@ AC_DEFUN([gl_FUNC_FCLOSE],
   AC_REQUIRE([AC_CANONICAL_HOST])
 
   gl_FUNC_FFLUSH_STDIN
-  if test $gl_cv_func_fflush_stdin != yes; then
-    REPLACE_FCLOSE=1
-  fi
+  case "$gl_cv_func_fflush_stdin" in
+    *yes) ;;
+    *) REPLACE_FCLOSE=1 ;;
+  esac
 
   AC_REQUIRE([gl_FUNC_CLOSE])
   if test $REPLACE_CLOSE = 1; then
index 7732234ee981307fa7d1fbdc3deaaeda3cd64f0d..d64f3ba5d52612ca4175c1b335cc9dfb65e79936 100644 (file)
@@ -1,4 +1,4 @@
-# fflush.m4 serial 16
+# fflush.m4 serial 17
 
 # Copyright (C) 2007-2017 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -14,9 +14,10 @@ AC_DEFUN([gl_FUNC_FFLUSH],
 [
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   gl_FUNC_FFLUSH_STDIN
-  if test $gl_cv_func_fflush_stdin != yes; then
-    REPLACE_FFLUSH=1
-  fi
+  case "$gl_cv_func_fflush_stdin" in
+    *yes) ;;
+    *) REPLACE_FFLUSH=1 ;;
+  esac
 ])
 
 dnl Determine whether fflush works on input streams.
@@ -24,6 +25,7 @@ dnl Sets gl_cv_func_fflush_stdin.
 
 AC_DEFUN([gl_FUNC_FFLUSH_STDIN],
 [
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_CHECK_HEADERS_ONCE([unistd.h])
   AC_CACHE_CHECK([whether fflush works on input streams],
     [gl_cv_func_fflush_stdin],
@@ -72,14 +74,21 @@ AC_DEFUN([gl_FUNC_FFLUSH_STDIN],
            { fclose (f); return 7; }
          fclose (f);
          return 0;
-       ]])], [gl_cv_func_fflush_stdin=yes], [gl_cv_func_fflush_stdin=no],
-     [gl_cv_func_fflush_stdin=cross])
+       ]])],
+       [gl_cv_func_fflush_stdin=yes],
+       [gl_cv_func_fflush_stdin=no],
+       [case "$host_os" in
+                  # Guess no on native Windows.
+          mingw*) gl_cv_func_fflush_stdin="guessing no" ;;
+          *)      gl_cv_func_fflush_stdin=cross ;;
+        esac
+       ])
      rm conftest.txt
     ])
-  case $gl_cv_func_fflush_stdin in
-    yes) gl_func_fflush_stdin=1 ;;
-    no)  gl_func_fflush_stdin=0 ;;
-    *)   gl_func_fflush_stdin='(-1)' ;;
+  case "$gl_cv_func_fflush_stdin" in
+    *yes) gl_func_fflush_stdin=1 ;;
+    *no)  gl_func_fflush_stdin=0 ;;
+    *)    gl_func_fflush_stdin='(-1)' ;;
   esac
   AC_DEFINE_UNQUOTED([FUNC_FFLUSH_STDIN], [$gl_func_fflush_stdin],
     [Define to 1 if fflush is known to work on stdin as per POSIX.1-2008,
index fdb565bac5916cbcd9bbd949805fc2179aeb0f99..5c30df220f37ed36970116ec4e522fd96f4d4d53 100644 (file)
@@ -1,4 +1,4 @@
-# fseeko.m4 serial 17
+# fseeko.m4 serial 18
 dnl Copyright (C) 2007-2017 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -37,9 +37,10 @@ AC_DEFUN([gl_FUNC_FSEEKO],
     fi
     m4_ifdef([gl_FUNC_FFLUSH_STDIN], [
       gl_FUNC_FFLUSH_STDIN
-      if test $gl_cv_func_fflush_stdin != yes; then
-        REPLACE_FSEEKO=1
-      fi
+      case "$gl_cv_func_fflush_stdin" in
+        *yes) ;;
+        *) REPLACE_FSEEKO=1 ;;
+      esac
     ])
   fi
 ])