Mercurial > hg > octave-lyh > gnulib-hg
changeset 12841:6ff1b1c23f57
Perform the same test for many <math.h> functions.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 31 Jan 2010 19:40:17 +0100 |
parents | fec628f2b5af |
children | b2bf8684a2db |
files | ChangeLog m4/mathfunc.m4 m4/sqrt.m4 modules/acos modules/asin modules/atan modules/atan2 modules/cbrt modules/copysign modules/cos modules/cosh modules/erf modules/erfc modules/exp modules/fmod modules/hypot modules/j0 modules/j1 modules/jn modules/lgamma modules/log modules/log10 modules/log1p modules/pow modules/remainder modules/sin modules/sinh modules/tan modules/tanh modules/y0 modules/y1 modules/yn |
diffstat | 32 files changed, 125 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +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.
--- 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 @@ 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)]) +])
--- 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 @@ AC_DEFUN([gl_FUNC_SQRT], [ - gl_MATHFUNC([sqrt], [double], [(double)]) + gl_COMMON_DOUBLE_MATHFUNC([sqrt]) ])
--- a/modules/acos +++ b/modules/acos @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([acos], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([acos]) Makefile.am:
--- a/modules/asin +++ b/modules/asin @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([asin], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([asin]) Makefile.am:
--- a/modules/atan +++ b/modules/atan @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([atan], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([atan]) Makefile.am:
--- a/modules/atan2 +++ b/modules/atan2 @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([atan2], [double], [(double, double)]) +gl_COMMON_DOUBLE_MATHFUNC([atan2]) Makefile.am:
--- a/modules/cbrt +++ b/modules/cbrt @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([cbrt], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([cbrt]) Makefile.am:
--- a/modules/copysign +++ b/modules/copysign @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([copysign], [double], [(double, double)]) +gl_COMMON_DOUBLE_MATHFUNC([copysign]) Makefile.am:
--- a/modules/cos +++ b/modules/cos @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([cos], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([cos]) Makefile.am:
--- a/modules/cosh +++ b/modules/cosh @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([cosh], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([cosh]) Makefile.am:
--- a/modules/erf +++ b/modules/erf @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([erf], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([erf]) Makefile.am:
--- a/modules/erfc +++ b/modules/erfc @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([erfc], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([erfc]) Makefile.am:
--- a/modules/exp +++ b/modules/exp @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([exp], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([exp]) Makefile.am:
--- a/modules/fmod +++ b/modules/fmod @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([fmod], [double], [(double, double)]) +gl_COMMON_DOUBLE_MATHFUNC([fmod]) Makefile.am:
--- a/modules/hypot +++ b/modules/hypot @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([hypot], [double], [(double, double)]) +gl_COMMON_DOUBLE_MATHFUNC([hypot]) Makefile.am:
--- a/modules/j0 +++ b/modules/j0 @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([j0], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([j0]) Makefile.am:
--- a/modules/j1 +++ b/modules/j1 @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([j1], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([j1]) Makefile.am:
--- a/modules/jn +++ b/modules/jn @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([jn], [double], [(int, double)]) +gl_COMMON_DOUBLE_MATHFUNC([jn]) Makefile.am:
--- a/modules/lgamma +++ b/modules/lgamma @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([lgamma], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([lgamma]) Makefile.am:
--- a/modules/log +++ b/modules/log @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([log], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([log]) Makefile.am:
--- a/modules/log10 +++ b/modules/log10 @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([log10], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([log10]) Makefile.am:
--- a/modules/log1p +++ b/modules/log1p @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([log1p], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([log1p]) Makefile.am:
--- a/modules/pow +++ b/modules/pow @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([pow], [double], [(double, double)]) +gl_COMMON_DOUBLE_MATHFUNC([pow]) Makefile.am:
--- a/modules/remainder +++ b/modules/remainder @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([remainder], [double], [(double, double)]) +gl_COMMON_DOUBLE_MATHFUNC([remainder]) Makefile.am:
--- a/modules/sin +++ b/modules/sin @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([sin], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([sin]) Makefile.am:
--- a/modules/sinh +++ b/modules/sinh @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([sinh], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([sinh]) Makefile.am:
--- a/modules/tan +++ b/modules/tan @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([tan], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([tan]) Makefile.am:
--- a/modules/tanh +++ b/modules/tanh @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([tanh], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([tanh]) Makefile.am:
--- a/modules/y0 +++ b/modules/y0 @@ -7,7 +7,7 @@ Depends-on: configure.ac: -gl_MATHFUNC([y0], [double], [(double)]) +gl_COMMON_DOUBLE_MATHFUNC([y0]) Makefile.am: