2 dnl Copyright (C) 2007, 2009-2017 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 AC_DEFUN([gl_FUNC_FLOORL],
9 AC_REQUIRE([gl_MATH_H_DEFAULTS])
10 AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
12 dnl Persuade glibc <math.h> to declare floorl().
13 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
15 dnl Test whether floorl() is declared.
16 AC_CHECK_DECLS([floorl], , , [[#include <math.h>]])
17 if test "$ac_cv_have_decl_floorl" = yes; then
18 dnl Test whether floorl() can be used without libm.
20 if test "$FLOORL_LIBM" = "?"; then
21 dnl Sun C 5.0 on Solaris declares floorl() and has it in the system-wide
22 dnl libm.so, but not in the libm.so that the compiler uses.
28 if test $HAVE_DECL_FLOORL = 0 || test $REPLACE_FLOORL = 1; then
29 dnl Find libraries needed to link lib/floorl.c.
30 if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
31 AC_REQUIRE([gl_FUNC_FLOOR])
32 FLOORL_LIBM="$FLOOR_LIBM"
37 AC_SUBST([FLOORL_LIBM])
40 # Determines the libraries needed to get the floorl() function.
42 AC_DEFUN([gl_FUNC_FLOORL_LIBS],
44 gl_CACHE_VAL_SILENT([gl_cv_func_floorl_libm], [
45 gl_cv_func_floorl_libm=?
48 [[#ifndef __NO_MATH_INLINES
49 # define __NO_MATH_INLINES 1 /* for glibc */
52 long double (*funcptr) (long double) = floorl;
54 [[x = funcptr (x) + floorl(x);]])],
55 [gl_cv_func_floorl_libm=])
56 if test "$gl_cv_func_floorl_libm" = "?"; then
61 [[#ifndef __NO_MATH_INLINES
62 # define __NO_MATH_INLINES 1 /* for glibc */
65 long double (*funcptr) (long double) = floorl;
67 [[x = funcptr (x) + floorl(x);]])],
68 [gl_cv_func_floorl_libm="-lm"])
72 FLOORL_LIBM="$gl_cv_func_floorl_libm"