Mercurial > hg > octave-lyh > gnulib-hg
changeset 15884:c46fa8f14280
New module 'acosf'.
* lib/math.in.h (acosf): New declaration.
* lib/acosf.c: New file.
* m4/acosf.m4: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether acosf is declared.
(gl_MATH_H_DEFAULTS): Initialize GNULIB_ACOSF, HAVE_ACOSF.
* modules/math (Makefile.am): Substitute GNULIB_ACOSF, HAVE_ACOSF.
* modules/acosf: New file.
* tests/test-math-c++.cc: Check the declaration of acosf.
* doc/posix-functions/acosf.texi: Mention the new module.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 08 Oct 2011 23:42:50 +0200 |
parents | 9ab2ab1387ef |
children | dfc170e1a5aa |
files | ChangeLog doc/posix-functions/acosf.texi lib/acosf.c lib/math.in.h m4/acosf.m4 m4/math_h.m4 modules/acosf modules/math tests/test-math-c++.cc |
diffstat | 9 files changed, 123 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2011-10-08 Bruno Haible <bruno@clisp.org> + New module 'acosf'. + * lib/math.in.h (acosf): New declaration. + * lib/acosf.c: New file. + * m4/acosf.m4: New file. + * m4/math_h.m4 (gl_MATH_H): Test whether acosf is declared. + (gl_MATH_H_DEFAULTS): Initialize GNULIB_ACOSF, HAVE_ACOSF. + * modules/math (Makefile.am): Substitute GNULIB_ACOSF, HAVE_ACOSF. + * modules/acosf: New file. + * tests/test-math-c++.cc: Check the declaration of acosf. + * doc/posix-functions/acosf.texi: Mention the new module. + acos: Use a .m4 file. * m4/acos.m4: New file. * modules/acos (Files): Add it.
--- a/doc/posix-functions/acosf.texi +++ b/doc/posix-functions/acosf.texi @@ -4,14 +4,10 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/acosf.html} -Gnulib module: --- +Gnulib module: acosf 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/acosf.c @@ -0,0 +1,26 @@ +/* Inverse cosine 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 +acosf (float x) +{ + return (float) acos ((double) x); +}
--- a/lib/math.in.h +++ b/lib/math.in.h @@ -108,6 +108,21 @@ #endif +#if @GNULIB_ACOSF@ +# if !@HAVE_ACOSF@ +# undef acosf +_GL_FUNCDECL_SYS (acosf, float, (float x)); +# endif +_GL_CXXALIAS_SYS (acosf, float, (float x)); +_GL_CXXALIASWARN (acosf); +#elif defined GNULIB_POSIXCHECK +# undef acosf +# if HAVE_RAW_DECL_ACOSF +_GL_WARN_ON_USE (acosf, "acosf is unportable - " + "use gnulib module acosf for portability"); +# endif +#endif + #if @GNULIB_ACOSL@ # if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@ _GL_FUNCDECL_SYS (acosl, long double, (long double x));
new file mode 100644 --- /dev/null +++ b/m4/acosf.m4 @@ -0,0 +1,25 @@ +# acosf.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_ACOSF], +[ + AC_REQUIRE([gl_MATH_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_ACOS]) + + dnl Test whether acosf() exists. Assume that acosf(), if it exists, is + dnl defined in the same library as acos(). + save_LIBS="$LIBS" + LIBS="$LIBS $ACOS_LIBM" + AC_CHECK_FUNCS([acosf]) + LIBS="$save_LIBS" + if test $ac_cv_func_acosf = yes; then + ACOSF_LIBM="$ACOS_LIBM" + else + HAVE_ACOSF=0 + ACOSF_LIBM="$ACOS_LIBM" + fi + AC_SUBST([ACOSF_LIBM]) +])
--- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -1,4 +1,4 @@ -# math_h.m4 serial 40 +# math_h.m4 serial 41 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 asinf asinl atanl ceilf ceill cosf cosl + [acosf 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 @@ -57,6 +57,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], [ + GNULIB_ACOSF=0; AC_SUBST([GNULIB_ACOSF]) GNULIB_ACOSL=0; AC_SUBST([GNULIB_ACOSL]) GNULIB_ASINF=0; AC_SUBST([GNULIB_ASINF]) GNULIB_ASINL=0; AC_SUBST([GNULIB_ASINL]) @@ -104,6 +105,7 @@ GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF]) GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL]) dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_ACOSF=1; AC_SUBST([HAVE_ACOSF]) HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL]) HAVE_ASINF=1; AC_SUBST([HAVE_ASINF]) HAVE_ASINL=1; AC_SUBST([HAVE_ASINL])
new file mode 100644 --- /dev/null +++ b/modules/acosf @@ -0,0 +1,31 @@ +Description: +acosf() function: inverse cosine function. + +Files: +lib/acosf.c +m4/acosf.m4 + +Depends-on: +math +acos [test $HAVE_ACOSF = 0] + +configure.ac: +gl_FUNC_ACOSF +if test $HAVE_ACOSF = 0; then + AC_LIBOBJ([acosf]) +fi +gl_MATH_MODULE_INDICATOR([acosf]) + +Makefile.am: + +Include: +<math.h> + +Link: +$(ACOSF_LIBM) + +License: +LGPL + +Maintainer: +Bruno Haible
--- a/modules/math +++ b/modules/math @@ -28,6 +28,7 @@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -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_ACOSF''@/$(GNULIB_ACOSF)/g' \ -e 's/@''GNULIB_ACOSL''@/$(GNULIB_ACOSL)/g' \ -e 's/@''GNULIB_ASINF''@/$(GNULIB_ASINF)/g' \ -e 's/@''GNULIB_ASINL''@/$(GNULIB_ASINL)/g' \ @@ -75,7 +76,8 @@ -e 's/@''GNULIB_TRUNCF''@/$(GNULIB_TRUNCF)/g' \ -e 's/@''GNULIB_TRUNCL''@/$(GNULIB_TRUNCL)/g' \ < $(srcdir)/math.in.h | \ - sed -e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \ + sed -e 's|@''HAVE_ACOSF''@|$(HAVE_ACOSF)|g' \ + -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' \
--- a/tests/test-math-c++.cc +++ b/tests/test-math-c++.cc @@ -24,6 +24,9 @@ #include "signature.h" +#if GNULIB_TEST_ACOSF +SIGNATURE_CHECK (GNULIB_NAMESPACE::acosf, float, (float)); +#endif //SIGNATURE_CHECK (GNULIB_NAMESPACE::acos, double, (double)); #if GNULIB_TEST_ASINF SIGNATURE_CHECK (GNULIB_NAMESPACE::asinf, float, (float));