New modules acosl, asinl, atanl, cosl, expl, logl, sinl, sqrtl, tanl.
authorBruno Haible <bruno@clisp.org>
Mon, 18 Jan 2010 00:27:33 +0000 (01:27 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 19 Jan 2010 01:59:13 +0000 (02:59 +0100)
38 files changed:
ChangeLog
doc/posix-functions/acosl.texi
doc/posix-functions/asinl.texi
doc/posix-functions/atanl.texi
doc/posix-functions/cosl.texi
doc/posix-functions/expl.texi
doc/posix-functions/logl.texi
doc/posix-functions/sinl.texi
doc/posix-functions/sqrtl.texi
doc/posix-functions/tanl.texi
lib/cosl.c
lib/math.in.h
lib/sincosl.c
lib/sinl.c
lib/tanl.c
lib/trigl.c
m4/acosl.m4 [new file with mode: 0644]
m4/asinl.m4 [new file with mode: 0644]
m4/atanl.m4 [new file with mode: 0644]
m4/cosl.m4 [new file with mode: 0644]
m4/expl.m4 [new file with mode: 0644]
m4/logl.m4 [new file with mode: 0644]
m4/math_h.m4
m4/mathl.m4 [deleted file]
m4/sinl.m4 [new file with mode: 0644]
m4/sqrtl.m4 [new file with mode: 0644]
m4/tanl.m4 [new file with mode: 0644]
modules/acosl [new file with mode: 0644]
modules/asinl [new file with mode: 0644]
modules/atanl [new file with mode: 0644]
modules/cosl [new file with mode: 0644]
modules/expl [new file with mode: 0644]
modules/logl [new file with mode: 0644]
modules/math
modules/mathl
modules/sinl [new file with mode: 0644]
modules/sqrtl [new file with mode: 0644]
modules/tanl [new file with mode: 0644]

index 25bbbe5..c841c7c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,52 @@
 2010-01-18  Bruno Haible  <bruno@clisp.org>
 
+       New modules acosl, asinl, atanl, cosl, expl, logl, sinl, sqrtl, tanl.
+       * lib/math.in.h (acosl, asinl, atanl, cosl, expl, logl, sinl, sqrtl,
+       tanl): Use the standard gnulib idiom.
+       * lib/cosl.c: Don't include trigl.c and sincosl.c.
+       * lib/sinl.c: Likewise.
+       * lib/tanl.c: Don't include trigl.c.
+       (kernel_tanl): Make static.
+       * lib/sincosl.c: Include trig.h first.
+       * lib/trigl.c: Likewise.
+       * m4/acosl.m4: New file.
+       * m4/asinl.m4: New file.
+       * m4/atanl.m4: New file.
+       * m4/cosl.m4: New file.
+       * m4/expl.m4: New file.
+       * m4/logl.m4: New file.
+       * m4/sinl.m4: New file.
+       * m4/sqrtl.m4: New file.
+       * m4/tanl.m4: New file.
+       * m4/mathl.m4: Remove file.
+       * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize GNULIB_* and HAVE_*
+       variables for acosl, asinl, atanl, cosl, expl, logl, sinl, sqrtl, tanl.
+       Don't initialize GNULIB_MATHL.
+       * modules/acosl: New file.
+       * modules/asinl: New file.
+       * modules/atanl: New file.
+       * modules/cosl: New file.
+       * modules/expl: New file.
+       * modules/logl: New file.
+       * modules/sinl: New file.
+       * modules/sqrtl: New file.
+       * modules/tanl: New file.
+       * modules/math (Makefile.am): Substitute GNULIB_* and HAVE_* variables
+       for acosl, asinl, atanl, cosl, expl, logl, sinl, sqrtl, tanl. Don't
+       substitute GNULIB_MATHL.
+       * modules/mathl: Rewritten.
+       * doc/posix-functions/acosl.texi: Mention the 'acosl' module.
+       * doc/posix-functions/asinl.texi: Mention the 'asinl' module.
+       * doc/posix-functions/atanl.texi: Mention the 'atanl' module.
+       * doc/posix-functions/cosl.texi: Mention the 'cosl' module.
+       * doc/posix-functions/expl.texi: Mention the 'expl' module.
+       * doc/posix-functions/logl.texi: Mention the 'logl' module.
+       * doc/posix-functions/sinl.texi: Mention the 'sinl' module.
+       * doc/posix-functions/sqrtl.texi: Mention the 'sqrtl' module.
+       * doc/posix-functions/tanl.texi: Mention the 'tanl' module.
+
+2010-01-18  Bruno Haible  <bruno@clisp.org>
+
        sqrt: Make gl_FUNC_SQRT requirable.
        * m4/sqrt.m4: New file.
        * modules/sqrt (Files): Add it.
index 48ed979..99e4f78 100644 (file)
@@ -4,15 +4,18 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/acosl.html}
 
-Gnulib module: ---
+Gnulib module: acosl
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @end itemize
index 11587ac..c304450 100644 (file)
@@ -4,15 +4,18 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/asinl.html}
 
-Gnulib module: ---
+Gnulib module: asinl
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @end itemize
index 638e259..971c5be 100644 (file)
@@ -4,15 +4,18 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/atanl.html}
 
-Gnulib module: ---
+Gnulib module: atanl
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @end itemize
index a23821d..d46bbb3 100644 (file)
@@ -4,15 +4,18 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/cosl.html}
 
-Gnulib module: ---
+Gnulib module: cosl
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @end itemize
index fc67ddd..23b7bbf 100644 (file)
@@ -4,15 +4,18 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/expl.html}
 
-Gnulib module: ---
+Gnulib module: expl
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @end itemize
index f325c3a..3df7d97 100644 (file)
@@ -4,15 +4,18 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/logl.html}
 
-Gnulib module: ---
+Gnulib module: logl
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @end itemize
index 06ca605..30751c2 100644 (file)
@@ -4,15 +4,18 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/sinl.html}
 
