2 dnl Copyright (C) 2007, 2009-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.
7 AC_DEFUN([gl_FUNC_CEILF],
9 m4_divert_text([DEFAULTS], [gl_ceilf_required=plain])
10 AC_REQUIRE([gl_MATH_H_DEFAULTS])
11 dnl Persuade glibc <math.h> to declare ceilf().
12 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
13 dnl Test whether ceilf() is declared.
14 AC_CHECK_DECLS([ceilf], , , [#include <math.h>])
15 if test "$ac_cv_have_decl_ceilf" = yes; then
16 dnl Test whether ceilf() can be used without libm.
18 if test "$CEILF_LIBM" = "?"; then
19 dnl Sun C 5.0 on Solaris declares ceilf() and has it in the system-wide
20 dnl libm.so, but not in the libm.so that the compiler uses.
23 m4_ifdef([gl_FUNC_CEILF_IEEE], [
24 if test $gl_ceilf_required = ieee && test $REPLACE_CEILF = 0; then
25 AC_CACHE_CHECK([whether ceilf works according to ISO C 99 with IEC 60559],
26 [gl_cv_func_ceilf_ieee],
29 LIBS="$LIBS $CEILF_LIBM"
32 #ifndef __NO_MATH_INLINES
33 # define __NO_MATH_INLINES 1 /* for glibc */
36 ]gl_FLOAT_MINUS_ZERO_CODE[
37 ]gl_FLOAT_SIGNBIT_CODE[
40 /* Test whether ceilf (-0.0f) is -0.0f. */
41 if (signbitf (minus_zerof) && !signbitf (ceilf (minus_zerof)))
46 [gl_cv_func_ceilf_ieee=yes],
47 [gl_cv_func_ceilf_ieee=no],
48 [gl_cv_func_ceilf_ieee="guessing no"])
51 case "$gl_cv_func_ceilf_ieee" in
60 if test $HAVE_DECL_CEILF = 0 || test $REPLACE_CEILF = 1; then
61 dnl No libraries are needed to link lib/ceilf.c.
64 AC_SUBST([CEILF_LIBM])
67 # Determines the libraries needed to get the ceilf() function.
69 AC_DEFUN([gl_FUNC_CEILF_LIBS],
71 gl_CACHE_VAL_SILENT([gl_cv_func_ceilf_libm], [
72 gl_cv_func_ceilf_libm=?
75 [[#ifndef __NO_MATH_INLINES
76 # define __NO_MATH_INLINES 1 /* for glibc */
81 [gl_cv_func_ceilf_libm=])
82 if test "$gl_cv_func_ceilf_libm" = "?"; then
87 [[#ifndef __NO_MATH_INLINES
88 # define __NO_MATH_INLINES 1 /* for glibc */
93 [gl_cv_func_ceilf_libm="-lm"])
97 CEILF_LIBM="$gl_cv_func_ceilf_libm"