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>]])
24 LIBS="$LIBS $CBRTF_LIBM"
27 case "$gl_cv_func_cbrtf_works" in
35 if test $HAVE_CBRTF = 0 || test $REPLACE_CBRTF = 1; then
36 dnl Find libraries needed to link lib/cbrtf.c.
37 AC_REQUIRE([gl_FUNC_FABSF])
38 AC_REQUIRE([gl_FUNC_FREXPF])
39 AC_REQUIRE([gl_FUNC_LDEXPF])
41 dnl Append $FABSF_LIBM to CBRTF_LIBM, avoiding gratuitous duplicates.
42 case " $CBRTF_LIBM " in
44 *) CBRTF_LIBM="$CBRTF_LIBM $FABSF_LIBM" ;;
46 dnl Append $FREXPF_LIBM to CBRTF_LIBM, avoiding gratuitous duplicates.
47 case " $CBRTF_LIBM " in
48 *" $FREXPF_LIBM "*) ;;
49 *) CBRTF_LIBM="$CBRTF_LIBM $FREXPF_LIBM" ;;
51 dnl Append $LDEXPF_LIBM to CBRTF_LIBM, avoiding gratuitous duplicates.
52 case " $CBRTF_LIBM " in
53 *" $LDEXPF_LIBM "*) ;;
54 *) CBRTF_LIBM="$CBRTF_LIBM $LDEXPF_LIBM" ;;
57 AC_SUBST([CBRTF_LIBM])
60 dnl Test whether cbrtf() works.
61 dnl It returns wrong values on IRIX 6.5.
62 AC_DEFUN([gl_FUNC_CBRTF_WORKS],
64 AC_REQUIRE([AC_PROG_CC])
65 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
66 AC_CACHE_CHECK([whether cbrtf works], [gl_cv_func_cbrtf_works],
80 /* This test fails on IRIX 6.5. */
88 [gl_cv_func_cbrtf_works=yes],
89 [gl_cv_func_cbrtf_works=no],
91 irix*) gl_cv_func_cbrtf_works="guessing no";;
92 *) gl_cv_func_cbrtf_works="guessing yes";;