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