From e660a47d371278b8d4ba7f227c5df451984cfe5b Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 8 Mar 2012 02:27:05 +0100 Subject: [PATCH] rintf: Don't override undeclared system function on IRIX 6.5. * lib/math.in.h (rintf): Test HAVE_DECL_RINTF, not HAVE_RINTF. * m4/rintf.m4 (gl_FUNC_RINTF): Don't assume rintf() is declared when it exists. Set HAVE_DECL_RINTF. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize HAVE_DECL_RINTF, not HAVE_RINTF. * modules/math (Makefile.am): Substitute HAVE_DECL_RINTF, not HAVE_RINTF. * doc/posix-functions/rintf.texi: Mention missing declaration problem. --- ChangeLog | 12 ++++++++++++ doc/posix-functions/rintf.texi | 5 ++++- lib/math.in.h | 2 +- m4/math_h.m4 | 4 ++-- m4/rintf.m4 | 20 ++++++++++++++++---- modules/math | 2 +- 6 files changed, 36 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index de925c96f..4bf60b6d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2012-03-07 Bruno Haible + rintf: Don't override undeclared system function on IRIX 6.5. + * lib/math.in.h (rintf): Test HAVE_DECL_RINTF, not HAVE_RINTF. + * m4/rintf.m4 (gl_FUNC_RINTF): Don't assume rintf() is declared when it + exists. Set HAVE_DECL_RINTF. + * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize HAVE_DECL_RINTF, not + HAVE_RINTF. + * modules/math (Makefile.am): Substitute HAVE_DECL_RINTF, not + HAVE_RINTF. + * doc/posix-functions/rintf.texi: Mention missing declaration problem. + +2012-03-07 Bruno Haible + roundl: Avoid compilation error on AIX. * lib/math.in.h (roundl): Undefine macro before declaration. Needed on AIX 5.2..7.1. diff --git a/doc/posix-functions/rintf.texi b/doc/posix-functions/rintf.texi index a67497af2..21472b4f6 100644 --- a/doc/posix-functions/rintf.texi +++ b/doc/posix-functions/rintf.texi @@ -10,7 +10,10 @@ Portability problems fixed by Gnulib: @itemize @item This function is missing on some platforms: -Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, MSVC 9. +Minix 3.1.8, AIX 5.1, HP-UX 11, older IRIX 6.5, Solaris 9, MSVC 9. +@item +This function is not declared on some platforms: +IRIX 6.5. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/math.in.h b/lib/math.in.h index d81f226a5..ed1e833b1 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -1277,7 +1277,7 @@ _GL_WARN_ON_USE (remainderl, "remainderl is unportable - " #if @GNULIB_RINTF@ -# if !@HAVE_RINTF@ +# if !@HAVE_DECL_RINTF@ _GL_FUNCDECL_SYS (rintf, float, (float x)); # endif _GL_CXXALIAS_SYS (rintf, float, (float x)); diff --git a/m4/math_h.m4 b/m4/math_h.m4 index 17b0343d2..a7e6893b3 100644 --- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -1,4 +1,4 @@ -# math_h.m4 serial 85 +# math_h.m4 serial 86 dnl Copyright (C) 2007-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -185,7 +185,6 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], HAVE_REMAINDERF=1; AC_SUBST([HAVE_REMAINDERF]) HAVE_REMAINDERL=1; AC_SUBST([HAVE_REMAINDERL]) HAVE_RINT=1; AC_SUBST([HAVE_RINT]) - HAVE_RINTF=1; AC_SUBST([HAVE_RINTF]) HAVE_RINTL=1; AC_SUBST([HAVE_RINTL]) HAVE_SINF=1; AC_SUBST([HAVE_SINF]) HAVE_SINL=1; AC_SUBST([HAVE_SINL]) @@ -213,6 +212,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) HAVE_DECL_LOG10L=1; AC_SUBST([HAVE_DECL_LOG10L]) HAVE_DECL_REMAINDER=1; AC_SUBST([HAVE_DECL_REMAINDER]) + HAVE_DECL_RINTF=1; AC_SUBST([HAVE_DECL_RINTF]) 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]) diff --git a/m4/rintf.m4 b/m4/rintf.m4 index 9e92a9757..ddd1a8270 100644 --- a/m4/rintf.m4 +++ b/m4/rintf.m4 @@ -1,4 +1,4 @@ -# rintf.m4 serial 3 +# rintf.m4 serial 4 dnl Copyright (C) 2011-2012 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,10 +12,22 @@ AC_DEFUN([gl_FUNC_RINTF], AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) dnl Determine RINTF_LIBM. - gl_MATHFUNC([rintf], [float], [(float)]) - if test $gl_cv_func_rintf_no_libm = no \ - && test $gl_cv_func_rintf_in_libm = no; then + gl_MATHFUNC([rintf], [float], [(float)], + [extern + #ifdef __cplusplus + "C" + #endif + float rintf (float); + ]) + if test $gl_cv_func_rintf_no_libm = yes \ + || test $gl_cv_func_rintf_in_libm = yes; then + HAVE_RINTF=1 + dnl Also check whether it's declared. + dnl IRIX 6.5 has rintf() in libm but doesn't declare it in . + AC_CHECK_DECLS([rintf], , [HAVE_DECL_RINTF=0], [[#include ]]) + else HAVE_RINTF=0 + HAVE_DECL_RINTF=0 RINTF_LIBM= fi AC_SUBST([RINTF_LIBM]) diff --git a/modules/math b/modules/math index 55b6a16e9..c4466a485 100644 --- a/modules/math +++ b/modules/math @@ -153,7 +153,6 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''HAVE_REMAINDERF''@|$(HAVE_REMAINDERF)|g' \ -e 's|@''HAVE_REMAINDERL''@|$(HAVE_REMAINDERL)|g' \ -e 's|@''HAVE_RINT''@|$(HAVE_RINT)|g' \ - -e 's|@''HAVE_RINTF''@|$(HAVE_RINTF)|g' \ -e 's|@''HAVE_RINTL''@|$(HAVE_RINTL)|g' \ -e 's|@''HAVE_SINF''@|$(HAVE_SINF)|g' \ -e 's|@''HAVE_SINL''@|$(HAVE_SINL)|g' \ @@ -181,6 +180,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \ -e 's|@''HAVE_DECL_LOG10L''@|$(HAVE_DECL_LOG10L)|g' \ -e 's|@''HAVE_DECL_REMAINDER''@|$(HAVE_DECL_REMAINDER)|g' \ + -e 's|@''HAVE_DECL_RINTF''@|$(HAVE_DECL_RINTF)|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' \ -- 2.11.0