First drop of aptitude for Maemo
[aptitude] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(aptitude, 0.4.11.11)
3 AC_CONFIG_SRCDIR([src/main.cc])
4 AM_INIT_AUTOMAKE
5 AM_CONFIG_HEADER(config.h)
6
7 dnl Use C++
8 AC_LANG([C++])
9
10 dnl Checks for programs.
11 AC_PROG_CXX
12 AC_PROG_RANLIB
13 dnl Checks for programs.
14 AC_PATH_PROG(PO4A, po4a)
15 if test "x$PO4A" = "x" ; then
16   AM_CONDITIONAL(USE_PO4A, false)
17 else
18   AM_CONDITIONAL(USE_PO4A, true)
19 fi
20
21 dnl C++ has const and inline!!!
22 ac_cv_c_const=yes
23 ac_cv_c_inline=yes
24
25 dnl Checks for libraries.
26 AC_CHECK_LIB(ncursesw, initscr, ,
27         [AC_MSG_ERROR([Can't find libncursesw -- please install libncursesw5-dev])])
28 AC_CHECK_LIB(apt-pkg, main, , [AC_MSG_ERROR([Can't find the APT libraries -- please install libapt-pkg-dev])])
29
30 AC_MSG_CHECKING([whether apt includes the automatic dependency removal patch (required)])
31
32 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <apt-pkg/depcache.h>]],
33                                   [[extern pkgDepCache::ActionGroup d;]]),
34                   AC_MSG_RESULT([yes]),
35                   AC_MSG_FAILURE([need libapt-pkg 0.7 or later]))
36
37 AC_CHECK_LIB(pthread, main,
38         HAVE_LIBPTHREAD=1
39         , [AC_MSG_ERROR([Can't find the POSIX thread libraries])])
40
41 ALL_LINGUAS="ar bs ca cs da de dz el es eu fi fr gl hu it ja km ku lt mr nb ne nl nn pl pt pt_BR ro ru sk sv th tl tr uk vi zh_CN zh_TW"
42 AM_GNU_GETTEXT([external])
43
44 HAVE_EPT=
45 AC_ARG_WITH(ept,
46         AS_HELP_STRING(--with-ept, [compile against the ept library (enables debtags and xapian-index support)]),
47         [if test x$withval = xyes
48          then
49             HAVE_EPT=1
50          fi])
51
52 PKG_CHECK_MODULES(ept, libept, [], [HAVE_EPT=])
53
54 if test x$HAVE_EPT = x1
55 then
56   AC_DEFINE(HAVE_EPT, 1, [Define if the ept package information library is available.])
57 else
58   # Force the program not to link against ept.
59   ept_CFLAGS=
60   ept_LIBS=
61 fi
62
63 PKG_CHECK_MODULES(SIGC, sigc++-2.0)
64
65 PKG_CHECK_MODULES(CWIDGET, cwidget)
66
67 CXXFLAGS="$CXXFLAGS $SIGC_CFLAGS $CWIDGET_CFLAGS $ept_CFLAGS"
68 LIBS="$LIBS $SIGC_LIBS $CWIDGET_LIBS $ept_LIBS"
69 AC_DEFINE_UNQUOTED(SIGC_VERSION, ["$(pkg-config --modversion sigc++-2.0)"], [The version of libsigc++ with which the program was compiled])
70
71 dnl Checks for header files.
72 AC_HEADER_STDC
73
74 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h unistd.h, , [AC_MSG_ERROR([Can't find needed header file.])])
75
76 AC_CHECK_HEADER(apt-pkg/init.h, , [AC_MSG_ERROR([Can't find the APT header files -- please install libapt-pkg-dev])])
77
78 AC_CHECK_HEADER(execinfo.h, [AC_DEFINE([HAVE_EXECINFO_H], [], [Define if the execinfo file (for self-backtracing) is available])])
79
80 AC_CHECK_HEADER(locale.h, [AC_DEFINE([HAVE_LOCALE_H], [], [Define if locale.h is available])])
81
82 AC_CHECK_DECL(setlocale, [AC_DEFINE([HAVE_SETLOCALE], [], [Define if setlocale is available in locale.h])], , [#include <locale.h>])
83
84 dnl All the hash-related stuff is commented out because g++ 4.3 will
85 dnl blow us up if we ever include hash_map -- yet it's present and I
86 dnl can't make the autoconf test fail.  The replacement is
87 dnl unordered_map, which is not just a nonstandard header: it also
88 dnl requires language extensions in order to work.  So, since aptitude
89 dnl has no real need for hashes anyway, I'm just removing all the
90 dnl hashes that it uses.
91
92 dnl HASH_INC=""
93 dnl HASH_CLS=""
94
95 dnl AC_CHECK_HEADER(hash_map,
96 dnl             [HASH_INC="hash_map"
97 dnl              HASH_CLS="hash_map"
98 dnl              AC_DEFINE(HAVE_HASH_MAP, ,
99 dnl                       [Define if the g++ extension hash_map is available])],
100 dnl             [AC_CHECK_HEADER(ext/hash_map,
101 dnl                              [HASH_INC="ext/hash_map"
102 dnl                               HASH_CLS="hash_map"
103 dnl                               AC_DEFINE(HAVE_EXT_HASH_MAP, , [Define if the g++ extension ext/hash_map is available])])])
104
105 dnl AC_CHECK_HEADER(hash_set,
106 dnl             [HASH_INC="hash_set"
107 dnl              HASH_CLS="hash_set"
108 dnl              AC_DEFINE(HAVE_HASH_SET,  , [Define if the g++ extension hash_set is available])],
109 dnl             [AC_CHECK_HEADER(ext/hash_set,
110 dnl                             [HASH_INC="ext/hash_set"
111 dnl                              HASH_CLS="hash_set"
112 dnl                              AC_DEFINE(HAVE_EXT_HASH_SET,  , [Define if the g++ extension ext/hash_set is available])])])
113
114 AC_MSG_CHECKING([whether apt supports ddtp])
115
116 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <apt-pkg/pkgcache.h>]],
117                                   [[pkgCache::DescIterator d;]]),
118                   AC_MSG_RESULT([yes])
119                   AC_DEFINE([HAVE_DDTP], [], [Set to true if apt is DDTP-enabled]),
120                   AC_MSG_RESULT([no]))
121
122 AC_MSG_CHECKING([whether apt supports the Homepage: field])
123
124 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <apt-pkg/pkgrecords.h>]],
125                                   [[  pkgRecords::Parser *p = NULL;]]
126                                   [[  if(0) p->Homepage();]]),
127                    AC_MSG_RESULT([yes])
128                    AC_DEFINE([APT_HAS_HOMEPAGE], [], [Set to true if apt supports the Homepage: field]),
129                    AC_MSG_RESULT([no]))
130
131 AC_MSG_CHECKING([whether apt supports dpkg triggers])
132
133 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <apt-pkg/pkgcache.h>]],
134                                   [[pkgCache::State::TriggersAwaited;]]
135                                   [[pkgCache::State::TriggersPending;]]),
136                   AC_MSG_RESULT([yes])
137                   AC_DEFINE([APT_HAS_TRIGGERS], [], [Set to true if apt supports dpkg trigger states]),
138                   AC_MSG_RESULT([no]))
139
140 # Try to guess what namespace the hash stuff is in (maybe I should just
141 # use rbltrees instead in most places?)
142 if test x$HASH_INC != x
143 then
144     AC_MSG_CHECKING([which namespace contains the hash extensions])
145
146     HASH_NAMESPACE=""
147
148     for NS in std __gnu_cxx
149     do
150       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <$HASH_INC>],
151                                          [${NS}::${HASH_CLS} < int, int > foo;])],
152                         [HASH_NAMESPACE=$NS])
153     done
154
155     if test x$HASH_NAMESPACE = x
156     then
157        AC_MSG_ERROR([found hash classes, but they aren't in the std or GNU namespace.])
158     fi
159
160     AC_MSG_RESULT($HASH_NAMESPACE)
161 else
162     # Use the std namespace if all else fails. (the code will fall back
163     # to using map instead of hash_map, set instead of hash_set)
164     HASH_NAMESPACE=std
165 fi
166
167 AC_DEFINE_UNQUOTED(HASH_NAMESPACE, $HASH_NAMESPACE, [If a hash header is available, define to the namespace in which the hash class resides])
168
169
170
171
172 # Try to guess how to extend string traits
173 TRAITS_CLASS=""
174
175 AC_MSG_CHECKING([for the name of the character traits template])
176
177 for T in char_traits string_char_traits
178 do
179   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <string>],
180                                      [std::basic_string<unsigned char,
181                                                         std::$T < unsigned char > > s;])],
182                     TRAITS_CLASS=$T)
183 done
184
185 if test x$TRAITS_CLASS = xstring_char_traits
186 then
187     AC_MSG_WARN([Your compiler uses string_char_traits for its character traits.  Some compilers (eg, g++ 2.95) which use this name for the character traits template are known to have hideously broken implementations of the standard string class, which cause aptitude to fail to compile.  If you have a compiler with this problem, please upgrade it to a version that has a more compliant version of the STL (g++ >=3.0 is known to work).  You can specify which compiler this script should use via the CXX environment variable.])
188 fi
189
190 if test x$TRAITS_CLASS = x
191 then
192   AC_MSG_ERROR([can't find the name of the character traits template])
193 else
194   AC_DEFINE_UNQUOTED(TRAITS_CLASS, $TRAITS_CLASS, [The name of the class used by the STL to define character traits])
195
196   AC_MSG_RESULT([$TRAITS_CLASS])
197 fi
198
199
200
201
202 if test x$HAVE_LIBPTHREAD = x1
203 then
204   AC_CHECK_HEADER(pthread.h,
205         CXXFLAGS="$CXXFLAGS -D_REENTRANT"
206         LIBS="$LIBS -lpthread"
207         [AC_DEFINE([HAVE_LIBPTHREAD], [] , [Define if pthread is available])]
208         ,
209         [AC_MSG_ERROR([POSIX thread header not installed])])
210 fi
211
212 WERROR="-Werror"
213
214 AC_ARG_ENABLE(dynamic-backtrace,
215         AS_HELP_STRING([--enable-dynamic-backtrace], [Modify the executable so that it can generate a backtrace for uncaught exceptions.  Will double the size of the stripped binary.]),
216         [if test x$enableval = xyes
217         then
218           AC_DEFINE([ENABLE_DYNAMIC_BACKTRACE], [], [Define to enable dynamic generation of backtraces if HAVE_EXECINFO_H is defined])
219           LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
220         fi]
221         )
222 AC_ARG_ENABLE(werror,
223         AS_HELP_STRING([--disable-werror], [do not compile with -Werror]),
224         if test x$enableval = xno
225         then
226           WERROR=""
227         fi
228         )
229 AC_ARG_ENABLE(period-beep,
230         AS_HELP_STRING([--enable-period-beep], [periodically (once a second) produce an annoying beep]),
231         if test x$enableval = xyes
232         then
233           [AC_DEFINE(WITH_PERIOD_BEEP,  , [Define to produce an annoying beep periodically, for debugging])]
234         fi
235         )
236 AC_ARG_ENABLE(reload-cache,
237         AS_HELP_STRING([--enable-reload-cache], [allow the user to reload the cache on demand. (debugging feature)]),
238         if test x$enableval = xyes
239         then
240           [AC_DEFINE(WITH_RELOAD_CACHE,  , [Allow the cache to be reloaded on demand])]
241         fi
242         )
243
244 AC_ARG_ENABLE(package-state-loc,
245         AS_HELP_STRING([--with-package-state-loc], [use the given location for storing state (default /var/lib/aptitude)]),
246         if test x$enableval = xyes
247         then
248           [AC_MSG_ERROR([--with-package-state-loc needs an argument])]
249         else
250           STATEDIR="$enableval"
251         fi,
252         STATEDIR="/var/lib/aptitude")
253
254 AC_ARG_ENABLE(lock-loc,
255         AS_HELP_STRING([--with-lock-loc], [use the given location for storing state (default /var/lock/aptitude)]),
256         if test x$enableval = xyes
257         then
258           [AC_MSG_ERROR([--with-lock-loc needs an argument])]
259         else
260           LOCKFILE="$enableval"
261         fi,
262         LOCKFILE="/var/lock/aptitude")
263
264 AC_ARG_ENABLE(aptitude,
265         AS_HELP_STRING([--disable-aptitude], [don't compile the program itself]),
266         if test x$enableval=xno
267         then
268           SRCDIRS=
269         else
270           SRCDIRS=src
271         fi,
272         SRCDIRS=src)
273
274 AC_ARG_ENABLE(docs,
275         AS_HELP_STRING([--disable-docs], [don't generate the documentation]),
276         if test x$enableval=xno
277         then
278           DOCDIRS=
279         else
280           DOCDIRS=doc
281         fi,
282         DOCDIRS=doc)
283
284 CXXFLAGS="$CXXFLAGS -Wall $WERROR"
285
286 AC_SUBST(SRCDIRS)
287 AC_SUBST(DOCDIRS)
288
289 AC_DEFINE_UNQUOTED(STATEDIR, "$STATEDIR", [The location of aptitude's state files])
290 AC_DEFINE_UNQUOTED(LOCKFILE, "$LOCKFILE", [The location of the lock to prevent simultaneous aptitude instances])
291 AC_SUBST(STATEDIR)
292
293 AC_TYPE_SIZE_T
294
295 dnl Checks for library functions.
296 AC_CHECK_FUNCS(strdup)
297
298 CPPFLAGS="$CPPFLAGS -DHELPDIR=\\\"\$(datadir)/aptitude\\\""
299 CPPFLAGS="$CPPFLAGS -DPKGDATADIR=\\\"\$(datadir)/aptitude\\\""
300 dnl FC_EXPAND_DIR(HELPDIR, [$datadir/aptitude])
301 dnl AC_DEFINE_UNQUOTED(HELPDIR, "$HELPDIR", [The location in which the online help data is placed])
302
303 dnl FC_EXPAND_DIR(PKGDATADIR, [$datadir/aptitude])
304 dnl AC_DEFINE_UNQUOTED(PKGDATADIR, "$PKGDATADIR", [The location in which the program data is placed])
305
306 AC_CONFIG_FILES([
307         Doxyfile
308         Makefile
309         doc/Makefile
310         doc/cs/Makefile
311         doc/cs/images/Makefile
312         doc/de/Makefile
313         doc/en/Makefile
314         doc/en/images/Makefile
315         doc/fi/Makefile
316         doc/fi/images/Makefile
317         doc/fr/Makefile
318         doc/fr/images/Makefile
319         doc/ja/Makefile
320         doc/ja/images/Makefile
321         doc/po4a/Makefile
322         doc/po4a/po/Makefile
323         doc/po4a/add_fr/Makefile
324         m4/Makefile
325         po/Makefile.in
326         src/Makefile
327         src/cmdline/Makefile
328         src/generic/Makefile
329         src/generic/apt/Makefile
330         src/generic/problemresolver/Makefile
331         src/generic/util/Makefile
332         src/mine/Makefile
333         tests/Makefile
334 ])
335
336 AC_OUTPUT