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