2 dnl Copyright (C) 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_CBRTL],
9 AC_REQUIRE([gl_MATH_H_DEFAULTS])
10 AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
11 AC_REQUIRE([gl_FUNC_CBRT])
13 dnl Test whether cbrtl() exists. Assume that cbrtl(), if it exists, is
14 dnl defined in the same library as cbrt().
16 LIBS="$LIBS $CBRT_LIBM"
17 AC_CHECK_FUNCS([cbrtl])
19 if test $ac_cv_func_cbrtl = yes; then
20 CBRTL_LIBM="$CBRT_LIBM"
21 dnl Also check whether it's declared.
22 dnl IRIX 6.5 has cbrtl() in libm but doesn't declare it in <math.h>.
23 AC_CHECK_DECL([cbrtl], , [HAVE_DECL_CBRTL=0], [[#include <math.h>]])
27 dnl Find libraries needed to link lib/cbrtl.c.
28 if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
29 CBRTL_LIBM="$CBRT_LIBM"
31 AC_REQUIRE([gl_FUNC_FREXPL])
32 AC_REQUIRE([gl_FUNC_LDEXPL])
34 dnl Append $FREXPL_LIBM to CBRTL_LIBM, avoiding gratuitous duplicates.
35 case " $CBRTL_LIBM " in
36 *" $FREXPL_LIBM "*) ;;
37 *) CBRTL_LIBM="$CBRTL_LIBM $FREXPL_LIBM" ;;
39 dnl Append $LDEXPL_LIBM to CBRTL_LIBM, avoiding gratuitous duplicates.
40 case " $CBRTL_LIBM " in
41 *" $LDEXPL_LIBM "*) ;;
42 *) CBRTL_LIBM="$CBRTL_LIBM $LDEXPL_LIBM" ;;
46 AC_SUBST([CBRTL_LIBM])