fmod, fmodl: Fix computation for large quotients x / y.
[gnulib.git] / m4 / cbrt.m4
1 # cbrt.m4 serial 1
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.
6
7 AC_DEFUN([gl_FUNC_CBRT],
8 [
9   AC_REQUIRE([gl_MATH_H_DEFAULTS])
10
11   dnl Determine CBRT_LIBM.
12   gl_COMMON_DOUBLE_MATHFUNC([cbrt])
13
14   dnl Test whether cbrt() exists.
15   save_LIBS="$LIBS"
16   LIBS="$LIBS $CBRT_LIBM"
17   AC_CHECK_FUNCS([cbrt])
18   LIBS="$save_LIBS"
19   if test $ac_cv_func_cbrt = no; then
20     HAVE_CBRT=0
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])
25     CBRT_LIBM=
26     dnl Append $FABS_LIBM to CBRT_LIBM, avoiding gratuitous duplicates.
27     case " $CBRT_LIBM " in
28       *" $FABS_LIBM "*) ;;
29       *) CBRT_LIBM="$CBRT_LIBM $FABS_LIBM" ;;
30     esac
31     dnl Append $FREXP_LIBM to CBRT_LIBM, avoiding gratuitous duplicates.
32     case " $CBRT_LIBM " in
33       *" $FREXP_LIBM "*) ;;
34       *) CBRT_LIBM="$CBRT_LIBM $FREXP_LIBM" ;;
35     esac
36     dnl Append $LDEXP_LIBM to CBRT_LIBM, avoiding gratuitous duplicates.
37     case " $CBRT_LIBM " in
38       *" $LDEXP_LIBM "*) ;;
39       *) CBRT_LIBM="$CBRT_LIBM $LDEXP_LIBM" ;;
40     esac
41   fi
42 ])