* m4/remainderl-ieee.m4: New file.
* m4/remainderl.m4 (gl_FUNC_REMAINDERL): If gl_FUNC_REMAINDERL_IEEE is
present, test whether remainderl works with a zero second argument.
Replace it if not.
* lib/math.in.h (remainderl): Override if REPLACE_REMAINDERL is 1.
* m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize REPLACE_REMAINDERL.
* modules/math (Makefile.am): Substitute REPLACE_REMAINDERL.
* modules/remainderl (configure.ac): Consider REPLACE_REMAINDERL.
(Depends-on): Update conditions.
* modules/remainderl-ieee (Files): Add m4/remainderl-ieee.m4.
(Depends-on): Add remainder-ieee.
(configure.ac): Invoke gl_FUNC_REMAINDERL_IEEE.
* doc/posix-functions/remainderl.texi: Mention the remainderl-ieee
module.
2012-02-27 Bruno Haible <bruno@clisp.org>
+ remainderl-ieee: Work around test failure on OSF/1.
+ * m4/remainderl-ieee.m4: New file.
+ * m4/remainderl.m4 (gl_FUNC_REMAINDERL): If gl_FUNC_REMAINDERL_IEEE is
+ present, test whether remainderl works with a zero second argument.
+ Replace it if not.
+ * lib/math.in.h (remainderl): Override if REPLACE_REMAINDERL is 1.
+ * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize REPLACE_REMAINDERL.
+ * modules/math (Makefile.am): Substitute REPLACE_REMAINDERL.
+ * modules/remainderl (configure.ac): Consider REPLACE_REMAINDERL.
+ (Depends-on): Update conditions.
+ * modules/remainderl-ieee (Files): Add m4/remainderl-ieee.m4.
+ (Depends-on): Add remainder-ieee.
+ (configure.ac): Invoke gl_FUNC_REMAINDERL_IEEE.
+ * doc/posix-functions/remainderl.texi: Mention the remainderl-ieee
+ module.
+
remainderf-ieee: Work around test failure on OSF/1.
* m4/remainderf-ieee.m4: New file.
* m4/remainderf.m4 (gl_FUNC_REMAINDERF): If gl_FUNC_REMAINDERF_IEEE is
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/remainderl.html}
-Gnulib module: remainderl
+Gnulib module: remainderl or remainderl-ieee
-Portability problems fixed by Gnulib:
+Portability problems fixed by either Gnulib module @code{remainderl} or @code{remainderl-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, OSF/1 4.0, Solaris 9, Cygwin, MSVC 9, Interix 3.5, BeOS.
@end itemize
+Portability problems fixed by Gnulib module @code{remainderl-ieee}:
+@itemize
+@item
+This function has problems when the second argument is zero on some platforms:
+OSF/1 5.1.
+@end itemize
+
Portability problems not fixed by Gnulib:
@itemize
@end itemize
#endif
#if @GNULIB_REMAINDERL@
-# if !@HAVE_REMAINDERL@
+# if @REPLACE_REMAINDERL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef remainderl
+# define remainderl rpl_remainderl
+# endif
+_GL_FUNCDECL_RPL (remainderl, long double, (long double x, long double y));
+_GL_CXXALIAS_RPL (remainderl, long double, (long double x, long double y));
+# else
+# if !@HAVE_REMAINDERL@
_GL_FUNCDECL_SYS (remainderl, long double, (long double x, long double y));
-# endif
+# endif
_GL_CXXALIAS_SYS (remainderl, long double, (long double x, long double y));
+# endif
_GL_CXXALIASWARN (remainderl);
#elif defined GNULIB_POSIXCHECK
# undef remainderl
-# math_h.m4 serial 70
+# math_h.m4 serial 71
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_NAN=0; AC_SUBST([REPLACE_NAN])
REPLACE_REMAINDER=0; AC_SUBST([REPLACE_REMAINDER])
REPLACE_REMAINDERF=0; AC_SUBST([REPLACE_REMAINDERF])
+ REPLACE_REMAINDERL=0; AC_SUBST([REPLACE_REMAINDERL])
REPLACE_ROUND=0; AC_SUBST([REPLACE_ROUND])
REPLACE_ROUNDF=0; AC_SUBST([REPLACE_ROUNDF])
REPLACE_ROUNDL=0; AC_SUBST([REPLACE_ROUNDL])
--- /dev/null
+# remainderl-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 remainderl.m4 and not inlined in the
+dnl module description), so that gl_FUNC_REMAINDER can test whether 'aclocal'
+dnl has found uses of this macro.
+
+AC_DEFUN([gl_FUNC_REMAINDERL_IEEE],
+[
+ m4_divert_text([INIT_PREPARE], [gl_remainderl_required=ieee])
+ AC_REQUIRE([gl_FUNC_REMAINDERL])
+])
-# remainderl.m4 serial 1
+# remainderl.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_REMAINDERL],
[
+ m4_divert_text([DEFAULTS], [gl_remainderl_required=plain])
AC_REQUIRE([gl_MATH_H_DEFAULTS])
AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
AC_REQUIRE([gl_FUNC_REMAINDER])
LIBS="$save_LIBS"
if test $gl_cv_func_remainderl = yes; then
REMAINDERL_LIBM="$REMAINDER_LIBM"
+ m4_ifdef([gl_FUNC_REMAINDERL_IEEE], [
+ if test $gl_remainderl_required = ieee && test $REPLACE_REMAINDERL = 0; then
+ AC_CACHE_CHECK([whether remainderl works according to ISO C 99 with IEC 60559],
+ [gl_cv_func_remainderl_ieee],
+ [
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $REMAINDERL_LIBM"
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#ifndef __NO_MATH_INLINES
+# define __NO_MATH_INLINES 1 /* for glibc */
+#endif
+#include <math.h>
+/* Compare two numbers with ==.
+ This is a separate function because IRIX 6.5 "cc -O" miscompiles an
+ 'x == x' test. */
+static int
+numeric_equal (long double x, long double y)
+{
+ return x == y;
+}
+static long double dummy (long double x, long double y) { return 0; }
+int main (int argc, char *argv[])
+{
+ long double (*my_remainderl) (long double, long double) = argc ? remainderl : dummy;
+ long double i;
+ long double f;
+ /* Test remainderl(...,0.0L).
+ This test fails on OSF/1 5.1. */
+ f = my_remainderl (2.0L, 0.0L);
+ if (numeric_equal (f, f))
+ return 1;
+ return 0;
+}
+ ]])],
+ [gl_cv_func_remainderl_ieee=yes],
+ [gl_cv_func_remainderl_ieee=no],
+ [gl_cv_func_remainderl_ieee="guessing no"])
+ LIBS="$save_LIBS"
+ ])
+ case "$gl_cv_func_remainderl_ieee" in
+ *yes) ;;
+ *) REPLACE_REMAINDERL=1 ;;
+ esac
+ fi
+ ])
else
HAVE_REMAINDERL=0
+ fi
+ if test $HAVE_REMAINDERL = 0 || test $REPLACE_REMAINDERL = 1; then
dnl Find libraries needed to link lib/remainderl.c.
if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
REMAINDERL_LIBM="$REMAINDER_LIBM"
-e 's|@''REPLACE_NAN''@|$(REPLACE_NAN)|g' \
-e 's|@''REPLACE_REMAINDER''@|$(REPLACE_REMAINDER)|g' \
-e 's|@''REPLACE_REMAINDERF''@|$(REPLACE_REMAINDERF)|g' \
+ -e 's|@''REPLACE_REMAINDERL''@|$(REPLACE_REMAINDERL)|g' \
-e 's|@''REPLACE_ROUND''@|$(REPLACE_ROUND)|g' \
-e 's|@''REPLACE_ROUNDF''@|$(REPLACE_ROUNDF)|g' \
-e 's|@''REPLACE_ROUNDL''@|$(REPLACE_ROUNDL)|g' \
Depends-on:
math
-remainder [test $HAVE_REMAINDERL = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1]
-roundl [test $HAVE_REMAINDERL = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
-fmal [test $HAVE_REMAINDERL = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
+remainder [{ test $HAVE_REMAINDERL = 0 || test $REPLACE_REMAINDERL = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1]
+roundl [{ test $HAVE_REMAINDERL = 0 || test $REPLACE_REMAINDERL = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
+fmal [{ test $HAVE_REMAINDERL = 0 || test $REPLACE_REMAINDERL = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
configure.ac:
gl_FUNC_REMAINDERL
-if test $HAVE_REMAINDERL = 0; then
+if test $HAVE_REMAINDERL = 0 || test $REPLACE_REMAINDERL = 1; then
AC_LIBOBJ([remainderl])
fi
gl_MATH_MODULE_INDICATOR([remainderl])
remainderl() function according to ISO C 99 with IEC 60559.
Files:
+m4/remainderl-ieee.m4
Depends-on:
remainderl
fpieee
+remainder-ieee [{ test $HAVE_REMAINDERL = 0 || test $REPLACE_REMAINDERL = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1]
configure.ac:
+gl_FUNC_REMAINDERL_IEEE
Makefile.am: