summaryrefslogtreecommitdiff
path: root/m4/popen.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/popen.m4')
-rw-r--r--m4/popen.m420
1 files changed, 14 insertions, 6 deletions
diff --git a/m4/popen.m4 b/m4/popen.m4
index 101e924db0..d6138a1885 100644
--- a/m4/popen.m4
+++ b/m4/popen.m4
@@ -1,4 +1,4 @@
-# popen.m4 serial 5
+# popen.m4 serial 6
dnl Copyright (C) 2009-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,
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_POPEN],
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_CHECK_FUNCS_ONCE([popen])
if test $ac_cv_func_popen = no; then
HAVE_POPEN=0
@@ -30,12 +31,19 @@ AC_DEFUN([gl_FUNC_POPEN],
]])],
[gl_cv_func_popen_works=yes],
[gl_cv_func_popen_works=no],
- dnl For now, only cygwin 1.5 or older is known to be broken.
- [gl_cv_func_popen_works='guessing yes'])
+ [case "$host_os" in
+ # For now, only cygwin 1.5 or older is known to be broken.
+ cygwin*) gl_cv_func_popen_works="guessing no" ;;
+ # Guess yes on native Windows.
+ mingw*) gl_cv_func_popen_works="guessing yes" ;;
+ *) gl_cv_func_popen_works="guessing yes" ;;
+ esac
+ ])
])
- if test "$gl_cv_func_popen_works" = no; then
- REPLACE_POPEN=1
- fi
+ case "$gl_cv_func_popen_works" in
+ *yes) ;;
+ *) REPLACE_POPEN=1 ;;
+ esac
fi
])