changeset 12752:73d9dd27dc41

New modules acosl, asinl, atanl, cosl, expl, logl, sinl, sqrtl, tanl.
author Bruno Haible <bruno@clisp.org>
date Mon, 18 Jan 2010 01:27:33 +0100
parents 78eebabdbcd9
children 33913ae888b2
files 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 m4/asinl.m4 m4/atanl.m4 m4/cosl.m4 m4/expl.m4 m4/logl.m4 m4/math_h.m4 m4/mathl.m4 m4/sinl.m4 m4/sqrtl.m4 m4/tanl.m4 modules/acosl modules/asinl modules/atanl modules/cosl modules/expl modules/logl modules/math modules/mathl modules/sinl modules/sqrtl modules/tanl
diffstat 38 files changed, 1057 insertions(+), 119 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,50 @@
+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.
--- a/doc/posix-functions/acosl.texi
+++ b/doc/posix-functions/acosl.texi
@@ -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
--- a/doc/posix-functions/asinl.texi
+++ b/doc/posix-functions/asinl.texi
@@ -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
--- a/doc/posix-functions/atanl.texi
+++ b/doc/posix-functions/atanl.texi
@@ -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
--- a/doc/posix-functions/cosl.texi
+++ b/doc/posix-functions/cosl.texi
@@ -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
--- a/doc/posix-functions/expl.texi
+++ b/doc/posix-functions/expl.texi
@@ -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
--- a/doc/posix-functions/logl.texi
+++ b/doc/posix-functions/logl.texi
@@ -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
--- a/doc/posix-functions/sinl.texi
+++ b/doc/posix-functions/sinl.texi
@@ -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
--- a/doc/posix-functions/sqrtl.texi
+++ b/doc/posix-functions/sqrtl.texi
@@ -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
--- a/doc/posix-functions/tanl.texi
+++ b/doc/posix-functions/tanl.texi
@@ -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
--- a/lib/cosl.c
+++ b/lib/cosl.c
@@ -50,10 +50,6 @@
  */
 
 #include "trigl.h"
-#ifdef HAVE_SINL
-#include "trigl.c"
-#include "sincosl.c"
-#endif
 
 long double cosl(long double x)
 {
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -118,10 +118,11 @@
 #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 @@
 #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 @@
 #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 @@
 #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 @@
 #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 @@
 #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 @@
 #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 @@
 #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 @@
 #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 - " \
--- a/lib/sincosl.c
+++ b/lib/sincosl.c
@@ -1,5 +1,5 @@
 /* Quad-precision floating point trigonometric functions on <-pi/4,pi/4>.
-   Copyright (C) 1999, 2006, 2007, 2009, 2010 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>
 
@@ -19,9 +19,10 @@
 #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]
--- a/lib/sinl.c
+++ b/lib/sinl.c
@@ -50,8 +50,6 @@
  */
 
 #include "trigl.h"
-#include "trigl.c"
-#include "sincosl.c"
 
 long double
 sinl (long double x)
--- a/lib/tanl.c
+++ b/lib/tanl.c
@@ -50,11 +50,6 @@
  */
 
 #include "trigl.h"
-#ifdef HAVE_SINL
-#ifdef HAVE_COSL
-#include "trigl.c"
-#endif
-#endif
 
 /*
  * ====================================================
@@ -120,7 +115,7 @@
   /* 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;
--- a/lib/trigl.c
+++ b/lib/trigl.c
@@ -1,5 +1,5 @@
 /* Quad-precision floating point argument reduction.
-   Copyright (C) 1999, 2007, 2009, 2010 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>
 
@@ -19,9 +19,10 @@
 #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[] = {
new file mode 100644
--- /dev/null
+++ b/m4/acosl.m4
@@ -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])
+])
new file mode 100644
--- /dev/null
+++ b/m4/asinl.m4
@@ -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])
+])
new file mode 100644
--- /dev/null
+++ b/m4/atanl.m4
@@ -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])
+])
new file mode 100644
--- /dev/null
+++ b/m4/cosl.m4
@@ -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])
+])
new file mode 100644
--- /dev/null
+++ b/m4/expl.m4
@@ -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])
+])
new file mode 100644
--- /dev/null
+++ b/m4/logl.m4
@@ -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])
+])
--- a/m4/math_h.m4
+++ b/m4/math_h.m4
@@ -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_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 @@
   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])
deleted file mode 100644
--- a/m4/mathl.m4
+++ /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)
-
-])
new file mode 100644
--- /dev/null
+++ b/m4/sinl.m4
@@ -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])
+])
new file mode 100644
--- /dev/null
+++ b/m4/sqrtl.m4
@@ -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])
+])
new file mode 100644
--- /dev/null
+++ b/m4/tanl.m4
@@ -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])
+])
new file mode 100644
--- /dev/null
+++ b/modules/acosl
@@ -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
new file mode 100644
--- /dev/null
+++ b/modules/asinl
@@ -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
new file mode 100644
--- /dev/null
+++ b/modules/atanl
@@ -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
new file mode 100644
--- /dev/null
+++ b/modules/cosl
@@ -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
new file mode 100644
--- /dev/null
+++ b/modules/expl
@@ -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
new file mode 100644
--- /dev/null
+++ b/modules/logl
@@ -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
--- a/modules/math
+++ b/modules/math
@@ -25,8 +25,13 @@
 	  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 @@
 	      -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' \
--- a/modules/mathl
+++ b/modules/mathl
@@ -2,35 +2,35 @@
 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>
new file mode 100644
--- /dev/null
+++ b/modules/sinl
@@ -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
new file mode 100644
--- /dev/null
+++ b/modules/sqrtl
@@ -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
new file mode 100644
--- /dev/null
+++ b/modules/tanl
@@ -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