Rewrite expression code.
[pspp-builds.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2
3 dnl Initialize.
4 AX_PREREQ(2.57)
5 AC_INIT(pspp, 0.3.1,bug-gnu-pspp@gnu.org)
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 AM_CONDITIONAL(cc_is_gcc, test x"$GCC" = x"yes" )
14
15 AC_PATH_PROG([PERL], perl, no)
16 AC_SUBST([PERL])dnl
17 if test "$PERL" = no; then
18   AC_MSG_ERROR([perl is not found])
19 fi
20 $PERL -e 'require 5.005_03;' || {
21    AC_MSG_ERROR([Perl 5.005_03 or better is required])
22 }
23
24 dnl Internationalization macros.
25 AM_GNU_GETTEXT
26 AM_GNU_GETTEXT_VERSION  dnl Prevents autoreconf complaint.
27
28 dnl Checks for libraries.
29 AC_SYS_LARGEFILE
30 AC_FUNC_FSEEKO
31 AC_CHECK_LIB(m, sin)
32 AC_ARG_WITH(libplot, [  --without-libplot         don't compile in support of charts (using libplot)])
33
34 if test x"$with_libplot" != x"no" ; then 
35         AC_CHECK_LIB(plot, pl_newpl_r,,
36           AC_MSG_ERROR([You must install libplot (or use --without-libplot)])
37         )
38 fi
39 AM_CONDITIONAL(WITHCHARTS, test x"$with_libplot" != x"no")
40
41
42 AC_CHECK_LIB(gmp, mpf_get_str,,
43         AC_CHECK_LIB(gmp, __gmpf_get_str,,
44           AC_MSG_ERROR([You must install libgmp])
45         )
46 )
47
48 AC_CHECK_LIB(gslcblas,main,,AC_MSG_ERROR([You must install libgslcblas]))
49 AC_CHECK_LIB(gsl, gsl_cdf_chisq_Q,,
50         AC_MSG_ERROR([You must install libgsl version 1.4 or later]))
51
52 AC_CHECK_LIB(gnugetopt,getopt_long)
53 AC_CHECK_FUNC(getopt_long,,
54         AC_MSG_ERROR(`This application depends upon getopt_long'))
55
56 AC_ARG_WITH(ncurses,
57 [  --without-ncurses         don't compile in ncurses command line editing])
58
59
60 if test "x$with_ncurses" = x"yes"; then 
61 AC_CHECK_LIB(ncurses, tgetent, LIBS="-lncurses $LIBS" termcap=yes,
62   AC_CHECK_LIB(termcap, tgetent, LIBS="-ltermcap $LIBS" termcap=yes,
63                termcap=no))
64 fi
65
66
67 if test "$termcap" = yes; then
68   AC_CHECK_HEADERS(termcap.h)
69   AC_DEFINE(HAVE_LIBTERMCAP, 1, 
70         [Define if you have the termcap library (-ltermcap).])
71 fi
72
73 AC_CHECK_LIB(readline, readline)
74 if test "$ac_cv_lib_readline_readline" = yes; then
75   AC_CHECK_HEADERS(readline/readline.h)
76   AC_CHECK_LIB(readline, add_history, history=yes,
77     AC_CHECK_LIB(history, add_history, LIBS="-lhistory" history=yes,
78                  history=no))
79   if test "$history" = yes; then
80     AC_CHECK_HEADERS(readline/history.h)
81     AC_DEFINE(HAVE_LIBHISTORY, 1,
82         [Define if you have the history library (-lhistory).])
83   fi
84 fi
85
86 dnl Checks for header files.
87 AC_ARG_WITH(valgrind, [  --without-valgrind        don't compile in valgrind])
88 if test "x$with_valgrind" != x"no"; then 
89  AC_CHECK_HEADERS([valgrind/valgrind.h])
90 fi
91 AC_CHECK_HEADERS([limits.h memory.h sys/stat.h sys/time.h sys/types.h \
92                   fpu_control.h sys/mman.h sys/wait.h ieeefp.h fenv.h] )
93
94 AC_HEADER_STAT
95 AC_HEADER_STDC
96 AC_HEADER_TIME
97 AC_HEADER_STDBOOL
98
99 AC_C_CONST
100 AC_C_INLINE
101 dnl  Dont use AC_TYPE_OFF_T --- it doesnt generate the HAVE_TYPE macro
102 AC_CHECK_TYPES(off_t) 
103 AC_TYPE_SIZE_T
104 AC_STRUCT_TM
105
106 AC_CHECK_SIZEOF(short, 2)
107 AC_CHECK_SIZEOF(int, 4)
108 AC_CHECK_SIZEOF(long, 4)
109 AC_CHECK_SIZEOF(long long, 0)
110 AC_CHECK_SIZEOF(float, 0)
111 AC_CHECK_SIZEOF(double, 8)
112 AC_CHECK_SIZEOF(long double, 0)
113
114 AC_DEFINE(FPREP_IEEE754, 1,
115         [Define for machines that have IEEE 754 floating point arithmetic,
116          the most common format today.])
117
118 AC_C_BIGENDIAN
119
120 BLP_IS_SPRINTF_GOOD
121 BLP_INT_DIGITS
122 BLP_RANDOM
123
124 AC_FUNC_ALLOCA
125 AC_FUNC_MEMCMP
126 AC_FUNC_VPRINTF
127 AC_REPLACE_FUNCS([memmove memset stpcpy strpbrk strerror strtol strtoul \
128                   memchr getline getdelim strcasecmp strncasecmp memmem \
129                   strtok_r])
130 AC_CHECK_FUNCS([gethostname strstr strtod __setfpucw isinf isnan finite \
131                 getpid feholdexcept mkdtemp])
132
133 AC_PROG_LN_S
134
135
136 AH_BOTTOM([#include <pref.h>])
137
138
139 AM_CONDITIONAL(unix, test x"$host_os" != x"msdos" )
140 AM_CONDITIONAL(msdos, test x"$host_os" == x"msdos" )
141
142 dnl This is needed otherwise --with-included-gettext fails
143 AH_BOTTOM([#include <locale.h>])
144
145 AC_ARG_ENABLE(debug, [  --enable-debug          Turn on diagnostic features in the program])
146 if test x"$enable_debug" = x"yes"  ; then
147   AC_DEFINE(DEBUGGING, 1, [Define to 1 if debugging is enabled.])
148 fi
149
150 AC_CONFIG_FILES([Makefile po/Makefile.in m4/Makefile 
151                  lib/Makefile lib/misc/Makefile 
152                  doc/Makefile 
153                  src/Makefile src/expressions/Makefile
154                  config/Makefile
155                  tests/Makefile])
156 AC_CONFIG_COMMANDS([pref.h],[
157            # Copy pref.h from pref.h.orig if prudent
158            if test ! -f pref.h; then
159              echo "creating pref.h"
160              cp $ac_given_srcdir/pref.h.orig pref.h
161            elif test "`ls -t pref.h.orig pref.h 2>/dev/null | sed 1q`" = pref.h.orig; then
162              echo "replacing pref.h with newer pref.h.orig"
163              cp $ac_given_srcdir/pref.h.orig pref.h
164            else
165              echo "pref.h exists"
166            fi
167            if test -f pref.h; then touch pref.h; fi
168           ])
169 AC_OUTPUT(intl/Makefile)
170
171 dnl configure.ac ends here