Eric Blake wrote: > No, on cygwin, isnan is a macro in <math.h> that wraps the internal > functions __isnan{,lf}, and the isnan entry point in cygwin1.dll exists > only for backwards compatibility for multi-year-old apps that were > compiled against cygwin prior to the POSIX compliance bug being fixed of > providing isnan only as a macro.
My copy of cygwin <math.h> (dated 2006-01-20) still has extern int isnan _PARAMS((double)); You simply have a newer copy of cygwin than me. > And you still didn't catch my point that > on cygwin, you don't need -lm to get isnan() to work Since there are also AIX, OSF/1, HP-UX, the situation on cygwin has no effect on m4/isnan.m4. > Checking AC_CHECK_FUNC([isnan]) is > wrong since POSIX does not guarantee that isnan is a function; instead, > you must check whether including <math.h> and using isnan() will link > correctly in the absence of -lm. Oh, I see now what you mean. Thanks for insisting. I had based my understanding of these functions on a manual page that lists isnanf(), isnan() as a function, and isnanl(). Doing as you say. Bruno 2007-02-24 Bruno Haible <[EMAIL PROTECTED]> * 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 <[EMAIL PROTECTED]>. *** lib/isnan.h 24 Feb 2007 19:08:56 -0000 1.1 --- lib/isnan.h 25 Feb 2007 04:38:13 -0000 *************** *** 16,22 **** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_ISNAN_IN_LIBC ! /* Get declaration of isnan. */ # include <math.h> #else /* Test whether X is a NaN. */ --- 16,22 ---- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_ISNAN_IN_LIBC ! /* Get declaration of isnan macro. */ # include <math.h> #else /* Test whether X is a NaN. */ *** lib/isnanl.h 24 Feb 2007 19:15:21 -0000 1.1 --- lib/isnanl.h 25 Feb 2007 04:38:13 -0000 *************** *** 16,23 **** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_ISNANL_IN_LIBC ! /* Get declaration of isnanl. */ # include <math.h> #else /* Test whether X is a NaN. */ # undef isnanl --- 16,27 ---- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_ISNANL_IN_LIBC ! /* 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 *** m4/isnan.m4 25 Feb 2007 01:57:58 -0000 1.2 --- m4/isnan.m4 25 Feb 2007 04:38:13 -0000 *************** *** 8,19 **** 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]) 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.]) else AC_LIBOBJ([isnan]) gl_DOUBLE_EXPONENT_LOCATION --- 8,25 ---- AC_DEFUN([gl_FUNC_ISNAN_NO_LIBM], [ ! 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(double) function is available in libc.]) else AC_LIBOBJ([isnan]) gl_DOUBLE_EXPONENT_LOCATION *** m4/isnanl.m4 24 Feb 2007 19:15:21 -0000 1.1 --- m4/isnanl.m4 25 Feb 2007 04:38:13 -0000 *************** *** 8,19 **** [ 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]) 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.]) else AC_LIBOBJ([isnanl]) gl_LONG_DOUBLE_EXPONENT_LOCATION --- 8,29 ---- [ AC_REQUIRE([gt_TYPE_LONGDOUBLE]) if test $gt_cv_c_long_double = yes; then ! 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 isnan(long double) function is available in libc.]) else AC_LIBOBJ([isnanl]) gl_LONG_DOUBLE_EXPONENT_LOCATION