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