Fixed intl/ and some tests, so that the project can be built and tested
[pspp-builds.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2
3 dnl Initialize.
4 AC_PREREQ(2.58)
5 AC_INIT(pspp, 0.3.1)
6 AC_CONFIG_HEADERS([config.h])
7 AM_INIT_AUTOMAKE
8
9 dnl Checks for programs.
10 AC_GNU_SOURCE
11 AC_PROG_CC
12
13 dnl Internationalization macros.
14 AM_GNU_GETTEXT
15 AM_GNU_GETTEXT_VERSION  dnl Prevents autoreconf complaint.
16
17 dnl Checks for libraries.
18 AC_CHECK_LIB(m, sin)
19 AC_CHECK_LIB(gmp, mpf_get_str, [LIBS="-lgmp $LIBS"],
20              [AC_CHECK_LIB(gmp, __gmpf_get_str, [LIBS="-lgmp $LIBS"])],
21              AC_MSG_ERROR(`You must install libgmp'))
22
23 AC_CHECK_FUNC(getopt_long,,
24         AC_MSG_ERROR(`This application depends upon getopt_long'))
25
26   
27 AC_CHECK_LIB(ncurses, tgetent, LIBS="-lncurses $LIBS" termcap=yes,
28   AC_CHECK_LIB(termcap, tgetent, LIBS="-ltermcap $LIBS" termcap=yes,
29                termcap=no))
30 if test "$termcap" = yes; then
31   AC_CHECK_HEADERS(termcap.h)
32   AC_DEFINE(HAVE_LIBTERMCAP, 1, 
33         [Define if you have the termcap library (-ltermcap).])
34 fi
35
36 AC_CHECK_LIB(readline, readline)
37 if test "$ac_cv_lib_readline_readline" = yes; then
38   AC_CHECK_HEADERS(readline/readline.h)
39   AC_CHECK_LIB(readline, add_history, history=yes,
40     AC_CHECK_LIB(history, add_history, LIBS="-lhistory" history=yes,
41                  history=no))
42   if test "$history" = yes; then
43     AC_CHECK_HEADERS(readline/history.h)
44     AC_DEFINE(HAVE_LIBHISTORY, 1,
45         [Define if you have the history library (-lhistory).])
46   fi
47 fi
48
49 dnl Checks for header files.
50 AC_CHECK_HEADERS([limits.h memory.h sys/stat.h sys/time.h sys/types.h \
51                   fpu_control.h sys/mman.h sys/wait.h ieeefp.h fenv.h])
52 AC_HEADER_STAT
53 AC_HEADER_STDC
54 AC_HEADER_TIME
55
56 AC_C_CONST
57 AC_C_INLINE
58 AC_TYPE_SIZE_T
59 AC_STRUCT_TM
60
61 AC_CHECK_SIZEOF(short, 2)
62 AC_CHECK_SIZEOF(int, 4)
63 AC_CHECK_SIZEOF(long, 4)
64 AC_CHECK_SIZEOF(long long, 0)
65 AC_CHECK_SIZEOF(float, 0)
66 AC_CHECK_SIZEOF(double, 8)
67 AC_CHECK_SIZEOF(long double, 0)
68
69 AC_DEFINE(FPREP_IEEE754, 1,
70         [Define for machines that have IEEE 754 floating point arithmetic,
71          the most common format today.])
72
73 AC_C_BIGENDIAN
74
75 BLP_IS_SPRINTF_GOOD
76 BLP_INT_DIGITS
77 BLP_RANDOM
78
79 AC_FUNC_ALLOCA
80 AC_FUNC_MEMCMP
81 AC_FUNC_VPRINTF
82 AC_REPLACE_FUNCS([memmove memset stpcpy strpbrk strerror strtol strtoul \
83                   memchr getline getdelim strcasecmp strncasecmp memmem \
84                   strtok_r])
85 AC_CHECK_FUNCS([gethostname strstr strtod __setfpucw isinf isnan finite \
86                 getpid feholdexcept])
87
88 AC_PROG_LN_S
89
90 dnl This must be after other tests so warnings don't provoke errors above.
91 if test "$ac_cv_c_compiler_gnu" = yes; then
92         CFLAGS="-g -Wall -W -Wno-uninitialized -Wwrite-strings \
93 -Wstrict-prototypes -Wpointer-arith -Wno-sign-compare"
94         if test "$CC_OPTIONS" != ""; then
95                 CFLAGS="$CFLAGS $CC_OPTIONS"
96         fi
97 fi
98 AC_SUBST(CFLAGS)
99
100 AH_BOTTOM([#include <pref.h>])
101
102 dnl This is needed otherwise --with-included-gettext fails
103 AH_BOTTOM([#include <locale.h>])
104
105 AC_CONFIG_FILES([Makefile po/Makefile.in m4/Makefile intl/Makefile 
106                  lib/Makefile lib/julcal/Makefile lib/misc/Makefile 
107                  lib/dcdflib/Makefile doc/Makefile src/Makefile 
108                  config/Makefile tests/Makefile])
109 AC_CONFIG_COMMANDS([pref.h],[
110            # Copy pref.h from pref.h.orig if prudent
111            if test ! -f pref.h; then
112              echo "creating pref.h"
113              cp $ac_given_srcdir/pref.h.orig pref.h
114            elif test "`ls -t pref.h.orig pref.h 2>/dev/null | sed 1q`" = pref.h.orig; then
115              echo "replacing pref.h with newer pref.h.orig"
116              cp $ac_given_srcdir/pref.h.orig pref.h
117            else
118              echo "pref.h exists"
119            fi
120            if test -f pref.h; then touch pref.h; fi
121           ])
122 AC_OUTPUT
123
124 dnl configure.ac ends here