cfloat: Use FE_ALL_EXCEPT instead of -1.
[altfloat.git] / configure.ac
blob1fd8518382ea896d049aab2dacf4d1a58911badd
1 dnl Copyright (C) 2009-2010 Nick Bowler
2 dnl Copying and distribution of this file, with or without modification,
3 dnl are permitted in any medium without royalty provided the copyright
4 dnl notice and this notice are preserved.  This file is offered as-is,
5 dnl without any warranty.
7 AC_PREREQ(2.62)
8 AC_INIT([altfloat],[0.2],[nbowler@draconx.ca])
9 AC_CONFIG_SRCDIR([altfloat.cabal])
10 AC_CONFIG_HEADER([config.h])
12 dnl We don't actually care, but this shuts up the warning.
13 AC_ARG_WITH([compiler], [AS_HELP_STRING([--with-compiler],
14         [specify which Haskell compiler to use])])
16 AC_PROG_CC_C99
18 dnl Cabal won't let us specify the C compiler, so we need this hack.
19 CC_OPTS=`echo $CC | sed 's/@<:@^@<:@:space:@:>@@:>@*//'`
20 AC_SUBST([CC_OPTS])
22 dnl We need to know the size and alignment of fenv_t in order to allocate it
23 dnl in Haskell code.
24 m4_define([FENV_HEADERS], [dnl
25 #include <fenv.h>
28 AC_CHECK_SIZEOF([fenv_t], [], [FENV_HEADERS])
29 AC_CHECK_ALIGNOF([fenv_t], [FENV_HEADERS])
31 dnl Check for some C library functions.
32 m4_define([C99_FLOAT_FUNCS], [dnl
33         [acosf], [asinf], [atanf], [atan2f], [cosf], [sinf], [tanf], [acoshf],
34         [asinhf], [atanhf], [coshf], [sinhf], [tanhf], [expf], [exp2f],
35         [expm1f], [frexpf], [ilogbf], [ldexpf], [logf], [log10f], [log1pf],
36         [log2f], [logbf], [modff], [scalbnf], [scalblnf], [cbrtf], [fabsf],
37         [hypotf], [powf], [sqrtf], [fmodf], [remainderf], [remquof],
38         [copysignf], [nanf], [erff], [erfcf], [lgammaf], [tgammaf], [ceilf],
39         [floorf], [nearbyintf], [rintf], [lrintf], [llrintf], [roundf],
40         [lroundf], [llroundf], [truncf], [fdimf], [fmaxf], [fminf], [fmaf]])
42 replaced_libm=no
43 AC_DEFUN([CHECK_LIBM], [AC_SEARCH_LIBS([$1], [m], [], [dnl
44         replaced_libm=yes
45         AC_DEFINE([NEED_LIBM_]m4_toupper([$1]), [1],
46                 [Define to 1 if you do not have a working $1 function.])])])
47 CHECK_LIBM([nan])
48 CHECK_LIBM([log2])
49 CHECK_LIBM([exp2])
50 CHECK_LIBM([fma])
51 CHECK_LIBM([remquo])
53 m4_foreach([func], [C99_FLOAT_FUNCS], [CHECK_LIBM(m4_strip(func))])
55 AC_CONFIG_FILES([
56         altfloat.buildinfo
58 AC_OUTPUT
60 if test x"$replaced_libm" = x"yes"; then
61 echo
62 AC_MSG_WARN([
63 Your C library appears to not provide all C99 math functions.
64 Replacements will be built, but note that they may raise spurious
65 exceptions or their accuracy may deviate from applicable standards.])