round.m4 832 Bytes
Newer Older
1
# round.m4 serial 3
2 3 4 5 6 7 8 9 10 11
dnl Copyright (C) 2007 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_ROUND],
[
  AC_REQUIRE([gl_MATH_H_DEFAULTS])
  dnl Persuade glibc <math.h> to declare round().
  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
12 13 14
  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);])
15 16
  fi
  if test "$ac_cv_have_decl_round" != yes || test "$ROUND_LIBM" = missing; then
17 18 19 20 21 22
    gl_CHECK_MATH_LIB([ROUND_LIBM], [x = floor (x) + ceil (x);])
    HAVE_DECL_ROUND=0
    AC_LIBOBJ([round])
  fi
  AC_SUBST([HAVE_DECL_ROUND])
  AC_SUBST([ROUND_LIBM])])