changeset 10862:dc5daffec182

Detect a dysfunctional signbit macro on MacOS X 10.4/PowerPC.
author Bruno Haible <bruno@clisp.org>
date Tue, 09 Dec 2008 02:28:20 +0100
parents 69048e86dbdf
children 054d026819f0
files ChangeLog m4/signbit.m4
diffstat 2 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-12-08  Bruno Haible  <bruno@clisp.org>
+
+	* m4/signbitl.m4 (gl_SIGNBIT_TEST_PROGRAM): Add a link check of signbit
+	applied to variables. Needed on MacOS X 10.4/PowerPC.
+	Reported by Simon Josefsson.
+
 2008-12-08  William Pursell  <bill.pursell@gmail.com>  (tiny change)
 	and Eric Blake  <ebb9@byu.net>
 
--- a/m4/signbit.m4
+++ b/m4/signbit.m4
@@ -1,4 +1,4 @@
-# signbit.m4 serial 4
+# signbit.m4 serial 5
 dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -124,6 +124,12 @@
 ])
 
 AC_DEFUN([gl_SIGNBIT_TEST_PROGRAM], [[
+/* Global variables.
+   Needed because GCC 4 constant-folds __builtin_signbitl (literal)
+   but cannot constant-fold            __builtin_signbitl (variable).  */
+float vf;
+double vd;
+long double vl;
 int main ()
 {
 /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0.
@@ -142,6 +148,8 @@
 #else
 long double m0l = -p0l;
 #endif
+  if (signbit (vf))
+    vf++;
   {
     float plus_inf = 1.0f / p0f;
     float minus_inf = -1.0f / p0f;
@@ -153,6 +161,8 @@
           && signbit (minus_inf)))
       return 1;
   }
+  if (signbit (vd))
+    vd++;
   {
     double plus_inf = 1.0 / p0d;
     double minus_inf = -1.0 / p0d;
@@ -164,6 +174,8 @@
           && signbit (minus_inf)))
       return 1;
   }
+  if (signbit (vl))
+    vl++;
   {
     long double plus_inf = 1.0L / p0l;
     long double minus_inf = -1.0L / p0l;