2 dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 AC_DEFUN([gl_FUNC_TRUNCL],
9 AC_REQUIRE([gl_MATH_H_DEFAULTS])
10 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
11 dnl Persuade glibc <math.h> to declare truncl().
12 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
13 dnl Test whether truncl() is declared.
14 AC_CHECK_DECLS([truncl], , , [#include <math.h>])
15 if test "$ac_cv_have_decl_truncl" = yes; then
16 dnl Test whether truncl() can be used without libm.
19 #ifndef __NO_MATH_INLINES
20 # define __NO_MATH_INLINES 1 /* for glibc */
26 if test "$TRUNCL_LIBM" = "?"; then
30 #ifndef __NO_MATH_INLINES
31 # define __NO_MATH_INLINES 1 /* for glibc */
39 if test "$TRUNCL_LIBM" = "?"; then
42 dnl Test whether truncl() works. It crashes on OSF/1 4.0d.
43 AC_CACHE_CHECK([whether truncl works], [gl_cv_func_truncl_works],
52 }], [gl_cv_func_truncl_works=yes], [gl_cv_func_truncl_works=no],
54 osf4*) gl_cv_func_truncl_works="guessing no";;
55 *) gl_cv_func_truncl_works="guessing yes";;
59 case "$gl_cv_func_truncl_works" in
61 *) REPLACE_TRUNCL=1 ;;
66 if test $REPLACE_TRUNCL = 1; then
70 AC_SUBST([REPLACE_TRUNCL])
71 AC_SUBST([TRUNCL_LIBM])