[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
copysignf: don't override undeclared system function
From: |
Bruno Haible |
Subject: |
copysignf: don't override undeclared system function |
Date: |
Thu, 08 Mar 2012 00:46:25 +0100 |
User-agent: |
KMail/4.7.4 (Linux/3.1.0-1.2-desktop; KDE/4.7.4; x86_64; ; ) |
On IRIX 6.5, copysignf() exists in libm (at least for certain target ABIs)
but is not unconditionally declared in the header files. As a result,
gnulib did not detect this function and provided a replacement - but without
the rpl_ prefix. Instead the system function can be used.
This patch does it. Similar patches will follow for round(), roundf(),
roundl(), rintf(), remainderl(), cbrtf(), expm1l().
2012-03-07 Bruno Haible <address@hidden>
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.
--- doc/posix-functions/copysignf.texi.orig Thu Mar 8 00:37:58 2012
+++ doc/posix-functions/copysignf.texi Wed Mar 7 23:36:57 2012
@@ -10,7 +10,10 @@
@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.
address@hidden
+This function is not declared on some platforms:
+IRIX 6.5.
@end itemize
Portability problems not fixed by Gnulib:
--- lib/math.in.h.orig Thu Mar 8 00:37:58 2012
+++ lib/math.in.h Wed Mar 7 23:37:42 2012
@@ -412,7 +412,7 @@
#if @GNULIB_COPYSIGNF@
-# if address@hidden@
+# if address@hidden@
_GL_FUNCDECL_SYS (copysignf, float, (float x, float y));
# endif
_GL_CXXALIAS_SYS (copysignf, float, (float x, float y));
--- m4/copysignf.m4.orig Thu Mar 8 00:37:58 2012
+++ m4/copysignf.m4 Wed Mar 7 23:52:57 2012
@@ -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_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])
--- m4/math_h.m4.orig Thu Mar 8 00:37:58 2012
+++ m4/math_h.m4 Wed Mar 7 23:38:43 2012
@@ -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 @@
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 @@
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])
--- modules/math.orig Thu Mar 8 00:37:58 2012
+++ modules/math Wed Mar 7 23:39:08 2012
@@ -119,7 +119,6 @@
-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 @@
-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' \
- copysignf: don't override undeclared system function,
Bruno Haible <=