+2010-03-07 Bruno Haible <bruno@clisp.org>
+
+ logb: Provide missing declaration for Cygwin.
+ * lib/math.in.h (logb): New declaration.
+ * m4/logb.m4: New file.
+ * modules/logb (Files): Add m4/logb.m4.
+ (Depends-on): Add math.
+ (configure.ac): Invoke gl_FUNC_LOGB, gl_MATH_MODULE_INDICATOR.
+ * m4/math_h.m4 (gl_MATH_H): Check also for logb declaration.
+ (gl_MATH_H_DEFAULTS): Initialize GNULIB_LOGB, HAVE_DECL_LOGB.
+ * modules/math (Makefile.am): Substitute GNULIB_LOGB, HAVE_DECL_LOGB.
+ * doc/posix-functions/logb.texi: Mention the Cygwin bug.
+
2010-03-07 Bruno Haible <bruno@clisp.org>
Fix test-cond link error.
Portability problems not fixed by Gnulib:
@itemize
+@item
+This function is missing a declaration on some platforms:
+Cygwin 1.5.x.
@end itemize
# define HUGE_VAL (1.0 / 0.0)
#endif
+
/* Write x as
x = mantissa * 2^exp
where
#endif
+#if @GNULIB_LOGB@
+# if !@HAVE_DECL_LOGB@
+extern double logb (double x);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef logb
+# if HAVE_RAW_DECL_LOGB
+_GL_WARN_ON_USE (logb, "logb is unportable - "
+ "use gnulib module logb for portability");
+# endif
+#endif
+
+
#if @GNULIB_ACOSL@
# if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@
extern long double acosl (long double x);
--- /dev/null
+# logb.m4 serial 1
+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,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_LOGB],
+[
+ AC_REQUIRE([gl_MATH_H_DEFAULTS])
+ dnl Test whether logb() is declared.
+ AC_CHECK_DECLS([logb], , , [#include <math.h>])
+ if test "$ac_cv_have_decl_logb" != yes; then
+ HAVE_DECL_LOGB=0
+ fi
+ dnl Test whether logb() can be used without libm.
+ LOGB_LIBM=?
+ AC_TRY_LINK([
+ #ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ extern double logb (double x);
+ double x;],
+ [x = logb(x);],
+ [LOGB_LIBM=])
+ if test "$LOGB_LIBM" = "?"; then
+ save_LIBS="$LIBS"
+ LIBS="$LIBS -lm"
+ AC_TRY_LINK([
+ #ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ extern double logb (double x);
+ double x;],
+ [x = logb(x);],
+ [LOGB_LIBM="-lm"])
+ LIBS="$save_LIBS"
+ fi
+ if test "$LOGB_LIBM" = "?"; then
+ LOGB_LIBM=
+ fi
+ AC_SUBST([LOGB_LIBM])
+])
-# math_h.m4 serial 17
+# math_h.m4 serial 18
dnl Copyright (C) 2007-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,
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[#include <math.h>
]], [acosl asinl atanl ceilf ceill cosl expl floorf floorl frexpl
- ldexpl logl round roundf roundl sinl sqrtl tanl trunc truncf truncl])
+ ldexpl logb logl round roundf roundl sinl sqrtl tanl trunc truncf truncl])
])
AC_DEFUN([gl_MATH_MODULE_INDICATOR],
GNULIB_ISNAND=0; AC_SUBST([GNULIB_ISNAND])
GNULIB_ISNANL=0; AC_SUBST([GNULIB_ISNANL])
GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL])
+ GNULIB_LOGB=0; AC_SUBST([GNULIB_LOGB])
GNULIB_LOGL=0; AC_SUBST([GNULIB_LOGL])
GNULIB_ROUND=0; AC_SUBST([GNULIB_ROUND])
GNULIB_ROUNDF=0; AC_SUBST([GNULIB_ROUNDF])
HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL])
HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL])
HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL])
+ HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB])
HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL])
HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL])
HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL])
logb() function: get exponent.
Files:
+m4/logb.m4
m4/mathfunc.m4
Depends-on:
+math
configure.ac:
-gl_MATHFUNC([logb], [double], [(double)])
+gl_FUNC_LOGB
+gl_MATH_MODULE_INDICATOR([logb])
Makefile.am:
-e 's|@''GNULIB_ISNAND''@|$(GNULIB_ISNAND)|g' \
-e 's|@''GNULIB_ISNANL''@|$(GNULIB_ISNANL)|g' \
-e 's|@''GNULIB_LDEXPL''@|$(GNULIB_LDEXPL)|g' \
+ -e 's|@''GNULIB_LOGB''@|$(GNULIB_LOGB)|g' \
-e 's|@''GNULIB_LOGL''@|$(GNULIB_LOGL)|g' \
-e 's|@''GNULIB_ROUND''@|$(GNULIB_ROUND)|g' \
-e 's|@''GNULIB_ROUNDF''@|$(GNULIB_ROUNDF)|g' \
-e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \
-e 's|@''HAVE_DECL_FREXPL''@|$(HAVE_DECL_FREXPL)|g' \
-e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \
+ -e 's|@''HAVE_DECL_LOGB''@|$(HAVE_DECL_LOGB)|g' \
-e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \
-e 's|@''HAVE_DECL_SINL''@|$(HAVE_DECL_SINL)|g' \
-e 's|@''HAVE_DECL_SQRTL''@|$(HAVE_DECL_SQRTL)|g' \