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