2 dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 dnl Check how to get or define isnand().
8 AC_DEFUN([gl_FUNC_ISNAND],
11 gl_HAVE_ISNAND_NO_LIBM
12 if test $gl_cv_func_isnand_no_libm = no; then
13 gl_HAVE_ISNAND_IN_LIBM
14 if test $gl_cv_func_isnand_in_libm = yes; then
18 dnl The variable gl_func_isnand set here is used by isnan.m4.
19 if test $gl_cv_func_isnand_no_libm = yes \
20 || test $gl_cv_func_isnand_in_libm = yes; then
22 AC_DEFINE([HAVE_ISNAND], 1,
23 [Define if the isnan(double) function is available.])
28 AC_SUBST([ISNAND_LIBM])
31 dnl Check how to get or define isnand() without linking with libm.
33 AC_DEFUN([gl_FUNC_ISNAND_NO_LIBM],
35 gl_HAVE_ISNAND_NO_LIBM
36 if test $gl_cv_func_isnand_no_libm = yes; then
37 AC_DEFINE([HAVE_ISNAND_IN_LIBC], 1,
38 [Define if the isnan(double) function is available in libc.])
44 dnl Pull in replacement isnand definition. It does not need -lm.
45 AC_DEFUN([gl_BUILD_ISNAND],
48 gl_DOUBLE_EXPONENT_LOCATION
51 dnl Test whether isnand() can be used with libm.
53 AC_DEFUN([gl_HAVE_ISNAND_IN_LIBM],
55 AC_CACHE_CHECK([whether isnan(double) can be used with libm],
56 [gl_cv_func_isnand_in_libm],
60 AC_TRY_LINK([#include <math.h>
63 # define isnand(x) __builtin_isnand ((double)(x))
66 # define isnand(x) isnan ((double)(x))
70 [gl_cv_func_isnand_in_libm=yes],
71 [gl_cv_func_isnand_in_libm=no])
76 AC_DEFUN([gl_HAVE_ISNAND_NO_LIBM],
78 AC_CACHE_CHECK([whether isnan(double) can be used without linking with libm],
79 [gl_cv_func_isnand_no_libm],
81 AC_TRY_LINK([#include <math.h>
84 # define isnand(x) __builtin_isnan ((double)(x))
87 # define isnand(x) isnan ((double)(x))
91 [gl_cv_func_isnand_no_libm=yes],
92 [gl_cv_func_isnand_no_libm=no])