1# isnan.m4 serial 5
2dnl Copyright (C) 2007-2012 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_ISNAN],
8[
9  AC_REQUIRE([gl_MATH_H_DEFAULTS])
10  AC_REQUIRE([gl_FUNC_ISNANF])
11  AC_REQUIRE([gl_FUNC_ISNAND])
12  AC_REQUIRE([gl_FUNC_ISNANL])
13
14  # If we replaced any of the underlying isnan* functions, replace
15  # the isnan macro; it undoubtedly suffers from the same flaws.
16  AC_MSG_CHECKING([whether isnan macro works])
17  if test $gl_func_isnanf = yes \
18     && test $gl_func_isnand = yes \
19     && test $gl_func_isnanl = yes; then
20    AC_MSG_RESULT([yes])
21    ISNAN_LIBM=
22    dnl Append $ISNANF_LIBM to ISNAN_LIBM, avoiding gratuitous duplicates.
23    case " $ISNAN_LIBM " in
24      *" $ISNANF_LIBM "*) ;;
25      *) ISNAN_LIBM="$ISNAN_LIBM $ISNANF_LIBM" ;;
26    esac
27    dnl Append $ISNAND_LIBM to ISNAN_LIBM, avoiding gratuitous duplicates.
28    case " $ISNAN_LIBM " in
29      *" $ISNAND_LIBM "*) ;;
30      *) ISNAN_LIBM="$ISNAN_LIBM $ISNAND_LIBM" ;;
31    esac
32    dnl Append $ISNANL_LIBM to ISNAN_LIBM, avoiding gratuitous duplicates.
33    case " $ISNAN_LIBM " in
34      *" $ISNANL_LIBM "*) ;;
35      *) ISNAN_LIBM="$ISNAN_LIBM $ISNANL_LIBM" ;;
36    esac
37  else
38    AC_MSG_RESULT([no])
39    dnl REPLACE_ISNAN=1 also makes sure the rpl_isnan[fdl] functions get built.
40    REPLACE_ISNAN=1
41    ISNAN_LIBM=
42  fi
43  AC_SUBST([ISNAN_LIBM])
44])
45