2 dnl Copyright (C) 2007-2011 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().
9 AC_DEFUN([gl_FUNC_ISNAND],
11 AC_REQUIRE([gl_MATH_H_DEFAULTS])
13 gl_HAVE_ISNAND_NO_LIBM
14 if test $gl_cv_func_isnand_no_libm = no; then
15 gl_HAVE_ISNAND_IN_LIBM
16 if test $gl_cv_func_isnand_in_libm = yes; then
20 dnl The variable gl_func_isnand set here is used by isnan.m4.
21 if test $gl_cv_func_isnand_no_libm = yes \
22 || test $gl_cv_func_isnand_in_libm = yes; then
29 AC_SUBST([ISNAND_LIBM])
32 dnl Check how to get or define isnand() without linking with libm.
34 AC_DEFUN([gl_FUNC_ISNAND_NO_LIBM],
36 gl_HAVE_ISNAND_NO_LIBM
37 if test $gl_cv_func_isnand_no_libm = yes; then
38 AC_DEFINE([HAVE_ISNAND_IN_LIBC], [1],
39 [Define if the isnan(double) function is available in libc.])
45 dnl Pull in replacement isnand definition. It does not need -lm.
46 AC_DEFUN([gl_BUILD_ISNAND],
49 gl_DOUBLE_EXPONENT_LOCATION
52 dnl Test whether isnand() can be used with libm.
54 AC_DEFUN([gl_HAVE_ISNAND_IN_LIBM],
56 AC_CACHE_CHECK([whether isnan(double) can be used with libm],
57 [gl_cv_func_isnand_in_libm],
66 # define isnand(x) __builtin_isnan ((double)(x))
69 # define isnand(x) isnan ((double)(x))
72 [[return isnand (x);]])],
73 [gl_cv_func_isnand_in_libm=yes],
74 [gl_cv_func_isnand_in_libm=no])
79 AC_DEFUN([gl_HAVE_ISNAND_NO_LIBM],
81 AC_CACHE_CHECK([whether isnan(double) can be used without linking with libm],
82 [gl_cv_func_isnand_no_libm],
89 # define isnand(x) __builtin_isnan ((double)(x))
92 # define isnand(x) isnan ((double)(x))
95 [[return isnand (x);]])],
96 [gl_cv_func_isnand_no_libm=yes],
97 [gl_cv_func_isnand_no_libm=no])