GCC 4.0 or newer also has a built-in for isnan(double). This patch makes use of it.
2008-01-26 Bruno Haible <[EMAIL PROTECTED]> * m4/isnand.m4 (gl_FUNC_ISNAND_NO_LIBM): Test the GCC >= 4.0 built-in. * lib/isnand.h (isnand): Use the GCC >= 4.0 built-in. *** lib/isnand.h.orig 2008-01-26 15:34:00.000000000 +0100 --- lib/isnand.h 2008-01-26 15:33:42.000000000 +0100 *************** *** 17,23 **** #if HAVE_ISNAND_IN_LIBC /* Get declaration of isnan macro. */ # include <math.h> ! # ifdef isnan # undef isnand # define isnand(x) isnan ((double)(x)) # endif --- 17,27 ---- #if HAVE_ISNAND_IN_LIBC /* Get declaration of isnan macro. */ # include <math.h> ! # if __GNUC__ >= 4 ! /* GCC 4.0 and newer provides three built-ins for isnan. */ ! # undef isnand ! # define isnand(x) __builtin_isnan ((double)(x)) ! # else # undef isnand # define isnand(x) isnan ((double)(x)) # endif *** m4/isnand.m4.orig 2008-01-26 15:34:00.000000000 +0100 --- m4/isnand.m4 2008-01-26 15:32:13.000000000 +0100 *************** *** 1,4 **** ! # isnand.m4 serial 1 dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, --- 1,4 ---- ! # isnand.m4 serial 2 dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, *************** *** 12,19 **** [gl_cv_func_isnand_no_libm], [ AC_TRY_LINK([#include <math.h> double x;], ! [return isnan (x);], [gl_cv_func_isnand_no_libm=yes], [gl_cv_func_isnand_no_libm=no]) ]) --- 12,26 ---- [gl_cv_func_isnand_no_libm], [ AC_TRY_LINK([#include <math.h> + #if __GNUC__ >= 4 + # undef isnand + # define isnand(x) __builtin_isnan ((double)(x)) + #else + # undef isnand + # define isnand(x) isnan ((double)(x)) + #endif double x;], ! [return isnand (x);], [gl_cv_func_isnand_no_libm=yes], [gl_cv_func_isnand_no_libm=no]) ])