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