From 7094a1e0d56aa303077cc0bccaa559a28e613ade Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 21 Oct 2007 17:28:32 -0700 Subject: Fix bugs in round modules reported by Bruno Haible. --- m4/roundf.m4 | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'm4/roundf.m4') diff --git a/m4/roundf.m4 b/m4/roundf.m4 index 57778a8660..d1f4183760 100644 --- a/m4/roundf.m4 +++ b/m4/roundf.m4 @@ -1,4 +1,4 @@ -# roundf.m4 serial 1 +# roundf.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, @@ -9,14 +9,20 @@ AC_DEFUN([gl_FUNC_ROUNDF], AC_REQUIRE([gl_MATH_H_DEFAULTS]) dnl Persuade glibc to declare roundf(). AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - dnl Test whether roundf() is declared. - gl_CHECK_LIBM_FUNC([roundf], [x = roundf(x);], [], [ - dnl No. Are both floorf() and ceilf() available? If so then we can use - dnl them to implement roundf(), on the assumption that they're fast. - gl_CHECK_LIBM_FUNC([floorf], [x = floorf(x);], [ - AC_CHECK_DECL([ceilf], - [dnl Yes. Both are declared. Link against the necessary library. - ROUNDF_LIBM="$FLOORF_LIBM"], - [: dnl No. We will use an implementation that doesn't need them. -], [#include -])])])]) + AC_CHECK_DECLS([roundf], , , [#include ]) + if test "$ac_cv_have_decl_roundf" = yes; then + gl_CHECK_MATH_LIB([ROUNDF_LIBM], [x = roundf (x);]) + else + AC_CHECK_DECLS([ceilf, floorf], , , [#include ]) + if test "$ac_cv_have_decl_floorf" = yes && + test "$ac_cv_have_decl_ceilf" = yes; then + gl_CHECK_MATH_LIB([ROUNDF_LIBM], [x = floorf (x) + ceilf (x);]) + else + ROUNDF_LIBM= + fi + HAVE_DECL_ROUNDF=0 + AC_LIBOBJ([roundf]) + fi + AC_SUBST([HAVE_DECL_ROUNDF]) + AC_SUBST([ROUNDF_LIBM]) +]) -- cgit v1.2.1