- 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);])
- 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([[
+
+ gl_CHECK_MATH_LIB([ROUNDF_LIBM], [x = roundf (x);],
+ [extern
+ #ifdef __cplusplus
+ "C"
+ #endif
+ float roundf (float);
+ ])
+ if test "$ROUNDF_LIBM" != missing; then
+ HAVE_ROUNDF=1
+ dnl Also check whether it's declared.
+ dnl IRIX 6.5 has roundf() in libm but doesn't declare it in <math.h>.
+ AC_CHECK_DECLS([roundf], , [HAVE_DECL_ROUNDF=0], [[#include <math.h>]])
+
+ 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([[