Ben Pfaff wrote: > > I propose to change the round* macros as follows, so as to > > 1. fix the Solaris problem with roundf, roundl, > > 2. use the gl_FUNC_FLOOR*_LIBS, gl_FUNC_CEIL*_LIBS macros introduced > > earlier today. > > And the corresponding changes to the 'math' module, of course. > > Yes, this is fine. Please apply.
OK. First part is to rename HAVE_DECL_ROUND* to !REPLACE_ROUND*. Done here: 2007-11-11 Bruno Haible <[EMAIL PROTECTED]> * m4/roundf.m4 (gl_FUNC_ROUNDF): Set REPLACE_ROUNDF instead of HAVE_DECL_ROUNDF. Remove redundant AC_SUBST. * m4/round.m4 (gl_FUNC_ROUND): Set REPLACE_ROUND instead of HAVE_DECL_ROUND. Remove redundant AC_SUBST. * m4/roundl.m4 (gl_FUNC_ROUNDL): Set REPLACE_ROUNDL instead of HAVE_DECL_ROUNDL. Remove redundant AC_SUBST. * lib/math.in.h (roundf): Use REPLACE_ROUNDF instead of HAVE_DECL_ROUNDF. (round): Use REPLACE_ROUND instead of HAVE_DECL_ROUND. (roundl): Use REPLACE_ROUNDL instead of HAVE_DECL_ROUNDL. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize REPLACE_ROUND* instead of HAVE_DECL_ROUND*. * modules/math (Makefile.am): Update. --- lib/math.in.h.orig 2007-11-11 13:56:20.000000000 +0100 +++ lib/math.in.h 2007-11-11 13:46:29.000000000 +0100 @@ -218,7 +218,7 @@ #if @GNULIB_ROUNDF@ -# if [EMAIL PROTECTED]@ +# if @REPLACE_ROUNDF@ # undef roundf # define roundf rpl_roundf extern float roundf (float x); @@ -232,7 +232,7 @@ #endif #if @GNULIB_ROUND@ -# if [EMAIL PROTECTED]@ +# if @REPLACE_ROUND@ # undef round # define round rpl_round extern double round (double x); @@ -246,7 +246,7 @@ #endif #if @GNULIB_ROUNDL@ -# if [EMAIL PROTECTED]@ +# if @REPLACE_ROUNDL@ # undef roundl # define roundl rpl_roundl extern long double roundl (long double x); --- m4/math_h.m4.orig 2007-11-11 13:56:20.000000000 +0100 +++ m4/math_h.m4 2007-11-11 13:52:46.000000000 +0100 @@ -1,4 +1,4 @@ -# math_h.m4 serial 7 +# math_h.m4 serial 8 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, @@ -44,9 +44,6 @@ HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL]) HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL]) HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) - HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND]) - HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF]) - HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL]) HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL]) HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL]) HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL]) @@ -61,5 +58,8 @@ REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL]) REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE]) REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL]) + REPLACE_ROUND=0; AC_SUBST([REPLACE_ROUND]) + REPLACE_ROUNDF=0; AC_SUBST([REPLACE_ROUNDF]) + REPLACE_ROUNDL=0; AC_SUBST([REPLACE_ROUNDL]) REPLACE_SIGNBIT=0; AC_SUBST([REPLACE_SIGNBIT]) ]) --- m4/round.m4.orig 2007-11-11 13:56:20.000000000 +0100 +++ m4/round.m4 2007-11-11 13:54:16.000000000 +0100 @@ -1,4 +1,4 @@ -# round.m4 serial 3 +# round.m4 serial 4 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, @@ -14,9 +14,8 @@ gl_CHECK_MATH_LIB([ROUND_LIBM], [x = round (x);]) 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 + REPLACE_ROUND=1 AC_LIBOBJ([round]) + gl_CHECK_MATH_LIB([ROUND_LIBM], [x = floor (x) + ceil (x);]) fi - AC_SUBST([HAVE_DECL_ROUND]) AC_SUBST([ROUND_LIBM])]) --- m4/roundf.m4.orig 2007-11-11 13:56:20.000000000 +0100 +++ m4/roundf.m4 2007-11-11 13:54:53.000000000 +0100 @@ -1,4 +1,4 @@ -# roundf.m4 serial 3 +# roundf.m4 serial 4 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, @@ -14,16 +14,15 @@ gl_CHECK_MATH_LIB([ROUNDF_LIBM], [x = roundf (x);]) fi if test "$ac_cv_have_decl_roundf" != yes || test "$ROUNDF_LIBM" = missing; then + REPLACE_ROUNDF=1 + AC_LIBOBJ([roundf]) AC_CHECK_DECLS([ceilf, floorf], , , [#include <math.h>]) - if test "$ac_cv_have_decl_floorf" = yes && - test "$ac_cv_have_decl_ceilf" = yes; then + 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]) ]) --- m4/roundl.m4.orig 2007-11-11 13:56:20.000000000 +0100 +++ m4/roundl.m4 2007-11-11 13:54:59.000000000 +0100 @@ -1,4 +1,4 @@ -# roundl.m4 serial 3 +# roundl.m4 serial 4 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, @@ -14,16 +14,15 @@ gl_CHECK_MATH_LIB([ROUNDL_LIBM], [x = roundl (x);]) fi if test "$ac_cv_have_decl_roundl" != yes || test "$ROUNDL_LIBM" = missing; then + REPLACE_ROUNDL=1 + AC_LIBOBJ([roundl]) AC_CHECK_DECLS([ceill, floorl], , , [#include <math.h>]) - if test "$ac_cv_have_decl_floorl" = yes && - test "$ac_cv_have_decl_ceill" = yes; then + if test "$ac_cv_have_decl_floorl" = yes \ + && test "$ac_cv_have_decl_ceill" = yes; then gl_CHECK_MATH_LIB([ROUNDL_LIBM], [x = floorl (x) + ceill (x);]) else ROUNDL_LIBM= fi - HAVE_DECL_ROUNDL=0 - AC_LIBOBJ([roundl]) fi - AC_SUBST([HAVE_DECL_ROUNDL]) AC_SUBST([ROUNDL_LIBM]) ]) --- modules/math.orig 2007-11-11 13:56:20.000000000 +0100 +++ modules/math 2007-11-11 13:48:00.000000000 +0100 @@ -46,9 +46,6 @@ -e 's|@''HAVE_DECL_FREXPL''@|$(HAVE_DECL_FREXPL)|g' \ -e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \ -e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \ - -e 's|@''HAVE_DECL_ROUND''@|$(HAVE_DECL_ROUND)|g' \ - -e 's|@''HAVE_DECL_ROUNDF''@|$(HAVE_DECL_ROUNDF)|g' \ - -e 's|@''HAVE_DECL_ROUNDL''@|$(HAVE_DECL_ROUNDL)|g' \ -e 's|@''HAVE_DECL_SINL''@|$(HAVE_DECL_SINL)|g' \ -e 's|@''HAVE_DECL_SQRTL''@|$(HAVE_DECL_SQRTL)|g' \ -e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \ @@ -63,6 +60,9 @@ -e 's|@''REPLACE_FREXPL''@|$(REPLACE_FREXPL)|g' \ -e 's|@''REPLACE_ISFINITE''@|$(REPLACE_ISFINITE)|g' \ -e 's|@''REPLACE_LDEXPL''@|$(REPLACE_LDEXPL)|g' \ + -e 's|@''REPLACE_ROUND''@|$(REPLACE_ROUND)|g' \ + -e 's|@''REPLACE_ROUNDF''@|$(REPLACE_ROUNDF)|g' \ + -e 's|@''REPLACE_ROUNDL''@|$(REPLACE_ROUNDL)|g' \ -e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ < $(srcdir)/math.in.h; \