Unify tests that set gl_cv_func_ldexpl_no_libm.
authorBruno Haible <bruno@clisp.org>
Mon, 12 Jul 2010 21:43:04 +0000 (23:43 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 12 Jul 2010 21:45:39 +0000 (23:45 +0200)
ChangeLog
m4/ldexpl.m4
m4/printf-frexpl.m4

index 234af74..67609e9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2010-07-12  Bruno Haible  <bruno@clisp.org>
 
+       Unify tests that set gl_cv_func_ldexpl_no_libm.
+       * m4/ldexpl.m4 (gl_CHECK_LDEXPL_NO_LIBM): New macro, extracted from
+       gl_FUNC_LDEXPL.
+       (gl_FUNC_LDEXPL): Invoke it.
+       * m4/printf-frexpl.m4 (gl_FUNC_PRINTF_FREXPL): Likewise.
+
+2010-07-12  Bruno Haible  <bruno@clisp.org>
+
        Unify tests that set gl_cv_func_ldexp_no_libm.
        * m4/ldexp.m4: New file, based on m4/mathfunc.m4.
        * m4/strtod.m4 (gl_PREREQ_STRTOD): Require gl_CHECK_LDEXP_NO_LIBM.
index d84b50f..6fdbf00 100644 (file)
@@ -1,4 +1,4 @@
-# ldexpl.m4 serial 5
+# ldexpl.m4 serial 6
 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -12,15 +12,7 @@ AC_DEFUN([gl_FUNC_LDEXPL],
   AC_CHECK_DECL([ldexpl], , [HAVE_DECL_LDEXPL=0], [#include <math.h>])
   LDEXPL_LIBM=
   if test $HAVE_DECL_LDEXPL = 1; then
-    AC_CACHE_CHECK([whether ldexpl() can be used without linking with libm],
-      [gl_cv_func_ldexpl_no_libm],
-      [
-        AC_TRY_LINK([#include <math.h>
-                     long double x;],
-                    [return ldexpl (x, -1) > 0;],
-          [gl_cv_func_ldexpl_no_libm=yes],
-          [gl_cv_func_ldexpl_no_libm=no])
-      ])
+    gl_CHECK_LDEXPL_NO_LIBM
     if test $gl_cv_func_ldexpl_no_libm = no; then
       AC_CACHE_CHECK([whether ldexpl() can be used with libm],
         [gl_cv_func_ldexpl_in_libm],
@@ -62,6 +54,21 @@ AC_DEFUN([gl_FUNC_LDEXPL],
   AC_SUBST([LDEXPL_LIBM])
 ])
 
+dnl Test whether ldexpl() can be used without linking with libm.
+dnl Set gl_cv_func_ldexpl_no_libm to 'yes' or 'no' accordingly.
+AC_DEFUN([gl_CHECK_LDEXPL_NO_LIBM],
+[
+  AC_CACHE_CHECK([whether ldexpl() can be used without linking with libm],
+    [gl_cv_func_ldexpl_no_libm],
+    [
+      AC_TRY_LINK([#include <math.h>
+                   long double x;],
+                  [return ldexpl (x, -1) > 0;],
+        [gl_cv_func_ldexpl_no_libm=yes],
+        [gl_cv_func_ldexpl_no_libm=no])
+    ])
+])
+
 dnl Test whether ldexpl() works on finite numbers (this fails on AIX 5.1
 dnl and MacOS X 10.4/PowerPC).
 AC_DEFUN([gl_FUNC_LDEXPL_WORKS],
index 8088d99..914bca6 100644 (file)
@@ -30,16 +30,7 @@ AC_DEFUN([gl_FUNC_PRINTF_FREXPL],
     AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include <math.h>])
   fi
 
-  AC_CACHE_CHECK([whether ldexpl can be used without linking with libm],
-    [gl_cv_func_ldexpl_no_libm],
-    [
-      AC_TRY_LINK([#include <math.h>
-                   long double x;
-                   int y;],
-                  [return ldexpl (x, y) < 1;],
-        [gl_cv_func_ldexpl_no_libm=yes],
-        [gl_cv_func_ldexpl_no_libm=no])
-    ])
+  gl_CHECK_LDEXPL_NO_LIBM
   if test $gl_cv_func_ldexpl_no_libm = yes; then
     gl_FUNC_LDEXPL_WORKS
     case "$gl_cv_func_ldexpl_works" in