New module 'frexpl-nolibm'.
authorBruno Haible <bruno@clisp.org>
Fri, 18 May 2007 17:21:44 +0000 (17:21 +0000)
committerBruno Haible <bruno@clisp.org>
Fri, 18 May 2007 17:21:44 +0000 (17:21 +0000)
ChangeLog
m4/frexpl.m4
modules/frexpl-nolibm [new file with mode: 0644]

index 90f1911..908caf6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-05-18  Bruno Haible  <bruno@clisp.org>
+
+       * modules/frexpl-nolibm: New file.
+       * m4/frexpl.m4 (gl_FUNC_FREXPL_NO_LIBM): New macro.
+
 2007-05-17  Paul Eggert  <eggert@cs.ucla.edu>
 
        * lib/dirent_.h: Prefer #include_next <foo.h> to #include
index ca67add..8832181 100644 (file)
@@ -1,4 +1,4 @@
-# frexpl.m4 serial 2
+# frexpl.m4 serial 3
 dnl Copyright (C) 2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -60,6 +60,39 @@ AC_DEFUN([gl_FUNC_FREXPL],
   AC_SUBST([FREXPL_LIBM])
 ])
 
+AC_DEFUN([gl_FUNC_FREXPL_NO_LIBM],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  AC_CACHE_CHECK([whether frexpl() can be used without linking with libm],
+    [gl_cv_func_frexpl_no_libm],
+    [
+      AC_TRY_LINK([#include <math.h>
+                   long double x;],
+                  [int e; return frexpl (x, &e) > 0;],
+        [gl_cv_func_frexpl_no_libm=yes],
+        [gl_cv_func_frexpl_no_libm=no])
+    ])
+  if test $gl_cv_func_frexpl_no_libm = yes; then
+    gl_FUNC_FREXPL_WORKS
+    case "$gl_cv_func_frexpl_works" in
+      *yes) gl_func_frexpl_no_libm=yes ;;
+      *)    gl_func_frexpl_no_libm=no; REPLACE_FREXPL=1 ;;
+    esac
+  else
+    gl_func_frexpl_no_libm=no
+  fi
+  if test $gl_func_frexpl_no_libm = yes; then
+    AC_DEFINE([HAVE_FREXPL_IN_LIBC], 1,
+      [Define if the frexpl() function is available in libc.])
+    dnl Also 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>])
+  else
+    HAVE_DECL_FREXPL=0
+    AC_LIBOBJ([frexpl])
+  fi
+])
+
 dnl Test whether frexpl() works on finite numbers (this fails on AIX 5.1) and
 dnl also on infinite numbers (this fails e.g. on IRIX 6.5).
 AC_DEFUN([gl_FUNC_FREXPL_WORKS],
diff --git a/modules/frexpl-nolibm b/modules/frexpl-nolibm
new file mode 100644 (file)
index 0000000..80ce8fb
--- /dev/null
@@ -0,0 +1,29 @@
+Description:
+frexpl() function: split a 'long double' into its constituents, without
+requiring libm.
+
+Files:
+lib/frexpl.c
+lib/frexp.c
+m4/frexpl.m4
+
+Depends-on:
+math
+isnanl-nolibm
+fpucw
+
+configure.ac:
+gl_FUNC_FREXPL_NO_LIBM
+gl_MATH_MODULE_INDICATOR([frexpl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible, Paolo Bonzini
+