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