bug-gnulib
[Top][All Lists]
Advanced

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

Re: frexpl, ldexpl declarations


From: Bruno Haible
Subject: Re: frexpl, ldexpl declarations
Date: Wed, 7 Mar 2007 02:14:08 +0100
User-agent: KMail/1.5.4

Paul Eggert wrote:
> Yes, math.h should declare them as functions.  But are you sure it isn't
> already doing this somehow?  It works for me, with Debian stable:

You are right. There was a mistake in my autoconf test. Thanks for the
clarifications.

So, the frexpl, ldexpl declarations are missing only on MacOS X, not on
glibc. And with it also the declarations of the other 11 functions of the
'mathl' module. I add to our <math.h> substitute the option to provide the
declarations there; a declaration of frexpl() simply doesn't belong in
lib/printf-frexpl.c.

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

        * lib/math_.h (acosl): Declare also if HAVE_DECL_ACOSL is set.
        (asinl): Declare also if HAVE_DECL_ASINL is set.
        (atanl): Declare also if HAVE_DECL_ATANL is set.
        (ceill): Declare also if HAVE_DECL_CEILL is set.
        (cosl): Declare also if HAVE_DECL_COSL is set.
        (expl): Declare also if HAVE_DECL_EXPL is set.
        (floorl): Declare also if HAVE_DECL_FLOORL is set.
        (frexpl): Declare also if HAVE_DECL_FREXPL is set.
        (ldexpl): Declare also if HAVE_DECL_LDEXPL is set.
        (logl): Declare also if HAVE_DECL_LOGL is set.
        (sinl): Declare also if HAVE_DECL_SINL is set.
        (sqrtl): Declare also if HAVE_DECL_SQRTL is set.
        (tanl): Declare also if HAVE_DECL_TANL is set.
        * modules/math (Makefile.am): Substitute the values of HAVE_DECL_*.
        * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Set HAVE_DECL_* to 1.
        * m4/printf-frexpl.m4 (gl_FUNC_PRINTF_FREXPL): Fix tests for the
        declaration of frexpl, ldexpl.
        * modules/printf-frexpl (Depends-on): Add math.

*** lib/math_.h 21 Feb 2007 00:02:37 -0000      1.2
--- lib/math_.h 7 Mar 2007 01:00:49 -0000
***************
*** 30,38 ****
  #endif
  
  
! #if @GNULIB_MATHL@
  extern long double acosl (long double x);
