From a5b5500500ba4d6aaa9a1b3bb214f6917dc1ac3c Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 31 Jan 2010 19:40:17 +0100 Subject: [PATCH] Perform the same test for many functions. --- ChangeLog | 38 +++++++++++++++++++++++++++++++++++++ m4/mathfunc.m4 | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- m4/sqrt.m4 | 4 ++-- modules/acos | 2 +- modules/asin | 2 +- modules/atan | 2 +- modules/atan2 | 2 +- modules/cbrt | 2 +- modules/copysign | 2 +- modules/cos | 2 +- modules/cosh | 2 +- modules/erf | 2 +- modules/erfc | 2 +- modules/exp | 2 +- modules/fmod | 2 +- modules/hypot | 2 +- modules/j0 | 2 +- modules/j1 | 2 +- modules/jn | 2 +- modules/lgamma | 2 +- modules/log | 2 +- modules/log10 | 2 +- modules/log1p | 2 +- modules/pow | 2 +- modules/remainder | 2 +- modules/sin | 2 +- modules/sinh | 2 +- modules/tan | 2 +- modules/tanh | 2 +- modules/y0 | 2 +- modules/y1 | 2 +- modules/yn | 2 +- 32 files changed, 125 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index f94e401a9..335da1a72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,43 @@ 2010-01-31 Bruno Haible + Perform the same test for many 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 + * m4/getline.m4 (gl_FUNC_GETLINE): Add comment about REPLACE_GETLINE. 2010-01-31 Bruno Haible diff --git a/m4/mathfunc.m4 b/m4/mathfunc.m4 index 5e79d4581..d09aacaa3 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 d87648cc9..dd87ed24e 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 8f03317c3..cceee873c 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 5bbef73a0..e6c496bc8 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 fd1abe5ef..9c5960194 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 22820a1f0..877cc6bd2 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 bcfb2936e..fe015ee05 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 5318e8027..c63280655 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 5ed327d42..eae9a4d28 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 efaee3a03..4fd5c3a90 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 02243bdc7..551dddb3b 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 5f93d8006..d891e9277 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 6a7a6854e..f90548a00 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 43997d8b2..ae82f4b11 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 2c3f66ff2..fc13752ce 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 1dc9d44dd..b06d76df0 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 d4e0b3cbe..9c1891421 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 ef8b41876..adcc9b1aa 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 40cc49c32..81d1704e3 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 95279699f..cbee37bc8 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 bb857a277..a0b4c2929 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 6b387e206..955893b73 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 dbcc10c71..dec50d1bc 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 9d25419f6..36d75bdc1 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 87ed8e663..ba5e92db7 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 ffcef67d7..d02ef56d2 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 6ec8a587f..4f14961fa 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 c7f078943..6969caf53 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 de188af1c..0c0ea34d5 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 dbe884d48..e5ae84f2d 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 63d05f647..8db130849 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: -- 2.11.0