+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.
@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:
#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
-# 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,
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])
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])
])
-# 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.
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.
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])
])
-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' \
-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