+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
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. */
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
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
[
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