2 dnl Copyright (C) 2010-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_EXP2L],
9 AC_REQUIRE([gl_MATH_H_DEFAULTS])
10 AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
11 AC_REQUIRE([gl_FUNC_EXP2])
13 dnl Persuade glibc <math.h> to declare exp2l().
14 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
16 dnl Test whether exp2l() exists. Assume that exp2l(), if it exists, is
17 dnl defined in the same library as exp2().
19 LIBS="$LIBS $EXP2_LIBM"
20 AC_CHECK_FUNCS([exp2l])
22 if test $ac_cv_func_exp2l = yes; then
24 EXP2L_LIBM="$EXP2_LIBM"
25 dnl Also check whether it's declared.
26 dnl IRIX 6.5 has exp2l() in libm but doesn't declare it in <math.h>.
27 AC_CHECK_DECL([exp2l], , [HAVE_DECL_EXP2L=0], [[#include <math.h>]])
31 dnl Find libraries needed to link lib/exp2l.c.
32 if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
33 EXP2L_LIBM="$EXP2_LIBM"
35 AC_REQUIRE([gl_FUNC_ISNANL])
36 AC_REQUIRE([gl_FUNC_ROUNDL])
37 AC_REQUIRE([gl_FUNC_LDEXPL])
39 dnl Append $ISNANL_LIBM to EXP2L_LIBM, avoiding gratuitous duplicates.
40 case " $EXP2L_LIBM " in
41 *" $ISNANL_LIBM "*) ;;
42 *) EXP2L_LIBM="$EXP2L_LIBM $ISNANL_LIBM" ;;
44 dnl Append $ROUNDL_LIBM to EXP2L_LIBM, avoiding gratuitous duplicates.
45 case " $EXP2L_LIBM " in
46 *" $ROUNDL_LIBM "*) ;;
47 *) EXP2L_LIBM="$EXP2L_LIBM $ROUNDL_LIBM" ;;
49 dnl Append $LDEXPL_LIBM to EXP2L_LIBM, avoiding gratuitous duplicates.
50 case " $EXP2L_LIBM " in
51 *" $LDEXPL_LIBM "*) ;;
52 *) EXP2L_LIBM="$EXP2L_LIBM $LDEXPL_LIBM" ;;
56 AC_SUBST([EXP2L_LIBM])