Use -Wdeclaration-after-statement if available.
[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.1,bug-gnu-pspp@gnu.org)
6 AC_CONFIG_HEADERS([config.h])
7 AM_INIT_AUTOMAKE(1.9)
8
9 dnl Checks for programs.
10 AC_GNU_SOURCE
11 AC_PROG_CC
12 AM_PROG_CC_C_O
13 AC_PROG_RANLIB
14 gl_EARLY
15
16 PSPP_ENABLE_WARNING(-Wdeclaration-after-statement)
17
18 AM_CONDITIONAL(cc_is_gcc, test x"$GCC" = x"yes" )
19
20
21 dnl Check that Perl is available.
22 AC_PATH_PROG([PERL], perl, no)
23 AC_SUBST([PERL])dnl
24 if test "$PERL" = no; then
25   AC_MSG_ERROR([perl is not found])
26 fi
27 $PERL -e 'require 5.005_03;' || {
28    AC_MSG_ERROR([Perl 5.005_03 or better is required])
29 }
30
31 dnl Internationalization macros.
32 AM_GNU_GETTEXT
33 AM_GNU_GETTEXT_VERSION([0.14.5])
34
35 dnl Checks for libraries.
36 AC_SYS_LARGEFILE
37 AC_FUNC_FSEEKO
38 AC_CHECK_LIB(m, sin)
39 AC_ARG_WITH(libplot, [  --without-libplot         don't compile in support of charts (using libplot)])
40
41 if test x"$with_libplot" != x"no" ; then 
42         AC_CHECK_LIB(plot, pl_newpl_r,,
43           AC_MSG_ERROR([You must install libplot development libraries (or use --without-libplot)])
44         )
45 fi
46 AM_CONDITIONAL(WITHCHARTS, test x"$with_libplot" != x"no")
47
48
49 AC_ARG_WITH(gui, [  --without-gui         don't build the PSPPIRE gui])
50
51 if test x"$with_gui" != x"no" ; then 
52         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6.0)
53         PKG_CHECK_MODULES(GLADE, libglade-2.0)
54 fi
55 AM_CONDITIONAL(WITHGUI, test x"$with_gui" != x"no")
56
57
58 dnl Check that off_t is defined as an integer type.
59 dnl Solaris sometimes declares it as a struct, if it
60 dnl thinks that the compiler does not support `long long'.
61 AC_COMPILE_IFELSE([#include <sys/types.h>
62 #include <unistd.h>
63 off_t x = 0;
64 int main (void) 
65
66   lseek (0, 1, 2);
67   return 0;
68 }], [], [AC_MSG_ERROR(
69 [Your system's definition of off_t is broken.  You are probably
70 using Solaris.  You can probably fix the problem with
71 `--disable-largefile' or `CFLAGS=-ansi'.])])
72
73 AC_CHECK_LIB(gslcblas,main,,AC_MSG_ERROR([You must install libgslcblas development libraries]))
74 AC_CHECK_LIB(gsl, gsl_cdf_chisq_Q,,
75   AC_MSG_ERROR([You must install development libraries for libgsl version 1.4 or later]))
76
77 AC_CHECK_LIB(ncurses, tgetent)
78 AC_CHECK_HEADERS(termcap.h)
79
80 PSPP_READLINE
81
82 dnl Checks for header files.
83 AC_CHECK_HEADERS([limits.h memory.h sys/stat.h sys/time.h sys/types.h \
84                   fpu_control.h sys/mman.h sys/wait.h ieeefp.h fenv.h] )
85
86 # For gnulib.
87 gl_INIT
88
89 AC_C_CONST
90 AC_C_INLINE
91
92 dnl  Dont use AC_TYPE_OFF_T --- it doesnt generate the HAVE_TYPE macro
93 AC_CHECK_TYPES(off_t) 
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 AC_FUNC_VPRINTF
109 AC_CHECK_FUNCS([strchr strrchr __setfpucw isinf isnan finite getpid feholdexcept])
110
111 AC_PROG_LN_S
112
113
114 AM_CONDITIONAL(unix, test x"$host_os" != x"msdos" )
115 AM_CONDITIONAL(msdos, test x"$host_os" = x"msdos" )
116
117 dnl This is needed otherwise --with-included-gettext fails
118 AH_BOTTOM([#include <locale.h>])
119
120 AC_ARG_ENABLE(debug, [  --enable-debug          Turn on diagnostic features in the program])
121 if test x"$enable_debug" = x"yes"  ; then
122   AC_DEFINE(DEBUGGING, 1, [Define to 1 if debugging is enabled.])
123 fi
124
125 AC_CONFIG_FILES([Makefile gl/Makefile intl/Makefile po/Makefile.in])
126
127 AC_OUTPUT
128
129 dnl configure.ac ends here