From 0d9ccdd3faa9b6f2e89ecaffe9f27aa88cc01258 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 8 Mar 2012 00:42:49 +0100 Subject: [PATCH] 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. --- ChangeLog | 14 ++++++++++++++ doc/posix-functions/copysignf.texi | 5 ++++- lib/math.in.h | 2 +- m4/copysignf.m4 | 20 ++++++++++++++++---- m4/math_h.m4 | 4 ++-- modules/math | 2 +- 6 files changed, 38 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 83a09a4cb..d49552ddf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2012-03-07 Bruno Haible + + 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 readtokens: add tests diff --git a/doc/posix-functions/copysignf.texi b/doc/posix-functions/copysignf.texi index 5c3154f69..8e473c72f 100644 --- a/doc/posix-functions/copysignf.texi +++ b/doc/posix-functions/copysignf.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, 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: diff --git a/lib/math.in.h b/lib/math.in.h index bd704b795..f1fdfacaa 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -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)); diff --git a/m4/copysignf.m4 b/m4/copysignf.m4 index 4f2825cb4..293bf4561 100644 --- a/m4/copysignf.m4 +++ b/m4/copysignf.m4 @@ -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 . + AC_CHECK_DECL([copysignf], , [HAVE_DECL_COPYSIGNF=0], [[#include ]]) + else HAVE_COPYSIGNF=0 + HAVE_DECL_COPYSIGNF=0 COPYSIGNF_LIBM= fi AC_SUBST([COPYSIGNF_LIBM]) diff --git a/m4/math_h.m4 b/m4/math_h.m4 index ce46a24f1..17b0343d2 100644 --- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -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]) diff --git a/modules/math b/modules/math index 74788f2f7..55b6a16e9 100644 --- a/modules/math +++ b/modules/math @@ -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' \ -- 2.11.0