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