Remove redundant AC_SUBST invocations.
[gnulib.git] / m4 / ceill.m4
1 # ceill.m4 serial 5
2 dnl Copyright (C) 2007, 2009-2010 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_CEILL],
8 [
9   AC_REQUIRE([gl_MATH_H_DEFAULTS])
10   dnl Persuade glibc <math.h> to declare ceill().
11   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
12   dnl Test whether ceill() is declared.
13   AC_CHECK_DECLS([ceill], , , [#include <math.h>])
14   if test "$ac_cv_have_decl_ceill" = yes; then
15     dnl Test whether ceill() can be used without libm.
16     gl_FUNC_CEILL_LIBS
17     if test "$CEILL_LIBM" = "?"; then
18       dnl Sun C 5.0 on Solaris declares ceill() and has it in the system-wide
19       dnl libm.so, but not in the libm.so that the compiler uses.
20       REPLACE_CEILL=1
21     fi
22   else
23     REPLACE_CEILL=1
24   fi
25   if test $REPLACE_CEILL = 1; then
26     AC_LIBOBJ([ceill])
27     CEILL_LIBM=
28   fi
29   AC_SUBST([CEILL_LIBM])
30 ])
31
32 # Determines the libraries needed to get the ceill() function.
33 # Sets CEILL_LIBM.
34 AC_DEFUN([gl_FUNC_CEILL_LIBS],
35 [
36   gl_CACHE_VAL_SILENT([gl_cv_func_ceill_libm], [
37     gl_cv_func_ceill_libm=?
38     AC_TRY_LINK([
39        #ifndef __NO_MATH_INLINES
40        # define __NO_MATH_INLINES 1 /* for glibc */
41        #endif
42        #include <math.h>
43        long double x;],
44       [x = ceill(x);],
45       [gl_cv_func_ceill_libm=])
46     if test "$gl_cv_func_ceill_libm" = "?"; then
47       save_LIBS="$LIBS"
48       LIBS="$LIBS -lm"
49       AC_TRY_LINK([
50          #ifndef __NO_MATH_INLINES
51          # define __NO_MATH_INLINES 1 /* for glibc */
52          #endif
53          #include <math.h>
54          long double x;],
55         [x = ceill(x);],
56         [gl_cv_func_ceill_libm="-lm"])
57       LIBS="$save_LIBS"
58     fi
59   ])
60   CEILL_LIBM="$gl_cv_func_ceill_libm"
61 ])