changeset 13463:592d6086de3f

Unify tests that set gl_cv_func_ldexpl_no_libm.
author Bruno Haible <bruno@clisp.org>
date Mon, 12 Jul 2010 23:43:04 +0200
parents 88292c519d86
children abaeec5957d0
files ChangeLog m4/ldexpl.m4 m4/printf-frexpl.m4
diffstat 3 files changed, 26 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+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.
--- a/m4/ldexpl.m4
+++ b/m4/ldexpl.m4
@@ -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_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_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],
--- a/m4/printf-frexpl.m4
+++ b/m4/printf-frexpl.m4
@@ -30,16 +30,7 @@
     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