gnulib update
[bpt/guile.git] / m4 / isinf.m4
1 # isinf.m4 serial 4
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.
6
7 AC_DEFUN([gl_ISINF],
8 [
9 AC_REQUIRE([gl_MATH_H_DEFAULTS])
10 dnl Persuade glibc <math.h> to declare isinf.
11 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
12 AC_CHECK_DECLS([isinf], , , [#include <math.h>])
13 if test "$ac_cv_have_decl_isinf" = yes; then
14 gl_CHECK_MATH_LIB([ISINF_LIBM], [x = isinf (x);])
15 if test "$ISINF_LIBM" != missing; then
16 dnl Test whether isinf() on 'long double' works.
17 gl_ISINFL_WORKS
18 case "$gl_cv_func_isinfl_works" in
19 *yes) ;;
20 *) ISINF_LIBM=missing;;
21 esac
22 fi
23 fi
24 if test "$ac_cv_have_decl_isinf" != yes ||
25 test "$ISINF_LIBM" = missing; then
26 REPLACE_ISINF=1
27 dnl No libraries are needed to link lib/isinf.c.
28 ISINF_LIBM=
29 fi
30 AC_SUBST([ISINF_LIBM])
31 ])
32
33 dnl Test whether isinf() correctly returns false for LDBL_MAX.
34 AC_DEFUN([gl_ISINFL_WORKS],
35 [
36 AC_REQUIRE([AC_PROG_CC])
37 AC_REQUIRE([gl_BIGENDIAN])
38 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
39 AC_CACHE_CHECK([whether isinf(long double) works], [gl_cv_func_isinfl_works],
40 [
41 AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <float.h>
42 #include <math.h>]],
43 [[return !!isinf(LDBL_MAX);]])],
44 [gl_cv_func_isinfl_works=yes],
45 [gl_cv_func_isinfl_works=no],
46 [gl_cv_func_isinfl_works="guessing no"])
47 ])
48 ])