Mercurial > hg > octave-lyh > gnulib-hg
changeset 8238:15ceab8cf57a
Also handle the case that isnan is a "type-generic" macro.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 25 Feb 2007 04:46:17 +0000 |
parents | c7cc3f95c8a7 |
children | d31f3019f697 |
files | ChangeLog lib/isnan.h lib/isnanl.h m4/isnan.m4 m4/isnanl.m4 |
diffstat | 5 files changed, 40 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-02-24 Bruno Haible <bruno@clisp.org> + + * lib/isnanl.h (isnanl): Define through isnan if isnan is a macro. + * m4/isnan.m4 (gl_FUNC_ISNAN_NO_LIBM): Don't check for isnan as a + function; instead check whether isnan with a double argument links. + * m4/isnanl.m4 (gl_FUNC_ISNANL_NO_LIBM): Don't check for isnanl as a + function; instead check whether isnan with a 'long double' argument + links. + Reported by Eric Blake <ebb9@byu.net>. + 2007-02-24 Bruno Haible <bruno@clisp.org> * lib/isnan.c: Support the 'long double' case if USE_LONG_DOUBLE is
--- a/lib/isnan.h +++ b/lib/isnan.h @@ -16,7 +16,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_ISNAN_IN_LIBC -/* Get declaration of isnan. */ +/* Get declaration of isnan macro. */ # include <math.h> #else /* Test whether X is a NaN. */
--- a/lib/isnanl.h +++ b/lib/isnanl.h @@ -16,8 +16,12 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_ISNANL_IN_LIBC -/* Get declaration of isnanl. */ +/* Get declaration of isnan macro or (older) isnanl function. */ # include <math.h> +# ifdef isnan +# undef isnanl +# define isnanl(x) isnan ((long double)(x)) +# endif #else /* Test whether X is a NaN. */ # undef isnanl
--- a/m4/isnan.m4 +++ b/m4/isnan.m4 @@ -8,12 +8,18 @@ AC_DEFUN([gl_FUNC_ISNAN_NO_LIBM], [ - AC_CHECK_FUNC([isnan], - [gl_cv_func_isnan_no_libm=yes], - [gl_cv_func_isnan_no_libm=no]) + AC_CACHE_CHECK([whether isnan(double) can be used without linking with libm], + [gl_cv_func_isnan_no_libm], + [ + AC_TRY_LINK([#include <math.h> + double x;], + [return isnan (x);], + [gl_cv_func_isnan_no_libm=yes], + [gl_cv_func_isnan_no_libm=no]) + ]) if test $gl_cv_func_isnan_no_libm = yes; then AC_DEFINE([HAVE_ISNAN_IN_LIBC], 1, - [Define if the isnan() function is available in libc.]) + [Define if the isnan(double) function is available in libc.]) else AC_LIBOBJ([isnan]) gl_DOUBLE_EXPONENT_LOCATION
--- a/m4/isnanl.m4 +++ b/m4/isnanl.m4 @@ -8,12 +8,22 @@ [ AC_REQUIRE([gt_TYPE_LONGDOUBLE]) if test $gt_cv_c_long_double = yes; then - AC_CHECK_FUNC([isnanl], - [gl_cv_func_isnanl_no_libm=yes], - [gl_cv_func_isnanl_no_libm=no]) + AC_CACHE_CHECK([whether isnan(long double) can be used without linking with libm], + [gl_cv_func_isnanl_no_libm], + [ + AC_TRY_LINK([#include <math.h> + #ifdef isnan + # undef isnanl + # define isnanl(x) isnan ((long double)(x)) + #endif + long double x;], + [return isnanl (x);], + [gl_cv_func_isnanl_no_libm=yes], + [gl_cv_func_isnanl_no_libm=no]) + ]) if test $gl_cv_func_isnanl_no_libm = yes; then AC_DEFINE([HAVE_ISNANL_IN_LIBC], 1, - [Define if the isnanl() function is available in libc.]) + [Define if the isnan(long double) function is available in libc.]) else AC_LIBOBJ([isnanl]) gl_LONG_DOUBLE_EXPONENT_LOCATION