Avoid "guessing no" guesses when cross-compiling to glibc systems.
[gnulib.git] / m4 / round.m4
index 805eba9..514c4f7 100644 (file)
@@ -1,4 +1,4 @@
-# round.m4 serial 15
+# round.m4 serial 16
 dnl Copyright (C) 2007, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -72,6 +72,7 @@ int main()
 
     m4_ifdef([gl_FUNC_ROUND_IEEE], [
       if test $gl_round_required = ieee && test $REPLACE_ROUND = 0; then
+        AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
         AC_CACHE_CHECK([whether round works according to ISO C 99 with IEC 60559],
           [gl_cv_func_round_ieee],
           [
@@ -102,7 +103,13 @@ int main (int argc, char *argv[])
               ]])],
               [gl_cv_func_round_ieee=yes],
               [gl_cv_func_round_ieee=no],
-              [gl_cv_func_round_ieee="guessing no"])
+              [case "$host_os" in
+                         # Guess yes on glibc systems.
+                 *-gnu*) gl_cv_func_round_ieee="guessing yes" ;;
+                         # If we don't know, assume the worst.
+                 *)      gl_cv_func_round_ieee="guessing no" ;;
+               esac
+              ])
             LIBS="$save_LIBS"
           ])
         case "$gl_cv_func_round_ieee" in