2 dnl Copyright (C) 2010-2020 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_LDEXP],
9 AC_REQUIRE([gl_CHECK_LDEXP_NO_LIBM])
11 if test $gl_cv_func_ldexp_no_libm = no; then
12 AC_CACHE_CHECK([whether ldexp() can be used with libm],
13 [gl_cv_func_ldexp_in_libm],
18 [AC_LANG_PROGRAM([[#ifndef __NO_MATH_INLINES
19 # define __NO_MATH_INLINES 1 /* for glibc */
22 double (*funcptr) (double, int) = ldexp;
24 [[return ldexp (x, -1) > 0;]])],
25 [gl_cv_func_ldexp_in_libm=yes],
26 [gl_cv_func_ldexp_in_libm=no])
29 if test $gl_cv_func_ldexp_in_libm = yes; then
33 AC_SUBST([LDEXP_LIBM])
36 dnl Test whether ldexp() can be used without linking with libm.
37 dnl Set gl_cv_func_ldexp_no_libm to 'yes' or 'no' accordingly.
38 AC_DEFUN([gl_CHECK_LDEXP_NO_LIBM],
40 AC_CACHE_CHECK([whether ldexp() can be used without linking with libm],
41 [gl_cv_func_ldexp_no_libm],
44 [AC_LANG_PROGRAM([[#ifndef __NO_MATH_INLINES
45 # define __NO_MATH_INLINES 1 /* for glibc */
48 double (*funcptr) (double, int) = ldexp;
50 [[return ldexp (x, -1) > 0;]])],
51 [gl_cv_func_ldexp_no_libm=yes],
52 [gl_cv_func_ldexp_no_libm=no])