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_CBRT],
9 AC_REQUIRE([gl_MATH_H_DEFAULTS])
11 dnl Determine CBRT_LIBM.
12 gl_COMMON_DOUBLE_MATHFUNC([cbrt])
14 dnl Test whether cbrt() exists.
16 LIBS="$LIBS $CBRT_LIBM"
17 AC_CHECK_FUNCS([cbrt])
19 if test $ac_cv_func_cbrt = no; then
21 dnl Find libraries needed to link lib/cbrt.c.
22 AC_REQUIRE([gl_FUNC_FABS])
23 AC_REQUIRE([gl_FUNC_FREXP])
24 AC_REQUIRE([gl_FUNC_LDEXP])
26 dnl Append $FABS_LIBM to CBRT_LIBM, avoiding gratuitous duplicates.
27 case " $CBRT_LIBM " in
29 *) CBRT_LIBM="$CBRT_LIBM $FABS_LIBM" ;;
31 dnl Append $FREXP_LIBM to CBRT_LIBM, avoiding gratuitous duplicates.
32 case " $CBRT_LIBM " in
34 *) CBRT_LIBM="$CBRT_LIBM $FREXP_LIBM" ;;
36 dnl Append $LDEXP_LIBM to CBRT_LIBM, avoiding gratuitous duplicates.
37 case " $CBRT_LIBM " in
39 *) CBRT_LIBM="$CBRT_LIBM $LDEXP_LIBM" ;;