Mercurial > hg > octave-lyh > gnulib-hg
changeset 16669:80b477c5aa4b
log1pf-ieee: Work around test failure on OpenBSD 4.9 and AIX 7.1.
* m4/log1pf-ieee.m4: New file.
* m4/log1pf.m4 (gl_FUNC_LOG1PF): If gl_FUNC_LOG1PF_IEEE is present,
test whether log1pf works with a minus zero argument. Replace it if
not.
* modules/log1pf-ieee (Files): Add m4/log1pf-ieee.m4, m4/minus-zero.m4,
m4/signbit.m4.
(configure.ac): Invoke gl_FUNC_LOG1PF_IEEE.
* doc/posix-functions/log1pf.texi: Mention the log1pf-ieee module.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 11 Mar 2012 02:06:49 +0100 |
parents | e5cdf9cb718e |
children | 1fae18345ca0 |
files | ChangeLog doc/posix-functions/log1pf.texi m4/log1pf-ieee.m4 m4/log1pf.m4 modules/log1pf-ieee |
diffstat | 5 files changed, 78 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2012-03-10 Bruno Haible <bruno@clisp.org> + log1pf-ieee: Work around test failure on OpenBSD 4.9 and AIX 7.1. + * m4/log1pf-ieee.m4: New file. + * m4/log1pf.m4 (gl_FUNC_LOG1PF): If gl_FUNC_LOG1PF_IEEE is present, + test whether log1pf works with a minus zero argument. Replace it if + not. + * modules/log1pf-ieee (Files): Add m4/log1pf-ieee.m4, m4/minus-zero.m4, + m4/signbit.m4. + (configure.ac): Invoke gl_FUNC_LOG1PF_IEEE. + * doc/posix-functions/log1pf.texi: Mention the log1pf-ieee module. + log1pf-ieee: Work around test failure on AIX 5.1 and HP-UX 11. * modules/log1pf-ieee (Depends-on): Add log1p-ieee. (configure.ac): Require gl_FUNC_LOG1PF.
--- a/doc/posix-functions/log1pf.texi +++ b/doc/posix-functions/log1pf.texi @@ -4,9 +4,9 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/log1pf.html} -Gnulib module: log1pf +Gnulib module: log1pf or log1pf-ieee -Portability problems fixed by Gnulib: +Portability problems fixed by either Gnulib module @code{log1pf} or @code{log1pf-ieee}: @itemize @item This function is missing on some platforms: @@ -16,6 +16,13 @@ IRIX 6.5. @end itemize +Portability problems fixed by Gnulib module @code{log1pf-ieee}: +@itemize +@item +This function has problems when the argument is minus zero on some platforms: +OpenBSD 4.9, AIX 7.1. +@end itemize + Portability problems not fixed by Gnulib: @itemize @end itemize
new file mode 100644 --- /dev/null +++ b/m4/log1pf-ieee.m4 @@ -0,0 +1,15 @@ +# log1pf-ieee.m4 serial 1 +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, +dnl with or without modifications, as long as this notice is preserved. + +dnl This macro is in a separate file (not in remainder.m4 and not inlined in the +dnl module description), so that gl_FUNC_LOG1PF can test whether 'aclocal' has +dnl found uses of this macro. + +AC_DEFUN([gl_FUNC_LOG1PF_IEEE], +[ + m4_divert_text([INIT_PREPARE], [gl_log1pf_required=ieee]) + AC_REQUIRE([gl_FUNC_LOG1PF]) +])
--- a/m4/log1pf.m4 +++ b/m4/log1pf.m4 @@ -1,4 +1,4 @@ -# log1pf.m4 serial 1 +# log1pf.m4 serial 2 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, @@ -6,6 +6,7 @@ AC_DEFUN([gl_FUNC_LOG1PF], [ + m4_divert_text([DEFAULTS], [gl_log1pf_required=plain]) AC_REQUIRE([gl_MATH_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_LOG1P]) @@ -29,6 +30,44 @@ *yes) ;; *) REPLACE_LOG1PF=1 ;; esac + + m4_ifdef([gl_FUNC_LOG1PF_IEEE], [ + if test $gl_log1pf_required = ieee && test $REPLACE_LOG1PF = 0; then + AC_CACHE_CHECK([whether log1pf works according to ISO C 99 with IEC 60559], + [gl_cv_func_log1pf_ieee], + [ + save_LIBS="$LIBS" + LIBS="$LIBS $LOG1PF_LIBM" + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#ifndef __NO_MATH_INLINES +# define __NO_MATH_INLINES 1 /* for glibc */ +#endif +#include <math.h> +]gl_FLOAT_MINUS_ZERO_CODE[ +]gl_FLOAT_SIGNBIT_CODE[ +static float dummy (float x) { return 0; } +int main (int argc, char *argv[]) +{ + float (*my_log1pf) (float) = argc ? log1pf : dummy; + /* This test fails on OpenBSD 4.9, AIX 7.1. */ + float y = my_log1pf (minus_zerof); + if (!(y == 0.0f) || (signbitf (minus_zerof) && !signbitf (y))) + return 1; + return 0; +} + ]])], + [gl_cv_func_log1pf_ieee=yes], + [gl_cv_func_log1pf_ieee=no], + [gl_cv_func_log1pf_ieee="guessing no"]) + LIBS="$save_LIBS" + ]) + case "$gl_cv_func_log1pf_ieee" in + *yes) ;; + *) REPLACE_LOG1PF=1 ;; + esac + fi + ]) else HAVE_LOG1PF=0 fi
--- a/modules/log1pf-ieee +++ b/modules/log1pf-ieee @@ -2,6 +2,9 @@ log1pf() function according to ISO C 99 with IEC 60559. Files: +m4/log1pf-ieee.m4 +m4/minus-zero.m4 +m4/signbit.m4 Depends-on: log1pf @@ -9,7 +12,7 @@ log1p-ieee [test $HAVE_LOG1PF = 0 || test $REPLACE_LOG1PF = 1] configure.ac: -AC_REQUIRE([gl_FUNC_LOG1PF]) +gl_FUNC_LOG1PF_IEEE Makefile.am: