changeset 8359:d8d194025f40

Provide the option to declare the mathl functions also when the 'mathl' module is not used. Needed for MacOS X.
author Bruno Haible <bruno@clisp.org>
date Wed, 07 Mar 2007 01:12:01 +0000
parents 02600ffa7298
children 31ccbcac6809
files lib/math_.h m4/math_h.m4 modules/math
diffstat 3 files changed, 67 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/lib/math_.h
+++ b/lib/math_.h
@@ -30,9 +30,10 @@
 #endif
 
 
-#if @GNULIB_MATHL@
+#if @GNULIB_MATHL@ || !@HAVE_DECL_ACOSL@
 extern long double acosl (long double x);
-#elif defined GNULIB_POSIXCHECK
+#endif
+#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
 # undef acosl
 # define acosl(x) \
     (GL_LINK_WARNING ("acosl is unportable - " \
@@ -40,9 +41,10 @@
      acosl (x))
 #endif
 
-#if @GNULIB_MATHL@
+#if @GNULIB_MATHL@ || !@HAVE_DECL_ASINL@
 extern long double asinl (long double x);
-#elif defined GNULIB_POSIXCHECK
+#endif
+#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
 # undef asinl
 # define asinl(x) \
     (GL_LINK_WARNING ("asinl is unportable - " \
@@ -50,9 +52,10 @@
      asinl (x))
 #endif
 
-#if @GNULIB_MATHL@
+#if @GNULIB_MATHL@ || !@HAVE_DECL_ATANL@
 extern long double atanl (long double x);
-#elif defined GNULIB_POSIXCHECK
+#endif
+#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
 # undef atanl
 # define atanl(x) \
     (GL_LINK_WARNING ("atanl is unportable - " \
@@ -60,9 +63,10 @@
      atanl (x))
 #endif
 
-#if @GNULIB_MATHL@
+#if @GNULIB_MATHL@ || !@HAVE_DECL_CEILL@
 extern long double ceill (long double x);
-#elif defined GNULIB_POSIXCHECK
+#endif
+#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
 # undef ceill
 # define ceill(x) \
     (GL_LINK_WARNING ("ceill is unportable - " \
@@ -70,9 +74,10 @@
      ceill (x))
 #endif
 
-#if @GNULIB_MATHL@
+#if @GNULIB_MATHL@ || !@HAVE_DECL_COSL@
 extern long double cosl (long double x);
-#elif defined GNULIB_POSIXCHECK
+#endif
+#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
 # undef cosl
 # define cosl(x) \
     (GL_LINK_WARNING ("cosl is unportable - " \
@@ -80,9 +85,10 @@
      cosl (x))
 #endif
 
-#if @GNULIB_MATHL@
+#if @GNULIB_MATHL@ || !@HAVE_DECL_EXPL@
 extern long double expl (long double x);
-#elif defined GNULIB_POSIXCHECK
+#endif
+#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
 # undef expl
 # define expl(x) \
     (GL_LINK_WARNING ("expl is unportable - " \
@@ -90,9 +96,10 @@
      expl (x))
 #endif
 
-#if @GNULIB_MATHL@
+#if @GNULIB_MATHL@ || !@HAVE_DECL_FLOORL@
 extern long double floorl (long double x);
-#elif defined GNULIB_POSIXCHECK
+#endif
+#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
 # undef floorl
 # define floorl(x) \
     (GL_LINK_WARNING ("floorl is unportable - " \
@@ -100,9 +107,10 @@
      floorl (x))
 #endif
 
-#if @GNULIB_MATHL@
+#if @GNULIB_MATHL@ || !@HAVE_DECL_FREXPL@
 extern long double frexpl (long double x, int *exp);
-#elif defined GNULIB_POSIXCHECK
+#endif
+#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
 # undef frexpl
 # define frexpl(x,e) \
     (GL_LINK_WARNING ("frexpl is unportable - " \
@@ -110,9 +118,10 @@
      frexpl (x, e))
 #endif
 
-#if @GNULIB_MATHL@
+#if @GNULIB_MATHL@ || !@HAVE_DECL_LDEXPL@
 extern long double ldexpl (long double x, int exp);
-#elif defined GNULIB_POSIXCHECK
+#endif
+#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
 # undef ldexpl
 # define ldexpl(x,e) \
     (GL_LINK_WARNING ("ldexpl is unportable - " \
@@ -120,9 +129,10 @@
      ldexpl (x, e))
 #endif
 
-#if @GNULIB_MATHL@
+#if @GNULIB_MATHL@ || !@HAVE_DECL_LOGL@
 extern long double logl (long double x);
-#elif defined GNULIB_POSIXCHECK
+#endif
+#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
 # undef logl
 # define logl(x) \
     (GL_LINK_WARNING ("logl is unportable - " \
@@ -130,9 +140,10 @@
      logl (x))
 #endif
 
-#if @GNULIB_MATHL@
+#if @GNULIB_MATHL@ || !@HAVE_DECL_SINL@
 extern long double sinl (long double x);
-#elif defined GNULIB_POSIXCHECK
+#endif
+#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
 # undef sinl
 # define sinl(x) \
     (GL_LINK_WARNING ("sinl is unportable - " \
@@ -140,9 +151,10 @@
      sinl (x))
 #endif
 
-#if @GNULIB_MATHL@
+#if @GNULIB_MATHL@ || !@HAVE_DECL_SQRTL@
 extern long double sqrtl (long double x);
-#elif defined GNULIB_POSIXCHECK
+#endif
+#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
 # undef sqrtl
 # define sqrtl(x) \
     (GL_LINK_WARNING ("sqrtl is unportable - " \
@@ -150,9 +162,10 @@
      sqrtl (x))
 #endif
 
-#if @GNULIB_MATHL@
+#if @GNULIB_MATHL@ || !@HAVE_DECL_TANL@
 extern long double tanl (long double x);
-#elif defined GNULIB_POSIXCHECK
+#endif
+#if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
 # undef tanl
 # define tanl(x) \
     (GL_LINK_WARNING ("tanl is unportable - " \
--- a/m4/math_h.m4
+++ b/m4/math_h.m4
@@ -1,4 +1,4 @@
-# math_h.m4 serial 1
+# math_h.m4 serial 2
 dnl Copyright (C) 2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -22,4 +22,18 @@
 AC_DEFUN([gl_MATH_H_DEFAULTS],
 [
   GNULIB_MATHL=0; AC_SUBST([GNULIB_MATHL])
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_DECL_ACOSL=1;  AC_SUBST([HAVE_DECL_ACOSL])
+  HAVE_DECL_ASINL=1;  AC_SUBST([HAVE_DECL_ASINL])
+  HAVE_DECL_ATANL=1;  AC_SUBST([HAVE_DECL_ATANL])
+  HAVE_DECL_CEILL=1;  AC_SUBST([HAVE_DECL_CEILL])
+  HAVE_DECL_COSL=1;   AC_SUBST([HAVE_DECL_COSL])
+  HAVE_DECL_EXPL=1;   AC_SUBST([HAVE_DECL_EXPL])
+  HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL])
+  HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL])
+  HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL])
+  HAVE_DECL_LOGL=1;   AC_SUBST([HAVE_DECL_LOGL])
+  HAVE_DECL_SINL=1;   AC_SUBST([HAVE_DECL_SINL])
+  HAVE_DECL_SQRTL=1;  AC_SUBST([HAVE_DECL_SQRTL])
+  HAVE_DECL_TANL=1;   AC_SUBST([HAVE_DECL_TANL])
 ])
--- a/modules/math
+++ b/modules/math
@@ -22,6 +22,19 @@
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''ABSOLUTE_MATH_H''@|$(ABSOLUTE_MATH_H)|g' \
 	      -e 's|@''GNULIB_MATHL''@|$(GNULIB_MATHL)|g' \
+	      -e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \
+	      -e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \
+	      -e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \
+	      -e 's|@''HAVE_DECL_CEILL''@|$(HAVE_DECL_CEILL)|g' \
+	      -e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \
+	      -e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \
+	      -e 's|@''HAVE_DECL_FLOORL''@|$(HAVE_DECL_FLOORL)|g' \
+	      -e 's|@''HAVE_DECL_FREXPL''@|$(HAVE_DECL_FREXPL)|g' \
+	      -e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \
+	      -e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \
+	      -e 's|@''HAVE_DECL_SINL''@|$(HAVE_DECL_SINL)|g' \
+	      -e 's|@''HAVE_DECL_SQRTL''@|$(HAVE_DECL_SQRTL)|g' \
+	      -e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \
 	      -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
 	      < $(srcdir)/math_.h; \
 	} > $@-t