Mercurial > hg > octave-lyh > gnulib-hg
changeset 15881:8ff52f1384c6
New module 'asinf'.
* lib/math.in.h (asinf): New declaration.
* lib/asinf.c: New file.
* m4/asinf.m4: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether asinf is declared.
(gl_MATH_H_DEFAULTS): Initialize GNULIB_ASINF, HAVE_ASINF.
* modules/math (Makefile.am): Substitute GNULIB_ASINF, HAVE_ASINF.
* modules/asinf: New file.
* tests/test-math-c++.cc: Check the declaration of asinf.
* doc/posix-functions/asinf.texi: Mention the new module.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 08 Oct 2011 23:29:33 +0200 |
parents | e7ece082df33 |
children | 3c9de9e79cbc |
files | ChangeLog doc/posix-functions/asinf.texi lib/asinf.c lib/math.in.h m4/asinf.m4 m4/math_h.m4 modules/asinf modules/math tests/test-math-c++.cc |
diffstat | 9 files changed, 122 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2011-10-08 Bruno Haible <bruno@clisp.org> + New module 'asinf'. + * lib/math.in.h (asinf): New declaration. + * lib/asinf.c: New file. + * m4/asinf.m4: New file. + * m4/math_h.m4 (gl_MATH_H): Test whether asinf is declared. + (gl_MATH_H_DEFAULTS): Initialize GNULIB_ASINF, HAVE_ASINF. + * modules/math (Makefile.am): Substitute GNULIB_ASINF, HAVE_ASINF. + * modules/asinf: New file. + * tests/test-math-c++.cc: Check the declaration of asinf. + * doc/posix-functions/asinf.texi: Mention the new module. + asin: Use a .m4 file. * m4/asin.m4: New file. * modules/asin (Files): Add it.
--- a/doc/posix-functions/asinf.texi +++ b/doc/posix-functions/asinf.texi @@ -4,14 +4,10 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/asinf.html} -Gnulib module: --- +Gnulib module: asinf Portability problems fixed by Gnulib: @itemize -@end itemize - -Portability problems not fixed by Gnulib: -@itemize @item This function is missing on some platforms: Minix 3.1.8, AIX 5.1, Solaris 9. @@ -19,3 +15,7 @@ This function is only defined as a macro with arguments on some platforms: MSVC 9. @end itemize + +Portability problems not fixed by Gnulib: +@itemize +@end itemize
new file mode 100644 --- /dev/null +++ b/lib/asinf.c @@ -0,0 +1,26 @@ +/* Inverse sine function. + Copyright (C) 2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include <math.h> + +float +asinf (float x) +{ + return (float) asin ((double) x); +}
--- a/lib/math.in.h +++ b/lib/math.in.h @@ -123,6 +123,21 @@ #endif +#if @GNULIB_ASINF@ +# if !@HAVE_ASINF@ +# undef asinf +_GL_FUNCDECL_SYS (asinf, float, (float x)); +# endif +_GL_CXXALIAS_SYS (asinf, float, (float x)); +_GL_CXXALIASWARN (asinf); +#elif defined GNULIB_POSIXCHECK +# undef asinf +# if HAVE_RAW_DECL_ASINF +_GL_WARN_ON_USE (asinf, "asinf is unportable - " + "use gnulib module asinf for portability"); +# endif +#endif + #if @GNULIB_ASINL@ # if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@ _GL_FUNCDECL_SYS (asinl, long double, (long double x));
new file mode 100644 --- /dev/null +++ b/m4/asinf.m4 @@ -0,0 +1,25 @@ +# asinf.m4 serial 1 +dnl Copyright (C) 2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_ASINF], +[ + AC_REQUIRE([gl_MATH_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_ASIN]) + + dnl Test whether asinf() exists. Assume that asinf(), if it exists, is + dnl defined in the same library as asin(). + save_LIBS="$LIBS" + LIBS="$LIBS $ASIN_LIBM" + AC_CHECK_FUNCS([asinf]) + LIBS="$save_LIBS" + if test $ac_cv_func_asinf = yes; then + ASINF_LIBM="$ASIN_LIBM" + else + HAVE_ASINF=0 + ASINF_LIBM="$ASIN_LIBM" + fi + AC_SUBST([ASINF_LIBM]) +])
--- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -1,4 +1,4 @@ -# math_h.m4 serial 39 +# math_h.m4 serial 40 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -39,7 +39,7 @@ dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include <math.h>]], - [acosl asinl atanl ceilf ceill cosf cosl + [acosl asinf asinl atanl ceilf ceill cosf cosl expf expl fabsf floorf floorl fmodf frexpf frexpl ldexpf ldexpl logb logf logl log10f modff powf round roundf roundl sinf sinl sqrtf sqrtl @@ -58,6 +58,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], [ GNULIB_ACOSL=0; AC_SUBST([GNULIB_ACOSL]) + GNULIB_ASINF=0; AC_SUBST([GNULIB_ASINF]) GNULIB_ASINL=0; AC_SUBST([GNULIB_ASINL]) GNULIB_ATANL=0; AC_SUBST([GNULIB_ATANL]) GNULIB_CEIL=0; AC_SUBST([GNULIB_CEIL]) @@ -104,6 +105,7 @@ GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL]) + HAVE_ASINF=1; AC_SUBST([HAVE_ASINF]) HAVE_ASINL=1; AC_SUBST([HAVE_ASINL]) HAVE_ATANL=1; AC_SUBST([HAVE_ATANL]) HAVE_COSF=1; AC_SUBST([HAVE_COSF])
new file mode 100644 --- /dev/null +++ b/modules/asinf @@ -0,0 +1,31 @@ +Description: +asinf() function: inverse sine function. + +Files: +lib/asinf.c +m4/asinf.m4 + +Depends-on: +math +asin [test $HAVE_ASINF = 0] + +configure.ac: +gl_FUNC_ASINF +if test $HAVE_ASINF = 0; then + AC_LIBOBJ([asinf]) +fi +gl_MATH_MODULE_INDICATOR([asinf]) + +Makefile.am: + +Include: +<math.h> + +Link: +$(ASINF_LIBM) + +License: +LGPL + +Maintainer: +Bruno Haible
--- a/modules/math +++ b/modules/math @@ -29,6 +29,7 @@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MATH_H)|g' \ -e 's/@''GNULIB_ACOSL''@/$(GNULIB_ACOSL)/g' \ + -e 's/@''GNULIB_ASINF''@/$(GNULIB_ASINF)/g' \ -e 's/@''GNULIB_ASINL''@/$(GNULIB_ASINL)/g' \ -e 's/@''GNULIB_ATANL''@/$(GNULIB_ATANL)/g' \ -e 's/@''GNULIB_CEIL''@/$(GNULIB_CEIL)/g' \ @@ -75,6 +76,7 @@ -e 's/@''GNULIB_TRUNCL''@/$(GNULIB_TRUNCL)/g' \ < $(srcdir)/math.in.h | \ sed -e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \ + -e 's|@''HAVE_ASINF''@|$(HAVE_ASINF)|g' \ -e 's|@''HAVE_ASINL''@|$(HAVE_ASINL)|g' \ -e 's|@''HAVE_ATANL''@|$(HAVE_ATANL)|g' \ -e 's|@''HAVE_COSF''@|$(HAVE_COSF)|g' \
--- a/tests/test-math-c++.cc +++ b/tests/test-math-c++.cc @@ -25,6 +25,9 @@ //SIGNATURE_CHECK (GNULIB_NAMESPACE::acos, double, (double)); +#if GNULIB_TEST_ASINF +SIGNATURE_CHECK (GNULIB_NAMESPACE::asinf, float, (float)); +#endif //SIGNATURE_CHECK (GNULIB_NAMESPACE::asin, double, (double)); //SIGNATURE_CHECK (GNULIB_NAMESPACE::atan, double, (double)); //SIGNATURE_CHECK (GNULIB_NAMESPACE::atan2, double, (double, double));