diff options
author | Bruno Haible <bruno@clisp.org> | 2007-10-29 02:08:41 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2007-10-29 02:08:41 +0100 |
commit | 1fd8064a06ed3ca83f73c495e998e66c225e395b (patch) | |
tree | 5b51d92a72c374d79cd75fa7d8a38f77d487d2e8 /m4/ceilf.m4 | |
parent | 7b104303bd1c2fd1536f918d69379308f80fdab8 (diff) | |
download | gnulib-1fd8064a06ed3ca83f73c495e998e66c225e395b.tar.gz |
Put the test whether the floor or ceil variant needs libm into a separate macro.
Diffstat (limited to 'm4/ceilf.m4')
-rw-r--r-- | m4/ceilf.m4 | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/m4/ceilf.m4 b/m4/ceilf.m4 index 65f10bedef..b409829945 100644 --- a/m4/ceilf.m4 +++ b/m4/ceilf.m4 @@ -1,4 +1,4 @@ -# ceilf.m4 serial 1 +# ceilf.m4 serial 2 dnl Copyright (C) 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -13,7 +13,25 @@ AC_DEFUN([gl_FUNC_CEILF], AC_CHECK_DECLS([ceilf], , , [#include <math.h>]) if test "$ac_cv_have_decl_ceilf" = yes; then dnl Test whether ceilf() can be used without libm. - CEILF_LIBM=? + gl_FUNC_CEILF_LIBS + if test "$CEILF_LIBM" = "?"; then + CEILF_LIBM= + fi + else + HAVE_DECL_CEILF=0 + AC_LIBOBJ([ceilf]) + CEILF_LIBM= + fi + AC_SUBST([HAVE_DECL_CEILF]) + AC_SUBST([CEILF_LIBM]) +]) + +# Determines the libraries needed to get the ceilf() function. +# Sets CEILF_LIBM. +AC_DEFUN([gl_FUNC_CEILF_LIBS], +[ + AC_CACHE_VAL([gl_func_ceilf_libm], [ + gl_func_ceilf_libm=? AC_TRY_LINK([ #ifndef __NO_MATH_INLINES # define __NO_MATH_INLINES 1 /* for glibc */ @@ -21,8 +39,8 @@ AC_DEFUN([gl_FUNC_CEILF], #include <math.h> float x;], [x = ceilf(x);], - [CEILF_LIBM=]) - if test "$CEILF_LIBM" = "?"; then + [gl_func_ceilf_libm=]) + if test "$gl_func_ceilf_libm" = "?"; then save_LIBS="$LIBS" LIBS="$LIBS -lm" AC_TRY_LINK([ @@ -32,17 +50,9 @@ AC_DEFUN([gl_FUNC_CEILF], #include <math.h> float x;], [x = ceilf(x);], - [CEILF_LIBM="-lm"]) + [gl_func_ceilf_libm="-lm"]) LIBS="$save_LIBS" fi - if test "$CEILF_LIBM" = "?"; then - CEILF_LIBM= - fi - else - HAVE_DECL_CEILF=0 - AC_LIBOBJ([ceilf]) - CEILF_LIBM= - fi - AC_SUBST([HAVE_DECL_CEILF]) - AC_SUBST([CEILF_LIBM]) + ]) + CEILF_LIBM="$gl_func_ceilf_libm" ]) |