2 dnl Copyright (C) 2011-2012 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_FABSL],
9 AC_REQUIRE([gl_MATH_H_DEFAULTS])
10 AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
12 dnl Determine FABSL_LIBM.
13 gl_MATHFUNC([fabsl], [long double], [(long double)])
14 if test $gl_cv_func_fabsl_no_libm = yes \
15 || test $gl_cv_func_fabsl_in_libm = yes; then
17 LIBS="$LIBS $FABSL_LIBM"
20 case "$gl_cv_func_fabsl_works" in
27 if test $HAVE_FABSL = 0 || test $REPLACE_FABSL = 1; then
28 dnl Find libraries needed to link lib/fabsl.c.
29 if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
30 AC_REQUIRE([gl_FUNC_FABS])
31 FABSL_LIBM="$FABS_LIBM"
36 AC_SUBST([FABSL_LIBM])
39 dnl Test whether fabsl() works on a minus zero.
40 dnl On IRIX 6.5, with gcc 4.2.4 and without -fno-builtin-fabsl, the value is a
41 dnl minus zero rather than a positive zero.
42 AC_DEFUN([gl_FUNC_FABSL_WORKS],
44 AC_REQUIRE([AC_PROG_CC])
45 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
46 AC_CACHE_CHECK([whether fabsl works], [gl_cv_func_fabsl_works],
53 volatile long double x;
55 long double zero = 0.0L;
58 x = - (LDBL_MIN * LDBL_MIN * LDBL_MIN);
60 return (memcmp (&y, &zero, sizeof y) != 0);
63 [gl_cv_func_fabsl_works=yes],
64 [gl_cv_func_fabsl_works=no],
66 irix*) gl_cv_func_fabsl_works="guessing no";;
67 *) gl_cv_func_fabsl_works="guessing yes";;