Missing quotes.
[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.17])
28
29 dnl Checks for libraries.
30 AC_SYS_LARGEFILE
31 AC_SEARCH_LIBS([sin], [m])
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.12.0,,
43     [PSPP_REQUIRED_PREREQ([gtk+ 2.0 v2.12.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 v2.6.0 or later (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
52 dnl The 8.x series postgres tarballs installs with a default prefix of
53 dnl /usr/local/pgsql whereas, OSes (such as debian)  install into /usr .
54
55 dnl If the libpq.so file is in a non standard path, (one which the linker
56 dnl doesn't search) then we must set the PG_LDFLAGS to -R/usr/wherever/
57 dnl However, if the system happens to have more than one version of other
58 dnl dependent libraries (eg. libgtk) in different standard paths. (eg:
59 dnl /usr and /usr/local) then the wrong one may get linked. 
60
61 dnl To overcome this, we first check for libpq in the standard places, and
62 dnl only set PG_LDFLAGS if it's not found.
63
64
65 AC_ARG_WITH(
66   libpq, 
67   [AS_HELP_STRING([--without-libpq], [don't compile in Postgres capability])])
68
69 if test x"$with_libpq" != x"no" ; then
70  AC_SEARCH_LIBS([PQexec], [pq], [libpq_in_std_lib_path=yes])
71
72  AC_ARG_VAR([PG_CONFIG], [Full pathname of the pg_config program shipped with Postgresql])
73  if test x"$cross_compiling" != x"yes" ; then
74    AC_PATH_PROG([PG_CONFIG], [pg_config], [], [$PATH:/usr/local/pgsql/bin:/usr/pgsql/bin])
75  fi 
76  if test -n "$PG_CONFIG" ; then 
77    AC_SUBST(PG_CONFIG)
78    AC_DEFINE([PSQL_SUPPORT], 1,
79    [Define to 1 if building in support for reading from postgres databases.])
80    PG_CFLAGS=-I`$PG_CONFIG --includedir` 
81    AC_SUBST(PG_CFLAGS)
82    
83    if test "x$libpq_in_std_lib_path" != x"yes" ; then
84       PG_LDFLAGS="-L`$PG_CONFIG --libdir` -R`$PG_CONFIG --libdir`"
85    fi
86    AC_SUBST(PG_LDFLAGS)
87
88    PG_LIBS=-lpq
89    AC_SUBST(PG_LIBS)
90    PKG_CHECK_EXISTS(libssl,
91          AC_DEFINE([USE_SSL],1,
92                     [Define to 1 if the openssl library is present.])
93             ,)
94  fi
95 fi
96 AM_CONDITIONAL(PSQL_SUPPORT, test -n "$PG_CONFIG")
97
98 dnl Checks needed for gnumeric reader
99 gnm_support=yes;
100 PKG_CHECK_MODULES(LIBXML2, libxml-2.0,,
101                            [PSPP_OPTIONAL_PREREQ([libxml2]); gnm_support=no;]);
102 AC_SEARCH_LIBS(gzopen,z,,[PSPP_OPTIONAL_PREREQ([zlib]); gnm_support=no;])
103 AC_CHECK_HEADERS(zlib.h,,[PSPP_OPTIONAL_PREREQ([zlib]); gnm_support=no;])
104
105 if test x"$gnm_support" = x"yes" ; then 
106    AC_DEFINE([GNM_SUPPORT], 1,
107    [Define to 1 if building in support for reading Gnumeric files.])
108 fi
109 AM_CONDITIONAL(GNM_SUPPORT, test x"$gnm_support" = x"yes")
110
111 AC_ARG_WITH(
112   gui_tools,
113   [AS_HELP_STRING([--with-gui-tools], [build the gui developer tools])])
114 if test x"$with_gui_tools" = x"yes" ; then 
115         PKG_CHECK_MODULES(GLADE_UI, gladeui-1.0)
116 fi
117 AM_CONDITIONAL(WITH_GUI_TOOLS, test x"$with_gui_tools" = x"yes")
118
119 AC_SEARCH_LIBS([cblas_dsdot], [gslcblas],,[PSPP_REQUIRED_PREREQ([libgslcblas])])
120 AC_SEARCH_LIBS([gsl_cdf_chisq_Q], [gsl],,[PSPP_REQUIRED_PREREQ([libgsl (version 1.4 or later)])])
121
122 dnl Recent versions of GNU ncurses install the curses header files into
123 dnl /usr/include/ncurses, and provide a 'ncurses5-config' program which
124 dnl enables us to discover where they are. Earlier versions don't have
125 dnl this, so we can't rely on it.  So if ncurses5-config is present,
126 dnl we'll trust it to find the right information.  Otherwise, we'll
127 dnl try to discover it ourselves.
128 dnl To confound things further, Cygwin has decided to rename ncurses5-config
129 dnl to ncurses8-config !!!
130 AC_ARG_WITH(
131   libncurses, 
132   [AS_HELP_STRING([--without-libncurses], [don't compile in ncurses functions])])
133
134 if test x"$with_libncurses" != x"no" ; then
135   if test x"$cross_compiling" != x"yes" ; then
136           AC_CHECK_PROGS([NCURSES_CONFIG], [ncurses5-config ncurses8-config])
137   fi
138   if test x"$NCURSES_CONFIG" = x ; then
139           AC_SEARCH_LIBS([tgetent], [ncurses],
140               [curses_available=yes; AC_CHECK_HEADERS([term.h curses.h],,[curses_available=no])])
141   else
142           old_cflags=$CFLAGS
143           CFLAGS="$CFLAGS `$NCURSES_CONFIG --cflags`"
144           AC_CHECK_HEADERS([term.h curses.h],[curses_available=yes])
145           CFLAGS=$old_cflags
146           if test x"$curses_available" = x"yes" ; then
147            NCURSES_LIBS=`$NCURSES_CONFIG --libs`
148            NCURSES_CFLAGS=`$NCURSES_CONFIG --cflags`
149            AC_SUBST(NCURSES_CFLAGS)
150            AC_SUBST(NCURSES_LIBS)
151           fi
152   fi
153   if test x"$curses_available" = x"yes" ; then
154           AC_DEFINE([LIBNCURSES_USABLE], 1,
155               [Define to 1 if the libncurses is both present and usable.])
156   fi
157   AC_CHECK_HEADERS([termcap.h])
158 fi
159
160 PSPP_READLINE
161
162 dnl Checks for header files.
163 AC_CHECK_HEADERS([sys/wait.h fpu_control.h ieeefp.h fenv.h])
164
165 # For gnulib.
166 gl_INIT
167
168 AC_C_INLINE
169
170 AC_CHECK_SIZEOF(double)
171
172 AC_C_BIGENDIAN
173
174 AC_CHECK_FUNCS([__setfpucw fork execl execlp isinf isnan finite getpid feholdexcept fpsetmask popen round])
175
176 AC_PROG_LN_S
177
178 AC_ARG_ENABLE(
179   debug, 
180   [AS_HELP_STRING([--enable-debug], 
181                   [Turn on diagnostic features in the program])])
182 if test x"$enable_debug" = x"yes"  ; then
183   AC_DEFINE(DEBUGGING, 1, [Define to 1 if debugging is enabled.])
184 fi
185
186 # iconv is required
187 if test "$am_cv_func_iconv" != "yes"; then
188    PSPP_REQUIRED_PREREQ([iconv (see http://www.gnu.org/software/libiconv/)])
189 fi
190
191 PSPP_CHECK_PREREQS
192
193 AC_CONFIG_FILES([Makefile gl/Makefile po/Makefile.in])
194
195 AC_OUTPUT
196 echo "PSPP configured successfully."
197
198 dnl configure.ac ends here