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