-Gnulib module: ---
+Gnulib module: sinl
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @end itemize
index 8657f52..c91fa08 100644 (file)
@@ -4,15 +4,18 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/sqrtl.html}
 
-Gnulib module: ---
+Gnulib module: sqrtl
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @end itemize
index 8e09447..109a598 100644 (file)
@@ -4,15 +4,18 @@
 
 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/tanl.html}
 
-Gnulib module: ---
+Gnulib module: tanl
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on some platforms:
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
+@item
+This function is not declared on some platforms:
+MacOS X 10.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5, BeOS.
 @end itemize
index 53df794..884cec8 100644 (file)
  */
 
 #include "trigl.h"
-#ifdef HAVE_SINL
-#include "trigl.c"
-#include "sincosl.c"
-#endif
 
 long double cosl(long double x)
 {
index 7f09424..4e21cf9 100644 (file)
@@ -118,10 +118,11 @@ extern double frexp (double x, int *expptr) _GL_ARG_NONNULL ((2));
 #endif
 
 
-#if @GNULIB_MATHL@ || !@HAVE_DECL_ACOSL@
+#if @GNULIB_ACOSL@
+# if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@
 extern long double acosl (long double x);
-#endif
-#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
 # undef acosl
 # define acosl(x) \
     (GL_LINK_WARNING ("acosl is unportable - " \
@@ -130,10 +131,11 @@ extern long double acosl (long double x);
 #endif
 
 
-#if @GNULIB_MATHL@ || !@HAVE_DECL_ASINL@
+#if @GNULIB_ASINL@
+# if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@
 extern long double asinl (long double x);
-#endif
-#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
 # undef asinl
 # define asinl(x) \
     (GL_LINK_WARNING ("asinl is unportable - " \
@@ -142,10 +144,11 @@ extern long double asinl (long double x);
 #endif
 
 
-#if @GNULIB_MATHL@ || !@HAVE_DECL_ATANL@
+#if @GNULIB_ATANL@
+# if !@HAVE_ATANL@ || !@HAVE_DECL_ATANL@
 extern long double atanl (long double x);
-#endif
-#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
 # undef atanl
 # define atanl(x) \
     (GL_LINK_WARNING ("atanl is unportable - " \
@@ -181,11 +184,15 @@ extern long double ceill (long double x);
 #endif
 
 
-#if @GNULIB_MATHL@ || (!@HAVE_DECL_COSL@ && !defined cosl)
-# undef cosl
+#if @GNULIB_COSL@
+# if !@HAVE_COSL@
+#  undef cosl
+#  define cosl rpl_cosl
+# endif
+# if !@HAVE_COSL@ || !@HAVE_DECL_COSL@
 extern long double cosl (long double x);
-#endif
-#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
 # undef cosl
 # define cosl(x) \
     (GL_LINK_WARNING ("cosl is unportable - " \
@@ -194,10 +201,11 @@ extern long double cosl (long double x);
 #endif
 
 
-#if @GNULIB_MATHL@ || !@HAVE_DECL_EXPL@
+#if @GNULIB_EXPL@
+# if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@
 extern long double expl (long double x);
-#endif
-#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
 # undef expl
 # define expl(x) \
     (GL_LINK_WARNING ("expl is unportable - " \
@@ -271,11 +279,15 @@ extern long double ldexpl (long double x, int exp);
 #endif
 
 
-#if @GNULIB_MATHL@ || (!@HAVE_DECL_LOGL@ && !defined logl)
-# undef logl
+#if @GNULIB_LOGL@
+# if !@HAVE_LOGL@
+#  undef logl
+#  define logl rpl_logl
+# endif
+# if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@
 extern long double logl (long double x);
-#endif
-#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
 # undef logl
 # define logl(x) \
     (GL_LINK_WARNING ("logl is unportable - " \
@@ -327,11 +339,15 @@ extern long double roundl (long double x);
 #endif
 
 
-#if @GNULIB_MATHL@ || (!@HAVE_DECL_SINL@ && !defined sinl)
-# undef sinl
+#if @GNULIB_SINL@
+# if !@HAVE_SINL@
+#  undef sinl
+#  define sinl rpl_sinl
+# endif
+# if !@HAVE_SINL@ || !@HAVE_DECL_SINL@
 extern long double sinl (long double x);
-#endif
-#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
 # undef sinl
 # define sinl(x) \
     (GL_LINK_WARNING ("sinl is unportable - " \
@@ -340,10 +356,11 @@ extern long double sinl (long double x);
 #endif
 
 
-#if @GNULIB_MATHL@ || !@HAVE_DECL_SQRTL@
+#if @GNULIB_SQRTL@
+# if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@
 extern long double sqrtl (long double x);
-#endif
-#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
 # undef sqrtl
 # define sqrtl(x) \
     (GL_LINK_WARNING ("sqrtl is unportable - " \
@@ -352,10 +369,11 @@ extern long double sqrtl (long double x);
 #endif
 
 
-#if @GNULIB_MATHL@ || !@HAVE_DECL_TANL@
+#if @GNULIB_TANL@
+# if !@HAVE_TANL@ || !@HAVE_DECL_TANL@
 extern long double tanl (long double x);
-#endif
-#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
+# endif
+#elif defined GNULIB_POSIXCHECK
 # undef tanl
 # define tanl(x) \
     (GL_LINK_WARNING ("tanl is unportable - " \
index 2c7ba93..9fae568 100644 (file)
@@ -1,5 +1,5 @@
 /* Quad-precision floating point trigonometric functions on <-pi/4,pi/4>.
-   Copyright (C) 1999, 2006, 2007, 20092010 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2006, 2007, 2009-2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jj@ultra.linux.cz>
 
 #include <config.h>
 
 /* Specification.  */
-#include <math.h>
+#include "trigl.h"
 
 #include <float.h>
+#include <math.h>
 
 static const long double sin_c[] = {
 #define ONE sin_c[0]
index eb0e05b..d8a0e7a 100644 (file)
@@ -50,8 +50,6 @@
  */
 
 #include "trigl.h"
-#include "trigl.c"
-#include "sincosl.c"
 
 long double
 sinl (long double x)
index 51262f0..6a6dc6d 100644 (file)
  */
 
 #include "trigl.h"
-#ifdef HAVE_SINL
-#ifdef HAVE_COSL
-#include "trigl.c"
-#endif
-#endif
 
 /*
  * ====================================================
@@ -120,7 +115,7 @@ static const long double
   /* 1.000000000000000000000000000000000000000E0 */
 
 
-long double
+static long double
 kernel_tanl (long double x, long double y, int iy)
 {
   long double z, r, v, w, s, u, u1;
index 1a8a791..fbd4815 100644 (file)
@@ -1,5 +1,5 @@
 /* Quad-precision floating point argument reduction.
-   Copyright (C) 1999, 2007, 20092010 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2007, 2009-2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jj@ultra.linux.cz>
 
 #include <config.h>
 
 /* Specification.  */
-#include <math.h>
+#include "trigl.h"
 
 #include <float.h>
+#include <math.h>
 
 /* Table of constants for 2/pi, 5628 hexadecimal digits of 2/pi */
 static const int two_over_pi[] = {
diff --git a/m4/acosl.m4 b/m4/acosl.m4
new file mode 100644 (file)
index 0000000..0e57df5
--- /dev/null
@@ -0,0 +1,60 @@
+# acosl.m4 serial 1
+dnl Copyright (C) 2010 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_ACOSL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare acosl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  ACOSL_LIBM=
+  AC_CACHE_CHECK([whether acosl() can be used without linking with libm],
+    [gl_cv_func_acosl_no_libm],
+    [
+      AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                   # define __NO_MATH_INLINES 1 /* for glibc */
+                   #endif
+                   #include <math.h>
+                   long double x;],
+                  [return acosl (x) > 1;],
+        [gl_cv_func_acosl_no_libm=yes],
+        [gl_cv_func_acosl_no_libm=no])
+    ])
+  if test $gl_cv_func_acosl_no_libm = no; then
+    AC_CACHE_CHECK([whether acosl() can be used with libm],
+      [gl_cv_func_acosl_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                     # define __NO_MATH_INLINES 1 /* for glibc */
+                     #endif
+                     #include <math.h>
+                     long double x;],
+                    [return acosl (x) > 1;],
+          [gl_cv_func_acosl_in_libm=yes],
+          [gl_cv_func_acosl_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_acosl_in_libm = yes; then
+      ACOSL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_acosl_no_libm = yes \
+     || test $gl_cv_func_acosl_in_libm = yes; then
+    dnl Also check whether it's declared.
+    dnl MacOS X 10.3 has acosl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([acosl], , [HAVE_DECL_ACOSL=0], [#include <math.h>])
+  else
+    HAVE_DECL_ACOSL=0
+    HAVE_ACOSL=0
+    AC_LIBOBJ([acosl])
+    AC_REQUIRE([gl_FUNC_ASINL])
+    AC_REQUIRE([gl_FUNC_SQRTL])
+    ACOSL_LIBM="$ASINL_LIBM $SQRTL_LIBM"
+  fi
+  AC_SUBST([ACOSL_LIBM])
+])
diff --git a/m4/asinl.m4 b/m4/asinl.m4
new file mode 100644 (file)
index 0000000..f2281a2
--- /dev/null
@@ -0,0 +1,59 @@
+# asinl.m4 serial 1
+dnl Copyright (C) 2010 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_ASINL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare asinl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  ASINL_LIBM=
+  AC_CACHE_CHECK([whether asinl() can be used without linking with libm],
+    [gl_cv_func_asinl_no_libm],
+    [
+      AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                   # define __NO_MATH_INLINES 1 /* for glibc */
+                   #endif
+                   #include <math.h>
+                   long double x;],
+                  [return asinl (x) > 1;],
+        [gl_cv_func_asinl_no_libm=yes],
+        [gl_cv_func_asinl_no_libm=no])
+    ])
+  if test $gl_cv_func_asinl_no_libm = no; then
+    AC_CACHE_CHECK([whether asinl() can be used with libm],
+      [gl_cv_func_asinl_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                     # define __NO_MATH_INLINES 1 /* for glibc */
+                     #endif
+                     #include <math.h>
+                     long double x;],
+                    [return asinl (x) > 1;],
+          [gl_cv_func_asinl_in_libm=yes],
+          [gl_cv_func_asinl_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_asinl_in_libm = yes; then
+      ASINL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_asinl_no_libm = yes \
+     || test $gl_cv_func_asinl_in_libm = yes; then
+    dnl Also check whether it's declared.
+    dnl MacOS X 10.3 has asinl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([asinl], , [HAVE_DECL_ASINL=0], [#include <math.h>])
+  else
+    HAVE_DECL_ASINL=0
+    HAVE_ASINL=0
+    AC_LIBOBJ([asinl])
+    AC_REQUIRE([gl_FUNC_SQRTL])
+    ASINL_LIBM="$SQRTL_LIBM"
+  fi
+  AC_SUBST([ASINL_LIBM])
+])
diff --git a/m4/atanl.m4 b/m4/atanl.m4
new file mode 100644 (file)
index 0000000..507f22b
--- /dev/null
@@ -0,0 +1,59 @@
+# atanl.m4 serial 1
+dnl Copyright (C) 2010 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_ATANL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare atanl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  ATANL_LIBM=
+  AC_CACHE_CHECK([whether atanl() can be used without linking with libm],
+    [gl_cv_func_atanl_no_libm],
+    [
+      AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                   # define __NO_MATH_INLINES 1 /* for glibc */
+                   #endif
+                   #include <math.h>
+                   long double x;],
+                  [return atanl (x) > 1;],
+        [gl_cv_func_atanl_no_libm=yes],
+        [gl_cv_func_atanl_no_libm=no])
+    ])
+  if test $gl_cv_func_atanl_no_libm = no; then
+    AC_CACHE_CHECK([whether atanl() can be used with libm],
+      [gl_cv_func_atanl_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                     # define __NO_MATH_INLINES 1 /* for glibc */
+                     #endif
+                     #include <math.h>
+                     long double x;],
+                    [return atanl (x) > 1;],
+          [gl_cv_func_atanl_in_libm=yes],
+          [gl_cv_func_atanl_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_atanl_in_libm = yes; then
+      ATANL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_atanl_no_libm = yes \
+     || test $gl_cv_func_atanl_in_libm = yes; then
+    dnl Also check whether it's declared.
+    dnl MacOS X 10.3 has atanl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([atanl], , [HAVE_DECL_ATANL=0], [#include <math.h>])
+  else
+    HAVE_DECL_ATANL=0
+    HAVE_ATANL=0
+    AC_LIBOBJ([atanl])
+    AC_REQUIRE([gl_FUNC_ISNANL])
+    ATANL_LIBM="$ISNANL_LIBM"
+  fi
+  AC_SUBST([ATANL_LIBM])
+])
diff --git a/m4/cosl.m4 b/m4/cosl.m4
new file mode 100644 (file)
index 0000000..460d0f0
--- /dev/null
@@ -0,0 +1,63 @@
+# cosl.m4 serial 1
+dnl Copyright (C) 2010 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_COSL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare cosl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  COSL_LIBM=
+  AC_CACHE_CHECK([whether cosl() can be used without linking with libm],
+    [gl_cv_func_cosl_no_libm],
+    [
+      AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                   # define __NO_MATH_INLINES 1 /* for glibc */
+                   #endif
+                   #include <math.h>
+                   long double x;],
+                  [return cosl (x) > 0.4;],
+        [gl_cv_func_cosl_no_libm=yes],
+        [gl_cv_func_cosl_no_libm=no])
+    ])
+  if test $gl_cv_func_cosl_no_libm = no; then
+    AC_CACHE_CHECK([whether cosl() can be used with libm],
+      [gl_cv_func_cosl_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                     # define __NO_MATH_INLINES 1 /* for glibc */
+                     #endif
+                     #include <math.h>
+                     long double x;],
+                    [return cosl (x) > 0.4;],
+          [gl_cv_func_cosl_in_libm=yes],
+          [gl_cv_func_cosl_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_cosl_in_libm = yes; then
+      COSL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_cosl_no_libm = yes \
+     || test $gl_cv_func_cosl_in_libm = yes; then
+    dnl Also check whether it's declared.
+    dnl MacOS X 10.3 has cosl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([cosl], , [HAVE_DECL_COSL=0], [#include <math.h>])
+  else
+    HAVE_DECL_COSL=0
+    HAVE_COSL=0
+    AC_LIBOBJ([cosl])
+    AC_LIBOBJ([sincosl])
+    AC_LIBOBJ([trigl])
+    AC_REQUIRE([gl_FUNC_ISNANL])
+    AC_REQUIRE([gl_FUNC_FLOOR])
+    AC_REQUIRE([gl_FUNC_FLOORL])
+    COSL_LIBM="$ISNANL_LIBM $FLOOR_LIBM $FLOORL_LIBM"
+  fi
+  AC_SUBST([COSL_LIBM])
+])
diff --git a/m4/expl.m4 b/m4/expl.m4
new file mode 100644 (file)
index 0000000..698a9fb
--- /dev/null
@@ -0,0 +1,59 @@
+# expl.m4 serial 1
+dnl Copyright (C) 2010 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_EXPL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare expl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  EXPL_LIBM=
+  AC_CACHE_CHECK([whether expl() can be used without linking with libm],
+    [gl_cv_func_expl_no_libm],
+    [
+      AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                   # define __NO_MATH_INLINES 1 /* for glibc */
+                   #endif
+                   #include <math.h>
+                   long double x;],
+                  [return expl (x) > 1.5;],
+        [gl_cv_func_expl_no_libm=yes],
+        [gl_cv_func_expl_no_libm=no])
+    ])
+  if test $gl_cv_func_expl_no_libm = no; then
+    AC_CACHE_CHECK([whether expl() can be used with libm],
+      [gl_cv_func_expl_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                     # define __NO_MATH_INLINES 1 /* for glibc */
+                     #endif
+                     #include <math.h>
+                     long double x;],
+                    [return expl (x) > 1.5;],
+          [gl_cv_func_expl_in_libm=yes],
+          [gl_cv_func_expl_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_expl_in_libm = yes; then
+      EXPL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_expl_no_libm = yes \
+     || test $gl_cv_func_expl_in_libm = yes; then
+    dnl Also check whether it's declared.
+    dnl MacOS X 10.3 has expl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([expl], , [HAVE_DECL_EXPL=0], [#include <math.h>])
+  else
+    HAVE_DECL_EXPL=0
+    HAVE_EXPL=0
+    AC_LIBOBJ([expl])
+    AC_REQUIRE([gl_FUNC_FLOORL])
+    EXPL_LIBM="$FLOORL_LIBM"
+  fi
+  AC_SUBST([EXPL_LIBM])
+])
diff --git a/m4/logl.m4 b/m4/logl.m4
new file mode 100644 (file)
index 0000000..196dcbd
--- /dev/null
@@ -0,0 +1,61 @@
+# logl.m4 serial 1
+dnl Copyright (C) 2010 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_LOGL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare logl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  LOGL_LIBM=
+  AC_CACHE_CHECK([whether logl() can be used without linking with libm],
+    [gl_cv_func_logl_no_libm],
+    [
+      AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                   # define __NO_MATH_INLINES 1 /* for glibc */
+                   #endif
+                   #include <math.h>
+                   long double x;],
+                  [return logl (x) > 1;],
+        [gl_cv_func_logl_no_libm=yes],
+        [gl_cv_func_logl_no_libm=no])
+    ])
+  if test $gl_cv_func_logl_no_libm = no; then
+    AC_CACHE_CHECK([whether logl() can be used with libm],
+      [gl_cv_func_logl_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                     # define __NO_MATH_INLINES 1 /* for glibc */
+                     #endif
+                     #include <math.h>
+                     long double x;],
+                    [return logl (x) > 1;],
+          [gl_cv_func_logl_in_libm=yes],
+          [gl_cv_func_logl_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_logl_in_libm = yes; then
+      LOGL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_logl_no_libm = yes \
+     || test $gl_cv_func_logl_in_libm = yes; then
+    dnl Also check whether it's declared.
+    dnl MacOS X 10.3 has logl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([logl], , [HAVE_DECL_LOGL=0], [#include <math.h>])
+  else
+    HAVE_DECL_LOGL=0
+    HAVE_LOGL=0
+    AC_LIBOBJ([logl])
+    AC_REQUIRE([gl_FUNC_FREXPL])
+    AC_REQUIRE([gl_FUNC_ISNANL])
+    AC_REQUIRE([gl_FUNC_FLOORL])
+    LOGL_LIBM="$FREXPL_LIBM $ISNANL_LIBM $FLOORL_LIBM"
+  fi
+  AC_SUBST([LOGL_LIBM])
+])
index bd8128b..1e4c480 100644 (file)
@@ -1,4 +1,4 @@
-# math_h.m4 serial 15
+# math_h.m4 serial 16
 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -46,8 +46,13 @@ AC_DEFUN([gl_MATH_MODULE_INDICATOR],
 
 AC_DEFUN([gl_MATH_H_DEFAULTS],
 [
+  GNULIB_ACOSL=0;    AC_SUBST([GNULIB_ACOSL])
+  GNULIB_ASINL=0;    AC_SUBST([GNULIB_ASINL])
+  GNULIB_ATANL=0;    AC_SUBST([GNULIB_ATANL])
   GNULIB_CEILF=0;    AC_SUBST([GNULIB_CEILF])
   GNULIB_CEILL=0;    AC_SUBST([GNULIB_CEILL])
+  GNULIB_COSL=0;     AC_SUBST([GNULIB_COSL])
+  GNULIB_EXPL=0;     AC_SUBST([GNULIB_EXPL])
   GNULIB_FLOORF=0;   AC_SUBST([GNULIB_FLOORF])
   GNULIB_FLOORL=0;   AC_SUBST([GNULIB_FLOORL])
   GNULIB_FREXP=0;    AC_SUBST([GNULIB_FREXP])
@@ -59,18 +64,30 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
   GNULIB_ISNAND=0;   AC_SUBST([GNULIB_ISNAND])
   GNULIB_ISNANL=0;   AC_SUBST([GNULIB_ISNANL])
   GNULIB_LDEXPL=0;   AC_SUBST([GNULIB_LDEXPL])
-  GNULIB_MATHL=0;    AC_SUBST([GNULIB_MATHL])
+  GNULIB_LOGL=0;     AC_SUBST([GNULIB_LOGL])
   GNULIB_ROUND=0;    AC_SUBST([GNULIB_ROUND])
   GNULIB_ROUNDF=0;   AC_SUBST([GNULIB_ROUNDF])
   GNULIB_ROUNDL=0;   AC_SUBST([GNULIB_ROUNDL])
   GNULIB_SIGNBIT=0;  AC_SUBST([GNULIB_SIGNBIT])
+  GNULIB_SINL=0;     AC_SUBST([GNULIB_SINL])
+  GNULIB_SQRTL=0;    AC_SUBST([GNULIB_SQRTL])
+  GNULIB_TANL=0;     AC_SUBST([GNULIB_TANL])
   GNULIB_TRUNC=0;    AC_SUBST([GNULIB_TRUNC])
   GNULIB_TRUNCF=0;   AC_SUBST([GNULIB_TRUNCF])
   GNULIB_TRUNCL=0;   AC_SUBST([GNULIB_TRUNCL])
   dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_ACOSL=1;                AC_SUBST([HAVE_ACOSL])
+  HAVE_ASINL=1;                AC_SUBST([HAVE_ASINL])
+  HAVE_ATANL=1;                AC_SUBST([HAVE_ATANL])
+  HAVE_COSL=1;                 AC_SUBST([HAVE_COSL])
+  HAVE_EXPL=1;                 AC_SUBST([HAVE_EXPL])
   HAVE_ISNANF=1;               AC_SUBST([HAVE_ISNANF])
   HAVE_ISNAND=1;               AC_SUBST([HAVE_ISNAND])
   HAVE_ISNANL=1;               AC_SUBST([HAVE_ISNANL])
+  HAVE_LOGL=1;                 AC_SUBST([HAVE_LOGL])
+  HAVE_SINL=1;                 AC_SUBST([HAVE_SINL])
+  HAVE_SQRTL=1;                AC_SUBST([HAVE_SQRTL])
+  HAVE_TANL=1;                 AC_SUBST([HAVE_TANL])
   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])
diff --git a/m4/mathl.m4 b/m4/mathl.m4
deleted file mode 100644 (file)
index cfe2de0..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# mathl.m4 serial 5
-dnl Copyright (c) 2003, 2007, 2009, 2010 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_LONG_DOUBLE_MATH], [
-
-AC_CHECK_LIB([m], [atan])
-AC_REPLACE_FUNCS(floorl ceill sqrtl asinl acosl atanl \
-        logl expl tanl sinl cosl)
-
-])
diff --git a/m4/sinl.m4 b/m4/sinl.m4
new file mode 100644 (file)
index 0000000..1239326
--- /dev/null
@@ -0,0 +1,63 @@
+# sinl.m4 serial 1
+dnl Copyright (C) 2010 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_SINL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare sinl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  SINL_LIBM=
+  AC_CACHE_CHECK([whether sinl() can be used without linking with libm],
+    [gl_cv_func_sinl_no_libm],
+    [
+      AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                   # define __NO_MATH_INLINES 1 /* for glibc */
+                   #endif
+                   #include <math.h>
+                   long double x;],
+                  [return sinl (x) > 0.4;],
+        [gl_cv_func_sinl_no_libm=yes],
+        [gl_cv_func_sinl_no_libm=no])
+    ])
+  if test $gl_cv_func_sinl_no_libm = no; then
+    AC_CACHE_CHECK([whether sinl() can be used with libm],
+      [gl_cv_func_sinl_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                     # define __NO_MATH_INLINES 1 /* for glibc */
+                     #endif
+                     #include <math.h>
+                     long double x;],
+                    [return sinl (x) > 0.4;],
+          [gl_cv_func_sinl_in_libm=yes],
+          [gl_cv_func_sinl_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_sinl_in_libm = yes; then
+      SINL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_sinl_no_libm = yes \
+     || test $gl_cv_func_sinl_in_libm = yes; then
+    dnl Also check whether it's declared.
+    dnl MacOS X 10.3 has sinl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([sinl], , [HAVE_DECL_SINL=0], [#include <math.h>])
+  else
+    HAVE_DECL_SINL=0
+    HAVE_SINL=0
+    AC_LIBOBJ([sinl])
+    AC_LIBOBJ([sincosl])
+    AC_LIBOBJ([trigl])
+    AC_REQUIRE([gl_FUNC_ISNANL])
+    AC_REQUIRE([gl_FUNC_FLOOR])
+    AC_REQUIRE([gl_FUNC_FLOORL])
+    SINL_LIBM="$ISNANL_LIBM $FLOOR_LIBM $FLOORL_LIBM"
+  fi
+  AC_SUBST([SINL_LIBM])
+])
diff --git a/m4/sqrtl.m4 b/m4/sqrtl.m4
new file mode 100644 (file)
index 0000000..7a29f9a
--- /dev/null
@@ -0,0 +1,62 @@
+# sqrtl.m4 serial 1
+dnl Copyright (C) 2010 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_SQRTL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare sqrtl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  SQRTL_LIBM=
+  AC_CACHE_CHECK([whether sqrtl() can be used without linking with libm],
+    [gl_cv_func_sqrtl_no_libm],
+    [
+      AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                   # define __NO_MATH_INLINES 1 /* for glibc */
+                   #endif
+                   #include <math.h>
+                   long double x;],
+                  [return sqrtl (x) > 0.4;],
+        [gl_cv_func_sqrtl_no_libm=yes],
+        [gl_cv_func_sqrtl_no_libm=no])
+    ])
+  if test $gl_cv_func_sqrtl_no_libm = no; then
+    AC_CACHE_CHECK([whether sqrtl() can be used with libm],
+      [gl_cv_func_sqrtl_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                     # define __NO_MATH_INLINES 1 /* for glibc */
+                     #endif
+                     #include <math.h>
+                     long double x;],
+                    [return sqrtl (x) > 0.4;],
+          [gl_cv_func_sqrtl_in_libm=yes],
+          [gl_cv_func_sqrtl_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_sqrtl_in_libm = yes; then
+      SQRTL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_sqrtl_no_libm = yes \
+     || test $gl_cv_func_sqrtl_in_libm = yes; then
+    dnl Also check whether it's declared.
+    dnl MacOS X 10.3 has sqrtl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([sqrtl], , [HAVE_DECL_SQRTL=0], [#include <math.h>])
+  else
+    HAVE_DECL_SQRTL=0
+    HAVE_SQRTL=0
+    AC_LIBOBJ([sqrtl])
+    AC_REQUIRE([gl_FUNC_ISNANL])
+    AC_REQUIRE([gl_FUNC_FREXPL])
+    AC_REQUIRE([gl_FUNC_LDEXPL])
+    AC_REQUIRE([gl_FUNC_SQRT])
+    SQRTL_LIBM="$ISNANL_LIBM $FREXPL_LIBM $LDEXPL_LIBM $SQRT_LIBM"
+  fi
+  AC_SUBST([SQRTL_LIBM])
+])
diff --git a/m4/tanl.m4 b/m4/tanl.m4
new file mode 100644 (file)
index 0000000..8f4ee10
--- /dev/null
@@ -0,0 +1,62 @@
+# tanl.m4 serial 1
+dnl Copyright (C) 2010 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_TANL],
+[
+  AC_REQUIRE([gl_MATH_H_DEFAULTS])
+  dnl Persuade glibc <math.h> to declare tanl().
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  TANL_LIBM=
+  AC_CACHE_CHECK([whether tanl() can be used without linking with libm],
+    [gl_cv_func_tanl_no_libm],
+    [
+      AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                   # define __NO_MATH_INLINES 1 /* for glibc */
+                   #endif
+                   #include <math.h>
+                   long double x;],
+                  [return tanl (x) > 0.4;],
+        [gl_cv_func_tanl_no_libm=yes],
+        [gl_cv_func_tanl_no_libm=no])
+    ])
+  if test $gl_cv_func_tanl_no_libm = no; then
+    AC_CACHE_CHECK([whether tanl() can be used with libm],
+      [gl_cv_func_tanl_in_libm],
+      [
+        save_LIBS="$LIBS"
+        LIBS="$LIBS -lm"
+        AC_TRY_LINK([#ifndef __NO_MATH_INLINES
+                     # define __NO_MATH_INLINES 1 /* for glibc */
+                     #endif
+                     #include <math.h>
+                     long double x;],
+                    [return tanl (x) > 0.4;],
+          [gl_cv_func_tanl_in_libm=yes],
+          [gl_cv_func_tanl_in_libm=no])
+        LIBS="$save_LIBS"
+      ])
+    if test $gl_cv_func_tanl_in_libm = yes; then
+      TANL_LIBM=-lm
+    fi
+  fi
+  if test $gl_cv_func_tanl_no_libm = yes \
+     || test $gl_cv_func_tanl_in_libm = yes; then
+    dnl Also check whether it's declared.
+    dnl MacOS X 10.3 has tanl() in libc but doesn't declare it in <math.h>.
+    AC_CHECK_DECL([tanl], , [HAVE_DECL_TANL=0], [#include <math.h>])
+  else
+    HAVE_DECL_TANL=0
+    HAVE_TANL=0
+    AC_LIBOBJ([tanl])
+    AC_LIBOBJ([trigl])
+    AC_REQUIRE([gl_FUNC_ISNANL])
+    AC_REQUIRE([gl_FUNC_FLOOR])
+    AC_REQUIRE([gl_FUNC_FLOORL])
+    TANL_LIBM="$ISNANL_LIBM $FLOOR_LIBM $FLOORL_LIBM"
+  fi
+  AC_SUBST([TANL_LIBM])
+])
diff --git a/modules/acosl b/modules/acosl
new file mode 100644 (file)
index 0000000..3c49196
--- /dev/null
@@ -0,0 +1,30 @@
+Description:
+acosl() function: inverse cosine function with long double argument.
+
+Files:
+lib/acosl.c
+m4/acosl.m4
+
+Depends-on:
+math
+extensions
+asinl
+sqrtl
+
+configure.ac:
+gl_FUNC_ACOSL
+gl_MATH_MODULE_INDICATOR([acosl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(ACOSL_LIBM)
+
+License:
+GPL
+
+Maintainer:
+Paolo Bonzini
diff --git a/modules/asinl b/modules/asinl
new file mode 100644 (file)
index 0000000..7f254ab
--- /dev/null
@@ -0,0 +1,29 @@
+Description:
+asinl() function: inverse sine function with long double argument.
+
+Files:
+lib/asinl.c
+m4/asinl.m4
+
+Depends-on:
+math
+extensions
+sqrtl
+
+configure.ac:
+gl_FUNC_ASINL
+gl_MATH_MODULE_INDICATOR([asinl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(ASINL_LIBM)
+
+License:
+GPL
+
+Maintainer:
+Paolo Bonzini
diff --git a/modules/atanl b/modules/atanl
new file mode 100644 (file)
index 0000000..f6ba1b8
--- /dev/null
@@ -0,0 +1,29 @@
+Description:
+atanl() function: inverse tangent function with long double argument.
+
+Files:
+lib/atanl.c
+m4/atanl.m4
+
+Depends-on:
+math
+extensions
+isnanl
+
+configure.ac:
+gl_FUNC_ATANL
+gl_MATH_MODULE_INDICATOR([atanl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(ATANL_LIBM)
+
+License:
+GPL
+
+Maintainer:
+Paolo Bonzini
diff --git a/modules/cosl b/modules/cosl
new file mode 100644 (file)
index 0000000..88ebf9c
--- /dev/null
@@ -0,0 +1,35 @@
+Description:
+cosl() function: cosine function with long double argument.
+
+Files:
+lib/cosl.c
+lib/trigl.h
+lib/sincosl.c
+lib/trigl.c
+m4/cosl.m4
+
+Depends-on:
+math
+extensions
+float
+isnanl
+floor
+floorl
+
+configure.ac:
+gl_FUNC_COSL
+gl_MATH_MODULE_INDICATOR([cosl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(ACOSL_LIBM)
+
+License:
+GPL
+
+Maintainer:
+Paolo Bonzini
diff --git a/modules/expl b/modules/expl
new file mode 100644 (file)
index 0000000..3870440
--- /dev/null
@@ -0,0 +1,30 @@
+Description:
+expl() function: exponential function with long double argument.
+
+Files:
+lib/expl.c
+m4/expl.m4
+
+Depends-on:
+math
+extensions
+float
+floorl
+
+configure.ac:
+gl_FUNC_EXPL
+gl_MATH_MODULE_INDICATOR([expl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(EXPL_LIBM)
+
+License:
+GPL
+
+Maintainer:
+Paolo Bonzini
diff --git a/modules/logl b/modules/logl
new file mode 100644 (file)
index 0000000..c9b7237
--- /dev/null
@@ -0,0 +1,31 @@
+Description:
+logl() function: logarithm with long double argument.
+
+Files:
+lib/logl.c
+m4/logl.m4
+
+Depends-on:
+math
+extensions
+frexpl
+isnanl
+floorl
+
+configure.ac:
+gl_FUNC_LOGL
+gl_MATH_MODULE_INDICATOR([logl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(LOGL_LIBM)
+
+License:
+GPL
+
+Maintainer:
+Paolo Bonzini
index dda67df..f7173bf 100644 (file)
@@ -25,8 +25,13 @@ math.h: math.in.h $(LINK_WARNING_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
          sed -e 's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MATH_H)|g' \
+             -e 's|@''GNULIB_ACOSL''@|$(GNULIB_ACOSL)|g' \
+             -e 's|@''GNULIB_ASINL''@|$(GNULIB_ASINL)|g' \
+             -e 's|@''GNULIB_ATANL''@|$(GNULIB_ATANL)|g' \
              -e 's|@''GNULIB_CEILF''@|$(GNULIB_CEILF)|g' \
              -e 's|@''GNULIB_CEILL''@|$(GNULIB_CEILL)|g' \
+             -e 's|@''GNULIB_COSL''@|$(GNULIB_COSL)|g' \
+             -e 's|@''GNULIB_EXPL''@|$(GNULIB_EXPL)|g' \
              -e 's|@''GNULIB_FLOORF''@|$(GNULIB_FLOORF)|g' \
              -e 's|@''GNULIB_FLOORL''@|$(GNULIB_FLOORL)|g' \
              -e 's|@''GNULIB_FREXP''@|$(GNULIB_FREXP)|g' \
@@ -38,17 +43,29 @@ math.h: math.in.h $(LINK_WARNING_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
              -e 's|@''GNULIB_ISNAND''@|$(GNULIB_ISNAND)|g' \
              -e 's|@''GNULIB_ISNANL''@|$(GNULIB_ISNANL)|g' \
              -e 's|@''GNULIB_LDEXPL''@|$(GNULIB_LDEXPL)|g' \
-             -e 's|@''GNULIB_MATHL''@|$(GNULIB_MATHL)|g' \
+             -e 's|@''GNULIB_LOGL''@|$(GNULIB_LOGL)|g' \
              -e 's|@''GNULIB_ROUND''@|$(GNULIB_ROUND)|g' \
              -e 's|@''GNULIB_ROUNDF''@|$(GNULIB_ROUNDF)|g' \
              -e 's|@''GNULIB_ROUNDL''@|$(GNULIB_ROUNDL)|g' \
              -e 's|@''GNULIB_SIGNBIT''@|$(GNULIB_SIGNBIT)|g' \
+             -e 's|@''GNULIB_SINL''@|$(GNULIB_SINL)|g' \
+             -e 's|@''GNULIB_SQRTL''@|$(GNULIB_SQRTL)|g' \
+             -e 's|@''GNULIB_TANL''@|$(GNULIB_TANL)|g' \
              -e 's|@''GNULIB_TRUNC''@|$(GNULIB_TRUNC)|g' \
              -e 's|@''GNULIB_TRUNCF''@|$(GNULIB_TRUNCF)|g' \
              -e 's|@''GNULIB_TRUNCL''@|$(GNULIB_TRUNCL)|g' \
+             -e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \
+             -e 's|@''HAVE_ASINL''@|$(HAVE_ASINL)|g' \
+             -e 's|@''HAVE_ATANL''@|$(HAVE_ATANL)|g' \
+             -e 's|@''HAVE_COSL''@|$(HAVE_COSL)|g' \
+             -e 's|@''HAVE_EXPL''@|$(HAVE_EXPL)|g' \
              -e 's|@''HAVE_ISNANF''@|$(HAVE_ISNANF)|g' \
              -e 's|@''HAVE_ISNAND''@|$(HAVE_ISNAND)|g' \
              -e 's|@''HAVE_ISNANL''@|$(HAVE_ISNANL)|g' \
+             -e 's|@''HAVE_LOGL''@|$(HAVE_LOGL)|g' \
+             -e 's|@''HAVE_SINL''@|$(HAVE_SINL)|g' \
+             -e 's|@''HAVE_SQRTL''@|$(HAVE_SQRTL)|g' \
+             -e 's|@''HAVE_TANL''@|$(HAVE_TANL)|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' \
index 0b3018e..ac0a27e 100644 (file)
@@ -2,35 +2,35 @@ Description:
 C99 functions for transcendental functions with long double arguments.
 
 Files:
-lib/acosl.c
-lib/asinl.c
-lib/atanl.c
-lib/cosl.c
-lib/expl.c
-lib/logl.c
-lib/sincosl.c
-lib/sinl.c
-lib/sqrtl.c
-lib/tanl.c
-lib/trigl.c
-lib/trigl.h
-m4/mathl.m4
 
 Depends-on:
-float
-math
-frexpl
-isnanl
-ldexpl
 floorl
 ceill
+acosl
+asinl
+atanl
+cosl
+expl
+logl
+sinl
+sqrtl
+tanl
 
 configure.ac:
-gl_FUNC_LONG_DOUBLE_MATH
-gl_MATH_MODULE_INDICATOR([mathl])
+AC_REQUIRE([gl_FUNC_FLOORL])
+AC_REQUIRE([gl_FUNC_CEILL])
+AC_REQUIRE([gl_FUNC_ACOSL])
+AC_REQUIRE([gl_FUNC_ASINL])
+AC_REQUIRE([gl_FUNC_ATANL])
+AC_REQUIRE([gl_FUNC_COSL])
+AC_REQUIRE([gl_FUNC_EXPL])
+AC_REQUIRE([gl_FUNC_LOGL])
+AC_REQUIRE([gl_FUNC_SINL])
+AC_REQUIRE([gl_FUNC_SQRTL])
+AC_REQUIRE([gl_FUNC_TANL])
+LIBS="$LIBS $FLOORL_LIBM $CEILL_LIBM $ACOSL_LIBM $ASINL_LIBM $ATANL_LIBM $ACOSL_LIBM $EXPL_LIBM $LOGL_LIBM $SINL_LIBM $SQRTL_LIBM $TANL_LIBM"
 
 Makefile.am:
-noinst_HEADERS += trigl.h trigl.c sincosl.c
 
 Include:
 <math.h>
diff --git a/modules/sinl b/modules/sinl
new file mode 100644 (file)
index 0000000..67621ed
--- /dev/null
@@ -0,0 +1,35 @@
+Description:
+sinl() function: sine function with long double argument.
+
+Files:
+lib/sinl.c
+lib/trigl.h
+lib/sincosl.c
+lib/trigl.c
+m4/sinl.m4
+
+Depends-on:
+math
+extensions
+float
+isnanl
+floor
+floorl
+
+configure.ac:
+gl_FUNC_SINL
+gl_MATH_MODULE_INDICATOR([sinl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(SINL_LIBM)
+
+License:
+GPL
+
+Maintainer:
+Paolo Bonzini
diff --git a/modules/sqrtl b/modules/sqrtl
new file mode 100644 (file)
index 0000000..d488666
--- /dev/null
@@ -0,0 +1,33 @@
+Description:
+sqrtl() function: square root with long double argument.
+
+Files:
+lib/sqrtl.c
+m4/sqrtl.m4
+
+Depends-on:
+math
+extensions
+float
+isnanl
+frexpl
+ldexpl
+sqrt
+
+configure.ac:
+gl_FUNC_SQRTL
+gl_MATH_MODULE_INDICATOR([sqrtl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(SQRTL_LIBM)
+
+License:
+GPL
+
+Maintainer:
+Paolo Bonzini
diff --git a/modules/tanl b/modules/tanl
new file mode 100644 (file)
index 0000000..b00fd1b
--- /dev/null
@@ -0,0 +1,34 @@
+Description:
+tanl() function: tangent function with long double argument.
+
+Files:
+lib/tanl.c
+lib/trigl.h
+lib/trigl.c
+m4/tanl.m4
+
+Depends-on:
+math
+extensions
+float
+isnanl
+floor
+floorl
+
+configure.ac:
+gl_FUNC_TANL
+gl_MATH_MODULE_INDICATOR([tanl])
+
+Makefile.am:
+
+Include:
+<math.h>
+
+Link:
+$(TANL_LIBM)
+
+License:
+GPL
+
+Maintainer:
+Paolo Bonzini