Just do not compile bug-replay(1) if libxml2-2.5.9 is not available.
[captive.git] / configure.in
1 # $Id$
2 # Source file to generate "./configure" to prepare package for compilation
3 # Copyright (C) 2002-2003 Jan Kratochvil <project-captive@jankratochvil.net>
4
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; exactly version 2 of June 1991 is required
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
18
19 AC_INIT(src/libcaptive/Makefile-libcaptive.am)
20 dnl 2.53 for AM_GLIB_GNU_GETTEXT:
21 AC_PREREQ(2.53)
22 AM_INIT_AUTOMAKE(captive,0.9cvs)
23 AM_CONFIG_HEADER(config.h)
24 AM_MAINTAINER_MODE
25 dnl Call AC_PROG_CC before AC_ISC_POSIX.
26 AC_PROG_CC(gcc3 gcc-3.0 gcc cc)
27 AC_TRY_CPP([
28 #if __GNUC__ >= 3
29 #else
30 #error "GCC version 3.0+ required at least for ReactOS anonymous unions"
31 #endif
32 ],,[AC_MSG_ERROR([Captive requires GCC version 3.0+.])])
33 dnl Prevent "AC_TRY_COMPILE was called before AC_ISC_POSIX":
34 AC_ISC_POSIX
35 AC_SYS_LARGEFILE
36 AM_PROG_AS
37 AM_ENABLE_STATIC
38 AM_DISABLE_SHARED
39 AM_PROG_LIBTOOL
40
41 dnl gettext localization.
42 dnl Use simpler AM_GLIB_GNU_GETTEXT instead of AM_GNU_GETTEXT
43 dnl as we depend on glib and glib requires system installed gettext anyway.
44 dnl http://lists.gnome.org/archives/gtk-devel-list/2003-April/msg00066.html
45 dnl Special 'GETTEXT_PACKAGE' is required by glib gettext.
46 ALL_LINGUAS="cs"
47 GETTEXT_PACKAGE="$PACKAGE"
48 AC_SUBST(GETTEXT_PACKAGE)
49 AM_GLIB_GNU_GETTEXT
50
51 GTK_DOC_CHECK
52 dnl AM_CONDITIONAL needs to be here explicitely for doc/apiref/Makefile rebuild
53 AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
54
55 dnl Do not discard 'CFLAGS' settings as they may have been passed us by rpmbuild(8)
56
57 dnl Define MAINTAINER_MODE in config.h.
58 if test "$USE_MAINTAINER_MODE" = "yes";then
59         AC_DEFINE(MAINTAINER_MODE,,[Turn even some software behaviour according to MAINTAINER_MODE.])
60         CFLAGS="$CFLAGS -ggdb3 -Wall -Wstrict-prototypes -Wsign-compare"  ## FIXME: fix all sources: -Wsign-compare
61         fi
62 dnl Some Makefiles use additional tests etc.
63 AM_CONDITIONAL(MAINTAINER_MODE,[test "$USE_MAINTAINER_MODE" = "yes"])
64
65 AC_ARG_WITH(sandbox-setuid,
66                 [  --with-sandbox-setuid=user    non-privileged user  for captive-sandbox-server (def.=captive)],
67                 [ CAPTIVE_SANDBOX_SETUID="$withval" ],[ CAPTIVE_SANDBOX_SETUID="captive" ])
68 AC_DEFINE_UNQUOTED(CAPTIVE_SANDBOX_SETUID,"$CAPTIVE_SANDBOX_SETUID",
69                 [non-privileged user  for captive-sandbox-server])
70
71 AC_ARG_WITH(sandbox-setgid,
72                 [  --with-sandbox-setgid=group   non-privileged group for captive-sandbox-server (def.=captive)],
73                 [ CAPTIVE_SANDBOX_SETGID="$withval" ],[ CAPTIVE_SANDBOX_SETGID="captive" ])
74 AC_DEFINE_UNQUOTED(CAPTIVE_SANDBOX_SETGID,"$CAPTIVE_SANDBOX_SETGID",
75                 [non-privileged group for captive-sandbox-server])
76
77 AC_ARG_WITH(sandbox-chroot,
78                 [  --with-sandbox-chroot=dir     root-owned directory for captive-sandbox-server (def.=/var/lib/captive)],
79                 [ CAPTIVE_SANDBOX_CHROOT="$withval" ],[ CAPTIVE_SANDBOX_CHROOT="/var/lib/captive" ])
80 AC_DEFINE_UNQUOTED(CAPTIVE_SANDBOX_CHROOT,"$CAPTIVE_SANDBOX_CHROOT",
81                 [root-owned directory for captive-sandbox-server])
82
83 dnl Permit 'if IS_FALSE' for Makefile.am-s; symbol 'FALSE' forbidden by automake
84 AM_CONDITIONAL(IS_FALSE,false)
85
86 dnl Separate 'acconfig.h' is no longer recommended by autoconf
87 AH_TOP([
88 #ifndef _CAPTIVE_CONFIG_H
89 #define _CAPTIVE_CONFIG_H 1
90 ])
91 AH_BOTTOM([
92 /* Do not place any stuff to AH_TOP as some of its includes
93  * would discard the effect of _FILE_OFFSET_BITS by AC_SYS_LARGEFILE.
94  */
95
96 #ifdef ENABLE_NLS
97 /* <libintl.h> is taken from "$(top_srcdir)/intl" if system doesn't provide intl */
98 #       include <libintl.h>
99 #ifdef LIBCAPTIVE
100 #       define _(String) dgettext (PACKAGE,String)
101 #else
102 #       define _(String) gettext (String)
103 #endif /* LIBCAPTIVE */
104 #       ifdef gettext_noop
105 #               define N_(String) gettext_noop (String)
106 #       else
107 #               define N_(String) (String)
108 #       endif
109 #else /* !ENABLE_NLS */
110 /* Stubs that do something close enough.  */
111 #       define textdomain(String) (String)
112 #       define gettext(String) (String)
113 #       define dgettext(Domain,Message) (Message)
114 #       define dcgettext(Domain,Message,Type) (Message)
115 #       define bindtextdomain(Domain,Directory) (Domain)
116 #       define _(String) (String)
117 #       define N_(String) (String)
118 #endif /* !ENABLE_NLS */
119
120 #include <glib/gtypes.h>        /* for 'gchar' */
121 #define G_LOG_DOMAIN ((const gchar *)"Captive")
122
123 /* Supplemental definitions not possible in this file. */
124 #ifdef LIBCAPTIVE
125 #include "captive/config2.h"
126 #endif
127
128 #endif /* !_CAPTIVE_CONFIG_H */
129 ])
130
131 AM_PATH_GLIB_2_0(,,[AC_MSG_ERROR([Captive requires glib-2.0 library.])],[gmodule gobject])
132 dnl Force glib for the whole package
133 CFLAGS="$CFLAGS $GLIB_CFLAGS"
134 LIBS="$LIBS $GLIB_LIBS"
135
136 dnl popt
137 AC_CHECK_LIB(popt,poptParseArgvString,[POPT_LIBS="-lpopt"],[AC_MSG_ERROR([Captive requires popt library.])])
138 AC_SUBST(POPT_LIBS)
139
140 AC_ARG_WITH(readline,   [  --with-readline=[no/yes/auto]        cmdline client w/line editing [default=auto]],,with_readline=auto)
141 AC_CHECK_HEADERS(readline/history.h)
142 dnl Check for libraries, if needed by configuration options.
143 if test "$with_readline" != "no"
144 then
145         if test -d "/usr/lib/termcap"
146         then
147                 READLINE_LDFLAGS="$READLINE_LDFLAGS -L/usr/lib/termcap"
148         fi
149         have_libreadline=false
150         need_failed=""
151         for need in "" termcap ncurses; do
152                 if test "x$need" != "x"
153                 then
154                         captive_save_LIBS="$LIBS"
155                         AC_CHECK_LIB($need, main,,
156                                 [ need_failed="$need_failed $need"
157                                 continue ]
158                                 )
159                         LIBS="$captive_save_LIBS"
160                         lneed="-l$need"
161                 else
162                         lneed=""
163                 fi
164                 dnl Prevent AC_CHECK_LIB() here as it would _cache_ the value ignoring
165                 dnl our ever-changing "additiona libraries" parameter
166                 captive_save_LIBS="$LIBS"
167                 LIBS="-lreadline $lneed $READLINE_LIBS"
168                 AC_TRY_LINK(,[ main() ],
169                         [ have_libreadline=true
170                         READLINE_LIBS="$LIBS" ])
171                 LIBS="$captive_save_LIBS"
172                 if $have_libreadline
173                 then
174                         break
175                 fi
176         done
177         if $have_libreadline
178         then
179                 AC_DEFINE(HAVE_LIBREADLINE,,[Use functions from libreadline?])
180                 AC_CHECK_LIB(readline, add_history,
181                         AC_DEFINE(HAVE_ADD_HISTORY,,[Use 'history' extension of libreadline?]),,
182                         $READLINE_LIBS)
183         else
184                 for need in $need_failed; do
185                         AC_MSG_WARN(captive recommends $need library as your readline library
186                         probably needs it.)
187                 done
188                 if test "$with_readline" = "yes"
189                 then
190                         AC_MSG_ERROR([captive did not find the requested readline library for its cmdline client line editing capability.])
191                 else
192                         AC_MSG_WARN([captive recommends readline library for its cmdline client line editing capability.])
193                 fi
194         fi
195 fi
196 AC_SUBST(READLINE_LIBS)
197 AC_SUBST(READLINE_LDFLAGS)
198
199 PKG_CHECK_MODULES(GNOME_VFS_MODULE,gnome-vfs-module-2.0)
200 AC_SUBST(GNOME_VFS_MODULE_CFLAGS)
201 AC_SUBST(GNOME_VFS_MODULE_LIBS)
202
203 dnl Check for 2.5.9 for: http://bugzilla.gnome.org/show_bug.cgi?id=117702
204 dnl Check the version - impossible to reliably check the missing feature.
205 PKG_CHECK_MODULES(LIBXML,libxml-2.0 >= 2.5.9,[ have_libxml_buffering=true ],[
206         dnl Disable bug-replay(1) build if not met; --bug-pathname would be still OK.
207         PKG_CHECK_MODULES(LIBXML,libxml-2.0,[ have_libxml_buffering=false ])
208         ])
209 AM_CONDITIONAL(HAVE_LIBXML_BUFFERING,$have_libxml_buffering)
210 AC_SUBST(LIBXML_CFLAGS)
211 AC_SUBST(LIBXML_LIBS)
212
213 PKG_CHECK_MODULES(OPENSSL,openssl,,[
214         dnl At least Debian-3.0r1 has openssl but without its .pc module.
215         AC_CHECK_LIB(crypto,MD5,[
216                 OPENSSL_CFLAGS=""
217                 OPENSSL_LIBS="-lcrypto"
218                 ],[AC_MSG_ERROR([Captive requires crypto library (of openssl).])])
219         ])
220 AC_SUBST(OPENSSL_CFLAGS)
221 AC_SUBST(OPENSSL_LIBS)
222
223 dnl for $(top_srcdir)/src/libcaptive/sandbox/split-sandbox.c
224 AM_PATH_LINC(,,[AC_MSG_ERROR([Captive requires linc library used by ORBit.])])
225
226 dnl for $(top_srcdir)/src/libcaptive/client/
227 dnl Do not use '[client server]' as $4 to prevent: configure: test: too many arguments
228 dnl  - currently this argument is not used by 'orbit2-config' in any way anyway
229 AM_PATH_ORBIT2(,,[AC_MSG_ERROR([Captive requires ORBit library.])])
230
231
232 AC_SUBST(CFLAGS)
233 AC_SUBST(LIBS)
234
235 dnl "Makefile" output files MUST have pathnames incl./excl. "./" prefix as specified!
236 AC_OUTPUT([
237 captive.spec
238 Makefile
239 ./macros/Makefile
240 ./po/Makefile.in
241 ./src/Makefile
242 ./src/libcaptive/Makefile
243 ./src/libcaptive/include/Makefile
244 ./src/libcaptive/include/captive/Makefile
245 ./src/libcaptive/include/reactos/Makefile
246 ./src/libcaptive/include/reactos/ddk/Makefile
247 ./src/libcaptive/include/reactos/ddk/i386/Makefile
248 ./src/libcaptive/include/reactos/internal/Makefile
249 ./src/libcaptive/include/reactos/internal/i386/Makefile
250 ./src/libcaptive/include/reactos/napi/Makefile
251 ./src/libcaptive/include/reactos/ntos/Makefile
252 ./src/libcaptive/reactos/Makefile
253 ./src/libcaptive/reactos/include/Makefile
254 ./src/libcaptive/reactos/hal/Makefile
255 ./src/libcaptive/reactos/hal/halx86/Makefile
256 ./src/libcaptive/reactos/ntoskrnl/Makefile
257 ./src/libcaptive/reactos/ntoskrnl/dbg/Makefile
258 ./src/libcaptive/reactos/ntoskrnl/ex/Makefile
259 ./src/libcaptive/reactos/ntoskrnl/fs/Makefile
260 ./src/libcaptive/reactos/ntoskrnl/io/Makefile
261 ./src/libcaptive/reactos/ntoskrnl/ke/Makefile
262 ./src/libcaptive/reactos/ntoskrnl/ldr/Makefile
263 ./src/libcaptive/reactos/ntoskrnl/mm/Makefile
264 ./src/libcaptive/reactos/ntoskrnl/nt/Makefile
265 ./src/libcaptive/reactos/ntoskrnl/ob/Makefile
266 ./src/libcaptive/reactos/ntoskrnl/ps/Makefile
267 ./src/libcaptive/reactos/ntoskrnl/rtl/Makefile
268 ./src/libcaptive/reactos/ntoskrnl/rtl/i386/Makefile
269 ./src/libcaptive/reactos/ntoskrnl/se/Makefile
270 ./src/libcaptive/halcaptive/Makefile
271 ./src/libcaptive/cc/Makefile
272 ./src/libcaptive/cm/Makefile
273 ./src/libcaptive/ex/Makefile
274 ./src/libcaptive/fs/Makefile
275 ./src/libcaptive/io/Makefile
276 ./src/libcaptive/kd/Makefile
277 ./src/libcaptive/ke/Makefile
278 ./src/libcaptive/ldr/Makefile
279 ./src/libcaptive/mm/Makefile
280 ./src/libcaptive/nt/Makefile
281 ./src/libcaptive/ob/Makefile
282 ./src/libcaptive/po/Makefile
283 ./src/libcaptive/ps/Makefile
284 ./src/libcaptive/rtl/Makefile
285 ./src/libcaptive/se/Makefile
286 ./src/libcaptive/storage/Makefile
287 ./src/libcaptive/sandbox/Makefile
288 ./src/libcaptive/client/Makefile
289 ./src/client/Makefile
290 ./src/client/bug-replay/Makefile
291 ./src/client/cmdline/Makefile
292 ./src/client/gnomevfs/Makefile
293 ./src/client/lufs/Makefile
294 ./src/client/sandbox-server/Makefile
295 ./src/TraceFS/Makefile
296 ./doc/Makefile
297 ./doc/apiref/Makefile
298 ./src/client/gnomevfs/captive.conf
299 ])
300
301 dnl FIXME: Why is "po/POTFILES" being substituted?
302 make -C src distfiles DISTFILES_PRINT=1 \
303                 |sed -n 's/^:DISTFILES: *\(.*\)$/\1/p'|tr ' ' '\n'|grep . >po/POTFILES.in
304 make -C po Makefile
305
306 echo done.