* lib/frexpl.c: Include <config.h>.
(frexpl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New function.
* lib/frexp.c [!USE_LONG_DOUBLE]: Don't include <config.h> a second
time.
* m4/frexpl.m4 (gl_FUNC_FREXPL): Require gl_LONG_DOUBLE_VS_DOUBLE.
Determine FREXPL_LIBM according to HAVE_SAME_LONG_DOUBLE_AS_DOUBLE.
(gl_FUNC_FREXPL_NO_LIBM): Require gl_LONG_DOUBLE_VS_DOUBLE.
* modules/frexpl (Depends-on): Add frexp. Update conditions.
* modules/frexpl-nolibm (Depends-on): Add frexp-nolibm. Update
conditions.
+2011-10-10 Bruno Haible <bruno@clisp.org>
+
+ frexpl: Simplify for platforms where 'long double' == 'double'.
+ * lib/frexpl.c: Include <config.h>.
+ (frexpl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New function.
+ * lib/frexp.c [!USE_LONG_DOUBLE]: Don't include <config.h> a second
+ time.
+ * m4/frexpl.m4 (gl_FUNC_FREXPL): Require gl_LONG_DOUBLE_VS_DOUBLE.
+ Determine FREXPL_LIBM according to HAVE_SAME_LONG_DOUBLE_AS_DOUBLE.
+ (gl_FUNC_FREXPL_NO_LIBM): Require gl_LONG_DOUBLE_VS_DOUBLE.
+ * modules/frexpl (Depends-on): Add frexp. Update conditions.
+ * modules/frexpl-nolibm (Depends-on): Add frexp-nolibm. Update
+ conditions.
+
2011-10-10 Jim Meyering <meyering@redhat.com>
test-renameat: don't leave behind a temporary file
/* Written by Paolo Bonzini <bonzini@gnu.org>, 2003, and
Bruno Haible <bruno@clisp.org>, 2007. */
-#include <config.h>
+#if ! defined USE_LONG_DOUBLE
+# include <config.h>
+#endif
/* Specification. */
#include <math.h>
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#define USE_LONG_DOUBLE
-#include "frexp.c"
+#include <config.h>
+
+#if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+
+/* Specification. */
+# include <math.h>
+
+long double
+frexpl (long double x, int *expptr)
+{
+ return frexp (x, expptr);
+}
+
+#else
+
+# define USE_LONG_DOUBLE
+# include "frexp.c"
+
+#endif
-# frexpl.m4 serial 17
+# frexpl.m4 serial 18
dnl Copyright (C) 2007-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_FREXPL],
[
AC_REQUIRE([gl_MATH_H_DEFAULTS])
+ AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
dnl Check whether it's declared.
dnl MacOS X 10.3 has frexpl() in libc but doesn't declare it in <math.h>.
AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [[#include <math.h>]])
LIBS="$save_LIBS"
case "$gl_cv_func_frexpl_works" in
*yes) gl_func_frexpl=yes ;;
- *) gl_func_frexpl=no; REPLACE_FREXPL=1; FREXPL_LIBM= ;;
+ *) gl_func_frexpl=no; REPLACE_FREXPL=1 ;;
esac
else
gl_func_frexpl=no
[Define if the frexpl() function is available.])
fi
fi
+ if test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no; then
+ dnl Find libraries needed to link lib/frexpl.c.
+ if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
+ AC_REQUIRE([gl_FUNC_FREXP])
+ FREXPL_LIBM="$FREXP_LIBM"
+ else
+ FREXPL_LIBM=
+ fi
+ fi
AC_SUBST([FREXPL_LIBM])
])
AC_DEFUN([gl_FUNC_FREXPL_NO_LIBM],
[
AC_REQUIRE([gl_MATH_H_DEFAULTS])
+ AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
dnl Check whether it's declared.
dnl MacOS X 10.3 has frexpl() in libc but doesn't declare it in <math.h>.
AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [[#include <math.h>]])
Depends-on:
math
-isnanl-nolibm [test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no]
-fpucw [test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no]
+frexp [{ test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1]
+isnanl-nolibm [{ test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
+fpucw [{ test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
configure.ac:
gl_FUNC_FREXPL
Depends-on:
math
-isnanl-nolibm [test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl_no_libm = no]
-fpucw [test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl_no_libm = no]
+frexp-nolibm [{ test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl_no_libm = no; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1]
+isnanl-nolibm [{ test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl_no_libm = no; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
+fpucw [{ test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl_no_libm = no; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0]
configure.ac:
gl_FUNC_FREXPL_NO_LIBM