Imported Upstream version 1.3.14
[debian/gzip] / m4 / printf-frexp.m4
1 # printf-frexp.m4 serial 3
2 dnl Copyright (C) 2007, 2009 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 dnl Check how to define printf_frexp() without linking with libm.
8
9 AC_DEFUN([gl_FUNC_PRINTF_FREXP],
10 [
11   AC_CACHE_CHECK([whether frexp can be used without linking with libm],
12     [gl_cv_func_frexp_no_libm],
13     [
14       AC_TRY_LINK([#include <math.h>
15                    double x;
16                    int y;],
17                   [return frexp (x, &y) < 1;],
18         [gl_cv_func_frexp_no_libm=yes],
19         [gl_cv_func_frexp_no_libm=no])
20     ])
21   if test $gl_cv_func_frexp_no_libm = yes; then
22     gl_FUNC_FREXP_WORKS
23     case "$gl_cv_func_frexp_works" in
24       *yes)
25         AC_DEFINE([HAVE_FREXP_IN_LIBC], [1],
26           [Define if the frexp function is available in libc.])
27         ;;
28     esac
29   fi
30
31   AC_CACHE_CHECK([whether ldexp can be used without linking with libm],
32     [gl_cv_func_ldexp_no_libm],
33     [
34       AC_TRY_LINK([#include <math.h>
35                    double x;
36                    int y;],
37                   [return ldexp (x, y) < 1;],
38         [gl_cv_func_ldexp_no_libm=yes],
39         [gl_cv_func_ldexp_no_libm=no])
40     ])
41   if test $gl_cv_func_ldexp_no_libm = yes; then
42     AC_DEFINE([HAVE_LDEXP_IN_LIBC], [1],
43       [Define if the ldexp function is available in libc.])
44   fi
45 ])