summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog38
-rw-r--r--m4/mathfunc.m457
-rw-r--r--m4/sqrt.m44
-rw-r--r--modules/acos2
-rw-r--r--modules/asin2
-rw-r--r--modules/atan2
-rw-r--r--modules/atan22
-rw-r--r--modules/cbrt2
-rw-r--r--modules/copysign2
-rw-r--r--modules/cos2
-rw-r--r--modules/cosh2
-rw-r--r--modules/erf2
-rw-r--r--modules/erfc2
-rw-r--r--modules/exp2
-rw-r--r--modules/fmod2
-rw-r--r--modules/hypot2
-rw-r--r--modules/j02
-rw-r--r--modules/j12
-rw-r--r--modules/jn2
-rw-r--r--modules/lgamma2
-rw-r--r--modules/log2
-rw-r--r--modules/log102
-rw-r--r--modules/log1p2
-rw-r--r--modules/pow2
-rw-r--r--modules/remainder2
-rw-r--r--modules/sin2
-rw-r--r--modules/sinh2
-rw-r--r--modules/tan2
-rw-r--r--modules/tanh2
-rw-r--r--modules/y02
-rw-r--r--modules/y12
-rw-r--r--modules/yn2
32 files changed, 125 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index f94e401a92..335da1a723 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,43 @@
2010-01-31 Bruno Haible <bruno@clisp.org>
+ Perform the same test for many <math.h> functions.
+ * m4/mathfunc.m4 (gl_COMMON_DOUBLE_MATHFUNC,
+ gl_COMMON_DOUBLE_MATHFUNC_TEST): New macros.
+ * m4/sqrt.m4 (gl_FUNC_SQRT): Invoke gl_COMMON_DOUBLE_MATHFUNC instead
+ of gl_MATHFUNC.
+ * modules/acos (configure.ac): Likewise.
+ * modules/asin (configure.ac): Likewise.
+ * modules/atan (configure.ac): Likewise.
+ * modules/atan2 (configure.ac): Likewise.
+ * modules/cbrt (configure.ac): Likewise.
+ * modules/copysign (configure.ac): Likewise.
+ * modules/cos (configure.ac): Likewise.
+ * modules/cosh (configure.ac): Likewise.
+ * modules/erf (configure.ac): Likewise.
+ * modules/erfc (configure.ac): Likewise.
+ * modules/exp (configure.ac): Likewise.
+ * modules/fmod (configure.ac): Likewise.
+ * modules/hypot (configure.ac): Likewise.
+ * modules/j0 (configure.ac): Likewise.
+ * modules/j1 (configure.ac): Likewise.
+ * modules/jn (configure.ac): Likewise.
+ * modules/lgamma (configure.ac): Likewise.
+ * modules/log (configure.ac): Likewise.
+ * modules/log10 (configure.ac): Likewise.
+ * modules/log1p (configure.ac): Likewise.
+ * modules/pow (configure.ac): Likewise.
+ * modules/remainder (configure.ac): Likewise.
+ * modules/sin (configure.ac): Likewise.
+ * modules/sinh (configure.ac): Likewise.
+ * modules/tan (configure.ac): Likewise.
+ * modules/tanh (configure.ac): Likewise.
+ * modules/y0 (configure.ac): Likewise.
+ * modules/y1 (configure.ac): Likewise.
+ * modules/yn (configure.ac): Likewise.
+ Suggested by Paolo Bonzini.
+
+2010-01-31 Bruno Haible <bruno@clisp.org>
+
* m4/getline.m4 (gl_FUNC_GETLINE): Add comment about REPLACE_GETLINE.
2010-01-31 Bruno Haible <bruno@clisp.org>
diff --git a/m4/mathfunc.m4 b/m4/mathfunc.m4
index 5e79d4581a..d09aacaa32 100644
--- a/m4/mathfunc.m4
+++ b/m4/mathfunc.m4
@@ -1,4 +1,4 @@
-# mathfunc.m4 serial 2
+# mathfunc.m4 serial 3
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,
@@ -58,3 +58,58 @@ AC_DEFUN([gl_MATHFUNC],
m4_popdef([FUNC])
m4_popdef([func])
])
+
+# gl_COMMON_DOUBLE_MATHFUNC(FUNC)
+# -------------------------------
+# tests whether the function FUNC is available in libc or libm.
+# It sets FUNC_LIBM to empty or "-lm" accordingly.
+# FUNC must be one of the following functions, that are present on all systems
+# and provided by libm on all systems except MacOS X, BeOS, Haiku:
+# acos asin atan atan2 cbrt copysign cos cosh erf erfc exp fmod hypot j0 j1
+# jn lgamma log log10 log1p pow remainder sin sinh sqrt tan tanh y0 y1 yn
+
+AC_DEFUN([gl_COMMON_DOUBLE_MATHFUNC],
+[
+ AC_REQUIRE([gl_COMMON_DOUBLE_MATHFUNC_TEST])
+ m4_pushdef([FUNC], [translit([$1],[abcdefghijklmnopqrstuvwxyz],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ])])
+ FUNC[]_LIBM="$POW_LIBM"
+ AC_SUBST(FUNC[_LIBM])
+ m4_popdef([FUNC])
+])
+
+AC_DEFUN([gl_COMMON_DOUBLE_MATHFUNC_TEST],
+[
+ dnl We could use any of the following:
+ dnl gl_MATHFUNC([acos], [double], [(double)])
+ dnl gl_MATHFUNC([asin], [double], [(double)])
+ dnl gl_MATHFUNC([atan], [double], [(double)])
+ dnl gl_MATHFUNC([atan2], [double], [(double, double)])
+ dnl gl_MATHFUNC([cbrt], [double], [(double)])
+ dnl gl_MATHFUNC([copysign], [double], [(double, double)])
+ dnl gl_MATHFUNC([cos], [double], [(double)])
+ dnl gl_MATHFUNC([cosh], [double], [(double)])
+ dnl gl_MATHFUNC([erf], [double], [(double)])
+ dnl gl_MATHFUNC([erfc], [double], [(double)])
+ dnl gl_MATHFUNC([exp], [double], [(double)])
+ dnl gl_MATHFUNC([fmod], [double], [(double, double)])
+ dnl gl_MATHFUNC([hypot], [double], [(double, double)])
+ dnl gl_MATHFUNC([j0], [double], [(double)])
+ dnl gl_MATHFUNC([j1], [double], [(double)])
+ dnl gl_MATHFUNC([jn], [double], [(int, double)])
+ dnl gl_MATHFUNC([lgamma], [double], [(double)])
+ dnl gl_MATHFUNC([log], [double], [(double)])
+ dnl gl_MATHFUNC([log10], [double], [(double)])
+ dnl gl_MATHFUNC([log1p], [double], [(double)])
+ dnl gl_MATHFUNC([pow], [double], [(double, double)])
+ dnl gl_MATHFUNC([remainder], [double], [(double, double)])
+ dnl gl_MATHFUNC([sin], [double], [(double)])
+ dnl gl_MATHFUNC([sinh], [double], [(double)])
+ dnl gl_MATHFUNC([sqrt], [double], [(double)])
+ dnl gl_MATHFUNC([tan], [double], [(double)])
+ dnl gl_MATHFUNC([tanh], [double], [(double)])
+ dnl gl_MATHFUNC([y0], [double], [(double)])
+ dnl gl_MATHFUNC([y1], [double], [(double)])
+ dnl gl_MATHFUNC([yn], [double], [(int, double)])
+ gl_MATHFUNC([pow], [double], [(double, double)])
+])
diff --git a/m4/sqrt.m4 b/m4/sqrt.m4
index d87648cc9f..dd87ed24e3 100644
--- a/m4/sqrt.m4
+++ b/m4/sqrt.m4
@@ -1,4 +1,4 @@
-# sqrt.m4 serial 2
+# sqrt.m4 serial 3
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,
@@ -6,5 +6,5 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_SQRT],
[
- gl_MATHFUNC([sqrt], [double], [(double)])
+ gl_COMMON_DOUBLE_MATHFUNC([sqrt])
])
diff --git a/modules/acos b/modules/acos
index 8f03317c38..cceee873c7 100644
--- a/modules/acos
+++ b/modules/acos
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([acos], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([acos])
Makefile.am:
diff --git a/modules/asin b/modules/asin
index 5bbef73a0c..e6c496bc8f 100644
--- a/modules/asin
+++ b/modules/asin
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([asin], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([asin])
Makefile.am:
diff --git a/modules/atan b/modules/atan
index fd1abe5efc..9c5960194d 100644
--- a/modules/atan
+++ b/modules/atan
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([atan], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([atan])
Makefile.am:
diff --git a/modules/atan2 b/modules/atan2
index 22820a1f04..877cc6bd2f 100644
--- a/modules/atan2
+++ b/modules/atan2
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([atan2], [double], [(double, double)])
+gl_COMMON_DOUBLE_MATHFUNC([atan2])
Makefile.am:
diff --git a/modules/cbrt b/modules/cbrt
index bcfb2936e0..fe015ee05c 100644
--- a/modules/cbrt
+++ b/modules/cbrt
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([cbrt], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([cbrt])
Makefile.am:
diff --git a/modules/copysign b/modules/copysign
index 5318e80271..c63280655a 100644
--- a/modules/copysign
+++ b/modules/copysign
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([copysign], [double], [(double, double)])
+gl_COMMON_DOUBLE_MATHFUNC([copysign])
Makefile.am:
diff --git a/modules/cos b/modules/cos
index 5ed327d42e..eae9a4d28e 100644
--- a/modules/cos
+++ b/modules/cos
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([cos], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([cos])
Makefile.am:
diff --git a/modules/cosh b/modules/cosh
index efaee3a03b..4fd5c3a904 100644
--- a/modules/cosh
+++ b/modules/cosh
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([cosh], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([cosh])
Makefile.am:
diff --git a/modules/erf b/modules/erf
index 02243bdc72..551dddb3b8 100644
--- a/modules/erf
+++ b/modules/erf
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([erf], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([erf])
Makefile.am:
diff --git a/modules/erfc b/modules/erfc
index 5f93d8006d..d891e92771 100644
--- a/modules/erfc
+++ b/modules/erfc
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([erfc], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([erfc])
Makefile.am:
diff --git a/modules/exp b/modules/exp
index 6a7a6854e9..f90548a00a 100644
--- a/modules/exp
+++ b/modules/exp
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([exp], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([exp])
Makefile.am:
diff --git a/modules/fmod b/modules/fmod
index 43997d8b25..ae82f4b11b 100644
--- a/modules/fmod
+++ b/modules/fmod
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([fmod], [double], [(double, double)])
+gl_COMMON_DOUBLE_MATHFUNC([fmod])
Makefile.am:
diff --git a/modules/hypot b/modules/hypot
index 2c3f66ff2b..fc13752cec 100644
--- a/modules/hypot
+++ b/modules/hypot
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([hypot], [double], [(double, double)])
+gl_COMMON_DOUBLE_MATHFUNC([hypot])
Makefile.am:
diff --git a/modules/j0 b/modules/j0
index 1dc9d44dd7..b06d76df07 100644
--- a/modules/j0
+++ b/modules/j0
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([j0], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([j0])
Makefile.am:
diff --git a/modules/j1 b/modules/j1
index d4e0b3cbe0..9c18914214 100644
--- a/modules/j1
+++ b/modules/j1
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([j1], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([j1])
Makefile.am:
diff --git a/modules/jn b/modules/jn
index ef8b418762..adcc9b1aae 100644
--- a/modules/jn
+++ b/modules/jn
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([jn], [double], [(int, double)])
+gl_COMMON_DOUBLE_MATHFUNC([jn])
Makefile.am:
diff --git a/modules/lgamma b/modules/lgamma
index 40cc49c323..81d1704e3a 100644
--- a/modules/lgamma
+++ b/modules/lgamma
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([lgamma], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([lgamma])
Makefile.am:
diff --git a/modules/log b/modules/log
index 95279699fa..cbee37bc89 100644
--- a/modules/log
+++ b/modules/log
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([log], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([log])
Makefile.am:
diff --git a/modules/log10 b/modules/log10
index bb857a277f..a0b4c29296 100644
--- a/modules/log10
+++ b/modules/log10
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([log10], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([log10])
Makefile.am:
diff --git a/modules/log1p b/modules/log1p
index 6b387e2060..955893b73e 100644
--- a/modules/log1p
+++ b/modules/log1p
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([log1p], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([log1p])
Makefile.am:
diff --git a/modules/pow b/modules/pow
index dbcc10c71e..dec50d1bc2 100644
--- a/modules/pow
+++ b/modules/pow
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([pow], [double], [(double, double)])
+gl_COMMON_DOUBLE_MATHFUNC([pow])
Makefile.am:
diff --git a/modules/remainder b/modules/remainder
index 9d25419f62..36d75bdc16 100644
--- a/modules/remainder
+++ b/modules/remainder
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([remainder], [double], [(double, double)])
+gl_COMMON_DOUBLE_MATHFUNC([remainder])
Makefile.am:
diff --git a/modules/sin b/modules/sin
index 87ed8e6632..ba5e92db75 100644
--- a/modules/sin
+++ b/modules/sin
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([sin], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([sin])
Makefile.am:
diff --git a/modules/sinh b/modules/sinh
index ffcef67d72..d02ef56d25 100644
--- a/modules/sinh
+++ b/modules/sinh
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([sinh], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([sinh])
Makefile.am:
diff --git a/modules/tan b/modules/tan
index 6ec8a587f9..4f14961fa1 100644
--- a/modules/tan
+++ b/modules/tan
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([tan], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([tan])
Makefile.am:
diff --git a/modules/tanh b/modules/tanh
index c7f078943f..6969caf53f 100644
--- a/modules/tanh
+++ b/modules/tanh
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([tanh], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([tanh])
Makefile.am:
diff --git a/modules/y0 b/modules/y0
index de188af1c3..0c0ea34d57 100644
--- a/modules/y0
+++ b/modules/y0
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([y0], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([y0])
Makefile.am:
diff --git a/modules/y1 b/modules/y1
index dbe884d48e..e5ae84f2db 100644
--- a/modules/y1
+++ b/modules/y1
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([y1], [double], [(double)])
+gl_COMMON_DOUBLE_MATHFUNC([y1])
Makefile.am:
diff --git a/modules/yn b/modules/yn
index 63d05f6472..8db1308494 100644
--- a/modules/yn
+++ b/modules/yn
@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
-gl_MATHFUNC([yn], [double], [(int, double)])
+gl_COMMON_DOUBLE_MATHFUNC([yn])
Makefile.am: