2 dnl Copyright (C) 2007 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_FREXPL],
9 AC_REQUIRE([gl_MATH_H_DEFAULTS])
11 AC_CACHE_CHECK([whether frexpl() can be used without linking with libm],
12 [gl_cv_func_frexpl_no_libm],
14 AC_TRY_LINK([#include <math.h>
16 [int e; return frexpl (x, &e) > 0;],
17 [gl_cv_func_frexpl_no_libm=yes],
18 [gl_cv_func_frexpl_no_libm=no])
20 if test $gl_cv_func_frexpl_no_libm = no; then
21 AC_CACHE_CHECK([whether frexpl() can be used with libm],
22 [gl_cv_func_frexpl_in_libm],
26 AC_TRY_LINK([#include <math.h>
28 [int e; return frexpl (x, &e) > 0;],
29 [gl_cv_func_frexpl_in_libm=yes],
30 [gl_cv_func_frexpl_in_libm=no])
33 if test $gl_cv_func_frexpl_in_libm = yes; then
37 if test $gl_cv_func_frexpl_no_libm = yes \
38 || test $gl_cv_func_frexpl_in_libm = yes; then
40 LIBS="$LIBS $FREXPL_LIBM"
43 case "$gl_cv_func_frexpl_works" in
44 *yes) gl_func_frexpl=yes ;;
45 *) gl_func_frexpl=no; REPLACE_FREXPL=1; FREXPL_LIBM= ;;
50 if test $gl_func_frexpl = yes; then
51 AC_DEFINE([HAVE_FREXPL], 1,
52 [Define if the frexpl() function is available.])
53 dnl Also check whether it's declared.
54 dnl MacOS X 10.3 has frexpl() in libc but doesn't declare it in <math.h>.
55 AC_CHECK_DECL([frexpl], , [HAVE_DECL_FREXPL=0], [#include <math.h>])
61 dnl Test whether frexpl() works also on infinite numbers (this fails e.g. on
63 AC_DEFUN([gl_FUNC_FREXPL_WORKS],
65 AC_REQUIRE([AC_PROG_CC])
66 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
67 AC_CACHE_CHECK([whether frexpl works], [gl_cv_func_frexpl_works],
73 volatile long double x;
74 /* Test on infinite numbers. */
78 long double y = frexpl (x, &exp);
83 }], [gl_cv_func_frexpl_works=yes], [gl_cv_func_frexpl_works=no],
85 irix*) gl_cv_func_frexpl_works="guessing no";;
86 *) gl_cv_func_frexpl_works="guessing yes";;