* m4/log1pl-ieee.m4: New file.
* m4/log1pl.m4 (gl_FUNC_LOG1PL): If gl_FUNC_LOG1PL_IEEE is present,
test whether log1pl works with a minus zero argument. Replace it if
not.
* lib/math.in.h (log1pl): Override if REPLACE_LOG1PL is 1.
* m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize REPLACE_LOG1PL.
* modules/math (Makefile.am): Substitute REPLACE_LOG1PL.
* modules/log1pl (configure.ac): Consider REPLACE_LOG1PL.
(Depends-on): Update conditions.
* modules/log1pl-ieee (Files): Add m4/log1p-ieee.m4, m4/minus-zero.m4,
m4/signbit.m4.
(configure.ac): Invoke gl_FUNC_LOG1PL_IEEE.
* doc/posix-functions/log1pl.texi: Mention the log1pl-ieee module.
2012-03-10 Bruno Haible <bruno@clisp.org>
+ log1pl-ieee: Work around test failure on IRIX 6.5.
+ * m4/log1pl-ieee.m4: New file.
+ * m4/log1pl.m4 (gl_FUNC_LOG1PL): If gl_FUNC_LOG1PL_IEEE is present,
+ test whether log1pl works with a minus zero argument. Replace it if
+ not.
+ * lib/math.in.h (log1pl): Override if REPLACE_LOG1PL is 1.
+ * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize REPLACE_LOG1PL.
+ * modules/math (Makefile.am): Substitute REPLACE_LOG1PL.
+ * modules/log1pl (configure.ac): Consider REPLACE_LOG1PL.
+ (Depends-on): Update conditions.
+ * modules/log1pl-ieee (Files): Add m4/log1p-ieee.m4, m4/minus-zero.m4,
+ m4/signbit.m4.
+ (configure.ac): Invoke gl_FUNC_LOG1PL_IEEE.
+ * doc/posix-functions/log1pl.texi: Mention the log1pl-ieee module.
+
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,
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/log1pl.html}
-Gnulib module: log1pl
+Gnulib module: log1pl or log1pl-ieee
-Portability problems fixed by Gnulib:
+Portability problems fixed by either Gnulib module @code{log1pl} or @code{log1pl-ieee}:
@itemize
@item
This function is missing on some platforms:
FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, MSVC 9, Interix 3.5, BeOS.
@end itemize
+Portability problems fixed by Gnulib module @code{log1pl-ieee}:
+@itemize
+@item
+This function has problems when the argument is minus zero on some platforms:
+AIX 7.1, IRIX 6.5.
+@end itemize
+
Portability problems not fixed by Gnulib:
@itemize
@end itemize
#endif
#if @GNULIB_LOG1PL@
-# if !@HAVE_LOG1PL@
+# if @REPLACE_LOG1PL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef log1pl
+# define log1pl rpl_log1pl
+# endif
+_GL_FUNCDECL_RPL (log1pl, long double, (long double x));
+_GL_CXXALIAS_RPL (log1pl, long double, (long double x));
+# else
+# if !@HAVE_LOG1PL@
_GL_FUNCDECL_SYS (log1pl, long double, (long double x));
-# endif
+# endif
_GL_CXXALIAS_SYS (log1pl, long double, (long double x));
+# endif
_GL_CXXALIASWARN (log1pl);
#elif defined GNULIB_POSIXCHECK
# undef log1pl
--- /dev/null
+# log1pl-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_LOG1PL can test whether 'aclocal' has
+dnl found uses of this macro.
+
+AC_DEFUN([gl_FUNC_LOG1PL_IEEE],
+[
+ m4_divert_text([INIT_PREPARE], [gl_log1pl_required=ieee])
+ AC_REQUIRE([gl_FUNC_LOG1PL])
+])
-# log1pl.m4 serial 1
+# log1pl.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,
AC_DEFUN([gl_FUNC_LOG1PL],
[
+ m4_divert_text([DEFAULTS], [gl_log1pl_required=plain])
AC_REQUIRE([gl_MATH_H_DEFAULTS])
AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
AC_REQUIRE([gl_FUNC_LOG1P])
LIBS="$save_LIBS"
if test $ac_cv_func_log1pl = yes; then
LOG1PL_LIBM="$LOG1P_LIBM"
+ m4_ifdef([gl_FUNC_LOG1PL_IEEE], [
+ if test $gl_log1pl_required = ieee && test $REPLACE_LOG1PL = 0; then
+ AC_CACHE_CHECK([whether log1pl works according to ISO C 99 with IEC 60559],
+ [gl_cv_func_log1pl_ieee],
+ [
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $LOG1PL_LIBM"
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#ifndef __NO_MATH_INLINES
+# define __NO_MATH_INLINES 1 /* for glibc */
+#endif
+#include <math.h>
+]gl_LONG_DOUBLE_MINUS_ZERO_CODE[
+]gl_LONG_DOUBLE_SIGNBIT_CODE[
+static long double dummy (long double x) { return 0; }
+int main (int argc, char *argv[])
+{
+ long double (*my_log1pl) (long double) = argc ? log1pl : dummy;
+ /* This test fails on AIX 7.1, IRIX 6.5. */
+ long double y = my_log1pl (minus_zerol);
+ if (!(y == 0.0L) || (signbitl (minus_zerol) && !signbitl (y)))
+ return 1;
+ return 0;
+}
+ ]])],
+ [gl_cv_func_log1pl_ieee=yes],
+ [gl_cv_func_log1pl_ieee=no],
+ [gl_cv_func_log1pl_ieee="guessing no"])
+ LIBS="$save_LIBS"
+ ])
+ case "$gl_cv_func_log1pl_ieee" in
+ *yes) ;;
+ *) REPLACE_LOG1PL=1 ;;
+ esac
+ fi
+ ])
else
HAVE_LOG1PL=0
dnl Find libraries needed to link lib/log1pl.c.
-# math_h.m4 serial 99
+# math_h.m4 serial 100
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,
REPLACE_LOGL=0; AC_SUBST([REPLACE_LOGL])
REPLACE_LOG1P=0; AC_SUBST([REPLACE_LOG1P])
REPLACE_LOG1PF=0; AC_SUBST([REPLACE_LOG1PF])
+ REPLACE_LOG1PL=0; AC_SUBST([REPLACE_LOG1PL])
REPLACE_MODF=0; AC_SUBST([REPLACE_MODF])
REPLACE_MODFF=0; AC_SUBST([REPLACE_MODFF])
REPLACE_MODFL=0; AC_SUBST([REPLACE_MODFL])
Depends-on:
math
extensions
-log1p [test $HAVE_LOG1PL = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1]
-isnanl [test $HAVE_LOG1PL = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
-logl [test $HAVE_LOG1PL = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
-roundl [test $HAVE_LOG1PL = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
+log1p [{ test $HAVE_LOG1PL = 0 || test $REPLACE_LOG1PL = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1]
+isnanl [{ test $HAVE_LOG1PL = 0 || test $REPLACE_LOG1PL = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
+logl [{ test $HAVE_LOG1PL = 0 || test $REPLACE_LOG1PL = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
+roundl [{ test $HAVE_LOG1PL = 0 || test $REPLACE_LOG1PL = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
configure.ac:
gl_FUNC_LOG1PL
-if test $HAVE_LOG1PL = 0; then
+if test $HAVE_LOG1PL = 0 || test $REPLACE_LOG1PL = 1; then
AC_LIBOBJ([log1pl])
fi
gl_MATH_MODULE_INDICATOR([log1pl])
log1pl() function according to ISO C 99 with IEC 60559.
Files:
+m4/log1pl-ieee.m4
+m4/minus-zero.m4
+m4/signbit.m4
Depends-on:
log1pl
fpieee
configure.ac:
+gl_FUNC_LOG1PL_IEEE
Makefile.am:
-e 's|@''REPLACE_LOGL''@|$(REPLACE_LOGL)|g' \
-e 's|@''REPLACE_LOG1P''@|$(REPLACE_LOG1P)|g' \
-e 's|@''REPLACE_LOG1PF''@|$(REPLACE_LOG1PF)|g' \
+ -e 's|@''REPLACE_LOG1PL''@|$(REPLACE_LOG1PL)|g' \
-e 's|@''REPLACE_MODF''@|$(REPLACE_MODF)|g' \
-e 's|@''REPLACE_MODFF''@|$(REPLACE_MODFF)|g' \
-e 's|@''REPLACE_MODFL''@|$(REPLACE_MODFL)|g' \