From: Bruno Haible <bruno@clisp.org> Date: Sun, 26 Jul 2020 10:22:00 +0000 (+0200) Subject: expl: Simplify autoconf test. X-Git-Tag: v1.0~3856 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=c7002725ef142a57787a13ed11dc701e4a0ee77b;p=gnulib.git expl: Simplify autoconf test. * m4/expl.m4 (gl_FUNC_EXPL): Merge the "checking whether expl() breaks with small values..." test into the "checking whether expl works..." test. --- diff --git a/ChangeLog b/ChangeLog index 2213b08760..fc4b46ebe9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2020-07-26 Bruno Haible <bruno@clisp.org> + + expl: Simplify autoconf test. + * m4/expl.m4 (gl_FUNC_EXPL): Merge the "checking whether expl() breaks + with small values..." test into the "checking whether expl works..." + test. + 2020-07-26 Bruno Haible <bruno@clisp.org> alloca: Remove Cray-2 and Cray Y-MP support. diff --git a/m4/expl.m4 b/m4/expl.m4 index 9f67322f9d..7667ef4e47 100644 --- a/m4/expl.m4 +++ b/m4/expl.m4 @@ -1,4 +1,4 @@ -# expl.m4 serial 16 +# expl.m4 serial 17 dnl Copyright (C) 2010-2020 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,43 +54,6 @@ AC_DEFUN([gl_FUNC_EXPL], EXPL_LIBM=-lm fi fi - 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>]], - [[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 - gl_cv_func_expl_no_libm=no ;; - esac - fi if test $gl_cv_func_expl_no_libm = yes \ || test $gl_cv_func_expl_in_libm = yes; then dnl Also check whether it's declared. @@ -150,6 +113,22 @@ int main (int argc, char *argv[]) { long double (* volatile my_expl) (long double) = argc ? expl : dummy; int result = 0; + /* On Haiku 2017 the system's native expl() is just a stub: it returns 0.0 + and prints "__expl not implemented" for all arguments. */ + { + volatile long double x1 = -1.0; + if (expl (x1) == 0.0) + result |= 1; + } + /* On OpenBSD 5.4 the system's native expl() is buggy: + it returns 'nan' for small values. */ + { + volatile long double x1 = -1.0; + volatile long double x2 = -0.8; + volatile long double x3 = -0.4; + if (isnan (expl (x1)) || isnan (expl (x2)) || isnan (expl (x3))) + result |= 2; + } /* This test fails on NetBSD 9.0. */ { const long double TWO_LDBL_MANT_DIG = /* 2^LDBL_MANT_DIG */ @@ -161,7 +140,7 @@ int main (int argc, char *argv[]) long double x = 11.358L; long double err = (my_expl (x) * my_expl (- x) - 1.0L) * TWO_LDBL_MANT_DIG; if (!(err >= -100.0L && err <= 100.0L)) - result |= 1; + result |= 4; } return result; }