Implement 'isfinite' module.
[gnulib.git] / m4 / floorl.m4
1 # floorl.m4 serial 1
2 dnl Copyright (C) 2007 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_FUNC_FLOORL],
8 [
9   AC_REQUIRE([gl_MATH_H_DEFAULTS])
10   dnl Persuade glibc <math.h> to declare floorl().
11   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
12   dnl Test whether floorl() is declared.
13   AC_CHECK_DECLS([floorl], , , [#include <math.h>])
14   if test "$ac_cv_have_decl_floorl" = yes; then
15     dnl Test whether floorl() can be used without libm.
16     FLOORL_LIBM=?
17     AC_TRY_LINK([
18        #ifndef __NO_MATH_INLINES
19        # define __NO_MATH_INLINES 1 /* for glibc */
20        #endif
21        #include <math.h>
22        long double x;],
23       [x = floorl(x);],
24       [FLOORL_LIBM=])
25     if test "$FLOORL_LIBM" = "?"; then
26       save_LIBS="$LIBS"
27       LIBS="$LIBS -lm"
28       AC_TRY_LINK([
29          #ifndef __NO_MATH_INLINES
30          # define __NO_MATH_INLINES 1 /* for glibc */
31          #endif
32          #include <math.h>
33          long double x;],
34         [x = floorl(x);],
35         [FLOORL_LIBM="-lm"])
36       LIBS="$save_LIBS"
37     fi
38     if test "$FLOORL_LIBM" = "?"; then
39       FLOORL_LIBM=
40     fi
41   else
42     HAVE_DECL_FLOORL=0
43     AC_LIBOBJ([floorl])
44     FLOORL_LIBM=
45   fi
46   AC_SUBST([HAVE_DECL_FLOORL])
47   AC_SUBST([FLOORL_LIBM])
48 ])