copysignf: Don't override undeclared system function on IRIX 6.5.
authorBruno Haible <bruno@clisp.org>
Wed, 7 Mar 2012 23:42:49 +0000 (00:42 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 7 Mar 2012 23:42:49 +0000 (00:42 +0100)
* lib/math.in.h (copysignf): Test HAVE_DECL_COPYSIGNF, not
HAVE_COPYSIGNF.
* m4/copysignf.m4 (gl_FUNC_COPYSIGNF): Don't assume copysignf() is
declared when it exists. Set HAVE_DECL_COPYSIGNF.
* m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize HAVE_DECL_COPYSIGNF,
not HAVE_COPYSIGNF.
* modules/math (Makefile.am): Substitute HAVE_DECL_COPYSIGNF, not
HAVE_COPYSIGNF.
* doc/posix-functions/copysignf.texi: Mention missing declaration
problem.

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

index 83a09a4..d49552d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2012-03-07  Bruno Haible  <bruno@clisp.org>
+
+       copysignf: Don't override undeclared system function on IRIX 6.5.
+       * lib/math.in.h (copysignf): Test HAVE_DECL_COPYSIGNF, not
+       HAVE_COPYSIGNF.
+       * m4/copysignf.m4 (gl_FUNC_COPYSIGNF): Don't assume copysignf() is
+       declared when it exists. Set HAVE_DECL_COPYSIGNF.
+       * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize HAVE_DECL_COPYSIGNF,
+       not HAVE_COPYSIGNF.
+       * modules/math (Makefile.am): Substitute HAVE_DECL_COPYSIGNF, not
+       HAVE_COPYSIGNF.
+       * doc/posix-functions/copysignf.texi: Mention missing declaration
+       problem.
+
 2012-03-07  Jim Meyering  <meyering@redhat.com>
 
        readtokens: add tests
index 5c3154f..8e473c7 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, IRIX 6.5, Solaris 9, MSVC 9.
+Minix 3.1.8, AIX 5.1, 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 bd704b7..f1fdfac 100644 (file)
@@ -412,7 +412,7 @@ _GL_WARN_ON_USE (ceill, "ceill is unportable - "
 
 
 #if @GNULIB_COPYSIGNF@
-# if !@HAVE_COPYSIGNF@
+# if !@HAVE_DECL_COPYSIGNF@
 _GL_FUNCDECL_SYS (copysignf, float, (float x, float y));
 # endif
 _GL_CXXALIAS_SYS (copysignf, float, (float x, float y));
index 4f2825c..293bf45 100644 (file)
@@ -1,4 +1,4 @@
-# copysignf.m4 serial 2
+# copysignf.m4 serial 3
 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_COPYSIGNF],
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
 
   dnl Determine COPYSIGNF_LIBM.
-  gl_MATHFUNC([copysignf], [float], [(float, float)])
-  if test $gl_cv_func_copysignf_no_libm = no \
-     && test $gl_cv_func_copysignf_in_libm = no; then
+  gl_MATHFUNC([copysignf], [float], [(float, float)],
+    [extern
+     #ifdef __cplusplus
+     "C"
+     #endif
+     float copysignf (float, float);
+    ])
+  if test $gl_cv_func_copysignf_no_libm = yes \
+     || test $gl_cv_func_copysignf_in_libm = yes; then
+    HAVE_COPYSIGNF=1
+    dnl Also check whether it's declared.
+    dnl IRIX 6.5 has copysignf() in libm but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([copysignf], , [HAVE_DECL_COPYSIGNF=0], [[#include <math.h>]])
+  else
     HAVE_COPYSIGNF=0
+    HAVE_DECL_COPYSIGNF=0
     COPYSIGNF_LIBM=
   fi
   AC_SUBST([COPYSIGNF_LIBM])
index ce46a24..17b0343 100644 (file)
@@ -1,4 +1,4 @@
-# math_h.m4 serial 84
+# math_h.m4 serial 85
 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,
@@ -151,7 +151,6 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
   HAVE_CBRTF=1;                AC_SUBST([HAVE_CBRTF])
   HAVE_CBRTL=1;                AC_SUBST([HAVE_CBRTL])
   HAVE_COPYSIGN=1;             AC_SUBST([HAVE_COPYSIGN])
-  HAVE_COPYSIGNF=1;            AC_SUBST([HAVE_COPYSIGNF])
   HAVE_COPYSIGNL=1;            AC_SUBST([HAVE_COPYSIGNL])
   HAVE_COSF=1;                 AC_SUBST([HAVE_COSF])
   HAVE_COSL=1;                 AC_SUBST([HAVE_COSL])
@@ -203,6 +202,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
   HAVE_DECL_CBRTL=1;           AC_SUBST([HAVE_DECL_CBRTL])
   HAVE_DECL_CEILF=1;           AC_SUBST([HAVE_DECL_CEILF])
   HAVE_DECL_CEILL=1;           AC_SUBST([HAVE_DECL_CEILL])
+  HAVE_DECL_COPYSIGNF=1;       AC_SUBST([HAVE_DECL_COPYSIGNF])
   HAVE_DECL_COSL=1;            AC_SUBST([HAVE_DECL_COSL])
   HAVE_DECL_EXPL=1;            AC_SUBST([HAVE_DECL_EXPL])
   HAVE_DECL_FLOORF=1;          AC_SUBST([HAVE_DECL_FLOORF])
index 74788f2..55b6a16 100644 (file)
@@ -119,7 +119,6 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e 's|@''HAVE_CBRTF''@|$(HAVE_CBRTF)|g' \
              -e 's|@''HAVE_CBRTL''@|$(HAVE_CBRTL)|g' \
              -e 's|@''HAVE_COPYSIGN''@|$(HAVE_COPYSIGN)|g' \
-             -e 's|@''HAVE_COPYSIGNF''@|$(HAVE_COPYSIGNF)|g' \
              -e 's|@''HAVE_COPYSIGNL''@|$(HAVE_COPYSIGNL)|g' \
              -e 's|@''HAVE_COSF''@|$(HAVE_COSF)|g' \
              -e 's|@''HAVE_COSL''@|$(HAVE_COSL)|g' \
@@ -171,6 +170,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e 's|@''HAVE_DECL_CBRTL''@|$(HAVE_DECL_CBRTL)|g' \
              -e 's|@''HAVE_DECL_CEILF''@|$(HAVE_DECL_CEILF)|g' \
              -e 's|@''HAVE_DECL_CEILL''@|$(HAVE_DECL_CEILL)|g' \
+             -e 's|@''HAVE_DECL_COPYSIGNF''@|$(HAVE_DECL_COPYSIGNF)|g' \
              -e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \
              -e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \
              -e 's|@''HAVE_DECL_FLOORF''@|$(HAVE_DECL_FLOORF)|g' \