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_CEIL],
9 m4_divert_text([DEFAULTS], [gl_ceil_required=plain])
10 AC_REQUIRE([gl_MATH_H_DEFAULTS])
11 dnl Test whether ceil() can be used without libm.
13 if test "$CEIL_LIBM" = "?"; then
16 m4_ifdef([gl_FUNC_CEIL_IEEE], [
17 if test $gl_ceil_required = ieee && test $REPLACE_CEIL = 0; then
18 AC_CACHE_CHECK([whether ceil works according to ISO C 99 with IEC 60559],
19 [gl_cv_func_ceil_ieee],
22 LIBS="$LIBS $CEIL_LIBM"
25 #ifndef __NO_MATH_INLINES
26 # define __NO_MATH_INLINES 1 /* for glibc */
29 ]gl_DOUBLE_MINUS_ZERO_CODE[
30 ]gl_DOUBLE_SIGNBIT_CODE[
33 /* Test whether ceil (-0.0) is -0.0. */
34 if (signbitd (minus_zerod) && !signbitd (ceil (minus_zerod)))
39 [gl_cv_func_ceil_ieee=yes],
40 [gl_cv_func_ceil_ieee=no],
41 [gl_cv_func_ceil_ieee="guessing no"])
44 case "$gl_cv_func_ceil_ieee" in
50 if test $REPLACE_CEIL = 1; then
51 dnl No libraries are needed to link lib/ceil.c.
57 # Determines the libraries needed to get the ceil() function.
59 AC_DEFUN([gl_FUNC_CEIL_LIBS],
61 gl_CACHE_VAL_SILENT([gl_cv_func_ceil_libm], [
62 gl_cv_func_ceil_libm=?
65 [[#ifndef __NO_MATH_INLINES
66 # define __NO_MATH_INLINES 1 /* for glibc */
71 [gl_cv_func_ceil_libm=])
72 if test "$gl_cv_func_ceil_libm" = "?"; then
77 [[#ifndef __NO_MATH_INLINES
78 # define __NO_MATH_INLINES 1 /* for glibc */
83 [gl_cv_func_ceil_libm="-lm"])
87 CEIL_LIBM="$gl_cv_func_ceil_libm"