* 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.
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.
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.
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
--- /dev/null
+/* 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);
+}
#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));
--- /dev/null
+# 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])
+])
-# 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,
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
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])
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])
--- /dev/null
+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
-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' \
-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' \
#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));