summaryrefslogtreecommitdiffstats
path: root/kcalc/configure.in.in
blob: 3501f1e510c05c5ce5af4337b85962565b699d68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
AC_CHECK_HEADERS(ieeefp.h)

AC_CHECK_FUNCS(fabsl)

AC_DEFUN([KDE_C_LONG_DOUBLE],
[
  AC_CACHE_CHECK(for long double, ac_cv_c_long_double,
  [
    ac_save_LIBS="$LIBS"
    LIBS="-lm $LIBS"
    AC_TRY_RUN(
    [
#define _ISOC99_SOURCE	1
#define _GNU_SOURCE	1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main() {
/* The Stardent Vistra knows sizeof(long double), but does not support it.  */
long double foo = 1.0;
char buffer[10];
/* On Ultrix 4.3 cc, long double is 4 and double is 8.  */
int result = (sizeof(long double) <= sizeof(double));
/* the following is needed for a broken printf in glibc2 */
if (!result) {
    foo = foo * 3;
    sprintf(buffer,"%0.0Lf",foo);
    result = strcmp(buffer, "3");
/* and now something mean ;-) */
    foo = powl(fabsl(foo), 1);
}
exit(result); }
    ],
    ac_cv_c_long_double=yes, ac_cv_c_long_double=no,
    ac_cv_c_long_double=no
    )
    LIBS="$ac_save_LIBS"
  ])
  if test $ac_cv_c_long_double = yes; then
    AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have support for long double in printf])
  fi
])
KDE_C_LONG_DOUBLE

have_l_funcs=yes
AC_CHECK_LIB(m, asinl,,have_l_funcs=no)
AC_CHECK_LIB(m, sqrtl,,have_l_funcs=no)

if test "xyes" = "x$have_l_funcs" ; then
  AC_DEFINE(HAVE_L_FUNCS,1,[Define if you have *l math functions (absl, ...)])
fi

AC_LANG_C
AC_CHECK_LIB(m, isinf, [
  AC_DEFINE_UNQUOTED(HAVE_FUNC_ISINF, 1, [Define if you have isinf])
])
AC_CHECK_LIB(m, round, [
  AC_DEFINE_UNQUOTED(HAVE_FUNC_ROUND, 1, [Define if you have round])
])
AC_CHECK_LIB(m, roundl, [
  AC_DEFINE_UNQUOTED(HAVE_FUNC_ROUNDL, 1, [Define if you have round])
])

kcalc_gmp_found=yes
LIBGMP=
KDE_CHECK_HEADER([gmp.h], [
  KDE_CHECK_LIB(gmp, main, [
    LIBGMP="-lgmp"
    AC_DEFINE(HAVE_GMP, 1, [Define if you have libgmp])
  ])
  ],[
  DO_NOT_COMPILE="kcalc $DO_NOT_COMPILE"
  kcalc_gmp_found=no
  ]
)
AC_SUBST(LIBGMP)