verify: new macro 'assume'
[gnulib.git] / m4 / cbrt.m4
1 # cbrt.m4 serial 2
2 dnl Copyright (C) 2012-2013 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 Persuade glibc <math.h> to declare cbrt().
12   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
13
14   dnl Determine CBRT_LIBM.
15   gl_COMMON_DOUBLE_MATHFUNC([cbrt])
16
17   dnl Test whether cbrt() exists.
18   save_LIBS="$LIBS"
19   LIBS="$LIBS $CBRT_LIBM"
20   AC_CHECK_FUNCS([cbrt])
21   LIBS="$save_LIBS"
22   if test $ac_cv_func_cbrt = no; then
23     HAVE_CBRT=0
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])
28     CBRT_LIBM=
29     dnl Append $FABS_LIBM to CBRT_LIBM, avoiding gratuitous duplicates.
30     case " $CBRT_LIBM " in
31       *" $FABS_LIBM "*) ;;
32       *) CBRT_LIBM="$CBRT_LIBM $FABS_LIBM" ;;
33     esac
34     dnl Append $FREXP_LIBM to CBRT_LIBM, avoiding gratuitous duplicates.
35     case " $CBRT_LIBM " in
36       *" $FREXP_LIBM "*) ;;
37       *) CBRT_LIBM="$CBRT_LIBM $FREXP_LIBM" ;;
38     esac
39     dnl Append $LDEXP_LIBM to CBRT_LIBM, avoiding gratuitous duplicates.
40     case " $CBRT_LIBM " in
41       *" $LDEXP_LIBM "*) ;;
42       *) CBRT_LIBM="$CBRT_LIBM $LDEXP_LIBM" ;;
43     esac
44   fi
45 ])