summaryrefslogtreecommitdiff
path: root/m4/frexp.m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-10-19 11:09:37 +0200
committerBruno Haible <bruno@clisp.org>2011-10-19 11:23:48 +0200
commit4d699c3727abd33573584053c3d272b92f5b4f1a (patch)
treefc52ed61757f13f14cd9bd8e081722eb8eb68a98 /m4/frexp.m4
parent209a1a065ec056c35f30f1127e7255e49c7ab662 (diff)
downloadgnulib-4d699c3727abd33573584053c3d272b92f5b4f1a.tar.gz
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>.
Diffstat (limited to 'm4/frexp.m4')
-rw-r--r--m4/frexp.m411
1 files changed, 10 insertions, 1 deletions
diff --git a/m4/frexp.m4 b/m4/frexp.m4
index f2048f3be3..b0bdd106b0 100644
--- a/m4/frexp.m4
+++ b/m4/frexp.m4
@@ -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)
;