cd9d5c215893f4f17c26a6ff3e2b3b7b34bfce2f
[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 AM_CONDITIONAL(GTK_DOC_USE_LIBTOOL, test -n "$LIBTOOL")
55
56 dnl Do not discard 'CFLAGS' settings as they may have been passed us by rpmbuild(8)
57
58 dnl Define MAINTAINER_MODE in config.h.
59 if test "$USE_MAINTAINER_MODE" = "yes";then
60         AC_DEFINE(MAINTAINER_MODE,,[Turn even some software behaviour according to MAINTAINER_MODE.])
61         CFLAGS="$CFLAGS -ggdb3 -Wall -Wstrict-prototypes -Wsign-compare"  ## FIXME: fix all sources: -Wsign-compare
62         fi
63 dnl Some Makefiles use additional tests etc.
64 AM_CONDITIONAL(MAINTAINER_MODE,[test "$USE_MAINTAINER_MODE" = "yes"])
65
66
67 AC_ARG_WITH(sbin-mountdir,
68                 [  --with-sbin-mountdir=dir      mount(8) 'mount.captive' directory (def.=/sbin)],,
69                 [ with_sbin_mountdir="/sbin" ])
70 AM_CONDITIONAL(WITH_SBIN_MOUNT,[test "$with_sbin_mount" != "no"])
71 AC_SUBST(with_sbin_mountdir)
72
73 AC_ARG_WITH(sbin-mount-fs,
74                 [  --with-sbin-mount-fs=fs1:fs2  sbin-mount pre-installed symlinks (def.=ntfs:fastfat:cdfs:ext2fsd)],,
75                 [ with_sbin_mount_fs="ntfs:fastfat:cdfs:ext2fsd" ])
76 AC_SUBST(with_sbin_mount_fs)
77
78 AC_ARG_WITH(sandbox-setuid,
79                 [  --with-sandbox-setuid=user    non-privileged user  for captive-sandbox-server (def.=captive)],
80                 [ CAPTIVE_SANDBOX_SETUID="$withval" ],[ CAPTIVE_SANDBOX_SETUID="captive" ])
81 AC_DEFINE_UNQUOTED(CAPTIVE_SANDBOX_SETUID,"$CAPTIVE_SANDBOX_SETUID",
82                 [non-privileged user  for captive-sandbox-server])
83
84 AC_ARG_WITH(sandbox-setgid,
85                 [  --with-sandbox-setgid=group   non-privileged group for captive-sandbox-server (def.=captive)],
86                 [ CAPTIVE_SANDBOX_SETGID="$withval" ],[ CAPTIVE_SANDBOX_SETGID="captive" ])
87 AC_DEFINE_UNQUOTED(CAPTIVE_SANDBOX_SETGID,"$CAPTIVE_SANDBOX_SETGID",
88                 [non-privileged group for captive-sandbox-server])
89
90 AC_ARG_WITH(sandbox-chroot,
91                 [  --with-sandbox-chroot=dir     root-owned directory for captive-sandbox-server (def.=/var/lib/captive)],
92                 [ CAPTIVE_SANDBOX_CHROOT="$withval" ],[ CAPTIVE_SANDBOX_CHROOT="/var/lib/captive" ])
93 AC_DEFINE_UNQUOTED(CAPTIVE_SANDBOX_CHROOT,"$CAPTIVE_SANDBOX_CHROOT",
94                 [root-owned directory for captive-sandbox-server])
95 AC_SUBST(CAPTIVE_SANDBOX_CHROOT)
96
97 dnl Permit 'if NEVER' for Makefile.am-s; symbol 'FALSE' forbidden by automake
98 AM_CONDITIONAL(NEVER,false)
99
100 dnl Separate 'acconfig.h' is no longer recommended by autoconf
101 AH_TOP([
102 #ifndef _CAPTIVE_CONFIG_H
103 #define _CAPTIVE_CONFIG_H 1
104 ])
105 AH_BOTTOM([
106 /* Do not place any stuff to AH_TOP as some of its includes
107  * would discard the effect of _FILE_OFFSET_BITS by AC_SYS_LARGEFILE.
108  */
109
110 #ifdef ENABLE_NLS
111 /* <libintl.h> is taken from "$(top_srcdir)/intl" if system doesn't provide intl */
112 #       include <libintl.h>
113 #ifdef LIBCAPTIVE
114 #       define _(String) dgettext (PACKAGE,String)
115 #else
116 #       define _(String) gettext (String)
117 #endif /* LIBCAPTIVE */
118 #       ifdef gettext_noop
119 #               define N_(String) gettext_noop (String)
120 #       else
121 #               define N_(String) (String)
122 #       endif
123 #else /* !ENABLE_NLS */
124 /* Stubs that do something close enough.  */
125 #       define textdomain(String) (String)
126 #       define gettext(String) (String)
127 #       define dgettext(Domain,Message) (Message)
128 #       define dcgettext(Domain,Message,Type) (Message)
129 #       define bindtextdomain(Domain,Directory) (Domain)
130 #       define _(String) (String)
131 #       define N_(String) (String)
132 #endif /* !ENABLE_NLS */
133
134 #include <glib/gtypes.h>        /* for 'gchar' */
135 #define G_LOG_DOMAIN ((const gchar *)"Captive")
136
137 /* Supplemental definitions not possible in this file. */
138 #ifdef LIBCAPTIVE
139 #include "captive/config2.h"
140 #endif
141
142 #endif /* !_CAPTIVE_CONFIG_H */
143 ])
144
145 AM_PATH_GLIB_2_0(,,[AC_MSG_ERROR([Captive requires glib-2.0 library.])],[gmodule gobject])
146 dnl Force glib for the whole package
147 CFLAGS="$CFLAGS $GLIB_CFLAGS"
148 LIBS="$LIBS $GLIB_LIBS"
149
150 dnl popt
151 AC_CHECK_LIB(popt,poptParseArgvString,[POPT_LIBS="-lpopt"],[AC_MSG_ERROR([Captive requires popt library.])])
152 AC_SUBST(POPT_LIBS)
153
154 AC_ARG_WITH(readline,   [  --with-readline=[no/yes/auto]        cmdline client with line editing (def.=auto)],,with_readline=auto)
155 AC_CHECK_HEADERS(readline/history.h)
156 dnl Check for libraries, if needed by configuration options.
157 if test "$with_readline" != "no"
158 then
159         if test -d "/usr/lib/termcap"
160         then
161                 READLINE_LDFLAGS="$READLINE_LDFLAGS -L/usr/lib/termcap"
162         fi
163         have_libreadline=false
164         need_failed=""
165         for need in "" termcap ncurses; do
166                 if test "x$need" != "x"
167                 then
168                         captive_save_LIBS="$LIBS"
169                         AC_CHECK_LIB($need, main,,
170                                 [ need_failed="$need_failed $need"
171                                 continue ]
172                                 )
173                         LIBS="$captive_save_LIBS"
174                         lneed="-l$need"
175                 else
176                         lneed=""
177                 fi
178                 dnl Prevent AC_CHECK_LIB() here as it would _cache_ the value ignoring
179                 dnl our ever-changing "additiona libraries" parameter
180                 captive_save_LIBS="$LIBS"
181                 LIBS="-lreadline $lneed $READLINE_LIBS"
182                 AC_TRY_LINK(,[ main() ],
183                         [ have_libreadline=true
184                         READLINE_LIBS="$LIBS" ])
185                 LIBS="$captive_save_LIBS"
186                 if $have_libreadline
187                 then
188                         break
189                 fi
190         done
191         if $have_libreadline
192         then
193                 AC_DEFINE(HAVE_LIBREADLINE,,[Use functions from libreadline?])
194                 AC_CHECK_LIB(readline, add_history,
195                         AC_DEFINE(HAVE_ADD_HISTORY,,[Use 'history' extension of libreadline?]),,
196                         $READLINE_LIBS)
197         else
198                 for need in $need_failed; do
199                         AC_MSG_WARN(captive recommends $need library as your readline library
200                         probably needs it.)
201                 done
202                 if test "$with_readline" = "yes"
203                 then
204                         AC_MSG_ERROR([captive did not find the requested readline library for its cmdline client line editing capability.])
205                 else
206                         AC_MSG_WARN([captive recommends readline library for its cmdline client line editing capability.])
207                 fi
208         fi
209 fi
210 AC_SUBST(READLINE_LIBS)
211 AC_SUBST(READLINE_LDFLAGS)
212
213 PKG_CHECK_MODULES(GNOME_VFS_MODULE,gnome-vfs-module-2.0)
214 AC_SUBST(GNOME_VFS_MODULE_CFLAGS)
215 AC_SUBST(GNOME_VFS_MODULE_LIBS)
216 PKG_CHECK_MODULES(GNOME_VFS,gnome-vfs-2.0)
217 AC_SUBST(GNOME_VFS_CFLAGS)
218 AC_SUBST(GNOME_VFS_LIBS)
219
220 dnl Check for 2.5.9 for: http://bugzilla.gnome.org/show_bug.cgi?id=117702
221 dnl Check the version - impossible to reliably check the missing feature.
222 PKG_CHECK_MODULES(LIBXML,libxml-2.0 >= 2.5.9,[ have_libxml_buffering=true ],[
223         dnl Disable bug-replay(1) build if not met; --bug-pathname would be still OK.
224         PKG_CHECK_MODULES(LIBXML,libxml-2.0,[ have_libxml_buffering=false ])
225         ])
226 dnl We also condition 'HAVE_LIBXML_XMLREADER_H' by 'HAVE_LIBXML_BUFFERING'
227 dnl as we have no use for xmlreader without working libxml buffering of 2.5.9.
228 AM_CONDITIONAL(HAVE_LIBXML_BUFFERING,$have_libxml_buffering)
229 if $have_libxml_buffering;then
230         AC_DEFINE(HAVE_LIBXML_BUFFERING,,[libxml2 correctly reads textnodes by its xmlTextReader.])
231 fi
232 AC_SUBST(LIBXML_CFLAGS)
233 AC_SUBST(LIBXML_LIBS)
234
235 PKG_CHECK_MODULES(OPENSSL,openssl,,[
236         dnl At least Debian-3.0r1 has openssl but without its .pc module.
237         AC_CHECK_LIB(crypto,MD5,[
238                 OPENSSL_CFLAGS=""
239                 OPENSSL_LIBS="-lcrypto"
240                 ],[AC_MSG_ERROR([Captive requires crypto library (of openssl).])])
241         ])
242 AC_SUBST(OPENSSL_CFLAGS)
243 AC_SUBST(OPENSSL_LIBS)
244
245 have_lufs_includes=true
246 AC_CHECK_HEADERS(lufs/fs.h lufs/proto.h,,[ have_lufs_includes=false ])
247 AM_CONDITIONAL(HAVE_LUFS_INCLUDES,$have_lufs_includes)
248 AC_CHECK_TYPES([struct lufs_sbattr],,,[#include <lufs/proto.h>])
249
250 dnl for $(top_srcdir)/src/libcaptive/sandbox/split-sandbox.c
251 AM_PATH_LINC(,,[AC_MSG_ERROR([Captive requires linc library used by ORBit.])])
252
253 dnl for $(top_srcdir)/src/libcaptive/client/
254 dnl Do not use '[client server]' as $4 to prevent: configure: test: too many arguments
255 dnl  - currently this argument is not used by 'orbit2-config' in any way anyway
256 AM_PATH_ORBIT2(,,[AC_MSG_ERROR([Captive requires ORBit library.])])
257
258 AC_CHECK_LIB(ntfs,ntfs_mount,
259         [ LIBNTFS_LIBS="-lntfs" ],
260         [ LIBNTFS_LIBS="" ])
261 AC_SUBST(LIBNTFS_LIBS)
262 AM_CONDITIONAL(HAVE_LIBNTFS,test -n "$LIBNTFS_LIBS")
263
264 PKG_CHECK_MODULES(GNOMEUI,libgnomeui-2.0)
265 AC_SUBST(GNOMEUI_CFLAGS)
266 AC_SUBST(GNOMEUI_LIBS)
267
268
269 AC_SUBST(CFLAGS)
270 AC_SUBST(LIBS)
271
272 dnl "Makefile" output files MUST have pathnames incl./excl. "./" prefix as specified!
273 dnl FIXME: Why the rule above was written here?
274 AC_OUTPUT([
275 captive.spec
276 ./src/client/gnomevfs/captive.conf
277 ./src/client/lufs/mount.captive
278 ./po/Makefile.in
279 Makefile
280 ./macros/Makefile
281 ./src/Makefile
282 ./src/libcaptive/Makefile
283 ./src/libcaptive/include/Makefile
284 ./src/libcaptive/include/captive/Makefile
285 ./src/libcaptive/include/reactos/Makefile
286 ./src/libcaptive/include/reactos/ddk/Makefile
287 ./src/libcaptive/include/reactos/ddk/i386/Makefile
288 ./src/libcaptive/include/reactos/internal/Makefile
289 ./src/libcaptive/include/reactos/internal/i386/Makefile
290 ./src/libcaptive/include/reactos/napi/Makefile
291 ./src/libcaptive/include/reactos/ntos/Makefile
292 ./src/libcaptive/reactos/Makefile
293 ./src/libcaptive/reactos/include/Makefile
294 ./src/libcaptive/reactos/hal/Makefile
295 ./src/libcaptive/reactos/hal/halx86/Makefile
296 ./src/libcaptive/reactos/ntoskrnl/Makefile
297 ./src/libcaptive/reactos/ntoskrnl/dbg/Makefile
298 ./src/libcaptive/reactos/ntoskrnl/ex/Makefile
299 ./src/libcaptive/reactos/ntoskrnl/fs/Makefile
300 ./src/libcaptive/reactos/ntoskrnl/io/Makefile
301 ./src/libcaptive/reactos/ntoskrnl/ke/Makefile
302 ./src/libcaptive/reactos/ntoskrnl/ldr/Makefile
303 ./src/libcaptive/reactos/ntoskrnl/mm/Makefile
304 ./src/libcaptive/reactos/ntoskrnl/nt/Makefile
305 ./src/libcaptive/reactos/ntoskrnl/ob/Makefile
306 ./src/libcaptive/reactos/ntoskrnl/ps/Makefile
307 ./src/libcaptive/reactos/ntoskrnl/rtl/Makefile
308 ./src/libcaptive/reactos/ntoskrnl/rtl/i386/Makefile
309 ./src/libcaptive/reactos/ntoskrnl/se/Makefile
310 ./src/libcaptive/halcaptive/Makefile
311 ./src/libcaptive/cc/Makefile
312 ./src/libcaptive/cm/Makefile
313 ./src/libcaptive/ex/Makefile
314 ./src/libcaptive/fs/Makefile
315 ./src/libcaptive/io/Makefile
316 ./src/libcaptive/kd/Makefile
317 ./src/libcaptive/ke/Makefile
318 ./src/libcaptive/ldr/Makefile
319 ./src/libcaptive/mm/Makefile
320 ./src/libcaptive/nt/Makefile
321 ./src/libcaptive/ob/Makefile
322 ./src/libcaptive/po/Makefile
323 ./src/libcaptive/ps/Makefile
324 ./src/libcaptive/rtl/Makefile
325 ./src/libcaptive/se/Makefile
326 ./src/libcaptive/storage/Makefile
327 ./src/libcaptive/sandbox/Makefile
328 ./src/libcaptive/client/Makefile
329 ./src/client/Makefile
330 ./src/client/bug-replay/Makefile
331 ./src/client/cmdline/Makefile
332 ./src/client/gnomevfs/Makefile
333 ./src/client/lufs/Makefile
334 ./src/client/sandbox-server/Makefile
335 ./src/install/Makefile
336 ./src/install/libcaptive-install/Makefile
337 ./src/install/fstab/Makefile
338 ./src/install/acquire/Makefile
339 ./src/TraceFS/Makefile
340 ./src/w32-mod/Makefile
341 ./doc/Makefile
342 ./doc/apiref/Makefile
343 ])
344
345 dnl FIXME: Why is "po/POTFILES" being substituted?
346 make -C src distfiles DISTFILES_PRINT=1 \
347                 |sed -n 's/^:DISTFILES: *\(.*\)$/\1/p'|tr ' ' '\n'|grep . >po/POTFILES.in
348 make -C po Makefile
349
350 echo done.