bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

new module frexpl-nolibm


From: Bruno Haible
Subject: new module frexpl-nolibm
Date: Fri, 18 May 2007 19:21:31 +0200
User-agent: KMail/1.5.4

For purposes of *printf correction, one needs an implementation of frexpl()
without access to libm. This new module does it.

2007-05-18  Bruno Haible  <address@hidden>

        * modules/frexpl-nolibm: New file.
        * m4/frexpl.m4 (gl_FUNC_FREXPL_NO_LIBM): New macro.

====================== modules/frexpl-nolibm ==================================
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

===============================================================================
*** m4/frexpl.m4        3 Apr 2007 23:28:37 -0000       1.6
--- m4/frexpl.m4        18 May 2007 17:16:14 -0000
***************
*** 1,4 ****
! # frexpl.m4 serial 2
  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,
--- 1,4 ----
! # 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,65 ****
--- 60,98 ----
    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],





reply via email to

[Prev in Thread] Current Thread [Next in Thread]