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.
8 AC_INIT([altfloat],[0.3],[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])])
18 dnl Cabal won't let us specify the C compiler, so we need this hack.
19 CC_OPTS=`echo $CC | sed 's/@<:@^@<:@:space:@:>@@:>@*//'`
22 dnl We need to know the size and alignment of fenv_t in order to allocate it
24 m4_define([FENV_HEADERS], [dnl
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]])
43 AC_DEFUN([CHECK_LIBM], [AC_SEARCH_LIBS([$1], [m], [], [dnl
45 AC_DEFINE([NEED_LIBM_]m4_toupper([$1]), [1],
46 [Define to 1 if you do not have a working $1 function.])])])
53 m4_foreach([func], [C99_FLOAT_FUNCS], [CHECK_LIBM(m4_strip(func))])
60 if test x"$replaced_libm" = x"yes"; then
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.])