X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Fisnanf.m4;h=388e6c049c3b53248dd903367ff25a9950af09a9;hb=5332d5a42d457c0d1894b242beace63916893650;hp=ddc17a841376175504b67c356f38f2dfc0a28924;hpb=15b93a23d220ccdf3d29bf6f9b8fbf7e50269f9f;p=gnulib.git diff --git a/m4/isnanf.m4 b/m4/isnanf.m4 index ddc17a841..388e6c049 100644 --- a/m4/isnanf.m4 +++ b/m4/isnanf.m4 @@ -1,4 +1,4 @@ -# isnanf.m4 serial 1 +# isnanf.m4 serial 4 dnl Copyright (C) 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,6 +10,14 @@ AC_DEFUN([gl_FUNC_ISNANF_NO_LIBM], [ gl_HAVE_ISNANF_NO_LIBM if test $gl_cv_func_isnanf_no_libm = yes; then + gl_ISNANF_WORKS + fi + if test $gl_cv_func_isnanf_no_libm = yes \ + && { case "$gl_cv_func_isnanf_works" in + *yes) true;; + *) false;; + esac + }; then AC_DEFINE([HAVE_ISNANF_IN_LIBC], 1, [Define if the isnan(float) function is available in libc.]) else @@ -36,6 +44,47 @@ AC_DEFUN([gl_HAVE_ISNANF_NO_LIBM], ]) ]) +dnl Test whether isnanf() recognizes a NaN (this fails on IRIX 6.5) and rejects +dnl Infinity (this fails on Solaris 2.5.1). +AC_DEFUN([gl_ISNANF_WORKS], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether isnan(float) works], [gl_cv_func_isnanf_works], + [ + AC_TRY_RUN([ +#include +#ifdef isnan +# undef isnanf +# define isnanf(x) isnan ((float)(x)) +#endif +/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ +#ifdef __DECC +static float +NaN () +{ + static float zero = 0.0f; + return zero / zero; +} +#else +# define NaN() (0.0f / 0.0f) +#endif +int main() +{ + if (!isnanf (NaN ())) + return 1; + if (isnanf (1.0f / 0.0f)) + return 1; + return 0; +}], [gl_cv_func_isnanf_works=yes], [gl_cv_func_isnanf_works=no], + [case "$host_os" in + irix* | solaris*) gl_cv_func_isnanf_works="guessing no";; + *) gl_cv_func_isnanf_works="guessing yes";; + esac + ]) + ]) +]) + AC_DEFUN([gl_FLOAT_EXPONENT_LOCATION], [ AC_CACHE_CHECK([where to find the exponent in a 'float'], @@ -108,7 +157,7 @@ int main () ], [gl_cv_cc_float_expbit0=`cat conftest.out`], [gl_cv_cc_float_expbit0="unknown"], - [gl_cv_cc_double_expbit0="word 0 bit 23"]) + [gl_cv_cc_float_expbit0="word 0 bit 23"]) rm -f conftest.out ]) case "$gl_cv_cc_float_expbit0" in