+2011-10-09 Bruno Haible <bruno@clisp.org>
+
+ ceill: Simplify for platforms where 'long double' == 'double'.
+ * lib/ceill.c: Include <config.h>.
+ (ceill) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New function.
+ * lib/ceil.c [!USE_LONG_DOUBLE]: Don't include <config.h> a second
+ time.
+ * m4/ceill.m4 (gl_FUNC_CEILL): Require gl_LONG_DOUBLE_VS_DOUBLE.
+ Determine CEILL_LIBM according to HAVE_SAME_LONG_DOUBLE_AS_DOUBLE.
+ * modules/ceill (Depends-on): Add ceil. Update conditions.
+
2011-10-09 Bruno Haible <bruno@clisp.org>
floorl: Simplify for platforms where 'long double' == 'double'.
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-#define USE_LONG_DOUBLE
-#include "ceil.c"
+#include <config.h>
+
+#if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+
+/* Specification. */
+# include <math.h>
+
+long double
+ceill (long double x)
+{
+ return ceil (x);
+}
+
+#else
+
+# define USE_LONG_DOUBLE
+# include "ceil.c"
+
+#endif
-# ceill.m4 serial 11
+# ceill.m4 serial 12
dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[
m4_divert_text([DEFAULTS], [gl_ceill_required=plain])
AC_REQUIRE([gl_MATH_H_DEFAULTS])
+ AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
+
dnl Persuade glibc <math.h> to declare ceill().
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
dnl Test whether ceill() is declared.
AC_CHECK_DECLS([ceill], , , [[#include <math.h>]])
if test "$ac_cv_have_decl_ceill" = yes; then
HAVE_DECL_CEILL=0
fi
if test $HAVE_DECL_CEILL = 0 || test $REPLACE_CEILL = 1; then
- dnl No libraries are needed to link lib/ceill.c.
- CEILL_LIBM=
+ dnl Find libraries needed to link lib/ceill.c.
+ if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
+ AC_REQUIRE([gl_FUNC_CEIL])
+ CEILL_LIBM="$CEIL_LIBM"
+ else
+ CEILL_LIBM=
+ fi
fi
AC_SUBST([CEILL_LIBM])
])
Depends-on:
math
extensions
-float [test $HAVE_DECL_CEILL = 0 || test $REPLACE_CEILL = 1]
+ceil [{ test $HAVE_DECL_CEILL = 0 || test $REPLACE_CEILL = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1]
+float [{ test $HAVE_DECL_CEILL = 0 || test $REPLACE_CEILL = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
configure.ac:
gl_FUNC_CEILL