3 dnl Copyright (C) 2012-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 AC_DEFUN([gl_FUNC_CBRT],
10 AC_REQUIRE([gl_MATH_H_DEFAULTS])
12 dnl Persuade glibc <math.h> to declare cbrt().
13 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
15 dnl Determine CBRT_LIBM.
16 gl_COMMON_DOUBLE_MATHFUNC([cbrt])
18 dnl Test whether cbrt() exists.
20 LIBS="$LIBS $CBRT_LIBM"
21 AC_CHECK_FUNCS([cbrt])
23 if test $ac_cv_func_cbrt = no; then
25 dnl Find libraries needed to link lib/cbrt.c.
26 AC_REQUIRE([gl_FUNC_FABS])
27 AC_REQUIRE([gl_FUNC_FREXP])
28 AC_REQUIRE([gl_FUNC_LDEXP])
30 dnl Append $FABS_LIBM to CBRT_LIBM, avoiding gratuitous duplicates.
31 case " $CBRT_LIBM " in
33 *) CBRT_LIBM="$CBRT_LIBM $FABS_LIBM" ;;
35 dnl Append $FREXP_LIBM to CBRT_LIBM, avoiding gratuitous duplicates.
36 case " $CBRT_LIBM " in
38 *) CBRT_LIBM="$CBRT_LIBM $FREXP_LIBM" ;;
40 dnl Append $LDEXP_LIBM to CBRT_LIBM, avoiding gratuitous duplicates.
41 case " $CBRT_LIBM " in
43 *) CBRT_LIBM="$CBRT_LIBM $LDEXP_LIBM" ;;