Mercurial > hg > octave-lyh > gnulib-hg
changeset 9413:9572edc3cc57
Check whether round* exist in libraries, not just whether they are declared.
author | Ben Pfaff <blp@cs.stanford.edu> |
---|---|
date | Sat, 27 Oct 2007 21:05:58 -0700 |
parents | f5d73cf73b89 |
children | 1c5d0b856e8b |
files | ChangeLog lib/math.in.h m4/check-math-lib.m4 m4/round.m4 m4/roundf.m4 m4/roundl.m4 |
diffstat | 6 files changed, 35 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2007-10-27 Ben Pfaff <blp@gnu.org> + + Ralf Wildenhues reported that Tru64 4.0D declares the round + functions but does not have definitions. + * m4/check-math-lib.m4 (gl_CHECK_MATH_LIB): If the target function + cannot be found in any library, set the output variable to + "missing" instead of "". + * m4/round.m4: Also use our substitute if we cannot find round in + any library, even if it is declared. + * m4/roundf.m4: Likewise for roundf. + * m4/roundl.m4: Likewise for roundl. + * lib/math.in.h: Undefine roundf, round, roundl before defining + their replacements, to allow for hypothetical systems where these + may be defined as macros but not available in libraries. + 2007-10-27 Bruno Haible <bruno@clisp.org> * doc/gnulib.texi: Invoke @firstparagraphindent.
--- a/lib/math.in.h +++ b/lib/math.in.h @@ -219,6 +219,7 @@ #if @GNULIB_ROUNDF@ # if !@HAVE_DECL_ROUNDF@ +# undef roundf # define roundf rpl_roundf extern float roundf (float x); # endif @@ -233,6 +234,7 @@ #if @GNULIB_ROUND@ # if !@HAVE_DECL_ROUND@ +# undef round # define round rpl_round extern double round (double x); # endif @@ -247,6 +249,7 @@ #if @GNULIB_ROUNDL@ # if !@HAVE_DECL_ROUNDL@ +# undef roundl # define roundl rpl_roundl extern long double roundl (long double x); # endif
--- a/m4/check-math-lib.m4 +++ b/m4/check-math-lib.m4 @@ -1,18 +1,20 @@ -# check-math-lib.m4 serial 1 +# check-math-lib.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, dnl with or without modifications, as long as this notice is preserved. dnl -dnl AC_CHECK_MATH_LIB (VARIABLE, EXPRESSION) +dnl gl_CHECK_MATH_LIB (VARIABLE, EXPRESSION) dnl -dnl Checks whether EXPRESSION requires -lm to compile and link. If so, sets -dnl the shell VARIABLE to -lm, otherwise to the empty string. +dnl Sets the shell VARIABLE according to the libraries needed by EXPRESSION +dnl to compile and link: to the empty string if no extra libraries are needed, +dnl to "-lm" if -lm is needed, or to "missing" if it does not compile and +dnl link either way. dnl -dnl Example: AC_CHECK_MATH_LIB([ROUNDF_LIBM], [x = roundf (x);]) +dnl Example: gl_CHECK_MATH_LIB([ROUNDF_LIBM], [x = roundf (x);]) AC_DEFUN([gl_CHECK_MATH_LIB], [ save_LIBS=$LIBS - $1=? + $1=missing for libm in "" "-lm"; do LIBS="$save_LIBS $libm" AC_TRY_LINK([ @@ -26,7 +28,4 @@ break]) done LIBS=$save_LIBS - if test "$$1" = "?"; then - $1= - fi ])
--- a/m4/round.m4 +++ b/m4/round.m4 @@ -1,4 +1,4 @@ -# round.m4 serial 2 +# round.m4 serial 3 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, @@ -12,7 +12,8 @@ AC_CHECK_DECLS([round], , , [#include <math.h>]) if test "$ac_cv_have_decl_round" = yes; then gl_CHECK_MATH_LIB([ROUND_LIBM], [x = round (x);]) - else + fi + if test "$ac_cv_have_decl_round" != yes || test "$ROUND_LIBM" = missing; then gl_CHECK_MATH_LIB([ROUND_LIBM], [x = floor (x) + ceil (x);]) HAVE_DECL_ROUND=0 AC_LIBOBJ([round])
--- a/m4/roundf.m4 +++ b/m4/roundf.m4 @@ -1,4 +1,4 @@ -# roundf.m4 serial 2 +# roundf.m4 serial 3 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, @@ -12,7 +12,8 @@ AC_CHECK_DECLS([roundf], , , [#include <math.h>]) if test "$ac_cv_have_decl_roundf" = yes; then gl_CHECK_MATH_LIB([ROUNDF_LIBM], [x = roundf (x);]) - else + fi + if test "$ac_cv_have_decl_roundf" != yes || test "$ROUNDF_LIBM" = missing; then AC_CHECK_DECLS([ceilf, floorf], , , [#include <math.h>]) if test "$ac_cv_have_decl_floorf" = yes && test "$ac_cv_have_decl_ceilf" = yes; then
--- a/m4/roundl.m4 +++ b/m4/roundl.m4 @@ -1,4 +1,4 @@ -# roundl.m4 serial 2 +# roundl.m4 serial 3 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, @@ -12,7 +12,8 @@ AC_CHECK_DECLS([roundl], , , [#include <math.h>]) if test "$ac_cv_have_decl_roundl" = yes; then gl_CHECK_MATH_LIB([ROUNDL_LIBM], [x = roundl (x);]) - else + fi + if test "$ac_cv_have_decl_roundl" != yes || test "$ROUNDL_LIBM" = missing; then AC_CHECK_DECLS([ceill, floorl], , , [#include <math.h>]) if test "$ac_cv_have_decl_floorl" = yes && test "$ac_cv_have_decl_ceill" = yes; then