1# printf-frexp.m4 serial 5
2dnl Copyright (C) 2007, 2009-2012 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl Check how to define printf_frexp() without linking with libm.
8
9AC_DEFUN([gl_FUNC_PRINTF_FREXP],
10[
11  AC_REQUIRE([gl_CHECK_FREXP_NO_LIBM])
12  if test $gl_cv_func_frexp_no_libm = yes; then
13    gl_FUNC_FREXP_WORKS
14    case "$gl_cv_func_frexp_works" in
15      *yes)
16        AC_DEFINE([HAVE_FREXP_IN_LIBC], [1],
17          [Define if the frexp function is available in libc.])
18        ;;
19    esac
20  fi
21
22  AC_CACHE_CHECK([whether ldexp can be used without linking with libm],
23    [gl_cv_func_ldexp_no_libm],
24    [
25      AC_LINK_IFELSE(
26        [AC_LANG_PROGRAM(
27           [[#include <math.h>
28             double x;
29             int y;]],
30           [[return ldexp (x, y) < 1;]])],
31        [gl_cv_func_ldexp_no_libm=yes],
32        [gl_cv_func_ldexp_no_libm=no])
33    ])
34  if test $gl_cv_func_ldexp_no_libm = yes; then
35    AC_DEFINE([HAVE_LDEXP_IN_LIBC], [1],
36      [Define if the ldexp function is available in libc.])
37  fi
38])
39