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_CBRTF],
9 AC_REQUIRE([gl_MATH_H_DEFAULTS])
10 AC_REQUIRE([gl_FUNC_CBRT])
12 dnl Test whether cbrtf() exists. Assume that cbrtf(), if it exists, is
13 dnl defined in the same library as cbrt().
15 LIBS="$LIBS $CBRT_LIBM"
16 AC_CHECK_FUNCS([cbrtf])
18 if test $ac_cv_func_cbrtf = yes; then
19 CBRTF_LIBM="$CBRT_LIBM"
20 dnl Also check whether it's declared.
21 dnl IRIX 6.5 has cbrtf() in libm but doesn't declare it in <math.h>.
22 AC_CHECK_DECL([cbrtf], , [HAVE_DECL_CBRTF=0], [[#include <math.h>]])
26 dnl Find libraries needed to link lib/cbrtf.c.
27 AC_REQUIRE([gl_FUNC_FABSF])
28 AC_REQUIRE([gl_FUNC_FREXPF])
29 AC_REQUIRE([gl_FUNC_LDEXPF])
31 dnl Append $FABSF_LIBM to CBRTF_LIBM, avoiding gratuitous duplicates.
32 case " $CBRTF_LIBM " in
34 *) CBRTF_LIBM="$CBRTF_LIBM $FABSF_LIBM" ;;
36 dnl Append $FREXPF_LIBM to CBRTF_LIBM, avoiding gratuitous duplicates.
37 case " $CBRTF_LIBM " in
38 *" $FREXPF_LIBM "*) ;;
39 *) CBRTF_LIBM="$CBRTF_LIBM $FREXPF_LIBM" ;;
41 dnl Append $LDEXPF_LIBM to CBRTF_LIBM, avoiding gratuitous duplicates.
42 case " $CBRTF_LIBM " in
43 *" $LDEXPF_LIBM "*) ;;
44 *) CBRTF_LIBM="$CBRTF_LIBM $LDEXPF_LIBM" ;;
47 AC_SUBST([CBRTF_LIBM])