1 dnl -*- mode: Autoconf; -*-
2 dnl Invoke autogen.sh to produce a configure script.
4 AC_INIT([syncevolution], [0.8.1+0.9+beta3+20090723])
5 AM_INIT_AUTOMAKE([tar-ustar])
6 AC_CONFIG_MACRO_DIR([m4])
7 define([SYNTHESISSRC_REPO], [])
8 dnl Specify git revisions/branches without prefix, i.e., without 'origin'.
9 dnl We'll sort that out below.
10 define([SYNTHESISSRC_REVISION], [syncevolution-0.9])
11 AM_CONFIG_HEADER(config.h)
14 dnl default device type (see AC_DEFINE below)
17 AC_ARG_WITH(synthesis-src,
18 AS_HELP_STRING([--with-synthesis-src=<base directory|svn URL|git URL>],
19 [Specifies location of the Synthesis root directory.
20 Use this when the Synthesis library is to
21 be compiled as part of the SyncEvolution compilation. In release
22 versions of SyncEvolution, a copy of the Synthesis code is bundled
23 under 'src/synthesis' and compiled unless something else is
24 specified. --with-synthesis-src can be given a path to sources
25 checked out already, a Subversion repository URL or a git repository
26 URL. When given a repository URL, then the configure script
27 will checkout the sources into 'src/synthesis-workdir' or
28 update that working copy if the directory already exists.
29 Default: bundled source in src/synthesis (in released SyncEvolution sources),
30 SYNTHESISSRC_REPO otherwise.]),
31 [SYNTHESISSRC="$withval"], [SYNTHESISSRC="$SYNTHESISSRC_DEF"; REVISION="SYNTHESISSRC_REVISION"])
33 AC_ARG_WITH(synthesis-username,
34 AS_HELP_STRING([--with-synthesis-username=<svn username>],
35 [username to use when checking out --with-synthesis-src sources from Subversion, default 'guest']),
36 [USERNAME="$withval"], [USERNAME="guest"])
38 AC_ARG_WITH(synthesis-revision,
39 AS_HELP_STRING([--with-synthesis-revision=<git tag/branch/hash or Subversion revision>],
40 [Identifies which source revision to use from --with-synthesis-src repository, empty string stands for latest. Default for default --synthesis-src: SYNTHESISSRC_REVISION]),
41 [REVISION="$withval"])
44 AS_HELP_STRING([--enable-shared],
45 [build backends as dynamically loadable modules]),
46 enable_shared="$enableval", enable_shared="no")
49 AS_HELP_STRING([--enable-static],
50 [build backends also as static libraries]),
51 enable_static="$enableval", enable_static="no")
53 AC_ARG_ENABLE(unit-tests,
54 AS_HELP_STRING([--enable-unit-tests],
55 [enables tests embedded in the source code of the library (changes content of executable)]),
56 enable_unit_tests="$enableval", enable_unit_tests="no")
57 AC_ARG_ENABLE(integration-tests,
58 AS_HELP_STRING([--enable-integration-tests],
59 [enables tests outside of the library (can be used together with normal builds of the library)]),
60 enable_integration_tests="$enableval", enable_integration_tests="no")
62 AC_ARG_ENABLE(static-cxx,
63 AS_HELP_STRING([--enable-static-cxx],
64 [build executables which contain libstdc++ instead of requiring suitable libstdc++.so to run]),
65 enable_static_cxx="$enableval", enable_static_cxx="no")
67 AC_ARG_ENABLE(evolution-compatibility,
68 AS_HELP_STRING([--enable-evolution-compatibility],
69 [build executables which only call Evolution via dlopen/dlsym: this avoids all hard dependencies on EDS shared objects, but might lead to crashes when their ABI changes]),
70 enable_evolution_compatibility="$enableval", enable_evolution_compatibility="no")
73 # - set the (non-standard!) DBUS_DEFAULT_TIMEOUT
74 # - wrap e_book_from_string() to fix invalid parameter
75 # - don't use UTF-8 encoding in Perl script
77 AS_HELP_STRING([--enable-maemo],
78 [enables some hacks which work around problems with the Maemo 2.0 until at least 3.0 EDS-Dbus]),
79 [AC_DEFINE(ENABLE_MAEMO, 1, [enable Maemo hacks])
81 MODIFY_SYNCCOMPARE='-e "s/use encoding/#use encoding/;" -e "s/:utf8//;"'])
82 AC_SUBST(MODIFY_SYNCCOMPARE)
84 AC_CHECK_HEADERS(signal.h dlfcn.h)
87 if test $enable_unit_tests == "yes" || test $enable_integration_tests == yes; then
88 CPPUNIT_CXXFLAGS=`cppunit-config --cflags` || AC_MSG_ERROR("cppunit-config --cflags failed - is it installed?")
89 CPPUNIT_LDFLAGS=`cppunit-config --libs` || AC_MSG_ERROR("cppunit-config --libs failed - is it installed?")
91 AC_SUBST(CPPUNIT_CXXFLAGS)
92 AC_SUBST(CPPUNIT_LDFLAGS)
94 if test "$enable_unit_tests" = "yes"; then
95 AC_DEFINE(ENABLE_UNIT_TESTS, 1, [enable unit tests inside the library's source code])
97 AM_CONDITIONAL([ENABLE_UNIT_TESTS], [test "$enable_unit_tests" = "yes"])
98 AM_CONDITIONAL([ENABLE_TESTING], [test "$enable_unit_tests" = "yes" || test "$enable_integration_tests" = "yes" ])
100 if test $enable_static_cxx == "yes"; then
102 CORE_LDADD_DEP=libstdc++.a
104 AC_SUBST(CORE_LDADD_DEP)
106 # preserve src/synthesis by default,
109 SYNTHESIS_LIB=$PWD/src/build-synthesis/src/libsynthesissdk.la
111 AC_SUBST(CLEAN_CLIENT_SRC)
113 # Check for transport layer.
114 # Both curl and libsoup can be enabled and disabled explicitly.
115 # The default is to use libsoup if available, otherwise curl.
117 AC_MSG_CHECKING([for libcurl])
118 if LIBCURL_LIBS=`sh -c 'curl-config --libs' 2>&AS_MESSAGE_LOG_FD` && \
119 LIBCURL_CFLAGS=`sh -c 'curl-config --cflags' 2>&AS_MESSAGE_LOG_FD`; then
126 PKG_CHECK_MODULES(LIBSOUP, libsoup-gnome-2.4,
128 AC_DEFINE(HAVE_LIBSOUP_SOUP_GNOME_FEATURES_H, 1, [enable GNOME specific libsoup])],
129 [PKG_CHECK_MODULES(LIBSOUP, libsoup-2.4,
136 AC_ARG_WITH(ca-certificates,
137 AS_HELP_STRING([--with-ca-certificates=<colon separated list of files>],
138 [Specifies location of one or more CA certificate files.
139 This sets the default value for the SSLServerCertificates option.
140 Default: empty when using libcurl (because it has its own default),
141 a list of paths known to work for Debian and Red Hat otherwise.]),
142 [CA_CERTIFICATES="$withval"])
145 # choose default transport (mirrors code in EvolutionSyncClient::createTransportAgent())
146 if test "$have_libsoup" = "yes"; then
147 default_transport="libsoup"
148 elif test "$have_libcurl" = "yes"; then
149 default_transport="libcurl"
152 AC_ARG_ENABLE(libcurl,
153 AC_HELP_STRING([--enable-libcurl],
154 [enable libcurl as transport layer]),
155 [ if test "$enableval" = "yes"; then
156 test "$have_libcurl" = "yes" || AC_MSG_ERROR([libcurl not found])
157 TRANSPORT="$TRANSPORT libcurl"
158 TRANSPORT_LIBS="$TRANSPORT_LIBS $LIBCURL_LIBS"
159 TRANSPORT_CFLAGS="$TRANSPORT_CFLAGS $LIBCURL_CFLAGS"
160 AC_DEFINE(ENABLE_LIBCURL, 1, [enable libcurl transport])
162 libcurl_disabled="yes"
164 [ if test "$have_libcurl" = "yes" && test "$default_transport" = "libcurl" ; then
165 TRANSPORT="$TRANSPORT libcurl"
166 TRANSPORT_LIBS="$TRANSPORT_LIBS $LIBCURL_LIBS"
167 TRANSPORT_CFLAGS="$TRANSPORT_CFLAGS $LIBCURL_CFLAGS"
168 AC_DEFINE(ENABLE_LIBCURL, 1, [enable libcurl transport])
171 AC_ARG_ENABLE(libsoup,
172 AC_HELP_STRING([--enable-libsoup],
173 [enable libsoup as transport layer]),
174 [ if test "$enableval" = "yes"; then
175 test "$have_libsoup" = "yes" || AC_MSG_ERROR([libsoup not found])
176 TRANSPORT="$TRANSPORT libsoup"
177 TRANSPORT_LIBS="$TRANSPORT_LIBS $LIBSOUP_LIBS"
178 TRANSPORT_CFLAGS="$TRANSPORT_CFLAGS $LIBSOUP_CFLAGS"
179 AC_DEFINE(ENABLE_LIBSOUP, 1, [enable libsoup transport])
181 libsoup_disabled="yes"
183 [ if test "$have_libsoup" = "yes" && test "$default_transport" = "libsoup"; then
184 TRANSPORT="$TRANSPORT libsoup"
185 TRANSPORT_LIBS="$TRANSPORT_LIBS $LIBSOUP_LIBS"
186 TRANSPORT_CFLAGS="$TRANSPORT_CFLAGS $LIBSOUP_CFLAGS"
187 AC_DEFINE(ENABLE_LIBSOUP, 1, [enable libsoup transport])
190 if test ! "$TRANSPORT" &&
191 test "$libsoup_disabled" != "yes" &&
192 test "$libcurl_disabled" != "yes"; then
193 AC_ERROR([no transport library found, configure with --disable-libcurl --disable-libsoup to continue anyway (only useful if users of libsyncevolution provide transport implementation)])
196 # for libsoup we must specify the SSL certificate file outself
197 if test "$libsoup_disabled" != "yes" && test -z "$CA_CERTIFICATES"; then
198 # Debian and Red Hat paths
199 CA_CERTIFICATES="/etc/ssl/certs/ca-certificates.crt:/etc/pki/tls/certs/ca-bundle.crt:/usr/share/ssl/certs/ca-bundle.crt"
201 AC_DEFINE_UNQUOTED(SYNCEVOLUTION_SSL_SERVER_CERTIFICATES, "$CA_CERTIFICATES", [default value for SSLServerCertificates option])
203 AC_SUBST(TRANSPORT_LIBS)
204 AC_SUBST(TRANSPORT_CFLAGS)
206 # for dbus interface file mangling
207 AC_PATH_PROG(XSLT, xsltproc)
210 AS_HELP_STRING([--enable-gui[=gui type]],
211 [enables building the GTK+ UI that uses the SyncEvolution DBus API.
212 Options: gtk, moblin.
213 "gtk" is the default for --enable-gui without type. No GUI is
214 built when --enable-gui is not used.
215 --enable-gui implies --enable-dbus.]),
216 [ if test "$enableval" = "gtk" ; then
218 elif test "$enableval" = "yes" ; then
220 elif test "$enableval" = "moblin" ; then
222 elif test "$enableval" = "no" ; then
225 AC_ERROR([Unknown gui type: '$enableval'])
230 AM_CONDITIONAL([COND_GUI], [test "$enable_gui" != "no"])
232 if test $enable_gui == "moblin"; then
233 AC_DEFINE(USE_MOBLIN_UX, 1, [Use the MUX widget library])
236 AC_ARG_ENABLE(dbus-service,
237 AS_HELP_STRING([--enable-dbus-service],
238 [enables building the dbus service executable and the wrapper library for it]),
239 enable_dbus_service="$enableval",
240 [if test $enable_gui == "no"; then
241 enable_dbus_service="no"
243 enable_dbus_service="yes"
245 AM_CONDITIONAL([COND_DBUS], [test "$enable_dbus_service" = "yes"])
247 if test $enable_gui != "no" && test $enable_dbus_service == "no"; then
248 AC_ERROR([cannot build GUI without building the D-Bus service])
251 if test $enable_dbus_service == "yes"; then
252 PKG_CHECK_MODULES(KEYRING, [gnome-keyring-1], HAVE_KEYRING=yes, HAVE_KEYRING=no)
253 if test $HAVE_KEYRING == "yes"; then
254 AC_DEFINE(USE_GNOME_KEYRING, 1, [define if gnome keyring should be used in dbus service])
256 PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 glib-2.0)
257 AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool)
258 AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
259 if test -z "$XSLT"; then
260 AC_ERROR([xsltproc not found, is required for D-Bus service])
263 AC_SUBST(DBUS_GLIB_CFLAGS)
264 AC_SUBST(DBUS_GLIB_LIBS)
265 AC_SUBST(KEYRING_CFLAGS)
266 AC_SUBST(KEYRING_LIBS)
269 DBUS_SERVICES_DIR="${datadir}/dbus-1/services"
270 AC_SUBST(DBUS_SERVICES_DIR)
271 AC_DEFINE_UNQUOTED(DBUS_SERVICES_DIR, "$DBUS_SERVICES_DIR", [Location of D-Bus services directory])
273 if test $enable_gui != "no"; then
274 gui_modules="glib-2.0 dbus-glib-1 >= 0.60 gtk+-2.0 libglade-2.0 gconf-2.0 gio-2.0 gnome-keyring-1"
276 PKG_CHECK_MODULES(UNIQUE, unique-1.0,
279 if test $have_unique == "yes"; then
280 gui_modules="$gui_modules unique-1.0"
281 AC_DEFINE(ENABLE_UNIQUE, 1, [enable single-app-instance functionality])
283 PKG_CHECK_MODULES(GUI, $gui_modules)
285 AC_PATH_PROG([GTK_BUILDER_CONV], gtk-builder-convert)
286 IT_PROG_INTLTOOL([0.37.1])
287 GETTEXT_PACKAGE=syncevolution
288 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [The gettext package name])
290 SYNCEVOLUTION_LOCALEDIR=[${datadir}/locale]
292 INTLTOOL_UPDATE="true"
295 AC_SUBST(SYNCEVOLUTION_LOCALEDIR)
296 AC_SUBST(GETTEXT_PACKAGE)
301 # Boost headers: boost/foreach.hpp is needed (1.33/Debian Etch
302 # doesn't have it, 1.34/Ubuntu 8.10 Hardy does). 1.35 is available
303 # as Debian Etch backport.
306 # absolute patch to source of Synthesis client library
307 SYNTHESIS_SRC=no-synthesis-source
308 AC_SUBST(SYNTHESIS_SRC)
309 if test "$SYNTHESISSRC" && test "$SYNTHESISSRC" != "none"; then
310 # default: checkout a copy of the sources, remove it during maintainer-clean and distclean
311 CLEAN_CLIENT_SRC=synthesis-workdir
312 SYNTHESIS_SRC=$PWD/src/synthesis-workdir
314 AC_MSG_NOTICE( [updating the content of $SYNTHESIS_SRC from $SYNTHESISSRC] )
315 case "$SYNTHESISSRC" in
316 *.git) protocol=git;;
317 *://*) protocol="`echo $SYNTHESISSRC | sed -e 's;://.*;;'`";;
324 # use existing copy of the sources
326 case "$SYNTHESISSRC" in
327 /*) SYNTHESIS_SRC="$SYNTHESISSRC";;
328 *) SYNTHESIS_SRC="$PWD/$SYNTHESISSRC";;
332 SYNTHESISSRCREV="$SYNTHESISSRC"
333 if test "$REVISION"; then
334 revarg="-r $REVISION "
335 if `echo $SYNTHESISSRC | grep '@[0123456789]*'` >/dev/null; then
338 SYNTHESISSRCREV="$SYNTHESISSRC@$REVISION"
341 if test -d $SYNTHESIS_SRC ; then
342 ( set -x; cd $SYNTHESIS_SRC && svn --username=$USERNAME switch $revarg "$SYNTHESISSRC" ) || AC_ERROR([updating from $SYNTHESISSRC failed])
344 (set -x; svn --username=$USERNAME checkout $revarg "$SYNTHESISSRCREV" $SYNTHESIS_SRC ) || AC_ERROR([checking out $SYNTHESISSRC failed])
348 if test -d $SYNTHESIS_SRC ; then
349 ( set -x; cd $SYNTHESIS_SRC && git fetch "$SYNTHESISSRC" ) || AC_ERROR([updating from $SYNTHESISSRC failed])
351 ( set -x; git clone "$SYNTHESISSRC" $SYNTHESIS_SRC ) || AC_ERROR([cloning $SYNTHESISSRC failed])
353 if test "$REVISION"; then
354 # git 1.6 finds tags and branches without explicit prefix, 1.4.4.4 doesn't
355 ( set -x; cd $SYNTHESIS_SRC &&
356 (git checkout "$REVISION" ||
357 git checkout "tags/$REVISION" ||
358 git checkout "origin/$REVISION") ) || AC_ERROR([checking out $SYNTHESISSRC failed])
362 elif test "$SYNTHESISSRC" != "none" && test -d $srcdir/src/synthesis; then
363 # use existing copy of the sources; beware of
364 # out-of-tree compilation
366 /*) SYNTHESIS_SRC="$srcdir/src/synthesis";;
367 *) SYNTHESIS_SRC="$PWD/$srcdir/src/synthesis";;
370 PKG_CHECK_MODULES(SYNTHESIS, "synthesis")
373 if test $SYNTHESIS_SRC != "no-synthesis-source"; then
374 ( cd $SYNTHESIS_SRC && ( test -f configure || sh autogen.sh ) ) || AC_MSG_ERROR([no configure script in $SYNTHESIS_SRC])
376 SYNTHESIS_CONFIGURE="$SYNTHESIS_SRC/configure"
377 chmod u+x $SYNTHESIS_SRC/configure $SYNTHESIS_SRC/config.sub $SYNTHESIS_SRC/config.guess
379 # use local copy of the sources, with dependencies
380 # to trigger building the synthesis library
381 SYNTHESIS_SUBDIR=$PWD/src/build-synthesis
382 SYNTHESIS_DEP=$PWD/src/build-synthesis/src/libsynthesissdk.la
384 SYNTHESIS_CFLAGS="-I$SYNTHESIS_SUBDIR/src"
385 SYNTHESIS_LIBS="-L$SYNTHESIS_SUBDIR/src -lsynthesissdk -lsynthesis"
387 AC_MSG_NOTICE( [configuring the Synthesis library] )
388 if (set -x; mkdir -p $SYNTHESIS_SUBDIR && cd $SYNTHESIS_SUBDIR && eval "\$SHELL \"\$SYNTHESIS_CONFIGURE\" $ac_configure_args \"--srcdir=\$SYNTHESIS_SRC\" " ); then true; else
389 AC_MSG_ERROR( [configuring Synthesis library failed] )
393 AC_SUBST(SYNTHESIS_CFLAGS)
394 AC_SUBST(SYNTHESIS_LIBS)
396 AC_SUBST(SYNTHESIS_SUBDIR)
397 AC_SUBST(SYNTHESIS_DEP)
398 AC_SUBST(SYNTHESIS_LIB)
399 AC_SUBST(SYNTHESISSRC)
404 # AC_ARG_ENABLE_BACKEND(BACKEND, DIR, HELP-STRING, [ACTION-IF-GIVEN],
405 # [ACTION-IF-NOT-GIVEN])
407 # Same as AC_ARG_ENABLE(), but also tells configure that the
410 # BACKEND = name of modules built in that dir as .la files without the
411 # obligatory sync prefix, e.g. "ebook"
412 # DIR = name of the directory inside src/backends, e.g., "evolution"
413 AC_DEFUN([AC_ARG_ENABLE_BACKEND],
415 AC_ARG_ENABLE($1, $3, $4, $5)
416 BACKENDS="$BACKENDS $1"
417 BACKEND_DEFINES="$BACKEND_DEFINES ENABLE_`echo $1 | tr a-z A-Z`"
419 SYNCSOURCES="$SYNCSOURCES backends/$2/sync$1.la"
422 AC_SUBST(SYNCSOURCES)
423 AC_SUBST(BACKEND_DEFINES)
425 BACKEND_CPPFLAGS="$SYNTHESIS_CFLAGS $EPACKAGE_CFLAGS $EBOOK_CFLAGS $ECAL_CFLAGS $GLIB_CFLAGS"
426 AC_SUBST(BACKEND_CPPFLAGS)
428 dnl src/backends/*/configure-sub.in and configure-post.in follow