2 dnl Copyright (C) 2012-2018 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 Persuade glibc <math.h> to declare cbrt().
12 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
14 dnl Determine CBRT_LIBM.
15 gl_COMMON_DOUBLE_MATHFUNC([cbrt])
17 dnl Test whether cbrt() exists.
19 LIBS="$LIBS $CBRT_LIBM"
20 AC_CHECK_FUNCS([cbrt])
22 if test $ac_cv_func_cbrt = no; then
24 dnl Find libraries needed to link lib/cbrt.c.
25 AC_REQUIRE([gl_FUNC_FABS])
26 AC_REQUIRE([gl_FUNC_FREXP])
27 AC_REQUIRE([gl_FUNC_LDEXP])
29 dnl Append $FABS_LIBM to CBRT_LIBM, avoiding gratuitous duplicates.
30 case " $CBRT_LIBM " in
32 *) CBRT_LIBM="$CBRT_LIBM $FABS_LIBM" ;;
34 dnl Append $FREXP_LIBM to CBRT_LIBM, avoiding gratuitous duplicates.
35 case " $CBRT_LIBM " in
37 *) CBRT_LIBM="$CBRT_LIBM $FREXP_LIBM" ;;
39 dnl Append $LDEXP_LIBM to CBRT_LIBM, avoiding gratuitous duplicates.
40 case " $CBRT_LIBM " in
42 *) CBRT_LIBM="$CBRT_LIBM $LDEXP_LIBM" ;;