! #elif defined GNULIB_POSIXCHECK
  # undef acosl
  # define acosl(x) \
      (GL_LINK_WARNING ("acosl is unportable - " \
--- 30,39 ----
  #endif
  
  
! #if @GNULIB_MATHL@ || address@hidden@
  extern long double acosl (long double x);
! #endif
! #if address@hidden@ && defined GNULIB_POSIXCHECK
  # undef acosl
  # define acosl(x) \
      (GL_LINK_WARNING ("acosl is unportable - " \
***************
*** 40,48 ****
       acosl (x))
  #endif
  
! #if @GNULIB_MATHL@
  extern long double asinl (long double x);
! #elif defined GNULIB_POSIXCHECK
  # undef asinl
  # define asinl(x) \
      (GL_LINK_WARNING ("asinl is unportable - " \
--- 41,50 ----
       acosl (x))
  #endif
  
! #if @GNULIB_MATHL@ || address@hidden@
  extern long double asinl (long double x);
! #endif
! #if address@hidden@ && defined GNULIB_POSIXCHECK
  # undef asinl
  # define asinl(x) \
      (GL_LINK_WARNING ("asinl is unportable - " \
***************
*** 50,58 ****
       asinl (x))
  #endif
  
! #if @GNULIB_MATHL@
  extern long double atanl (long double x);
! #elif defined GNULIB_POSIXCHECK
  # undef atanl
  # define atanl(x) \
      (GL_LINK_WARNING ("atanl is unportable - " \
--- 52,61 ----
       asinl (x))
  #endif
  
! #if @GNULIB_MATHL@ || address@hidden@
  extern long double atanl (long double x);
! #endif
! #if address@hidden@ && defined GNULIB_POSIXCHECK
  # undef atanl
  # define atanl(x) \
      (GL_LINK_WARNING ("atanl is unportable - " \
***************
*** 60,68 ****
       atanl (x))
  #endif
  
! #if @GNULIB_MATHL@
  extern long double ceill (long double x);
! #elif defined GNULIB_POSIXCHECK
  # undef ceill
  # define ceill(x) \
      (GL_LINK_WARNING ("ceill is unportable - " \
--- 63,72 ----
       atanl (x))
  #endif
  
! #if @GNULIB_MATHL@ || address@hidden@
  extern long double ceill (long double x);
! #endif
! #if address@hidden@ && defined GNULIB_POSIXCHECK
  # undef ceill
  # define ceill(x) \
      (GL_LINK_WARNING ("ceill is unportable - " \
***************
*** 70,78 ****
       ceill (x))
  #endif
  
! #if @GNULIB_MATHL@
  extern long double cosl (long double x);
! #elif defined GNULIB_POSIXCHECK
  # undef cosl
  # define cosl(x) \
      (GL_LINK_WARNING ("cosl is unportable - " \
--- 74,83 ----
       ceill (x))
  #endif
  
! #if @GNULIB_MATHL@ || address@hidden@
  extern long double cosl (long double x);
! #endif
! #if address@hidden@ && defined GNULIB_POSIXCHECK
  # undef cosl
  # define cosl(x) \
      (GL_LINK_WARNING ("cosl is unportable - " \
***************
*** 80,88 ****
       cosl (x))
  #endif
  
! #if @GNULIB_MATHL@
  extern long double expl (long double x);
! #elif defined GNULIB_POSIXCHECK
  # undef expl
  # define expl(x) \
      (GL_LINK_WARNING ("expl is unportable - " \
--- 85,94 ----
       cosl (x))
  #endif
  
! #if @GNULIB_MATHL@ || address@hidden@
  extern long double expl (long double x);
! #endif
! #if address@hidden@ && defined GNULIB_POSIXCHECK
  # undef expl
  # define expl(x) \
      (GL_LINK_WARNING ("expl is unportable - " \
***************
*** 90,98 ****
       expl (x))
  #endif
  
! #if @GNULIB_MATHL@
  extern long double floorl (long double x);
! #elif defined GNULIB_POSIXCHECK
  # undef floorl
  # define floorl(x) \
      (GL_LINK_WARNING ("floorl is unportable - " \
--- 96,105 ----
       expl (x))
  #endif
  
! #if @GNULIB_MATHL@ || address@hidden@
  extern long double floorl (long double x);
! #endif
! #if address@hidden@ && defined GNULIB_POSIXCHECK
  # undef floorl
  # define floorl(x) \
      (GL_LINK_WARNING ("floorl is unportable - " \
***************
*** 100,108 ****
       floorl (x))
  #endif
  
! #if @GNULIB_MATHL@
  extern long double frexpl (long double x, int *exp);
! #elif defined GNULIB_POSIXCHECK
  # undef frexpl
  # define frexpl(x,e) \
      (GL_LINK_WARNING ("frexpl is unportable - " \
--- 107,116 ----
       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 - " \
***************
*** 110,118 ****
       frexpl (x, e))
  #endif
  
! #if @GNULIB_MATHL@
  extern long double ldexpl (long double x, int exp);
! #elif defined GNULIB_POSIXCHECK
  # undef ldexpl
  # define ldexpl(x,e) \
      (GL_LINK_WARNING ("ldexpl is unportable - " \
--- 118,127 ----
       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 - " \
***************
*** 120,128 ****
       ldexpl (x, e))
  #endif
  
! #if @GNULIB_MATHL@
  extern long double logl (long double x);
! #elif defined GNULIB_POSIXCHECK
  # undef logl
  # define logl(x) \
      (GL_LINK_WARNING ("logl is unportable - " \
--- 129,138 ----
       ldexpl (x, e))
  #endif
  
! #if @GNULIB_MATHL@ || address@hidden@
  extern long double logl (long double x);
! #endif
! #if address@hidden@ && defined GNULIB_POSIXCHECK
  # undef logl
  # define logl(x) \
      (GL_LINK_WARNING ("logl is unportable - " \
***************
*** 130,138 ****
       logl (x))
  #endif
  
! #if @GNULIB_MATHL@
  extern long double sinl (long double x);
! #elif defined GNULIB_POSIXCHECK
  # undef sinl
  # define sinl(x) \
      (GL_LINK_WARNING ("sinl is unportable - " \
--- 140,149 ----
       logl (x))
  #endif
  
! #if @GNULIB_MATHL@ || address@hidden@
  extern long double sinl (long double x);
! #endif
! #if address@hidden@ && defined GNULIB_POSIXCHECK
  # undef sinl
  # define sinl(x) \
      (GL_LINK_WARNING ("sinl is unportable - " \
***************
*** 140,148 ****
       sinl (x))
  #endif
  
! #if @GNULIB_MATHL@
  extern long double sqrtl (long double x);
! #elif defined GNULIB_POSIXCHECK
  # undef sqrtl
  # define sqrtl(x) \
      (GL_LINK_WARNING ("sqrtl is unportable - " \
--- 151,160 ----
       sinl (x))
  #endif
  
! #if @GNULIB_MATHL@ || address@hidden@
  extern long double sqrtl (long double x);
! #endif
! #if address@hidden@ && defined GNULIB_POSIXCHECK
  # undef sqrtl
  # define sqrtl(x) \
      (GL_LINK_WARNING ("sqrtl is unportable - " \
***************
*** 150,158 ****
       sqrtl (x))
  #endif
  
! #if @GNULIB_MATHL@
  extern long double tanl (long double x);
! #elif defined GNULIB_POSIXCHECK
  # undef tanl
  # define tanl(x) \
      (GL_LINK_WARNING ("tanl is unportable - " \
--- 162,171 ----
       sqrtl (x))
  #endif
  
! #if @GNULIB_MATHL@ || address@hidden@
  extern long double tanl (long double x);
! #endif
! #if address@hidden@ && defined GNULIB_POSIXCHECK
  # undef tanl
  # define tanl(x) \
      (GL_LINK_WARNING ("tanl is unportable - " \
*** modules/math        18 Feb 2007 15:10:28 -0000      1.1
--- modules/math        7 Mar 2007 01:00:49 -0000
***************
*** 22,27 ****
--- 22,40 ----
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''ABSOLUTE_MATH_H''@|$(ABSOLUTE_MATH_H)|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' \
+             -e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \
+             -e 's|@''HAVE_DECL_CEILL''@|$(HAVE_DECL_CEILL)|g' \
+             -e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \
+             -e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \
+             -e 's|@''HAVE_DECL_FLOORL''@|$(HAVE_DECL_FLOORL)|g' \
+             -e 's|@''HAVE_DECL_FREXPL''@|$(HAVE_DECL_FREXPL)|g' \
+             -e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \
+             -e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \
+             -e 's|@''HAVE_DECL_SINL''@|$(HAVE_DECL_SINL)|g' \
+             -e 's|@''HAVE_DECL_SQRTL''@|$(HAVE_DECL_SQRTL)|g' \
+             -e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              < $(srcdir)/math_.h; \
        } > address@hidden
*** m4/math_h.m4        18 Feb 2007 15:10:28 -0000      1.1
--- m4/math_h.m4        7 Mar 2007 01:00:49 -0000
***************
*** 1,4 ****
! # math_h.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,
--- 1,4 ----
! # math_h.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,
***************
*** 22,25 ****
--- 22,39 ----
  AC_DEFUN([gl_MATH_H_DEFAULTS],
  [
    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])
+   HAVE_DECL_ATANL=1;  AC_SUBST([HAVE_DECL_ATANL])
+   HAVE_DECL_CEILL=1;  AC_SUBST([HAVE_DECL_CEILL])
+   HAVE_DECL_COSL=1;   AC_SUBST([HAVE_DECL_COSL])
+   HAVE_DECL_EXPL=1;   AC_SUBST([HAVE_DECL_EXPL])
+   HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL])
+   HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL])
+   HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL])
+   HAVE_DECL_LOGL=1;   AC_SUBST([HAVE_DECL_LOGL])
+   HAVE_DECL_SINL=1;   AC_SUBST([HAVE_DECL_SINL])
+   HAVE_DECL_SQRTL=1;  AC_SUBST([HAVE_DECL_SQRTL])
+   HAVE_DECL_TANL=1;   AC_SUBST([HAVE_DECL_TANL])
  ])
*** m4/printf-frexpl.m4 6 Mar 2007 03:38:53 -0000       1.2
--- m4/printf-frexpl.m4 7 Mar 2007 01:00:49 -0000
***************
*** 1,4 ****
! # printf-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 ----
! # printf-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,
***************
*** 9,14 ****
--- 9,15 ----
  AC_DEFUN([gl_FUNC_PRINTF_FREXPL],
  [
    AC_REQUIRE([gt_TYPE_LONGDOUBLE])
+   AC_REQUIRE([gl_MATH_H_DEFAULTS])
    if test $gt_cv_c_long_double = yes; then
      AC_CACHE_CHECK([whether frexpl can be used without linking with libm],
        [gl_cv_func_frexpl_no_libm],
***************
*** 23,31 ****
      if test $gl_cv_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. glibc (2.3..2.5 at least) and
!       dnl MacOS X 10.3 have frexpl() in libc but don't declare it in <math.h>.
!       AC_CHECK_DECLS([frexpl])
      fi
  
      AC_CACHE_CHECK([whether ldexpl can be used without linking with libm],
--- 24,32 ----
      if test $gl_cv_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>])
      fi
  
      AC_CACHE_CHECK([whether ldexpl can be used without linking with libm],
***************
*** 41,49 ****
      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. glibc (2.3..2.5 at least) and
!       dnl MacOS X 10.3 have ldexpl() in libc but don't declare it in <math.h>.
!       AC_CHECK_DECLS([ldexpl])
      fi
    fi
  ])
--- 42,50 ----
      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
  ])
*** modules/printf-frexpl       25 Feb 2007 17:43:12 -0000      1.2
--- modules/printf-frexpl       7 Mar 2007 01:00:49 -0000
***************
*** 10,15 ****
--- 10,16 ----
  m4/longdouble.m4
  
  Depends-on:
+ math
  
  configure.ac:
  gl_FUNC_PRINTF_FREXPL





reply via email to

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