1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(src/syncevolution.cpp)
4 AM_INIT_AUTOMAKE(syncevolution, 0.8-beta1)
5 AM_CONFIG_HEADER(config.h)
8 dnl default device type (see AC_DEFINE below)
11 # command used to configure client library, including options
12 CLIENT_CONFIGURE=$PWD/src/client-api/build/autotools/configure
15 AS_HELP_STRING([--with-sync4j=<base directory>],
16 [specifies location of Sync4j client library]),
19 AC_ARG_WITH(sync4j-src,
20 AS_HELP_STRING([--with-sync4j-src=<base directory>],
21 [specifies location of the Sync4j '3x/client-api/native' source code]),
22 [SYNC4JSRC="$withval"])
25 AS_HELP_STRING([--enable-shared],
26 [build backends as dynamically loadable modules]),
27 enable_shared="$enableval", enable_shared="no")
30 AS_HELP_STRING([--enable-static],
31 [build backends also as static libraries]),
32 enable_static="$enableval", enable_static="no")
34 AC_ARG_ENABLE(unit-tests,
35 AS_HELP_STRING([--enable-unit-tests],
36 [enables tests embedded in the source code of the library (changes content of executable)]),
37 enable_unit_tests="$enableval", enable_unit_tests="no")
38 AC_ARG_ENABLE(integration-tests,
39 AS_HELP_STRING([--enable-integration-tests],
40 [enables tests outside of the library (can be used together with normal builds of the library)]),
41 enable_integration_tests="$enableval", enable_integration_tests="no")
43 AC_ARG_ENABLE(static-cxx,
44 AS_HELP_STRING([--enable-static-cxx],
45 [build executables which contain libstdc++ instead of requiring suitable libstdc++.so to run]),
46 enable_static_cxx="$enableval", enable_static_cxx="no")
49 # - set the (non-standard!) DBUS_DEFAULT_TIMEOUT
50 # - wrap e_book_from_string() to fix invalid parameter
51 # - don't use UTF-8 encoding in Perl script
53 AS_HELP_STRING([--enable-maemo],
54 [enables some hacks which work around problems with the Maemo 2.0 until at least 3.0 EDS-Dbus]),
55 [AC_DEFINE(ENABLE_MAEMO, 1, [enable Maemo hacks])
57 MODIFY_SYNCCOMPARE='-e "s/use encoding/#use encoding/;" -e "s/:utf8//;"'])
58 AC_SUBST(MODIFY_SYNCCOMPARE)
61 # - link main binaries against precompiled, patched libdbus-1.a
62 AC_ARG_WITH(patched-libdbus,
63 AS_HELP_STRING([--with-patched-libdbus=<absolute path of directory with patched libdbus-1.a/so>],
64 [link main executables against special libdbus-1.a, for example one which supports DBUS_DEFAULT_TIMEOUT (required for Maemo)]),
65 [LIBDBUS="-L$withval"])
68 AC_CHECK_HEADERS(signal.h dlfcn.h)
71 if test $enable_unit_tests == "yes" || test $enable_integration_tests == yes; then
72 CPPUNIT_CXXFLAGS=`cppunit-config --cflags` || AC_MSG_ERROR("cppunit-config --cflags failed - is it installed?")
73 CPPUNIT_LDFLAGS=`cppunit-config --libs` || AC_MSG_ERROR("cppunit-config --libs failed - is it installed?")
74 CPPUNIT_TESTS=client-test
76 AC_SUBST(CPPUNIT_CXXFLAGS)
77 AC_SUBST(CPPUNIT_LDFLAGS)
78 AC_SUBST(CPPUNIT_TESTS)
80 if test $enable_unit_tests == "yes"; then
81 CLIENT_CONFIGURE="$CLIENT_CONFIGURE --enable-unit-tests"
82 AC_DEFINE(ENABLE_UNIT_TESTS, 1, [enable unit tests inside the library's source code])
84 if test $enable_integration_tests == "yes"; then
85 CLIENT_CONFIGURE="$CLIENT_CONFIGURE --enable-integration-tests"
86 AC_DEFINE(ENABLE_INTEGRATION_TESTS, 1, [enable unit tests outside of the library's source code])
89 if test $enable_static_cxx == "yes"; then
91 CORE_LDADD_DEP=libstdc++.a
93 AC_SUBST(CORE_LDADD_DEP)
95 # preserve src/client-api by default
97 SYNC4J_LIB=$PWD/src/client-api.build/src/libsync4j.la
99 AC_SUBST(CLEAN_CLIENT_SRC)
101 if test ! "$SYNC4J"; then
102 if test "$SYNC4JSRC"; then
103 # make a copy of the sources, remove it during maintainer-clean and distclean
104 CLEAN_CLIENT_SRC=client-api
106 AC_MSG_NOTICE( [updating the content of src/client-api from $SYNC4JSRC] )
107 mkdir -p src/client-api
108 if cp --help 2>/dev/null | grep >/dev/null -e "--update"; then
110 cp_opts="--update --archive"
115 if cp $cp_opts $SYNC4JSRC/* src/client-api; then
116 ( cd src/client-api/build/autotools && ( test -f configure || sh autogen.sh ) )
118 AC_MSG_ERROR( [copying $SYNC4JSRC into src/client-api failed] )
120 find src/client-api/build/autotools/win* -name output | xargs rm -rf
121 find src/client-api/build/autotools/include/* src/client-api/build/autotools/src/* -type d | xargs rm -rf
122 find src/client-api -name "*~*" -o -name ".#*" -o -name "*.orig" -o -name "stamp-*" -o -name "*.o" -o -name "*.lo" -o -name .libs -o -name autom4te.cache -o -name config.status | xargs rm -rf
124 if test ! -d src/client-api; then
125 if test -d $srcdir/src/client-api; then
128 /*) ln -s $srcdir/src/client-api src/client-api;;
129 *) ln -s $PWD/$srcdir/src/client-api src/client-api;;
135 if test -f src/client-api/build/autotools/configure; then
136 chmod u+x src/client-api/build/autotools/configure src/client-api/build/autotools/config.sub src/client-api/build/autotools/config.guess
138 # use local copy of the sources, with dependencies
139 # to trigger building the client library
140 SYNC4J_SUBDIR=$PWD/src/client-api.build
141 SYNC4J_DEP=$PWD/src/client-api.build/src/libsync4j.la
143 SYNC4J_CFLAGS="-I$SYNC4J_SUBDIR/include/posix -I$SYNC4J_SUBDIR/include/common -I$SYNC4J_SUBDIR/include -I$SYNC4J_SUBDIR/test"
144 SYNC4J_LIBS="-L$SYNC4J_SUBDIR/src -lsync4j"
146 AC_MSG_NOTICE( [configuring the client library] )
147 if (set -x; mkdir -p $SYNC4J_SUBDIR && cd $SYNC4J_SUBDIR && $CLIENT_CONFIGURE --build=$build_alias --host=$host_alias --target=$target_alias --disable-shared); then true; else
148 AC_MSG_ERROR( [configuring client library failed] )
151 AC_MSG_ERROR( [either --with-sync4j or --with-sync4j-src have to be used] )
154 if test -f $SYNC4J/include/sync4j/common/spds/SyncItem.h; then
155 SYNC4J_CFLAGS="-I$SYNC4J/include/sync4j/posix -I$SYNC4J/include/sync4j/common -I$SYNC4J/include/sync4j"
156 SYNC4J_LIBS="-L$SYNC4J/lib -lsync4j"
158 AC_MSG_ERROR( [$SYNC4J does seem to be valid (e.g. include/sync4j/spds/common/SyncItem.h is missing)] )
162 AC_SUBST(SYNC4J_CFLAGS)
163 AC_SUBST(SYNC4J_LIBS)
165 AC_SUBST(SYNC4J_SUBDIR)
170 pkg_emodules_10="libedataserver-1.0"
171 pkg_emodules_11="libedataserver-1.1"
172 pkg_emodules_12="libedataserver-1.2"
173 pkg_ebook_10="libebook-1.0"
174 pkg_ebook_11="libebook-1.1"
175 pkg_ebook_12="libebook-1.2"
176 pkg_ecal_10="libecal-1.0"
177 pkg_ecal_11="libecal-1.1"
178 pkg_ecal_12="libecal-1.2"
180 export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/usr/lib/pkgconfig:$prefix/lib/pkgconfig:/usr/local/lib/pkgconfig
183 Please install the development packages of Evolution and/or
184 set the PKG_CONFIG_PATH variable so that it points towards
185 the .pc files of libedataserver, libecal and libebook (the
186 latter two are optional).
188 You can check that these packages are available by running
189 pkg-config --list-all."
191 evomissing="No compatible evolution-data-server was found.
194 dnl check for Evolution core packages
195 PKG_CHECK_MODULES(EPACKAGE, [$pkg_emodules_12], EDSFOUND=yes, [EDSFOUND=no])
196 if test "x${EDSFOUND}" = "xno"; then
197 PKG_CHECK_MODULES(EPACKAGE, [$pkg_emodules_11], EDSFOUND=yes, [EDSFOUND=no])
198 if test "x${EDSFOUND}" = "xno"; then
199 PKG_CHECK_MODULES(EPACKAGE, [$pkg_emodules_10], EDSFOUND=yes, [EDSFOUND=no])
202 AC_SUBST(EPACKAGE_CFLAGS)
203 AC_SUBST(EPACKAGE_LIBS)
205 dnl check for Evolution calendar packages
206 PKG_CHECK_MODULES(ECAL, [$pkg_ecal_12], ECALFOUND=yes, [ECALFOUND=no])
207 if test "x${ECALFOUND}" = "xno"; then
208 PKG_CHECK_MODULES(ECAL, [$pkg_ecal_11], ECALFOUND=yes, [ECALFOUND=no])
209 if test "x${ECALFOUND}" = "xno"; then
210 PKG_CHECK_MODULES(ECAL, [$pkg_ecal_10], ECALFOUND=yes, [ECALFOUND=no])
213 AC_SUBST(ECAL_CFLAGS)
216 dnl check for Evolution contact packages
217 PKG_CHECK_MODULES(EBOOK, [$pkg_ebook_12], EBOOKFOUND=yes, [EBOOKFOUND=no])
218 if test "x${EBOOKFOUND}" = "xno"; then
219 PKG_CHECK_MODULES(EBOOK, [$pkg_ebook_11], EBOOKFOUND=yes, [EBOOKFOUND=no])
220 if test "x${EBOOKFOUND}" = "xno"; then
221 PKG_CHECK_MODULES(EBOOK, [$pkg_ebook_10], EBOOKFOUND=yes, [EBOOKFOUND=no])
224 AC_SUBST(EBOOK_CFLAGS)
229 PKG_CHECK_MODULES(SQLITE, sqlite3, SQLITEFOUND=yes, [SQLITEFOUND=no])
230 AC_SUBST(SQLITE_CFLAGS)
231 AC_SUBST(SQLITE_LIBS)
233 dnl hard-coded settings for Mac OS X AddressBook
236 ADDRESSBOOK_LIBS="-framework AddressBook -framework CoreFoundation"
237 AC_SUBST(ADDRESSBOOK_CFLAGS)
238 AC_SUBST(ADDRESSBOOK_LIBS)
241 AC_ARG_ENABLE(ebook, AS_HELP_STRING([--disable-ebook], [disable access to addressbooks (default on if available)]),
242 [enable_ebook="$enableval"], [enable_ebook=$EBOOKFOUND])
243 AC_ARG_ENABLE(ecal, AS_HELP_STRING([--disable-ecal], [disable access to calendars and tasks (default on if available)]),
244 [enable_ecal="$enableval"], [enable_ecal=$ECALFOUND])
245 AC_ARG_ENABLE(sqlite, AS_HELP_STRING([--enable-sqlite], [enable access to PIM data stored in SQLite files (experimental, default off)]),
246 [enable_sqlite="$enableval"], [enable_sqlite="no"])
247 AC_ARG_ENABLE(addressbook, AS_HELP_STRING([--enable-addressbook], [enable access to Mac OS X address book (default off)]),
248 [enable_addressbook="$enableval"], [enable_addressbook="no"])
252 if test "$enable_ebook" = "yes"; then
253 test "x${EBOOKFOUND}" == "xyes" || AC_MSG_ERROR([--enable-ebook requires pkg-config information for libebook, which was not found])
254 AC_DEFINE(ENABLE_EBOOK, 1, [libebook available])
259 AM_CONDITIONAL([ENABLE_ECAL], [test "$enable_ecal" == "yes"])
260 if test "$enable_ecal" = "yes"; then
261 test "x${ECALFOUND}" == "xyes" || AC_MSG_ERROR([--enable-ecal requires pkg-config information for libecal, which was not found"])
262 AC_DEFINE(ENABLE_ECAL, 1, [libecal available])
267 if test "$enable_sqlite" = "yes"; then
268 test "x${SQLITEFOUND}" == "xyes" || AC_MSG_ERROR([--enable-sqlite requires pkg-config information for sqlite3, which was not found])
269 AC_DEFINE(ENABLE_SQLITE, 1, [sqlite available])
273 if test "$enable_addressbook" = "yes"; then
274 AC_DEFINE(ENABLE_ADDRESSBOOK, 1, [addressbook available])
281 if test "$enable_any" = "no"; then
282 AC_MSG_ERROR([no backend enabled - refusing to continue: $anymissing])
285 if test "$enable_evo" = "yes"; then
286 if test "$EDSFOUND" = "yes"; then
287 AC_DEFINE(HAVE_EDS, 1, [evolution-dataserver available])
289 AC_MSG_ERROR($evomissing)
296 dnl check for glib - calling g_type_init() is expected on Maemo
297 PKG_CHECK_MODULES(GLIB, "glib-2.0", GLIBFOUND=yes, GLIBFOUND=no)
298 if test "x${GLIBFOUND}" = "xno"; then
299 PKG_CHECK_MODULES(GLIB, "glib", GLIBFOUND=yes, GLIBFOUND=no)
301 AC_SUBST(GLIB_CFLAGS)
304 dnl check for programs.
309 if test "$enable_sqlite" == "yes"; then
310 SYNCEVOLUTION_MODULES="$SYNCEVOLUTION_MODULES syncsqlite.la"
312 if test "$enable_addressbook" == "yes"; then
313 SYNCEVOLUTION_MODULES="$SYNCEVOLUTION_MODULES syncaddressbook.la"
316 dnl glib initialization is done only for libebook and libecal, not needed
317 dnl otherwise even if found
318 if test "$enable_ebook" != "yes" && test "$enable_ecal" != "yes"; then
322 if test "x${GLIBFOUND}" = "xyes"; then
323 AC_DEFINE(HAVE_GLIB, 1, [glib found])
327 dnl figure out whether we link all code statically or as modules
328 AM_CONDITIONAL([ENABLE_MODULES], [test "$enable_shared" == "yes"])
329 if test "$enable_shared" == "yes"; then
330 SYNCEVOLUTION_LDADD="-Wl,-export-dynamic -rpath '\$(pkglibdir)'"
331 AC_DEFINE(ENABLE_MODULES, 1, [enable dynamically opening sync source backends])
333 SYNCEVOLUTION_LDADD="\$(EXTRA_LTLIBRARIES)"
335 AC_SUBST(SYNCEVOLUTION_LDADD)
337 dnl CXXFLAGS gets applied to SyncEvolution and the client library.
338 dnl For e.g. "-Wall -Werror" this might not be such a good idea;
339 dnl SYNCEVOLUTION_CXXFLAGS can be used instead. It applies only
340 dnl to the sources in the SyncEvolution repository.
341 AC_SUBST(SYNCEVOLUTION_CXXFLAGS)
343 dnl a quick-and-dirty way to detect compilation for the iPhone
344 if test "$host" == "arm-apple-darwin"; then
345 AC_DEFINE(IPHONE, 1, [compiling for iPhone])
349 dnl This string is sent as part of the SyncML DevInf (device
350 dnl information) structure to the server. All SyncEvolution platforms
351 dnl use "SyncEvolution" as HTTP user agent and "Mod" (model), so the
352 dnl device type is the only way how different kinds of clients can be
354 AC_DEFINE_UNQUOTED(DEVICE_TYPE, "$DEVICE_TYPE", "SyncML DevInf DevType")
356 AC_CHECK_HEADERS(stdarg.h valgrind/valgrind.h execinfo.h)