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