* lib/rintl.c: Include <config.h>.
(rintl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New function.
* lib/rint.c [!USE_LONG_DOUBLE]: Don't include <config.h> a second
time.
* m4/rintl.m4 (gl_FUNC_RINTL): Require gl_LONG_DOUBLE_VS_DOUBLE.
Determine RINTL_LIBM according to HAVE_SAME_LONG_DOUBLE_AS_DOUBLE.
* modules/rintl (Depends-on): Add rint. Update conditions.
+2011-10-09 Bruno Haible <bruno@clisp.org>
+
+ rintl: Simplify for platforms where 'long double' == 'double'.
+ * lib/rintl.c: Include <config.h>.
+ (rintl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New function.
+ * lib/rint.c [!USE_LONG_DOUBLE]: Don't include <config.h> a second
+ time.
+ * m4/rintl.m4 (gl_FUNC_RINTL): Require gl_LONG_DOUBLE_VS_DOUBLE.
+ Determine RINTL_LIBM according to HAVE_SAME_LONG_DOUBLE_AS_DOUBLE.
+ * modules/rintl (Depends-on): Add rint. Update conditions.
+
2011-10-09 Bruno Haible <bruno@clisp.org>
roundl: Simplify for platforms where 'long double' == 'double'.
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-#include <config.h>
+#if ! defined USE_LONG_DOUBLE
+# include <config.h>
+#endif
/* Specification. */
#include <math.h>
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-#define USE_LONG_DOUBLE
-#include "rint.c"
+#include <config.h>
+
+#if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+
+/* Specification. */
+# include <math.h>
+
+long double
+rintl (long double x)
+{
+ return rint (x);
+}
+
+#else
+
+# define USE_LONG_DOUBLE
+# include "rint.c"
+
+#endif
-# rintl.m4 serial 2
+# rintl.m4 serial 3
dnl Copyright (C) 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,
AC_DEFUN([gl_FUNC_RINTL],
[
AC_REQUIRE([gl_MATH_H_DEFAULTS])
+ AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
dnl Determine RINTL_LIBM.
gl_MATHFUNC([rintl], [long double], [(long double)])
if test $gl_cv_func_rintl_no_libm = no \
&& test $gl_cv_func_rintl_in_libm = no; then
HAVE_RINTL=0
- RINTL_LIBM=
+ dnl Find libraries needed to link lib/rintl.c.
+ if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
+ AC_REQUIRE([gl_FUNC_RINT])
+ RINTL_LIBM="$RINT_LIBM"
+ else
+ RINTL_LIBM=
+ fi
fi
AC_SUBST([RINTL_LIBM])
])
Depends-on:
math
+rint [test $HAVE_RINTL = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1]
configure.ac:
gl_FUNC_RINTL