Increase the chances of finding libpq if it's installed.
[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.60)
5 AC_INIT(pspp, 0.4.3,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 gl_EARLY
13 AM_PROG_CC_C_O
14 AC_LIBTOOL_DLOPEN
15 AC_PROG_LIBTOOL
16 PKG_PROG_PKG_CONFIG
17
18 PSPP_ENABLE_OPTION(-Wdeclaration-after-statement)
19
20 AM_CONDITIONAL(cc_is_gcc, test x"$GCC" = x"yes" )
21
22 PSPP_CC_FOR_BUILD
23 PSPP_PERL
24
25 dnl Internationalization macros.
26 AM_GNU_GETTEXT([external], [need-ngettext])
27 AM_GNU_GETTEXT_VERSION([0.16.1])
28
29 dnl Checks for libraries.
30 AC_SYS_LARGEFILE
31 AC_CHECK_LIB(m, sin)
32 PSPP_LIBPLOT
33 PSPP_LC_PAPER
34 AM_CONDITIONAL(WITHCHARTS, test x"$with_libplot" != x"no")
35
36
37 AC_ARG_WITH(
38   gui, 
39   [AS_HELP_STRING([--without-gui], [don't build the PSPPIRE gui])])
40
41 if test x"$with_gui" != x"no" ; then 
42   PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.8.0,,
43     [PSPP_REQUIRED_PREREQ([gtk+ 2.0 v2.8.0 or later (or use --without-gui)])])
44   PKG_CHECK_MODULES(GLADE, libglade-2.0 >= 2.6.0,,
45     [PSPP_REQUIRED_PREREQ([libglade 2.0 (or use --without-gui)])])
46 fi
47 AM_CONDITIONAL(WITHGUI, test x"$with_gui" != x"no")
48
49
50 dnl Checks needed for psql reader
51 AC_ARG_VAR([PG_CONFIG], [Full pathname of the pg_config program shipped with Postgresql])
52 AC_PATH_PROG([PG_CONFIG], [pg_config], [], [$PATH:/usr/local/pgsql/bin:/usr/pgsql/bin])
53 if test -n "$PG_CONFIG" ; then 
54    AC_SUBST(PG_CONFIG)
55    AC_DEFINE([PSQL_SUPPORT], 1,
56    [Define to 1 if building in support for reading from postgres databases.])
57    PG_CFLAGS=-I`$PG_CONFIG --includedir` 
58    AC_SUBST(PG_CFLAGS)
59    PG_LDFLAGS=-R`$PG_CONFIG --libdir`
60    AC_SUBST(PG_LDFLAGS)
61    PG_LIBS=-lpq
62    AC_SUBST(PG_LIBS)
63    PKG_CHECK_MODULES(OPENSSL,libssl,
64          AC_DEFINE([USE_SSL],1,
65                     [Define to 1 if the openssl library is present.])
66             ,)
67 fi
68 AM_CONDITIONAL(PSQL_SUPPORT, test -n "$PG_CONFIG")
69
70 dnl Checks needed for gnumeric reader
71 gnm_support=yes;
72 PKG_CHECK_MODULES(LIBXML2, libxml-2.0,,
73                            [PSPP_OPTIONAL_PREREQ([libxml2]); gnm_support=no;]);
74 AC_SEARCH_LIBS(gzopen,z,,[PSPP_OPTIONAL_PREREQ([zlib]); gnm_support=no;])
75 AC_CHECK_HEADERS(zlib.h,,[PSPP_OPTIONAL_PREREQ([zlib]); gnm_support=no;])
76
77 if test x"$gnm_support" = x"yes" ; then 
78    AC_DEFINE([GNM_SUPPORT], 1,
79    [Define to 1 if building in support for reading Gnumeric files.])
80 fi
81 AM_CONDITIONAL(GNM_SUPPORT, test x"$gnm_support" = x"yes")
82
83 AC_ARG_WITH(
84   gui_tools,
85   [AS_HELP_STRING([--with-gui-tools], [build the gui developer tools])])
86 if test x"$with_gui_tools" = x"yes" ; then 
87         PKG_CHECK_MODULES(GLADE_UI, gladeui-1.0)
88 fi
89 AM_CONDITIONAL(WITH_GUI_TOOLS, test x"$with_gui_tools" = x"yes")
90
91 AC_CHECK_LIB(gslcblas,main,,[PSPP_REQUIRED_PREREQ([libgslcblas])])
92 AC_CHECK_LIB(gsl, gsl_cdf_chisq_Q,,[PSPP_REQUIRED_PREREQ([libgsl (version 1.4 or later)])])
93
94 AC_CHECK_LIB(ncurses, tgetent)
95 AC_CHECK_HEADERS(termcap.h)
96
97 PSPP_READLINE
98
99 dnl Checks for header files.
100 AC_CHECK_HEADERS([sys/wait.h fpu_control.h ieeefp.h fenv.h])
101
102 # For gnulib.
103 gl_INIT
104
105 AC_C_INLINE
106
107 AC_CHECK_SIZEOF(double)
108
109 AC_C_BIGENDIAN
110
111 AC_CHECK_FUNCS([__setfpucw fork execl execlp isinf isnan finite getpid feholdexcept fpsetmask popen round])
112
113 AC_PROG_LN_S
114
115 AC_ARG_ENABLE(
116   debug, 
117   [AS_HELP_STRING([--enable-debug], 
118                   [Turn on diagnostic features in the program])])
119 if test x"$enable_debug" = x"yes"  ; then
120   AC_DEFINE(DEBUGGING, 1, [Define to 1 if debugging is enabled.])
121 fi
122
123 # iconv is required
124 if test "$am_cv_func_iconv" != "yes"; then
125    PSPP_REQUIRED_PREREQ([iconv (see http://www.gnu.org/software/libiconv/)])
126 fi
127
128 PSPP_CHECK_PREREQS
129
130 AC_CONFIG_FILES([Makefile gl/Makefile po/Makefile.in])
131
132 AC_OUTPUT
133 echo "PSPP configured successfully."
134
135 dnl configure.ac ends here