summaryrefslogtreecommitdiffstats
path: root/kcalc/knumber/configure.in.in
blob: 8ef670b371321aaa3ad31a3b1d50e6fd8a556320 (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
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, 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

LIBGMP=
KDE_CHECK_HEADER([gmp.h], [
  AC_LANG_SAVE
  AC_LANG_CPLUSPLUS

  kde_save_LIBS=$LIBS
  LIBS="$all_libraries -lgmp"
  AC_TRY_LINK(dnl
  [
    #include <gmp.h>
  ],
  [ 
    mpz_t _mpz;
    mpz_init_set_si(_mpz, 0);
  ],
  [LIBGMP="-lgmp"],
  [
    DO_NOT_COMPILE="$DO_NOT_COMPILE kcalc"
  ])
  LIBS=$kde_save_LIBS
  AC_LANG_RESTORE

])
AC_SUBST(LIBGMP)