summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2017-10-29 11:16:56 +0100
committerBruno Haible <bruno@clisp.org>2017-10-29 21:27:50 +0100
commit6065f427d616ccc578b38d92a5ef27bc4b6286ea (patch)
treee4f59cbf1415f95ea68de8d9d789eb632e282176 /m4
parent5beeeb81c77cbcf72a7b9635fbad87e69432e6fd (diff)
downloadgnulib-6065f427d616ccc578b38d92a5ef27bc4b6286ea.tar.gz
expl: Ensure replacement on Haiku.
* m4/expl.m4 (gl_FUNC_EXPL): Test whether an expl() return value is zero. * doc/posix-functions/expl.texi: Mention the Haiku problem.
Diffstat (limited to 'm4')
-rw-r--r--m4/expl.m450
1 files changed, 28 insertions, 22 deletions
diff --git a/m4/expl.m4 b/m4/expl.m4
index 2eddf0a19e..42db88b052 100644
--- a/m4/expl.m4
+++ b/m4/expl.m4
@@ -1,4 +1,4 @@
-# expl.m4 serial 10
+# expl.m4 serial 11
dnl Copyright (C) 2010-2017 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -54,31 +54,37 @@ AC_DEFUN([gl_FUNC_EXPL],
EXPL_LIBM=-lm
fi
fi
- dnl On OpenBSD5.4 the system's native expl() is buggy:
+ dnl On Haiku 2017 the system's native expl() is just a stub: it returns 0.0
+ dnl and prints "__expl not implemented" for all arguments.
+ dnl On OpenBSD 5.4 the system's native expl() is buggy:
dnl it returns 'nan' for small values. Test for this anomaly.
if test $gl_cv_func_expl_no_libm = yes \
|| test $gl_cv_func_expl_in_libm = yes; then
AC_CACHE_CHECK([whether expl() breaks with small values],
- [gl_cv_func_expl_buggy],
- [
- save_LIBS="$LIBS"
- LIBS="$EXPL_LIBM"
- AC_RUN_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <math.h>]],
- [[return isnan(expl(-1.0))||
- isnan(expl(-0.8))||
- isnan(expl(-0.4)); ]])],
- [gl_cv_func_expl_buggy=no], [gl_cv_func_expl_buggy=yes],
- [case $host_os in
- openbsd*) gl_cv_func_expl_buggy="guessing yes" ;;
- # Guess no on native Windows.
- mingw*) gl_cv_func_expl_buggy="guessing no" ;;
- *) gl_cv_func_expl_buggy="guessing no" ;;
- esac
- ])
- LIBS="$save_LIBS"
- ])
+ [gl_cv_func_expl_buggy],
+ [save_LIBS="$LIBS"
+ LIBS="$EXPL_LIBM"
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>]],
+ [[volatile long double x1 = -1.0;
+ volatile long double x2 = -0.8;
+ volatile long double x3 = -0.4;
+ return expl(x1) == 0.0 || isnan(expl(x1))
+ || isnan(expl(x2)) || isnan(expl(x3));
+ ]])
+ ],
+ [gl_cv_func_expl_buggy=no], [gl_cv_func_expl_buggy=yes],
+ [case $host_os in
+ haiku* | openbsd*)
+ gl_cv_func_expl_buggy="guessing yes" ;;
+ # Guess no on native Windows.
+ mingw*) gl_cv_func_expl_buggy="guessing no" ;;
+ *) gl_cv_func_expl_buggy="guessing no" ;;
+ esac
+ ])
+ LIBS="$save_LIBS"
+ ])
case "$gl_cv_func_expl_buggy" in
*yes)
gl_cv_func_expl_in_libm=no