2 dnl Copyright (C) 2007-2008, 2010 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.
20 [[#ifndef __NO_MATH_INLINES
21 # define __NO_MATH_INLINES 1 /* for glibc */
27 if test "$TRUNCL_LIBM" = "?"; then
32 [[#ifndef __NO_MATH_INLINES
33 # define __NO_MATH_INLINES 1 /* for glibc */
41 if test "$TRUNCL_LIBM" = "?"; then
44 dnl Test whether truncl() works. It crashes on OSF/1 4.0d.
46 LIBS="$LIBS $TRUNCL_LIBM"
47 AC_CACHE_CHECK([whether truncl works], [gl_cv_func_truncl_works],
58 [gl_cv_func_truncl_works=yes],
59 [gl_cv_func_truncl_works=no],
61 osf4*) gl_cv_func_truncl_works="guessing no";;
62 *) gl_cv_func_truncl_works="guessing yes";;
67 case "$gl_cv_func_truncl_works" in
69 *) REPLACE_TRUNCL=1 ;;
74 if test $HAVE_DECL_TRUNCL = 0 || test $REPLACE_TRUNCL = 1; then
78 AC_SUBST([TRUNCL_LIBM])