]> Savannah Git Hosting - gnulib.git/commitdiff
Support for old NeXTstep 3.3 frexp().
authorBruno Haible <bruno@clisp.org>
Wed, 19 Oct 2011 09:09:37 +0000 (11:09 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 19 Oct 2011 09:23:48 +0000 (11:23 +0200)
* m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Check for alarm. Limit the
execution time of the test to 5 seconds.
Reported by Daniel Richard G. <skunk@iskunk.org>.

ChangeLog
m4/frexp.m4

index 19bd1796ba050d1e4e424e2f7adb675929c393e7..a2f95ec98bc3ab749659bfb47c5703ab94fdbef0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-10-19  Bruno Haible  <bruno@clisp.org>
+
+       Support for old NeXTstep 3.3 frexp().
+       * m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Check for alarm. Limit the
+       execution time of the test to 5 seconds.
+       Reported by Daniel Richard G. <skunk@iskunk.org>.
+
 2011-10-19  Bruno Haible  <bruno@clisp.org>
 
        Support for old NeXTstep 3.3 sed.
index f2048f3be37bc58d5e2b8d27069a86f9e197b1c1..b0bdd106b0cf9cef4f561c5004b3c3ae4eafdd82 100644 (file)
@@ -1,4 +1,4 @@
-# frexp.m4 serial 12
+# frexp.m4 serial 13
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -93,6 +93,7 @@ AC_DEFUN([gl_FUNC_FREXP_WORKS],
 [
   AC_REQUIRE([AC_PROG_CC])
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_FUNCS_ONCE([alarm])
   AC_CACHE_CHECK([whether frexp works], [gl_cv_func_frexp_works],
     [
       AC_RUN_IFELSE(
@@ -100,6 +101,9 @@ AC_DEFUN([gl_FUNC_FREXP_WORKS],
 #include <float.h>
 #include <math.h>
 #include <string.h>
+#if HAVE_ALARM
+# include <unistd.h>
+#endif
 /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0.
    ICC 10.0 has a bug when optimizing the expression -zero.
    The expression -DBL_MIN * DBL_MIN does not work when cross-compiling
@@ -120,6 +124,11 @@ int main()
   int i;
   volatile double x;
   double zero = 0.0;
+#if HAVE_ALARM
+  /* NeXTstep 3.3 frexp() runs into an endless loop when called on an infinite
+     number.  Let the test fail in this case.  */
+  alarm (5);
+#endif
   /* Test on denormalized numbers.  */
   for (i = 1, x = 1.0; i >= DBL_MIN_EXP; i--, x *= 0.5)
     ;