+2010-04-04 Bruno Haible <bruno@clisp.org>
+
+ math: Fix some C++ test errors on Cygwin.
+ * lib/math.in.h (ceilf, ceill, floorf, floorl, roundf, round, roundl,
+ truncl): Provide declaration if the system does not have it.
+ * m4/ceilf.m4 (gl_FUNC_CEILF): If the function is not declared, set
+ HAVE_DECL_CEILF to 0, not REPLACE_CEILF to 1.
+ * m4/ceill.m4 (gl_FUNC_CEILL): If the function is not declared, set
+ HAVE_DECL_CEILL to 0, not REPLACE_CEILL to 1.
+ * m4/floorf.m4 (gl_FUNC_FLOORF): If the function is not declared, set
+ HAVE_DECL_FLOORF to 0, not REPLACE_FLOORF to 1.
+ * m4/floorl.m4 (gl_FUNC_FLOORL): If the function is not declared, set
+ HAVE_DECL_FLOORL to 0, not REPLACE_FLOORL to 1.
+ * m4/round.m4 (gl_FUNC_ROUND): If the function is not declared, set
+ HAVE_DECL_ROUND to 0, not REPLACE_ROUND to 1.
+ * m4/roundf.m4 (gl_FUNC_ROUNDF): If the function is not declared, set
+ HAVE_DECL_ROUNDF to 0, not REPLACE_ROUNDF to 1.
+ * m4/roundl.m4 (gl_FUNC_ROUNDL): If the function is not declared, set
+ HAVE_DECL_ROUNDL to 0, not REPLACE_ROUNDL to 1.
+ * m4/truncl.m4 (gl_FUNC_TRUNCL): If the function is not declared, set
+ HAVE_DECL_TRUNCL to 0, not REPLACE_TRUNCL to 1.
+ * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize HAVE_DECL_CEILF,
+ HAVE_DECL_CEILL, HAVE_DECL_FLOORF, HAVE_DECL_FLOORL, HAVE_DECL_ROUND,
+ HAVE_DECL_ROUNDF, HAVE_DECL_ROUNDL, HAVE_DECL_TRUNCL.
+ * modules/math (Makefile.am): Substitute HAVE_DECL_CEILF,
+ HAVE_DECL_CEILL, HAVE_DECL_FLOORF, HAVE_DECL_FLOORL, HAVE_DECL_ROUND,
+ HAVE_DECL_ROUNDF, HAVE_DECL_ROUNDL, HAVE_DECL_TRUNCL.
+
2010-04-04 Bruno Haible <bruno@clisp.org>
* m4/ceilf.m4 (gl_FUNC_CEILF): Remove redundant AC_SUBST invocation.
# endif
_GL_FUNCDECL_RPL (ceilf, float, (float x));
_GL_CXXALIAS_RPL (ceilf, float, (float x));
-#else
+# else
+# if !@HAVE_DECL_CEILF@
+_GL_FUNCDECL_SYS (ceilf, float, (float x));
+# endif
_GL_CXXALIAS_SYS (ceilf, float, (float x));
# endif
_GL_CXXALIASWARN (ceilf);
_GL_FUNCDECL_RPL (ceill, long double, (long double x));
_GL_CXXALIAS_RPL (ceill, long double, (long double x));
# else
+# if !@HAVE_DECL_CEILL@
+_GL_FUNCDECL_SYS (ceill, long double, (long double x));
+# endif
_GL_CXXALIAS_SYS (ceill, long double, (long double x));
# endif
_GL_CXXALIASWARN (ceill);
_GL_FUNCDECL_RPL (floorf, float, (float x));
_GL_CXXALIAS_RPL (floorf, float, (float x));
#else
+# if !@HAVE_DECL_FLOORF@
+_GL_FUNCDECL_SYS (floorf, float, (float x));
+# endif
_GL_CXXALIAS_SYS (floorf, float, (float x));
# endif
_GL_CXXALIASWARN (floorf);
_GL_FUNCDECL_RPL (floorl, long double, (long double x));
_GL_CXXALIAS_RPL (floorl, long double, (long double x));
# else
+# if !@HAVE_DECL_FLOORL@
+_GL_FUNCDECL_SYS (floorl, long double, (long double x));
+# endif
_GL_CXXALIAS_SYS (floorl, long double, (long double x));
# endif
_GL_CXXALIASWARN (floorl);
_GL_FUNCDECL_RPL (roundf, float, (float x));
_GL_CXXALIAS_RPL (roundf, float, (float x));
# else
+# if !@HAVE_DECL_ROUNDF@
+_GL_FUNCDECL_SYS (roundf, float, (float x));
+# endif
_GL_CXXALIAS_SYS (roundf, float, (float x));
# endif
_GL_CXXALIASWARN (roundf);
_GL_FUNCDECL_RPL (round, double, (double x));
_GL_CXXALIAS_RPL (round, double, (double x));
# else
+# if !@HAVE_DECL_ROUND@
+_GL_FUNCDECL_SYS (round, double, (double x));
+# endif
_GL_CXXALIAS_SYS (round, double, (double x));
# endif
_GL_CXXALIASWARN (round);
_GL_FUNCDECL_RPL (roundl, long double, (long double x));
_GL_CXXALIAS_RPL (roundl, long double, (long double x));
# else
+# if !@HAVE_DECL_ROUNDL@
+_GL_FUNCDECL_SYS (roundl, long double, (long double x));
+# endif
_GL_CXXALIAS_SYS (roundl, long double, (long double x));
# endif
_GL_CXXALIASWARN (roundl);
_GL_FUNCDECL_RPL (truncl, long double, (long double x));
_GL_CXXALIAS_RPL (truncl, long double, (long double x));
# else
+# if !@HAVE_DECL_TRUNCL@
+_GL_FUNCDECL_SYS (truncl, long double, (long double x));
+# endif
_GL_CXXALIAS_SYS (truncl, long double, (long double x));
# endif
_GL_CXXALIASWARN (truncl);
-# ceilf.m4 serial 5
+# ceilf.m4 serial 6
dnl Copyright (C) 2007, 2009-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,
REPLACE_CEILF=1
fi
else
- REPLACE_CEILF=1
+ HAVE_DECL_CEILF=0
fi
- if test $REPLACE_CEILF = 1; then
+ if test $HAVE_DECL_CEILF = 0 || test $REPLACE_CEILF = 1; then
AC_LIBOBJ([ceilf])
CEILF_LIBM=
fi
-# ceill.m4 serial 5
+# ceill.m4 serial 6
dnl Copyright (C) 2007, 2009-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,
REPLACE_CEILL=1
fi
else
- REPLACE_CEILL=1
+ HAVE_DECL_CEILL=0
fi
- if test $REPLACE_CEILL = 1; then
+ if test $HAVE_DECL_CEILL = 0 || test $REPLACE_CEILL = 1; then
AC_LIBOBJ([ceill])
CEILL_LIBM=
fi
-# floorf.m4 serial 5
+# floorf.m4 serial 6
dnl Copyright (C) 2007, 2009-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,
REPLACE_FLOORF=1
fi
else
- REPLACE_FLOORF=1
+ HAVE_DECL_FLOORF=0
fi
- if test $REPLACE_FLOORF = 1; then
+ if test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1; then
AC_LIBOBJ([floorf])
FLOORF_LIBM=
fi
-# floorl.m4 serial 5
+# floorl.m4 serial 6
dnl Copyright (C) 2007, 2009-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,
REPLACE_FLOORL=1
fi
else
- REPLACE_FLOORL=1
+ HAVE_DECL_FLOORL=0
fi
- if test $REPLACE_FLOORL = 1; then
+ if test $HAVE_DECL_FLOORL = 0 || test $REPLACE_FLOORL = 1; then
AC_LIBOBJ([floorl])
FLOORL_LIBM=
fi
-# math_h.m4 serial 20
+# math_h.m4 serial 21
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,
HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL])
HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL])
HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL])
+ HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF])
+ HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL])
HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL])
HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL])
+ HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF])
+ HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL])
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_ROUND=1; AC_SUBST([HAVE_DECL_ROUND])
+ HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF])
+ HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL])
HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL])
HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL])
HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL])
HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC])
HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF])
+ HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL])
REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF])
REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL])
REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF])
-# round.m4 serial 7
+# round.m4 serial 8
dnl Copyright (C) 2007, 2009-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,
AC_CHECK_DECLS([round], , , [#include <math.h>])
if test "$ac_cv_have_decl_round" = yes; then
gl_CHECK_MATH_LIB([ROUND_LIBM], [x = round (x);])
- fi
- if test "$ac_cv_have_decl_round" = yes && test "$ROUND_LIBM" != missing; then
- dnl Test whether round() produces correct results. On NetBSD 3.0, for
- dnl x = 1/2 - 2^-54, the system's round() returns a wrong result.
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether round works], [gl_cv_func_round_works],
- [
- save_LIBS="$LIBS"
- LIBS="$LIBS $ROUND_LIBM"
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
+ if test "$ROUND_LIBM" != missing; then
+ dnl Test whether round() produces correct results. On NetBSD 3.0, for
+ dnl x = 1/2 - 2^-54, the system's round() returns a wrong result.
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+ AC_CACHE_CHECK([whether round works], [gl_cv_func_round_works],
+ [
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $ROUND_LIBM"
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <float.h>
#include <math.h>
int main()
volatile double x = 0.5 - 0.5 / TWO_MANT_DIG;
exit (x < 0.5 && round (x) != 0.0);
}]])], [gl_cv_func_round_works=yes], [gl_cv_func_round_works=no],
- [case "$host_os" in
- netbsd*) gl_cv_func_round_works="guessing no";;
- *) gl_cv_func_round_works="guessing yes";;
- esac
+ [case "$host_os" in
+ netbsd*) gl_cv_func_round_works="guessing no";;
+ *) gl_cv_func_round_works="guessing yes";;
+ esac
+ ])
+ LIBS="$save_LIBS"
])
- LIBS="$save_LIBS"
- ])
- case "$gl_cv_func_round_works" in
- *no) ROUND_LIBM=missing ;;
- esac
+ case "$gl_cv_func_round_works" in
+ *no) ROUND_LIBM=missing ;;
+ esac
+ fi
+ if test "$ROUND_LIBM" = missing; then
+ REPLACE_ROUND=1
+ fi
+ else
+ HAVE_DECL_ROUND=0
fi
- if test "$ac_cv_have_decl_round" != yes || test "$ROUND_LIBM" = missing; then
- REPLACE_ROUND=1
+ if test $HAVE_DECL_ROUND = 0 || test $REPLACE_ROUND = 1; then
AC_LIBOBJ([round])
gl_FUNC_FLOOR_LIBS
gl_FUNC_CEIL_LIBS
-# roundf.m4 serial 8
+# roundf.m4 serial 9
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,
AC_CHECK_DECLS([roundf], , , [#include <math.h>])
if test "$ac_cv_have_decl_roundf" = yes; then
gl_CHECK_MATH_LIB([ROUNDF_LIBM], [x = roundf (x);])
- fi
- if test "$ac_cv_have_decl_roundf" = yes && test "$ROUNDF_LIBM" != missing; then
- dnl Test whether roundf() produces correct results. On mingw, for
- dnl x = 1/2 - 2^-25, the system's roundf() returns a wrong result.
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether roundf works], [gl_cv_func_roundf_works],
- [
- save_LIBS="$LIBS"
- LIBS="$LIBS $ROUNDF_LIBM"
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
+ if test "$ROUNDF_LIBM" != missing; then
+ dnl Test whether roundf() produces correct results. On mingw, for
+ dnl x = 1/2 - 2^-25, the system's roundf() returns a wrong result.
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+ AC_CACHE_CHECK([whether roundf works], [gl_cv_func_roundf_works],
+ [
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $ROUNDF_LIBM"
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <float.h>
#include <math.h>
int main()
volatile float x = 0.5f - 0.5f / TWO_MANT_DIG;
exit (x < 0.5f && roundf (x) != 0.0f);
}]])], [gl_cv_func_roundf_works=yes], [gl_cv_func_roundf_works=no],
- [case "$host_os" in
- mingw*) gl_cv_func_roundf_works="guessing no";;
- *) gl_cv_func_roundf_works="guessing yes";;
- esac
+ [case "$host_os" in
+ mingw*) gl_cv_func_roundf_works="guessing no";;
+ *) gl_cv_func_roundf_works="guessing yes";;
+ esac
+ ])
+ LIBS="$save_LIBS"
])
- LIBS="$save_LIBS"
- ])
- case "$gl_cv_func_roundf_works" in
- *no) ROUNDF_LIBM=missing ;;
- esac
+ case "$gl_cv_func_roundf_works" in
+ *no) ROUNDF_LIBM=missing ;;
+ esac
+ fi
+ if test "$ROUNDF_LIBM" = missing; then
+ REPLACE_ROUNDF=1
+ fi
+ else
+ HAVE_DECL_ROUNDF=0
fi
- if test "$ac_cv_have_decl_roundf" != yes || test "$ROUNDF_LIBM" = missing; then
- REPLACE_ROUNDF=1
+ if test $HAVE_DECL_ROUNDF = 0 || test $REPLACE_ROUNDF = 1; then
AC_LIBOBJ([roundf])
AC_CHECK_DECLS([ceilf, floorf], , , [#include <math.h>])
if test "$ac_cv_have_decl_floorf" = yes \
-# roundl.m4 serial 6
+# roundl.m4 serial 7
dnl Copyright (C) 2007, 2009-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,
AC_CHECK_DECLS([roundl], , , [#include <math.h>])
if test "$ac_cv_have_decl_roundl" = yes; then
gl_CHECK_MATH_LIB([ROUNDL_LIBM], [x = roundl (x);])
+ if test "$ROUNDL_LIBM" = missing; then
+ REPLACE_ROUNDL=1
+ fi
+ else
+ HAVE_DECL_ROUNDL=0
fi
- if test "$ac_cv_have_decl_roundl" != yes || test "$ROUNDL_LIBM" = missing; then
- REPLACE_ROUNDL=1
+ if test $HAVE_DECL_ROUNDL = 0 || test $REPLACE_ROUNDL = 1; then
AC_LIBOBJ([roundl])
AC_CHECK_DECLS([ceill, floorl], , , [#include <math.h>])
if test "$ac_cv_have_decl_floorl" = yes \
-# truncl.m4 serial 3
+# truncl.m4 serial 4
dnl Copyright (C) 2007-2008, 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,
*) REPLACE_TRUNCL=1 ;;
esac
else
- REPLACE_TRUNCL=1
+ HAVE_DECL_TRUNCL=0
fi
- if test $REPLACE_TRUNCL = 1; then
+ if test $HAVE_DECL_TRUNCL = 0 || test $REPLACE_TRUNCL = 1; then
AC_LIBOBJ([truncl])
TRUNCL_LIBM=
fi
-e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \
-e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \
-e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \
+ -e 's|@''HAVE_DECL_CEILF''@|$(HAVE_DECL_CEILF)|g' \
+ -e 's|@''HAVE_DECL_CEILL''@|$(HAVE_DECL_CEILL)|g' \
-e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \
-e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \
+ -e 's|@''HAVE_DECL_FLOORF''@|$(HAVE_DECL_FLOORF)|g' \
+ -e 's|@''HAVE_DECL_FLOORL''@|$(HAVE_DECL_FLOORL)|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_ROUND''@|$(HAVE_DECL_ROUND)|g' \
+ -e 's|@''HAVE_DECL_ROUNDF''@|$(HAVE_DECL_ROUNDF)|g' \
+ -e 's|@''HAVE_DECL_ROUNDL''@|$(HAVE_DECL_ROUNDL)|g' \
-e 's|@''HAVE_DECL_SINL''@|$(HAVE_DECL_SINL)|g' \
-e 's|@''HAVE_DECL_SQRTL''@|$(HAVE_DECL_SQRTL)|g' \
-e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \
-e 's|@''HAVE_DECL_TRUNC''@|$(HAVE_DECL_TRUNC)|g' \
-e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \
+ -e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \
-e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \
-e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \
-e 's|@''REPLACE_FLOORF''@|$(REPLACE_FLOORF)|g' \