remainderl: Don't override undeclared system function on IRIX 6.5.
authorBruno Haible <bruno@clisp.org>
Thu, 8 Mar 2012 02:21:38 +0000 (03:21 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 8 Mar 2012 02:21:38 +0000 (03:21 +0100)
* lib/math.in.h (remainderl): Test HAVE_DECL_REMAINDERL, not
HAVE_REMAINDERL.
* m4/remainderl.m4 (gl_FUNC_REMAINDERL): Don't assume remainderl() is
declared when it exists. Set HAVE_DECL_REMAINDERL.
* m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize HAVE_DECL_REMAINDERL,
not HAVE_REMAINDERL.
* modules/math (Makefile.am): Substitute HAVE_DECL_REMAINDERL, not
HAVE_REMAINDERL.
* doc/posix-functions/remainderl.texi: Mention missing declaration
problem.

ChangeLog
doc/posix-functions/remainderl.texi
lib/math.in.h
m4/math_h.m4
m4/remainderl.m4
modules/math

index 4bf60b6..8480c0c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2012-03-07  Bruno Haible  <bruno@clisp.org>
 
+       remainderl: Don't override undeclared system function on IRIX 6.5.
+       * lib/math.in.h (remainderl): Test HAVE_DECL_REMAINDERL, not
+       HAVE_REMAINDERL.
+       * m4/remainderl.m4 (gl_FUNC_REMAINDERL): Don't assume remainderl() is
+       declared when it exists. Set HAVE_DECL_REMAINDERL.
+       * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize HAVE_DECL_REMAINDERL,
+       not HAVE_REMAINDERL.
+       * modules/math (Makefile.am): Substitute HAVE_DECL_REMAINDERL, not
+       HAVE_REMAINDERL.
+       * doc/posix-functions/remainderl.texi: Mention missing declaration
+       problem.
+
+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
index c010988..c6d8aed 100644 (file)
@@ -10,7 +10,10 @@ Portability problems fixed by either Gnulib module @code{remainderl} or @code{re
 @itemize
 @item
 This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, MSVC 9, Interix 3.5, BeOS.
+FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, older IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, MSVC 9, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+IRIX 6.5.
 @end itemize
 
 Portability problems fixed by Gnulib module @code{remainderl-ieee}:
index ed1e833..162f546 100644 (file)
@@ -1261,7 +1261,7 @@ _GL_WARN_ON_USE (remainder, "remainder is unportable - "
 _GL_FUNCDECL_RPL (remainderl, long double, (long double x, long double y));
 _GL_CXXALIAS_RPL (remainderl, long double, (long double x, long double y));
 # else
-#  if !@HAVE_REMAINDERL@
+#  if !@HAVE_DECL_REMAINDERL@
 _GL_FUNCDECL_SYS (remainderl, long double, (long double x, long double y));
 #  endif
 _GL_CXXALIAS_SYS (remainderl, long double, (long double x, long double y));
index a7e6893..6aa6831 100644 (file)
@@ -1,4 +1,4 @@
-# math_h.m4 serial 86
+# math_h.m4 serial 87
 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,
@@ -183,7 +183,6 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
   HAVE_POWF=1;                 AC_SUBST([HAVE_POWF])
   HAVE_REMAINDER=1;            AC_SUBST([HAVE_REMAINDER])
   HAVE_REMAINDERF=1;           AC_SUBST([HAVE_REMAINDERF])
-  HAVE_REMAINDERL=1;           AC_SUBST([HAVE_REMAINDERL])
   HAVE_RINT=1;                 AC_SUBST([HAVE_RINT])
   HAVE_RINTL=1;                AC_SUBST([HAVE_RINTL])
   HAVE_SINF=1;                 AC_SUBST([HAVE_SINF])
@@ -212,6 +211,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_REMAINDERL=1;      AC_SUBST([HAVE_DECL_REMAINDERL])
   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])
index 912f181..7c3c205 100644 (file)
@@ -1,4 +1,4 @@
-# remainderl.m4 serial 4
+# remainderl.m4 serial 5
 dnl Copyright (C) 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,
@@ -27,6 +27,11 @@ AC_DEFUN([gl_FUNC_REMAINDERL],
              # define __NO_MATH_INLINES 1 /* for glibc */
              #endif
              #include <math.h>
+             extern
+             #ifdef __cplusplus
+             "C"
+             #endif
+             long double remainderl (long double, long double);
              long double (*funcptr) (long double, long double) = remainderl;
              long double x;
              long double y;]],
@@ -37,7 +42,11 @@ AC_DEFUN([gl_FUNC_REMAINDERL],
     ])
   LIBS="$save_LIBS"
   if test $gl_cv_func_remainderl = yes; then
+    HAVE_REMAINDERL=1
     REMAINDERL_LIBM="$REMAINDER_LIBM"
+    dnl Also check whether it's declared.
+    dnl IRIX 6.5 has remainderl() in libm but doesn't declare it in <math.h>.
+    AC_CHECK_DECLS([remainderl], , [HAVE_DECL_REMAINDERL=0], [[#include <math.h>]])
     m4_ifdef([gl_FUNC_REMAINDERL_IEEE], [
       if test $gl_remainderl_required = ieee && test $REPLACE_REMAINDERL = 0; then
         AC_CACHE_CHECK([whether remainderl works according to ISO C 99 with IEC 60559],
@@ -51,6 +60,11 @@ AC_DEFUN([gl_FUNC_REMAINDERL],
 # define __NO_MATH_INLINES 1 /* for glibc */
 #endif
 #include <math.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+long double remainderl (long double, long double);
 /* Compare two numbers with ==.
    This is a separate function because IRIX 6.5 "cc -O" miscompiles an
    'x == x' test.  */
@@ -85,6 +99,7 @@ int main (int argc, char *argv[])
     ])
   else
     HAVE_REMAINDERL=0
+    HAVE_DECL_REMAINDERL=0
   fi
   if test $HAVE_REMAINDERL = 0 || test $REPLACE_REMAINDERL = 1; then
     dnl Find libraries needed to link lib/remainderl.c.
index c4466a4..d2e7abf 100644 (file)
@@ -151,7 +151,6 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e 's|@''HAVE_POWF''@|$(HAVE_POWF)|g' \
              -e 's|@''HAVE_REMAINDER''@|$(HAVE_REMAINDER)|g' \
              -e 's|@''HAVE_REMAINDERF''@|$(HAVE_REMAINDERF)|g' \
-             -e 's|@''HAVE_REMAINDERL''@|$(HAVE_REMAINDERL)|g' \
              -e 's|@''HAVE_RINT''@|$(HAVE_RINT)|g' \
              -e 's|@''HAVE_RINTL''@|$(HAVE_RINTL)|g' \
              -e 's|@''HAVE_SINF''@|$(HAVE_SINF)|g' \
@@ -180,6 +179,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_REMAINDERL''@|$(HAVE_DECL_REMAINDERL)|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' \