>From fd5ca537635ec84406a18d8a5cf97dc8914382b0 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 13 Jul 2017 19:42:10 +0200 Subject: [PATCH 1/4] 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. --- ChangeLog | 9 +++++++++ m4/fclose.m4 | 9 +++++---- m4/fflush.m4 | 29 +++++++++++++++++++---------- m4/fseeko.m4 | 9 +++++---- 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 32c254f..5519ae2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2017-07-13 Bruno Haible + + 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 More systematic m4 quoting and indentation. diff --git a/m4/fclose.m4 b/m4/fclose.m4 index a2f9c5f..0855c23 100644 --- a/m4/fclose.m4 +++ b/m4/fclose.m4 @@ -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 diff --git a/m4/fflush.m4 b/m4/fflush.m4 index 7732234..d64f3ba 100644 --- a/m4/fflush.m4 +++ b/m4/fflush.m4 @@ -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, diff --git a/m4/fseeko.m4 b/m4/fseeko.m4 index fdb565b..5c30df2 100644 --- a/m4/fseeko.m4 +++ b/m4/fseeko.m4 @@ -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 ]) -- 2.7.4