From 6d273f723651db3faff61a76569eb44d8750b5f1 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 11 Oct 2011 02:11:21 +0200 Subject: logl: Simplify for platforms where 'long double' == 'double'. * lib/logl.c (logl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New alternative implementation. * m4/logl.m4 (gl_FUNC_LOGL): Require gl_LONG_DOUBLE_VS_DOUBLE. Determine LOGL_LIBM according to HAVE_SAME_LONG_DOUBLE_AS_DOUBLE. * modules/logl (Depends-on): Add log. Update conditions. --- m4/logl.m4 | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) (limited to 'm4/logl.m4') diff --git a/m4/logl.m4 b/m4/logl.m4 index 70a5eadfc6..f17e5e5f3f 100644 --- a/m4/logl.m4 +++ b/m4/logl.m4 @@ -1,4 +1,4 @@ -# logl.m4 serial 5 +# logl.m4 serial 6 dnl Copyright (C) 2010-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, @@ -7,6 +7,8 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_LOGL], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) + AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) + dnl Persuade glibc to declare logl(). AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) @@ -56,24 +58,29 @@ AC_DEFUN([gl_FUNC_LOGL], HAVE_DECL_LOGL=0 HAVE_LOGL=0 dnl Find libraries needed to link lib/logl.c. - AC_REQUIRE([gl_FUNC_FREXPL]) - AC_REQUIRE([gl_FUNC_ISNANL]) - AC_REQUIRE([gl_FUNC_FLOORL]) - dnl Append $FREXPL_LIBM to LOGL_LIBM, avoiding gratuitous duplicates. - case " $LOGL_LIBM " in - *" $FREXPL_LIBM "*) ;; - *) LOGL_LIBM="$LOGL_LIBM $FREXPL_LIBM" ;; - esac - dnl Append $ISNANL_LIBM to LOGL_LIBM, avoiding gratuitous duplicates. - case " $LOGL_LIBM " in - *" $ISNANL_LIBM "*) ;; - *) LOGL_LIBM="$LOGL_LIBM $ISNANL_LIBM" ;; - esac - dnl Append $FLOORL_LIBM to LOGL_LIBM, avoiding gratuitous duplicates. - case " $LOGL_LIBM " in - *" $FLOORL_LIBM "*) ;; - *) LOGL_LIBM="$LOGL_LIBM $FLOORL_LIBM" ;; - esac + if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then + AC_REQUIRE([gl_FUNC_LOG]) + LOGL_LIBM="$LOG_LIBM" + else + AC_REQUIRE([gl_FUNC_FREXPL]) + AC_REQUIRE([gl_FUNC_ISNANL]) + AC_REQUIRE([gl_FUNC_FLOORL]) + dnl Append $FREXPL_LIBM to LOGL_LIBM, avoiding gratuitous duplicates. + case " $LOGL_LIBM " in + *" $FREXPL_LIBM "*) ;; + *) LOGL_LIBM="$LOGL_LIBM $FREXPL_LIBM" ;; + esac + dnl Append $ISNANL_LIBM to LOGL_LIBM, avoiding gratuitous duplicates. + case " $LOGL_LIBM " in + *" $ISNANL_LIBM "*) ;; + *) LOGL_LIBM="$LOGL_LIBM $ISNANL_LIBM" ;; + esac + dnl Append $FLOORL_LIBM to LOGL_LIBM, avoiding gratuitous duplicates. + case " $LOGL_LIBM " in + *" $FLOORL_LIBM "*) ;; + *) LOGL_LIBM="$LOGL_LIBM $FLOORL_LIBM" ;; + esac + fi fi AC_SUBST([LOGL_LIBM]) ]) -- cgit v1.2.1