2 dnl Copyright (C) 2007-2018 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
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 gl_func_isnand_no_libm=$gl_cv_func_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.])
43 dnl Prerequisites of replacement isnand definition. It does not need -lm.
44 AC_DEFUN([gl_PREREQ_ISNAND],
46 AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION])
49 dnl Test whether isnand() can be used with libm.
51 AC_DEFUN([gl_HAVE_ISNAND_IN_LIBM],
53 AC_CACHE_CHECK([whether isnan(double) can be used with libm],
54 [gl_cv_func_isnand_in_libm],
63 # define isnand(x) __builtin_isnan ((double)(x))
66 # define isnand(x) isnan ((double)(x))
69 [[return isnand (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],
86 # define isnand(x) __builtin_isnan ((double)(x))
89 # define isnand(x) isnan ((double)(x))
92 [[return isnand (x);]])],
93 [gl_cv_func_isnand_no_libm=yes],
94 [gl_cv_func_isnand_no_libm=no])