bug-gnulib
[Top][All Lists]
Advanced

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

new module 'frexpl'


From: Bruno Haible
Subject: new module 'frexpl'
Date: Fri, 23 Mar 2007 02:26:09 +0100
User-agent: KMail/1.5.4

This adds 'frexpl' as a separate module from 'mathl' (since users of
frexpl often don't need trigonometric functions).


2007-03-22  Bruno Haible  <address@hidden>

        * modules/frexpl: New file.
        * m4/frexpl.m4: New file.
        * modules/math (Makefile.am): Also substitute GNULIB_FREXPL into math.h.
        * lib/math_.h (frexpl): Test GNULIB_FREXPL instead of GNULIB_MATHL.
        * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize GNULIB_FREXPL.
        * modules/mathl (Files): Remove lib/frexpl.c, lib/frexp.c.
        (Depends-on): Add frexpl. Remove isnanl-nolibm.
        * m4/mathl.m4 (gl_FUNC_LONG_DOUBLE_MATH): Don't test for frexpl.

============================== modules/frexpl ===============================
Description:
frexpl() function: split a 'long double' into its constituents.

Files:
lib/frexpl.c
lib/frexp.c
m4/frexpl.m4

Depends-on:
math
isnanl-nolibm

configure.ac:
gl_FUNC_FREXPL
gl_MATH_MODULE_INDICATOR([frexpl])

Makefile.am:

Include:
<math.h>

License:
LGPL

Maintainer:
Bruno Haible, Paolo Bonzini

=============================== m4/frexpl.m4 ================================
# frexpl.m4 serial 1
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,
dnl with or without modifications, as long as this notice is preserved.

AC_DEFUN([gl_FUNC_FREXPL],
[
  AC_REQUIRE([gl_MATH_H_DEFAULTS])
  FREXPL_LIBM=
  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 = no; then
    AC_CACHE_CHECK([whether frexpl() can be used with libm],
      [gl_cv_func_frexpl_in_libm],
      [
        save_LIBS="$LIBS"
        LIBS="$LIBS -lm"
        AC_TRY_LINK([#include <math.h>
                     long double x;],
                    [int e; return frexpl (x, &e) > 0;],
          [gl_cv_func_frexpl_in_libm=yes],
          [gl_cv_func_frexpl_in_libm=no])
        LIBS="$save_LIBS"
      ])
    if test $gl_cv_func_frexpl_in_libm = yes; then
      FREXPL_LIBM=-lm
    fi
  fi
  if test $gl_cv_func_frexpl_no_libm = yes \
     || test $gl_cv_func_frexpl_in_libm = yes; then
    AC_DEFINE([HAVE_FREXPL], 1,
      [Define if the frexpl() function is available.])
    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
    AC_LIBOBJ([frexpl])
  fi
])
=============================================================================
*** lib/math_.h 22 Mar 2007 03:59:38 -0000      1.4
--- lib/math_.h 23 Mar 2007 01:11:30 -0000
***************
*** 128,141 ****
       floorl (x))
  #endif
  
! #if @GNULIB_MATHL@ || address@hidden@
  extern long double frexpl (long double x, int *exp);
  #endif
! #if address@hidden@ && defined GNULIB_POSIXCHECK
  # undef frexpl
  # define frexpl(x,e) \
      (GL_LINK_WARNING ("frexpl is unportable - " \
!                       "use gnulib module mathl for portability"), \
       frexpl (x, e))
  #endif
  
--- 128,148 ----
       floorl (x))
  #endif
  
! /* Write x as
!      x = mantissa * 2^exp
!    where
!      If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
!      If x is zero: mantissa = x, exp = 0.
!      If x is infinite or NaN: mantissa = x, exp unspecified.
!    Store exp and return mantissa.  */
! #if @GNULIB_FREXPL@ || address@hidden@
  extern long double frexpl (long double x, int *exp);
  #endif
! #if address@hidden@ || defined GNULIB_POSIXCHECK
  # undef frexpl
  # define frexpl(x,e) \
      (GL_LINK_WARNING ("frexpl is unportable - " \
!                       "use gnulib module frexpl for portability"), \
       frexpl (x, e))
  #endif
  
*** m4/math_h.m4        22 Mar 2007 03:59:38 -0000      1.3
--- m4/math_h.m4        23 Mar 2007 01:11:30 -0000
***************
*** 21,28 ****
  
  AC_DEFUN([gl_MATH_H_DEFAULTS],
  [
!   GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP])
!   GNULIB_MATHL=0; AC_SUBST([GNULIB_MATHL])
    dnl Assume proper GNU behavior unless another module says otherwise.
    HAVE_DECL_ACOSL=1;  AC_SUBST([HAVE_DECL_ACOSL])
    HAVE_DECL_ASINL=1;  AC_SUBST([HAVE_DECL_ASINL])
--- 21,29 ----
  
  AC_DEFUN([gl_MATH_H_DEFAULTS],
  [
!   GNULIB_FREXP=0;  AC_SUBST([GNULIB_FREXP])
!   GNULIB_FREXPL=0; AC_SUBST([GNULIB_FREXPL])
!   GNULIB_MATHL=0;  AC_SUBST([GNULIB_MATHL])
    dnl Assume proper GNU behavior unless another module says otherwise.
    HAVE_DECL_ACOSL=1;  AC_SUBST([HAVE_DECL_ACOSL])
    HAVE_DECL_ASINL=1;  AC_SUBST([HAVE_DECL_ASINL])
*** m4/mathl.m4 23 Jan 2005 08:06:57 -0000      1.2
--- m4/mathl.m4 23 Mar 2007 01:11:30 -0000
***************
*** 1,5 ****
! # mathl.m4 serial 2
! dnl Copyright (c) 2003 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
  dnl with or without modifications, as long as this notice is preserved.
--- 1,5 ----
! # mathl.m4 serial 3
! dnl Copyright (c) 2003, 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,
  dnl with or without modifications, as long as this notice is preserved.
***************
*** 7,13 ****
  AC_DEFUN([gl_FUNC_LONG_DOUBLE_MATH], [
  
  AC_CHECK_LIB(m, atan)
! AC_REPLACE_FUNCS(floorl ceill sqrtl frexpl ldexpl asinl acosl atanl \
          logl expl tanl sinl cosl)
  
  ])
--- 7,13 ----
  AC_DEFUN([gl_FUNC_LONG_DOUBLE_MATH], [
  
  AC_CHECK_LIB(m, atan)
! AC_REPLACE_FUNCS(floorl ceill sqrtl ldexpl asinl acosl atanl \
          logl expl tanl sinl cosl)
  
  ])
*** modules/math        22 Mar 2007 03:59:38 -0000      1.3
--- modules/math        23 Mar 2007 01:11:30 -0000
***************
*** 22,27 ****
--- 22,28 ----
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''ABSOLUTE_MATH_H''@|$(ABSOLUTE_MATH_H)|g' \
              -e 's|@''GNULIB_FREXP''@|$(GNULIB_FREXP)|g' \
+             -e 's|@''GNULIB_FREXPL''@|$(GNULIB_FREXPL)|g' \
              -e 's|@''GNULIB_MATHL''@|$(GNULIB_MATHL)|g' \
              -e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \
              -e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \
*** modules/mathl       22 Mar 2007 12:24:07 -0000      1.6
--- modules/mathl       23 Mar 2007 01:11:30 -0000
***************
*** 9,16 ****
  lib/cosl.c
  lib/expl.c
  lib/floorl.c
- lib/frexpl.c
- lib/frexp.c
  lib/ldexpl.c
  lib/logl.c
  lib/sincosl.c
--- 9,14 ----
***************
*** 23,29 ****
  
  Depends-on:
  math
! isnanl-nolibm
  
  configure.ac:
  gl_FUNC_LONG_DOUBLE_MATH
--- 21,27 ----
  
  Depends-on:
  math
! frexpl
  
  configure.ac:
  gl_FUNC_LONG_DOUBLE_MATH





reply via email to

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