Mercurial > gnulib
changeset 29604:a25897e558b8
Make truncl work on OSF/1 4.0.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 13 Apr 2008 20:43:12 +0200 |
parents | fdcd6fd6d7fe |
children | f83646acca90 |
files | ChangeLog doc/posix-functions/truncl.texi lib/math.in.h m4/math_h.m4 m4/truncl.m4 modules/math |
diffstat | 6 files changed, 48 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Apr 13 19:33:56 2008 +0200 +++ b/ChangeLog Sun Apr 13 20:43:12 2008 +0200 @@ -1,3 +1,15 @@ +2008-04-13 Bruno Haible <bruno@clisp.org> + + Make truncl work on OSF/1 4.0. + * m4/truncl.m4 (gl_FUNC_TRUNCL): Test whether truncl actually works. + Set REPLACE_TRUNCL, not HAVE_DECL_TRUNCL. + * lib/math.in.h (truncl): Test REPLACE_TRUNCL, not HAVE_DECL_TRUNCL. + * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize REPLACE_TRUNCL, not + HAVE_DECL_TRUNCL. + * modules/math (Makefile.am): Substitute REPLACE_TRUNCL, not + HAVE_DECL_TRUNCL. + * doc/posix-functions/truncl.texi: Document the OSF/1 4.0 problem. + 2008-04-13 Bruno Haible <bruno@clisp.org> * lib/unictype.h: Remove trailing comma from enumeration definitions.
--- a/doc/posix-functions/truncl.texi Sun Apr 13 19:33:56 2008 +0200 +++ b/doc/posix-functions/truncl.texi Sun Apr 13 20:43:12 2008 +0200 @@ -11,6 +11,9 @@ @item This function is missing on some platforms: FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS. +@item +This function crashes on some platforms: +OSF/1 4.0. @end itemize Portability problems not fixed by Gnulib:
--- a/lib/math.in.h Sun Apr 13 19:33:56 2008 +0200 +++ b/lib/math.in.h Sun Apr 13 20:43:12 2008 +0200 @@ -351,7 +351,8 @@ #endif #if @GNULIB_TRUNCL@ -# if !@HAVE_DECL_TRUNCL@ +# if @REPLACE_TRUNCL@ +# undef truncl # define truncl rpl_truncl extern long double truncl (long double x); # endif
--- a/m4/math_h.m4 Sun Apr 13 19:33:56 2008 +0200 +++ b/m4/math_h.m4 Sun Apr 13 20:43:12 2008 +0200 @@ -1,4 +1,4 @@ -# math_h.m4 serial 11 +# math_h.m4 serial 12 dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -74,7 +74,6 @@ HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL]) HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC]) HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF]) - HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL]) REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF]) REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL]) REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF]) @@ -90,4 +89,5 @@ REPLACE_ROUNDL=0; AC_SUBST([REPLACE_ROUNDL]) REPLACE_SIGNBIT=0; AC_SUBST([REPLACE_SIGNBIT]) REPLACE_SIGNBIT_USING_GCC=0; AC_SUBST([REPLACE_SIGNBIT_USING_GCC]) + REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL]) ])
--- a/m4/truncl.m4 Sun Apr 13 19:33:56 2008 +0200 +++ b/m4/truncl.m4 Sun Apr 13 20:43:12 2008 +0200 @@ -1,5 +1,5 @@ -# truncl.m4 serial 1 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# truncl.m4 serial 2 +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -7,6 +7,7 @@ AC_DEFUN([gl_FUNC_TRUNCL], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Persuade glibc <math.h> to declare truncl(). AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) dnl Test whether truncl() is declared. @@ -38,11 +39,34 @@ if test "$TRUNCL_LIBM" = "?"; then TRUNCL_LIBM= fi + dnl Test whether truncl() works. It crashes on OSF/1 4.0d. + AC_CACHE_CHECK([whether truncl works], [gl_cv_func_truncl_works], + [ + AC_TRY_RUN([ +#include <math.h> +long double x; +int main() +{ + x = truncl (0.0L); + return 0; +}], [gl_cv_func_truncl_works=yes], [gl_cv_func_truncl_works=no], + [case "$host_os" in + osf4*) gl_cv_func_truncl_works="guessing no";; + *) gl_cv_func_truncl_works="guessing yes";; + esac + ]) + ]) + case "$gl_cv_func_truncl_works" in + *yes) ;; + *) REPLACE_TRUNCL=1 ;; + esac else - HAVE_DECL_TRUNCL=0 + REPLACE_TRUNCL=1 + fi + if test $REPLACE_TRUNCL = 1; then AC_LIBOBJ([truncl]) TRUNCL_LIBM= fi - AC_SUBST([HAVE_DECL_TRUNCL]) + AC_SUBST([REPLACE_TRUNCL]) AC_SUBST([TRUNCL_LIBM]) ])
--- a/modules/math Sun Apr 13 19:33:56 2008 +0200 +++ b/modules/math Sun Apr 13 20:43:12 2008 +0200 @@ -51,7 +51,6 @@ -e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \ -e 's|@''HAVE_DECL_TRUNC''@|$(HAVE_DECL_TRUNC)|g' \ -e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \ - -e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \ -e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \ -e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \ -e 's|@''REPLACE_FLOORF''@|$(REPLACE_FLOORF)|g' \ @@ -67,6 +66,7 @@ -e 's|@''REPLACE_ROUNDL''@|$(REPLACE_ROUNDL)|g' \ -e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \ -e 's|@''REPLACE_SIGNBIT_USING_GCC''@|$(REPLACE_SIGNBIT_USING_GCC)|g' \ + -e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ < $(srcdir)/math.in.h; \ } > $@-t