Commit a5b55005 authored by Bruno Haible's avatar Bruno Haible

Perform the same test for many <math.h> functions.

parent 5a390fd2
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.
# 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)])
])
# 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])
])
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([acos], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([acos])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([asin], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([asin])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([atan], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([atan])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([atan2], [double], [(double, double)])
gl_COMMON_DOUBLE_MATHFUNC([atan2])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([cbrt], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([cbrt])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([copysign], [double], [(double, double)])
gl_COMMON_DOUBLE_MATHFUNC([copysign])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([cos], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([cos])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([cosh], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([cosh])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([erf], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([erf])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([erfc], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([erfc])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([exp], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([exp])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([fmod], [double], [(double, double)])
gl_COMMON_DOUBLE_MATHFUNC([fmod])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([hypot], [double], [(double, double)])
gl_COMMON_DOUBLE_MATHFUNC([hypot])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([j0], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([j0])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([j1], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([j1])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([jn], [double], [(int, double)])
gl_COMMON_DOUBLE_MATHFUNC([jn])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([lgamma], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([lgamma])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([log], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([log])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([log10], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([log10])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([log1p], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([log1p])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([pow], [double], [(double, double)])
gl_COMMON_DOUBLE_MATHFUNC([pow])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([remainder], [double], [(double, double)])
gl_COMMON_DOUBLE_MATHFUNC([remainder])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([sin], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([sin])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([sinh], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([sinh])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([tan], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([tan])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([tanh], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([tanh])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([y0], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([y0])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([y1], [double], [(double)])
gl_COMMON_DOUBLE_MATHFUNC([y1])
Makefile.am:
......
......@@ -7,7 +7,7 @@ m4/mathfunc.m4
Depends-on:
configure.ac:
gl_MATHFUNC([yn], [double], [(int, double)])
gl_COMMON_DOUBLE_MATHFUNC([yn])
Makefile.am:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment