[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
new module 'ldexpl'
From: |
Bruno Haible |
Subject: |
new module 'ldexpl' |
Date: |
Fri, 30 Mar 2007 02:12:32 +0200 |
User-agent: |
KMail/1.5.4 |
On AIX, not only frexpl() is completely broken, but also ldexpl(). So it
needs a substitute. I am therefore pulling it out of the 'mathl' module.
2007-03-29 Bruno Haible <address@hidden>
* modules/ldexpl: New file.
* m4/ldexpl.m4: New file.
* lib/math_.h (ldexpl): Define to a replacement if REPLACE_LDEXPL is
set.
* m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize also GNULIB_LDEXPL,
REPLACE_LDEXPL.
* modules/math (Makefile.am): Substitute also GNULIB_LDEXPL,
REPLACE_LDEXPL.
* m4/printf-frexpl.m4 (gl_FUNC_PRINTF_FREXPL): Invoke
gl_FUNC_LDEXPL_WORKS.
* m4/mathl.m4 (gl_FUNC_LONG_DOUBLE_MATH): Remove test for ldexpl.
* modules/mathl (Files): Remove lib/ldexpl.c.
(Depends-on): Add ldexpl.
============================ modules/ldexpl ================================
Description:
ldexpl() function: multiply a 'long double' by a power of 2.
Files:
lib/ldexpl.c
m4/ldexpl.m4
Depends-on:
math
isnanl-nolibm
configure.ac:
gl_FUNC_LDEXPL
gl_MATH_MODULE_INDICATOR([ldexpl])
Makefile.am:
Include:
<math.h>
License:
LGPL
Maintainer:
Bruno Haible, Paolo Bonzini
============================= m4/ldexpl.m4 =================================
# ldexpl.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,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_LDEXPL],
[
AC_REQUIRE([gl_MATH_H_DEFAULTS])
LDEXPL_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])
])
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],
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
AC_TRY_LINK([#include <math.h>
long double x;],
[return ldexpl (x, -1) > 0;],
[gl_cv_func_ldexpl_in_libm=yes],
[gl_cv_func_ldexpl_in_libm=no])
LIBS="$save_LIBS"
])
if test $gl_cv_func_ldexpl_in_libm = yes; then
LDEXPL_LIBM=-lm
fi
fi
if test $gl_cv_func_ldexpl_no_libm = yes \
|| test $gl_cv_func_ldexpl_in_libm = yes; then
save_LIBS="$LIBS"
LIBS="$LIBS $LDEXPL_LIBM"
gl_FUNC_LDEXPL_WORKS
LIBS="$save_LIBS"
case "$gl_cv_func_ldexpl_works" in
*yes) gl_func_ldexpl=yes ;;
*) gl_func_ldexpl=no; REPLACE_LDEXPL=1; LDEXPL_LIBM= ;;
esac
else
gl_func_ldexpl=no
fi
if test $gl_func_ldexpl = yes; then
AC_DEFINE([HAVE_LDEXPL], 1,
[Define if the ldexpl() function is available.])
dnl Also check whether it's declared.
dnl MacOS X 10.3 has ldexpl() in libc but doesn't declare it in <math.h>.
AC_CHECK_DECL([ldexpl], , [HAVE_DECL_LDEXPL=0], [#include <math.h>])
else
AC_LIBOBJ([ldexpl])
fi
])
dnl Test whether ldexpl() works on finite numbers (this fails on AIX 5.1).
AC_DEFUN([gl_FUNC_LDEXPL_WORKS],
[
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_CACHE_CHECK([whether ldexpl works], [gl_cv_func_ldexpl_works],
[
AC_TRY_RUN([
#include <math.h>
extern long double ldexpl (long double, int);
int main()
{
volatile long double x = 1.0;
volatile long double y = ldexpl (x, -1);
return (y != 0.5L);
}], [gl_cv_func_ldexpl_works=yes], [gl_cv_func_ldexpl_works=no],
[case "$host_os" in
aix*) gl_cv_func_ldexpl_works="guessing no";;
*) gl_cv_func_ldexpl_works="guessing yes";;
esac
])
])
])
============================================================================
*** lib/math_.h 25 Mar 2007 21:35:38 -0000 1.7
--- lib/math_.h 30 Mar 2007 00:03:35 -0000
***************
*** 149,162 ****
frexpl (x, e))
#endif
! #if @GNULIB_MATHL@ || address@hidden@
extern long double ldexpl (long double x, int exp);
#endif
! #if address@hidden@ && defined GNULIB_POSIXCHECK
# undef ldexpl
# define ldexpl(x,e) \
(GL_LINK_WARNING ("ldexpl is unportable - " \
! "use gnulib module mathl for portability"), \
ldexpl (x, e))
#endif
--- 149,166 ----
frexpl (x, e))
#endif
! /* Return x * 2^exp. */
! #if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@
! # define ldexpl rpl_ldexpl
! #endif
! #if (@GNULIB_LDEXPL@ && @REPLACE_LDEXPL@) || address@hidden@
extern long double ldexpl (long double x, int exp);
#endif
! #if address@hidden@ && defined GNULIB_POSIXCHECK
# undef ldexpl
# define ldexpl(x,e) \
(GL_LINK_WARNING ("ldexpl is unportable - " \
! "use gnulib module ldexpl for portability"), \
ldexpl (x, e))
#endif
*** m4/math_h.m4 25 Mar 2007 21:35:38 -0000 1.5
--- m4/math_h.m4 30 Mar 2007 00:03:35 -0000
***************
*** 1,4 ****
! # math_h.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,
--- 1,4 ----
! # math_h.m4 serial 4
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,
***************
*** 23,28 ****
--- 23,29 ----
[
GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP])
GNULIB_FREXPL=0; AC_SUBST([GNULIB_FREXPL])
+ GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL])
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])
***************
*** 40,43 ****
--- 41,45 ----
HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL])
REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP])
REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL])
+ REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL])
])
*** modules/math 25 Mar 2007 21:35:38 -0000 1.5
--- modules/math 30 Mar 2007 00:03:35 -0000
***************
*** 23,28 ****
--- 23,29 ----
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_LDEXPL''@|$(GNULIB_LDEXPL)|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' \
***************
*** 39,44 ****
--- 40,46 ----
-e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \
-e 's|@''REPLACE_FREXP''@|$(REPLACE_FREXP)|g' \
-e 's|@''REPLACE_FREXPL''@|$(REPLACE_FREXPL)|g' \
+ -e 's|@''REPLACE_LDEXPL''@|$(REPLACE_LDEXPL)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/math_.h; \
} > address@hidden
*** m4/printf-frexpl.m4 7 Mar 2007 01:14:04 -0000 1.3
--- m4/printf-frexpl.m4 30 Mar 2007 00:03:35 -0000
***************
*** 40,50 ****
[gl_cv_func_ldexpl_no_libm=no])
])
if test $gl_cv_func_ldexpl_no_libm = yes; then
! AC_DEFINE([HAVE_LDEXPL_IN_LIBC], 1,
! [Define if the ldexpl function is available in libc.])
! dnl Also check whether it's declared.
! dnl MacOS X 10.3 has ldexpl() in libc but doesn't declare it in
<math.h>.
! AC_CHECK_DECL([ldexpl], , [HAVE_DECL_LDEXPL=0], [#include <math.h>])
fi
fi
])
--- 40,55 ----
[gl_cv_func_ldexpl_no_libm=no])
])
if test $gl_cv_func_ldexpl_no_libm = yes; then
! gl_FUNC_LDEXPL_WORKS
! case "$gl_cv_func_ldexpl_works" in
! *yes)
! AC_DEFINE([HAVE_LDEXPL_IN_LIBC], 1,
! [Define if the ldexpl function is available in libc.])
! dnl Also check whether it's declared.
! dnl MacOS X 10.3 has ldexpl() in libc but doesn't declare it in
<math.h>.
! AC_CHECK_DECL([ldexpl], , [HAVE_DECL_LDEXPL=0], [#include <math.h>])
! ;;
! esac
fi
fi
])
*** m4/mathl.m4 23 Mar 2007 01:26:24 -0000 1.3
--- m4/mathl.m4 30 Mar 2007 00:03:35 -0000
***************
*** 1,4 ****
! # 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,
--- 1,4 ----
! # mathl.m4 serial 4
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,
***************
*** 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)
])
--- 7,13 ----
AC_DEFUN([gl_FUNC_LONG_DOUBLE_MATH], [
AC_CHECK_LIB(m, atan)
! AC_REPLACE_FUNCS(floorl ceill sqrtl asinl acosl atanl \
logl expl tanl sinl cosl)
])
*** modules/mathl 26 Mar 2007 22:27:16 -0000 1.8
--- modules/mathl 30 Mar 2007 00:03:35 -0000
***************
*** 9,15 ****
lib/cosl.c
lib/expl.c
lib/floorl.c
- lib/ldexpl.c
lib/logl.c
lib/sincosl.c
lib/sinl.c
--- 9,14 ----
***************
*** 23,28 ****
--- 22,28 ----
math
frexpl
isnanl
+ ldexpl
configure.ac:
gl_FUNC_LONG_DOUBLE_MATH
- new module 'ldexpl',
Bruno Haible <=