rintf: Don't override undeclared system function on IRIX 6.5.
authorBruno Haible <bruno@clisp.org>
Thu, 8 Mar 2012 01:27:05 +0000 (02:27 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 8 Mar 2012 02:18:03 +0000 (03:18 +0100)
* 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
doc/posix-functions/rintf.texi
lib/math.in.h
m4/math_h.m4
m4/rintf.m4
modules/math

index de925c9..4bf60b6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2012-03-07  Bruno Haible  <bruno@clisp.org>
 
+       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  <bruno@clisp.org>
+
        roundl: Avoid compilation error on AIX.
        * lib/math.in.h (roundl): Undefine macro before declaration. Needed on
        AIX 5.2..7.1.
index a67497a..21472b4 100644 (file)
@@ -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:
index d81f226..ed1e833 100644 (file)
@@ -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));
index 17b0343..a7e6893 100644 (file)
@@ -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])
index 9e92a97..ddd1a82 100644 (file)
@@ -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 <math.h>.
+    AC_CHECK_DECLS([rintf], , [HAVE_DECL_RINTF=0], [[#include <math.h>]])
+  else
     HAVE_RINTF=0
+    HAVE_DECL_RINTF=0
     RINTF_LIBM=
   fi
   AC_SUBST([RINTF_LIBM])
index 55b6a16..c4466a4 100644 (file)
@@ -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' \