bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cross-compilation guesses (10)


From: Bruno Haible
Subject: Re: cross-compilation guesses (10)
Date: Sat, 05 May 2012 11:42:48 +0200
User-agent: KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; )

> When cross-compiling, I also see this wrong guess:
> 
>   checking for signbit macro... guessing no
> 
> This should fix it. (Most of this patch is merely reindentation.)

There is another wrong guess in the same file:

  checking for signbit compiler built-ins... guessing no

This combined patch (modulo reindentation) fixes both.


2012-05-05  Bruno Haible  <address@hidden>

        signbit: Avoid "guessing no" when cross-compiling to glibc systems.
        * m4/signbit.m4 (gl_SIGNBIT): Require AC_CANONICAL_HOST. When cross-
        compiling to a glibc system, set gl_cv_func_signbit and
        gl_cv_func_signbit_gcc to "guessing yes".

diff --git a/m4/signbit.m4 b/m4/signbit.m4
index 8955326..e9877f6 100644
--- a/m4/signbit.m4
+++ b/m4/signbit.m4
@@ -1,4 +1,4 @@
-# signbit.m4 serial 11
+# signbit.m4 serial 12
 dnl Copyright (C) 2007-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,
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is 
preserved.
 AC_DEFUN([gl_SIGNBIT],
 [
   AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_CACHE_CHECK([for signbit macro], [gl_cv_func_signbit],
     [
       AC_RUN_IFELSE(
@@ -27,7 +28,13 @@ AC_DEFUN([gl_SIGNBIT],
 ])],
         [gl_cv_func_signbit=yes],
         [gl_cv_func_signbit=no],
-        [gl_cv_func_signbit="guessing no"])
+        [case "$host_os" in
+                   # Guess yes on glibc systems.
+           *-gnu*) gl_cv_func_signbit="guessing yes" ;;
+                   # If we don't know, assume the worst.
+           *)      gl_cv_func_signbit="guessing no" ;;
+         esac
+        ])
     ])
   dnl GCC 4.0 and newer provides three built-ins for signbit.
   dnl They can be used without warnings, also in C++, regardless of <math.h>.
@@ -50,14 +57,24 @@ AC_DEFUN([gl_SIGNBIT],
 ])],
         [gl_cv_func_signbit_gcc=yes],
         [gl_cv_func_signbit_gcc=no],
-        [gl_cv_func_signbit_gcc="guessing no"])
+        [case "$host_os" in
+                   # Guess yes on glibc systems.
+           *-gnu*) gl_cv_func_signbit_gcc="guessing yes" ;;
+                   # If we don't know, assume the worst.
+           *)      gl_cv_func_signbit_gcc="guessing no" ;;
+         esac
+        ])
     ])
   dnl Use the compiler built-ins whenever possible, because they are more
   dnl efficient than the system library functions (if they exist).
-  if test "$gl_cv_func_signbit_gcc" = yes; then
+  case "$gl_cv_func_signbit_gcc" in
+    *yes)
     REPLACE_SIGNBIT_USING_GCC=1
-  else
-    if test "$gl_cv_func_signbit" != yes; then
+      ;;
+    *)
+      case "$gl_cv_func_signbit" in
+        *yes) ;;
+        *)
       dnl REPLACE_SIGNBIT=1 makes sure the signbit[fdl] functions get built.
       REPLACE_SIGNBIT=1
       gl_FLOAT_SIGN_LOCATION
@@ -129,8 +146,10 @@ AC_DEFUN([gl_SIGNBIT],
           fi
         fi
       fi
-    fi
-  fi
+          ;;
+      esac
+      ;;
+  esac
 ])
 
 AC_DEFUN([gl_SIGNBIT_TEST_PROGRAM], [[




reply via email to

[Prev in Thread] Current Thread [Next in Thread]