f367c830d66b961d42aa42b67368c711574b15ca
[platform/upstream/syncevolution.git] / configure.in
1 dnl -*- mode: Autoconf; -*-
2 dnl Invoke autogen.sh to produce a configure script.
3
4 # The STABLE_VERSION is used when building
5 # Debian packages. For prereleases (beta, alpha),
6 # set it to something like "0.9.2+" and the AC_INIT
7 # VERSION to 1.0beta1 to produce 0.9.2+1.0beta1.
8 #
9 # Starting with the 1.1 release cycle, the rpm-style
10 # .99 pseudo-version number is used to mark a pre-release.
11 AC_INIT([syncevolution], [1.0.99.7])
12 # STABLE_VERSION=1.0.1+
13 AC_SUBST(STABLE_VERSION)
14
15 AM_INIT_AUTOMAKE([tar-ustar])
16 AC_CONFIG_MACRO_DIR([m4])
17 define([SYNTHESISSRC_REPO], [])
18 dnl Specify git revisions/branches without prefix, i.e., without 'origin'.
19 dnl We'll sort that out below.
20 define([SYNTHESISSRC_REVISION], [syncevolution-0.9])
21 AM_CONFIG_HEADER(config.h)
22 AC_LIBTOOL_DLOPEN
23
24 dnl default device type (see AC_DEFINE below)
25 DEVICE_TYPE=workstation
26
27 AC_ARG_WITH(synthesis-src,
28             AS_HELP_STRING([--with-synthesis-src=<base directory|svn URL|git URL>],
29                            [Specifies location of the Synthesis root directory.
30                            Use this when the Synthesis library is to
31                            be compiled as part of the SyncEvolution compilation. In release
32                            versions of SyncEvolution, a copy of the Synthesis code is bundled
33                            under 'src/synthesis' and compiled unless something else is
34                            specified. --with-synthesis-src can be given a path to sources
35                            checked out already, a Subversion repository URL or a git repository
36                            URL. When given a repository URL, then the configure script
37                            will checkout the sources into 'src/synthesis-workdir' or
38                            update that working copy if the directory already exists.
39                            Default: bundled source in src/synthesis (in released SyncEvolution sources),
40                            SYNTHESISSRC_REPO otherwise.]),
41             [SYNTHESISSRC="$withval"
42              test "$SYNTHESISSRC" != "yes" || AC_MSG_ERROR([--with-synthesis-src requires a parameter (base directory, svn URL or git URL)])],
43             [SYNTHESISSRC="$SYNTHESISSRC_DEF"; REVISION="SYNTHESISSRC_REVISION"])
44
45 AC_ARG_WITH(syncml-engines,
46             AS_HELP_STRING([--with-syncml-engines=client|server|both],
47                            [Determines which kind of support for SyncML is compiled and linked into SyncEvolution. Default is both. Currently has no effect.]),
48             [SYNCML_ENGINES="$withval"], SYNCML_ENGINES=both)
49
50 case $SYNCML_ENGINES in both|client) AC_DEFINE(ENABLE_SYNCML_CLIENT, 1, [SyncML client support available]);; esac
51 case $SYNCML_ENGINES in both|server) AC_DEFINE(ENABLE_SYNCML_SERVER, 1, [SyncML server support available]);; esac
52 case $SYNCML_ENGINES in both|server|client) true;; *) AC_ERROR([Invalid value for --with-syncml-engines: $SYNCML_ENGINES]);; esac
53
54 AC_ARG_WITH(synthesis-username,
55             AS_HELP_STRING([--with-synthesis-username=<svn username>],
56                            [username to use when checking out --with-synthesis-src sources from Subversion, default 'guest']),
57             [USERNAME="$withval"], [USERNAME="guest"])
58
59 AC_ARG_WITH(synthesis-revision,
60             AS_HELP_STRING([--with-synthesis-revision=<git tag/branch/hash or Subversion revision>],
61                            [Identifies which source revision to use from --with-synthesis-src repository, empty string stands for latest. Default for default --synthesis-src: SYNTHESISSRC_REVISION]),
62             [REVISION="$withval"])
63
64 AC_ARG_ENABLE(shared,
65               AS_HELP_STRING([--enable-shared],
66                              [build backends as dynamically loadable modules]),
67               enable_shared="$enableval", enable_shared="no")
68
69 AC_ARG_ENABLE(static,
70               AS_HELP_STRING([--enable-static],
71                              [build backends also as static libraries]),
72               enable_static="$enableval", enable_static="no")
73
74 AC_ARG_ENABLE(unit-tests,
75               AS_HELP_STRING([--enable-unit-tests],
76                              [enables tests embedded in the source code of the library (changes content of executable)]),
77               enable_unit_tests="$enableval", enable_unit_tests="no")
78 AC_ARG_ENABLE(integration-tests,
79               AS_HELP_STRING([--enable-integration-tests],
80                              [enables tests outside of the library (can be used together with normal builds of the library)]),
81               enable_integration_tests="$enableval", enable_integration_tests="no")
82
83 AC_ARG_ENABLE(static-cxx,
84               AS_HELP_STRING([--enable-static-cxx],
85                              [build executables which contain libstdc++ instead of requiring suitable libstdc++.so to run]),
86               enable_static_cxx="$enableval", enable_static_cxx="no")
87
88 AC_ARG_ENABLE(evolution-compatibility,
89               AS_HELP_STRING([--enable-evolution-compatibility],
90                              [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]),
91               enable_evolution_compatibility="$enableval", enable_evolution_compatibility="no")
92
93 AC_ARG_ENABLE(developer-mode, 
94              AC_HELP_STRING([--enable-developer-mode], 
95                             [The dynamic loadble backend libraries is loaded from current build directory instead of the standard library path]),
96              enable_developer_mode="$enableval", enable_developer_mode="no")
97
98 # Maemo hacks:
99 # - wrap e_book_from_string() to fix invalid parameter
100 # - don't use UTF-8 encoding in Perl script
101 AC_ARG_ENABLE(maemo,
102               AS_HELP_STRING([--enable-maemo],
103                              [enables some hacks which work around problems with the Maemo 2.0 until at least 3.0 EDS-Dbus]),
104               [AC_DEFINE(ENABLE_MAEMO, 1, [enable Maemo hacks])
105                DEVICE_TYPE=Maemo
106                MODIFY_SYNCCOMPARE='-e "s/use encoding/#use encoding/;" -e "s/:utf8//;"'])
107 AC_SUBST(MODIFY_SYNCCOMPARE)
108
109 AC_CHECK_HEADERS(signal.h dlfcn.h)
110
111 # cppunit needed?
112 if test $enable_unit_tests == "yes" || test $enable_integration_tests == yes; then
113         CPPUNIT_CXXFLAGS=`cppunit-config --cflags` || AC_MSG_ERROR("cppunit-config --cflags failed - is it installed?")
114         CPPUNIT_LDFLAGS=`cppunit-config --libs` || AC_MSG_ERROR("cppunit-config --libs failed - is it installed?")
115 fi
116 AC_SUBST(CPPUNIT_CXXFLAGS)
117 AC_SUBST(CPPUNIT_LDFLAGS)
118
119 if test "$enable_unit_tests" = "yes"; then
120         AC_DEFINE(ENABLE_UNIT_TESTS, 1, [enable unit tests inside the library's source code])
121 fi
122 if test "$enable_integration_tests" = "yes"; then
123         AC_DEFINE(ENABLE_INTEGRATION_TESTS, 1, [enable integration tests inside the final library])
124 fi
125 AM_CONDITIONAL([ENABLE_UNIT_TESTS], [test "$enable_unit_tests" = "yes"])
126 AM_CONDITIONAL([ENABLE_TESTING], [test "$enable_unit_tests" = "yes" || test "$enable_integration_tests" = "yes" ])
127
128 if test $enable_static_cxx == "yes"; then
129         LIBS="$LIBS -L."
130         CORE_LDADD_DEP=libstdc++.a
131 fi
132 AC_SUBST(CORE_LDADD_DEP)
133
134 # Check for transport layer.
135 # Both curl and libsoup can be enabled and disabled explicitly.
136 # The default is to use libsoup if available, otherwise curl.
137
138 AC_MSG_CHECKING([for libcurl])
139 if LIBCURL_LIBS=`sh -c 'curl-config --libs' 2>&AS_MESSAGE_LOG_FD` && \
140     LIBCURL_CFLAGS=`sh -c 'curl-config --cflags' 2>&AS_MESSAGE_LOG_FD`; then
141     AC_MSG_RESULT([yes])
142     have_libcurl="yes"
143 else
144     AC_MSG_RESULT([no])
145     have_libcurl="no"
146 fi
147
148 PKG_CHECK_MODULES(LIBSOUP, libsoup-gnome-2.4,
149                   [have_libsoup="yes"
150                    AC_DEFINE(HAVE_LIBSOUP_SOUP_GNOME_FEATURES_H, 1, [enable GNOME specific libsoup])],
151                   [PKG_CHECK_MODULES(LIBSOUP, libsoup-2.4,
152                                      have_libsoup="yes",
153                                      have_libsoup="no")])
154
155 PKG_CHECK_MODULES(LIBOPENOBEX, openobex, have_obex="yes", have_obex="no")
156 have_bluetooth="no"
157 if test $have_obex = "yes"; then
158     PKG_CHECK_MODULES(BLUEZ, bluez, have_bluez="yes", have_bluez="no")
159     if test $have_bluez = "yes"; then
160         have_bluetooth="yes"
161     fi
162 fi
163 AC_SUBST(LIBOPENOBEX_CFLAGS)
164 AC_SUBST(LIBOPENOBEX_LIBS)
165 AC_SUBST(BLUEZ_CFLAGS)
166 AC_SUBST(BLUEZ_LIBS)
167
168 TRANSPORT=
169 TRANSPORT_LIBS=
170 TRANSPORT_CFLAGS=
171
172 AC_ARG_WITH(ca-certificates,
173             AS_HELP_STRING([--with-ca-certificates=<colon separated list of files>],
174                            [Specifies location of one or more CA certificate files.
175                            This sets the default value for the SSLServerCertificates option.
176                            Default: empty when using libcurl (because it has its own default),
177                            a list of paths known to work for Debian and Red Hat otherwise.]),
178             [CA_CERTIFICATES="$withval"])
179
180
181 # choose default http transport (mirrors code in EvolutionSyncClient::createTransportAgent())
182 if test "$have_libsoup" = "yes"; then
183    default_http_transport="libsoup"
184 elif test "$have_libcurl" = "yes"; then
185    default_http_transport="libcurl"
186 fi
187
188 AC_ARG_ENABLE(libcurl,
189               AC_HELP_STRING([--enable-libcurl],
190                              [enable libcurl as transport layer]),
191               [ if test "$enableval" = "yes"; then
192                    test "$have_libcurl" = "yes" || AC_MSG_ERROR([libcurl not found])
193                    TRANSPORT="$TRANSPORT libcurl"
194                    TRANSPORT_LIBS="$TRANSPORT_LIBS $LIBCURL_LIBS"
195                    TRANSPORT_CFLAGS="$TRANSPORT_CFLAGS $LIBCURL_CFLAGS"
196                    AC_DEFINE(ENABLE_LIBCURL, 1, [enable libcurl transport])
197                 else
198                    libcurl_disabled="yes"
199                 fi ],
200               [ if test "$have_libcurl" = "yes" && test "$default_http_transport" = "libcurl" ; then
201                    TRANSPORT="$TRANSPORT libcurl"
202                    TRANSPORT_LIBS="$TRANSPORT_LIBS $LIBCURL_LIBS"
203                    TRANSPORT_CFLAGS="$TRANSPORT_CFLAGS $LIBCURL_CFLAGS"
204                    AC_DEFINE(ENABLE_LIBCURL, 1, [enable libcurl transport])
205                 fi ])
206
207 AC_ARG_ENABLE(libsoup,
208               AC_HELP_STRING([--enable-libsoup],
209                              [enable libsoup as transport layer]),
210               [ if test "$enableval" = "yes"; then
211                    test "$have_libsoup" = "yes" || AC_MSG_ERROR([libsoup not found])
212                    TRANSPORT="$TRANSPORT libsoup"
213                    TRANSPORT_LIBS="$TRANSPORT_LIBS $LIBSOUP_LIBS"
214                    TRANSPORT_CFLAGS="$TRANSPORT_CFLAGS $LIBSOUP_CFLAGS"
215                    AC_DEFINE(ENABLE_LIBSOUP, 1, [enable libsoup transport])
216                 else
217                    libsoup_disabled="yes"
218                 fi ],
219               [ if test "$have_libsoup" = "yes" && test "$default_http_transport" = "libsoup"; then
220                    TRANSPORT="$TRANSPORT libsoup"
221                    TRANSPORT_LIBS="$TRANSPORT_LIBS $LIBSOUP_LIBS"
222                    TRANSPORT_CFLAGS="$TRANSPORT_CFLAGS $LIBSOUP_CFLAGS"
223                    AC_DEFINE(ENABLE_LIBSOUP, 1, [enable libsoup transport])
224                 fi ])
225
226 # SoupTransportAgent depends on glib
227 case "$TRANSPORT" in *libsoup*) need_glib=yes;; esac
228
229 bluetooth_disabled=no
230 AC_ARG_ENABLE(bluetooth,
231               AC_HELP_STRING([--enable-bluetooth],
232                              [enable bluetooth transport support]),
233               [ enable_bluetooth="$enableval"
234                 if test "$enableval" = "no"; then
235                     bluetooth_disabled=yes
236                 fi
237               ],
238               [ enable_bluetooth="$have_bluetooth" ])
239
240 if test "$enable_bluetooth" = "yes"; then
241    # currently we need Bluetooth and OBEX support
242    test "$have_bluetooth" = "yes" || AC_MSG_ERROR([openobex or bluez not found])   
243
244    AC_LANG(C)
245    CFLAGS_old="$CFLAGS"
246    CFLAGS="$CPPFLAGS $BLUEZ_CFLAGS"
247    # test in this order:
248    # - recent libbluetooth (no _safe variant, base function has bufsize)
249    # - intermediate with _safe
250    # - else assume old-style (no bufsize, no _safe)
251    #
252    # The source code checks the signature both by via pointer assignment and calling
253    # it (better safe than sorry). One these should fail if the signature is not right.
254    AC_COMPILE_IFELSE([#include <bluetooth/sdp.h>
255                       #include <bluetooth/sdp_lib.h>
256                       sdp_record_t *(*extract_pdu)(const uint8_t *pdata, int bufsize, int *scanned) =
257                            sdp_extract_pdu;
258                       void foo(void) {
259                           uint8_t *pdata = NULL;
260                           int scanned;
261                           sdp_extract_pdu(pdata, 100, &scanned);
262                       }
263                      ],
264                      AC_DEFINE(HAVE_BLUEZ_BUFSIZE, 1, [base libbluetooth functions accept bufsize parameter]),
265                      AC_COMPILE_IFELSE([#include <bluetooth/sdp.h>
266                                         #include <bluetooth/sdp_lib.h>
267                                         sdp_record_t *(*extract_pdu)(const uint8_t *pdata, int bufsize, int *scanned) =
268                                                sdp_extract_pdu_safe;
269                                         void foo(void) {
270                                             uint8_t *pdata = NULL;
271                                             int scanned;        
272                                             sdp_extract_pdu_safe(pdata, 100, &scanned);
273                                         }
274                                        ],
275                                        AC_DEFINE(HAVE_BLUEZ_SAFE, 1, [libbluetooth has _safe variants])))
276    CFLAGS="$CFLAGS_old"
277
278    if test "$have_obex" = "yes"; then
279       AC_DEFINE(ENABLE_OBEX, 1, [define if openobex library is available])
280    fi
281    if test "$have_bluez" = "yes"; then
282       AC_DEFINE(ENABLE_BLUETOOTH, 1, [define if bluez library is available])
283    fi
284 fi
285 AM_CONDITIONAL([ENABLE_OBEX], [test "$have_obex" = "yes" && test "$enable_bluetooth" = "yes"])
286 AM_CONDITIONAL([ENABLE_BLUETOOTH], [test "$have_bluetooth" = "yes" && test "$enable_bluetooth" = "yes"])
287
288 if test ! "$TRANSPORT" &&
289    test "$libsoup_disabled" != "yes" &&
290    test "$libcurl_disabled" != "yes" &&
291    test "$bluetooth_disabled" != "yes" &&
292    test "$have_bluetooth" != "yes" ; then
293    AC_ERROR([no transport library found, configure with --disable-libcurl --disable-libsoup --disable-bluetooth to continue anyway (only useful if users of libsyncevolution provide transport implementation)])
294 fi
295
296 # for libsoup we must specify the SSL certificate file outself
297 if test "$libsoup_disabled" != "yes" && test -z "$CA_CERTIFICATES"; then
298    # Debian and Red Hat paths
299    CA_CERTIFICATES="/etc/ssl/certs/ca-certificates.crt:/etc/pki/tls/certs/ca-bundle.crt:/usr/share/ssl/certs/ca-bundle.crt"
300 fi
301 AC_DEFINE_UNQUOTED(SYNCEVOLUTION_SSL_SERVER_CERTIFICATES, "$CA_CERTIFICATES", [default value for SSLServerCertificates option])
302
303 AC_SUBST(TRANSPORT_LIBS)
304 AC_SUBST(TRANSPORT_CFLAGS)
305
306 AC_ARG_ENABLE(ssl-certificate-check,
307               AC_HELP_STRING([--disable-ssl-certificate-check],
308                              [Disable SSL certificate checking in all server
309                               *templates*.  Users can still choose to enable or
310                               disable it in their configuration. This is necessary on
311                               platforms where the transport library has problems
312                               verifying the server's certificate (libsoup + Google,
313                               http://bugzilla.moblin.org/show_bug.cgi?id=4551)]),
314              enable_ssl_certificate_check="$enableval",
315              enable_ssl_certificate_check="yes")
316 if test "$enable_ssl_certificate_check" = "yes"; then
317    AC_DEFINE(ENABLE_SSL_CERTIFICATE_CHECK, 1, [enable SSL certificate check in server templates])
318 fi
319
320 # for dbus interface file mangling
321 AC_PATH_PROG(XSLT, xsltproc)
322
323 AC_ARG_ENABLE(gui,
324               AS_HELP_STRING([--enable-gui[=gui type]],
325                              [enables building the GTK+ UI that uses the SyncEvolution DBus API.
326                               Options: gtk, moblin, all (builds sync-ui-gtk and sync-ui-moblin)
327                               "gtk" is the default for --enable-gui without type. No GUI is
328                               built when --enable-gui is not used.]),
329               [ if test "$enableval" = "gtk" ; then
330                     enable_gui=gtk
331                 elif test "$enableval" = "yes" ; then
332                     enable_gui=gtk
333                 elif test "$enableval" = "moblin" ; then
334                     enable_gui=moblin
335                 elif test "$enableval" = "no" ; then
336                     enable_gui=no
337                 elif test "$enableval" = "all" ; then
338                     enable_gui=all
339                 else
340                     AC_ERROR([Unknown gui type: '$enableval'])
341                 fi
342               ],
343               [ enable_gui=no ])
344
345 AM_CONDITIONAL([COND_GUI], [test "$enable_gui" != "no"])
346
347 AC_ARG_ENABLE(core,
348               AS_HELP_STRING([--enable-core],
349                              [enables building the core SyncEvolution (library, backends)]),
350               enable_core="$enableval",
351               enable_core="yes")
352 AM_CONDITIONAL([COND_CORE], [test "$enable_core" = "yes"])
353
354 AC_ARG_ENABLE(dbus-service,
355               AS_HELP_STRING([--enable-dbus-service],
356                              [enables building the dbus service executable and all related features
357                              (the DBus wrapper library, command line usage of server, etc).]),
358               enable_dbus_service="$enableval",
359               [if test $enable_gui == "no"; then
360                   enable_dbus_service="no"
361                else
362                   enable_dbus_service="yes"
363                fi])
364 AM_CONDITIONAL([COND_DBUS], [test "$enable_dbus_service" = "yes"])
365
366 PKG_CHECK_MODULES(KEYRING, [gnome-keyring-1], HAVE_KEYRING=yes, HAVE_KEYRING=no)
367 AC_ARG_ENABLE(gnome-keyring,
368               AS_HELP_STRING([--enable-gnome-keyring],
369                              [enables or disables support for the GNOME keyring; default is on if development files are available]),
370               [enable_gnome_keyring="$enableval"
371                test "$enable_gnome_keyring" = "yes" || test "$enable_gnome_keyring" = "no" || AC_ERROR([invalid value for --enable-gnome-keyring: $enable_gnome_keyring])
372                test "$enable_gnome_keyring" = "no" || test "$HAVE_KEYRING" = "yes" || AC_ERROR([gnome-keyring-1 pkg not found, needed for --enable-gnome-keyring])],
373               enable_gnome_keyring="$HAVE_KEYRING")
374 if test $enable_gnome_keyring == "yes"; then
375     AC_DEFINE(USE_GNOME_KEYRING, 1, [define if gnome keyring should be used in dbus service])
376     PKG_CHECK_MODULES([KEYRING_2_20], [gnome-keyring-1 >= 2.20 ], KEYRING220=yes, KEYRING220=no)
377     if test $KEYRING220 == "yes"; then
378         AC_DEFINE(GNOME_KEYRING_220, 1, [define if gnome keyring version is above 2.20])
379     fi
380 fi
381
382 if test $enable_dbus_service == "yes"; then
383     if test -z "$XSLT"; then
384        AC_ERROR([xsltproc not found, is required for D-Bus service])
385     fi
386     PKG_CHECK_MODULES(DBUS, dbus-1, dummy=yes,
387                       AC_MSG_ERROR(libdbus-1 is required))
388     AC_CHECK_LIB(dbus-1, dbus_watch_get_unix_fd, dummy=yes,
389                  AC_DEFINE(NEED_DBUS_WATCH_GET_UNIX_FD, 1,
390                  [Define to 1 if you need the dbus_watch_get_unix_fd() function.]))
391     need_glib=yes
392     # Recent libnotify releases work with gtk+-2.0 and gtk+-3.0. We
393     # pick gtk+-2.0 here, to be compatible with old libnotify releases
394     # which had that hard-cored and because sync-ui also depends on
395     # gtk+-2.0.
396     PKG_CHECK_MODULES(LIBNOTIFY, [libnotify gtk+-2.0], HAVE_LIBNOTIFY=yes, HAVE_LIBNOTIFY=no)
397     AC_ARG_ENABLE(notify,
398                   AS_HELP_STRING([--enable-notify],
399                                  [send notifications for automatic sync events]),
400                   [ test "$enableval" = "no" || test $HAVE_LIBNOTIFY = "yes" || AC_ERROR([required libnotify package not found]) ],
401                   [ test $HAVE_LIBNOTIFY = "yes" || AC_ERROR([required libnotify package not found, use --disable-notify to compile without notifications]) ])
402     if test $HAVE_LIBNOTIFY == "yes"; then
403         AC_DEFINE(HAS_NOTIFY, 1, [define if libnotify could be used in dbus service])
404     fi
405     AC_DEFINE(DBUS_SERVICE, 1, [define if dbus service is enabled])
406 fi
407 AC_SUBST(DBUS_CFLAGS)
408 AC_SUBST(DBUS_LIBS)
409 AC_SUBST(DBUS_GLIB_CFLAGS)
410 AC_SUBST(DBUS_GLIB_LIBS)
411 AC_SUBST(KEYRING_CFLAGS) 
412 AC_SUBST(KEYRING_LIBS) 
413 AC_SUBST(LIBNOTIFY_CFLAGS)
414 AC_SUBST(LIBNOTIFY_LIBS)
415 AC_SUBST(LIBEXECDIR)
416
417 DBUS_SERVICES_DIR="${datadir}/dbus-1/services"
418 AC_SUBST(DBUS_SERVICES_DIR)
419 AC_DEFINE_UNQUOTED(DBUS_SERVICES_DIR, "$DBUS_SERVICES_DIR", [Location of D-Bus services directory])
420
421 if test $enable_gui != "no" || test $enable_dbus_service == "yes"; then
422     IT_PROG_INTLTOOL([0.37.1])
423     GETTEXT_PACKAGE=syncevolution
424     AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [The gettext package name])
425     AM_GLIB_GNU_GETTEXT
426     SYNCEVOLUTION_LOCALEDIR=[${datadir}/locale]
427 fi
428
429 # decide which sync-ui(s) we are building:
430 # sync-ui (in either GTK or Moblin mode) or both (in separate binaries)
431 case $enable_gui in
432      all) GUI_PROGRAMS='sync-ui-gtk${EXEEXT} sync-ui-moblin${EXEEXT}'; GUI_DESKTOP_FILES="sync-gtk.desktop sync-moblin.desktop";;
433      gtk|moblin) GUI_PROGRAMS='sync-ui${EXEEXT}'; GUI_DESKTOP_FILES="sync.desktop";;
434      no) GUI_PROGRAMS=; GUI_DESKTOP_FILES=;;
435      *) AC_ERROR([Unknown enable_gui type: '$enable_gui'])
436 esac
437
438 if test $enable_gui != "no"; then
439     PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 glib-2.0)
440     AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool)
441     AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
442
443     gui_modules="glib-2.0 dbus-glib-1 >= 0.60 gtk+-2.0 libglade-2.0 gio-2.0"
444     if test $enable_gui == "moblin"; then
445         AC_DEFINE(USE_MOBLIN_UX, 1, [Use Moblin UI widgets])
446     fi
447     if test $enable_gui == "moblin" -o $enable_gui == "all"; then
448         gui_modules="$guimodules mx-gtk-1.0"
449
450         PKG_CHECK_MODULES(MX_GTK_0_99_1, mx-gtk-1.0 >= 0.99.1,
451                           have_mx_gtk_0_99_1="yes",
452                           have_mx_gtk_0_99_1="no")
453         if test $have_mx_gtk_0_99_1 == "yes"; then
454             AC_DEFINE(MX_GTK_0_99_1, 1, [we have Mx-Gtk 0.99.1 or better])
455         fi
456     fi
457
458     PKG_CHECK_MODULES(UNIQUE, unique-1.0,
459                       have_unique="yes",
460                       have_unique="no")
461     if test $have_unique == "yes"; then
462         gui_modules="$gui_modules unique-1.0" 
463         AC_DEFINE(ENABLE_UNIQUE, 1, [enable single-app-instance functionality])
464     fi
465
466     PKG_CHECK_MODULES(GTK_2_18, gtk+-2.0 >= 2.18,
467                       have_gtk_2_18="yes",
468                       have_gtk_2_18="no")
469     if test $have_gtk_2_18 == "yes"; then
470         AC_DEFINE(GTK_2_18, 1, [we have GTK+ 2.18 or better])
471     fi
472
473     PKG_CHECK_MODULES(GUI, $gui_modules)
474
475     AC_PATH_PROG([GTK_BUILDER_CONV], gtk-builder-convert)
476 elif test "$enable_dbus_service" = "yes"; then
477     # syncevo-dbus-server needs localization
478     :
479 else
480     INTLTOOL_UPDATE="true"
481     USE_NLS="no"
482 fi
483 AC_SUBST(SYNCEVOLUTION_LOCALEDIR)
484 AC_SUBST(GETTEXT_PACKAGE)
485 AC_SUBST(GUI_CFLAGS)
486 AC_SUBST(GUI_LIBS)
487 AC_SUBST(GUI_PROGRAMS)
488 AC_SUBST(GUI_DESKTOP_FILES)
489
490
491 # Boost headers: boost/foreach.hpp is needed (1.33/Debian Etch
492 # doesn't have it, 1.34/Ubuntu 8.10 Hardy does). 1.35 is available
493 # as Debian Etch backport.
494 AX_BOOST_BASE(1.34)
495
496 # need rst2man for man pages
497 AC_ARG_WITH(rst2man,
498             AS_HELP_STRING([--with-rst2man=<path to reStructuredText to man converter>],
499                            [Specifies an explicit path to the utility if not found in PATH.
500                             An explicit --without-rst2man or not having it installed turn off
501                             building of man pages.]),
502             [RST2MAN=$withval
503              if test "$RST2MAN" == "yes"; then
504                  AC_PATH_PROG(RST2MAN, rst2man, "no")
505              fi
506              test "$RST2MAN" == "no" || test -x "$RST2MAN" || AC_ERROR([--with-rst2man=$RST2MAN: tool not found])],
507             [AC_PATH_PROG(RST2MAN, rst2man, "no")])
508 AM_CONDITIONAL([COND_MAN_PAGES], [test "$RST2MAN" != "no"])
509
510 # need rst2html for HTML version of README
511 AC_ARG_WITH(rst2html,
512             AS_HELP_STRING([--with-rst2html=<path to reStructuredText to HTML converter>],
513                            [Specifies an explicit path to the utility if not found in PATH.
514                             An explicit --without-rst2html or not having it installed turn off
515                             building of README in HTML format.]),
516             [RST2HTML=$withval
517              if test "$RST2HTML" == "yes"; then
518                  AC_PATH_PROG(RST2HTML, rst2html, "no")
519              fi
520              test "$RST2HTML" == "no" || test -x "$RST2HTML" || AC_ERROR([--with-rst2html=$RST2HTML: tool not found])],
521             [AC_PATH_PROG(RST2HTML, rst2html, "no")])
522 AM_CONDITIONAL([COND_HTML_README], [test "$RST2HTML" != "no"])
523
524 # absolute patch to source of Synthesis client library
525 SYNTHESIS_SRC=no-synthesis-source
526 AC_SUBST(SYNTHESIS_SRC)
527 if test "$SYNTHESISSRC" && test "$SYNTHESISSRC" != "none"; then
528     # default: checkout a copy of the sources, remove it during maintainer-clean and distclean
529     CLEAN_CLIENT_SRC=synthesis-workdir
530     SYNTHESIS_SRC=$PWD/src/synthesis-workdir
531
532     AC_MSG_NOTICE( [updating the content of $SYNTHESIS_SRC from $SYNTHESISSRC] )
533     case "$SYNTHESISSRC" in
534         *.git) protocol=git;;
535         *://*) protocol="`echo $SYNTHESISSRC | sed -e 's;://.*;;'`";;
536         *) protocol="file";;
537     esac
538
539     mkdir -p src
540     case $protocol in
541         file)
542             # use existing copy of the sources
543             CLEAN_CLIENT_SRC=
544             case "$SYNTHESISSRC" in
545                  /*) SYNTHESIS_SRC="$SYNTHESISSRC";;
546                  *) SYNTHESIS_SRC="$PWD/$SYNTHESISSRC";;
547             esac
548             ;;
549         *svn*|*http*)
550             SYNTHESISSRCREV="$SYNTHESISSRC"
551             if test "$REVISION"; then
552                 revarg="-r $REVISION "
553                 if `echo $SYNTHESISSRC | grep '@[0123456789]*'` >/dev/null; then
554                     :
555                 else
556                     SYNTHESISSRCREV="$SYNTHESISSRC@$REVISION"
557                 fi
558             fi
559             if test -d $SYNTHESIS_SRC ; then
560                 ( set -x; cd $SYNTHESIS_SRC && svn --username=$USERNAME switch $revarg "$SYNTHESISSRC" ) || AC_ERROR([updating from $SYNTHESISSRC failed])
561             else
562                 (set -x; svn --username=$USERNAME checkout $revarg "$SYNTHESISSRCREV" $SYNTHESIS_SRC ) || AC_ERROR([checking out $SYNTHESISSRC failed])
563             fi
564             ;;
565         *)
566             if test -d $SYNTHESIS_SRC ; then
567                 ( set -x; cd $SYNTHESIS_SRC && git fetch "$SYNTHESISSRC" ) || AC_ERROR([updating from $SYNTHESISSRC failed])
568             else
569                 ( set -x; git clone "$SYNTHESISSRC" $SYNTHESIS_SRC ) || AC_ERROR([cloning $SYNTHESISSRC failed])
570             fi
571             if test "$REVISION"; then
572                 # git 1.6 finds tags and branches without explicit prefix, 1.4.4.4 doesn't
573                 ( set -x; cd $SYNTHESIS_SRC &&
574                   (git checkout "$REVISION" ||
575                    git checkout "tags/$REVISION" ||
576                    git checkout "origin/$REVISION") ) || AC_ERROR([checking out $SYNTHESISSRC failed])
577             fi
578             ;;
579     esac
580 elif test "$SYNTHESISSRC" != "none" && test -d $srcdir/src/synthesis; then
581     # use existing copy of the sources; beware of
582     # out-of-tree compilation
583     case $srcdir in
584          /*) SYNTHESIS_SRC="$srcdir/src/synthesis";;
585          *) SYNTHESIS_SRC="$PWD/$srcdir/src/synthesis";;
586     esac
587 elif test "$enable_shared" = "no"; then
588     # link against engine
589     PKG_CHECK_MODULES(SYNTHESIS, "synthesis")
590     SYNTHESIS_ENGINE="$SYNTHESIS_LIBS -lsynthesis"
591 else
592     # link against SDK alone, except in client-test
593     #PKG_CHECK_MODULES(SYNTHESIS, "synthesis-sdk")
594     #SYNTHESIS_ENGINE="`echo $SYNTHESIS_LIBS | sed -e 's/-lsynthesisstubs/-lsynthesis/'`"
595
596     # can't use the SDK alone because of sysync::SySyncDebugPuts()
597     PKG_CHECK_MODULES(SYNTHESIS, "synthesis")
598     SYNTHESIS_ENGINE="$SYNTHESIS_LIBS"
599 fi
600
601 if test $SYNTHESIS_SRC != "no-synthesis-source"; then
602     ( cd $SYNTHESIS_SRC && ( test -f configure || sh autogen.sh ) ) || AC_MSG_ERROR([--with-synthesis-src=$SYNTHESIS_SRC: no Synthesis configure script found in that directory])
603
604     SYNTHESIS_CONFIGURE="$SYNTHESIS_SRC/configure"
605     chmod u+x $SYNTHESIS_SRC/configure $SYNTHESIS_SRC/config.sub $SYNTHESIS_SRC/config.guess
606
607     # use local copy of the sources, with dependencies
608     # to trigger building the synthesis library
609     SYNTHESIS_SUBDIR=$PWD/src/build-synthesis
610     SYNTHESIS_CFLAGS="-I$SYNTHESIS_SUBDIR/src"
611     SYNTHESIS_LIBS="$SYNTHESIS_SUBDIR/src/libsynthesissdk.la"
612
613     if test "$enable_core" = "no" && test "$enable_gui" != "no"; then
614        # SYNTHESIS_SUBDIR is ignored, at least build headers for GUI
615        SYNTHESIS_SUBDIR_INCLUDES=synthesis-includes
616     fi
617
618     if test "$enable_shared" = "no"; then
619         # link against the engines that were enabled
620         case $SYNCML_ENGINES in both|client|server) SYNTHESIS_LIBS="$SYNTHESIS_LIBS $SYNTHESIS_SUBDIR/src/libsynthesis.la";; esac
621         AC_DEFINE(ENABLE_SYNCML_LINKED, 1, [SyncML engines are linked directly])
622     else
623         # It would be nice if we could avoid linking against libsynthesis.la here.
624         # This doesn't work at the moment because sysync::SySyncDebugPuts()
625         # is called directly by the libsynthesissdk instead of going through
626         # the normal C function pointer lookup.
627         SYNTHESIS_LIBS="$SYNTHESIS_LIBS $SYNTHESIS_SUBDIR/src/libsynthesis.la"
628     fi
629     SYNTHESIS_DEP=$SYNTHESIS_LIBS
630
631     # for linking client-test
632     SYNTHESIS_ENGINE="$SYNTHESIS_SUBDIR/src/libsynthesis.la"
633
634     AC_MSG_NOTICE( [configuring the Synthesis library] )
635     if (set -x; mkdir -p $SYNTHESIS_SUBDIR && cd $SYNTHESIS_SUBDIR && eval "\$SHELL \"\$SYNTHESIS_CONFIGURE\" $ac_configure_args \"--srcdir=\$SYNTHESIS_SRC\" " ); then true; else
636         AC_MSG_ERROR( [configuring Synthesis library failed] )
637     fi
638 fi
639
640 AC_SUBST(SYNTHESIS_CFLAGS)
641 AC_SUBST(SYNTHESIS_LIBS)
642 AC_SUBST(SYNTHESIS)
643 AC_SUBST(SYNTHESIS_SUBDIR)
644 AC_SUBST(SYNTHESIS_SUBDIR_INCLUDES)
645 AC_SUBST(SYNTHESIS_DEP)
646 AC_SUBST(SYNTHESIS_ENGINE)
647 AC_SUBST(SYNTHESIS_LIB)
648 AC_SUBST(SYNTHESISSRC)
649
650 dnl select backends
651 BACKENDS=""
652
653 # AC_ARG_ENABLE_BACKEND(BACKEND, DIR, HELP-STRING, [ACTION-IF-GIVEN],
654 #                       [ACTION-IF-NOT-GIVEN])
655 #
656 # Same as AC_ARG_ENABLE(), but also tells configure that the
657 # backend exists.
658 #
659 # BACKEND = name of modules built in that dir as .la files without the
660 #           obligatory sync prefix, e.g. "ebook"
661 # DIR = name of the directory inside src/backends, e.g., "evolution"
662 AC_DEFUN([AC_ARG_ENABLE_BACKEND],
663 [
664         AC_ARG_ENABLE($1, $3, $4, $5)
665         BACKENDS="$BACKENDS $1"
666         BACKEND_DEFINES="$BACKEND_DEFINES ENABLE_`echo $1 | tr a-z A-Z`"
667         for source in $2; do
668             SYNCSOURCES="$SYNCSOURCES backends/$2/sync$1.la"
669         done
670 ])
671 AC_SUBST(SYNCSOURCES)
672 AC_SUBST(BACKEND_DEFINES)
673
674 BACKEND_CPPFLAGS="$SYNTHESIS_CFLAGS $EPACKAGE_CFLAGS $EBOOK_CFLAGS $ECAL_CFLAGS $GLIB_CFLAGS $BOOST_CPPFLAGS"
675 AC_SUBST(BACKEND_CPPFLAGS)
676
677 # GNOME Bluetooth Panel plugin
678 PKG_CHECK_MODULES(GNOMEBLUETOOTH, [gnome-bluetooth-1.0 >= 2.27.6],
679                   [have_gbt="yes"
680                    GNOMEBLUETOOTH_DIR=`$PKG_CONFIG --variable=libdir gnome-bluetooth-1.0 2>/dev/null`/gnome-bluetooth],
681                    have_gbt="no")
682 AC_SUBST(GNOMEBLUETOOTH_CFLAGS)
683 AC_SUBST(GNOMEBLUETOOTH_DIR)
684
685 AC_ARG_ENABLE(gnome-bluetooth-panel-plugin, 
686         AC_HELP_STRING([--enable-gnome-bluetooth-panel-plugin],
687                        [GNOME Bluetooth panel plugin adding a "sync" button for paired devices (off by default)]),
688                        [enable_gnome_bluetooth_panel="$enableval"],
689         [enable_gnome_bluetooth_panel="no"]
690         )
691 if test "$enable_gnome_bluetooth_panel" = "yes"; then
692    test "$have_gbt" = "yes" || AC_MSG_ERROR([--enable-gnome-bluetooth-panel requires
693            pkg-config information for gnome-bluetooth-1.0 >= 2.27.6 which was not found])
694 fi
695 AC_CONFIG_FILES(src/gnome-bluetooth/Makefile)
696 AM_CONDITIONAL([ENABLE_GNOME_BLUETOOTH_PANEL], [test "$have_gbt" = "yes" && test "$enable_gnome_bluetooth_panel" = "yes"])
697
698 AC_ARG_ENABLE(doc,
699               AC_HELP_STRING([--enable-doc],
700                              [generate backend and DBus API documentation]),
701               enable_doc="$enableval", enable_doc="no")
702             
703 AM_CONDITIONAL([COND_DOC], [test "$enable_doc" != "no"])
704
705 dnl src/backends/*/configure-sub.in and configure-post.in follow
706 # vvvvvvvvvvvvvv src/backends/addressbook/configure-sub.in vvvvvvvvvvvvvv
707 dnl -*- mode: Autoconf; -*-
708 dnl Invoke autogen.sh to produce a configure script.
709
710 dnl hard-coded settings for Mac OS X AddressBook
711 ADDRESSBOOK_CFLAGS=
712
713 ADDRESSBOOK_LIBS="-framework AddressBook -framework CoreFoundation"
714 AC_SUBST(ADDRESSBOOK_CFLAGS)
715 AC_SUBST(ADDRESSBOOK_LIBS)
716 BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $ADDRESSBOOK_CFLAGS"
717
718 AC_ARG_ENABLE_BACKEND(addressbook, addressbook,
719                       AS_HELP_STRING([--enable-addressbook], [enable access to Mac OS X address book (default off)]),
720                       [enable_addressbook="$enableval"], [enable_addressbook="no"])
721
722 if test "$enable_addressbook" = "yes"; then
723         AC_DEFINE(ENABLE_ADDRESSBOOK, 1, [addressbook available])
724         DEVICE_TYPE=MacOS_X
725         enable_any="yes"
726 else
727         ADDRESSBOOK_LIBS=
728 fi
729
730 AC_CONFIG_FILES(src/backends/addressbook/Makefile)
731 # ^^^^^^^^^^^^^^ src/backends/addressbook/configure-sub.in ^^^^^^^^^^^^^^
732
733 # vvvvvvvvvvvvvv src/backends/evolution/configure-sub.in vvvvvvvvvvvvvv
734 dnl -*- mode: Autoconf; -*-
735 dnl Invoke autogen.sh to produce a configure script.
736
737 pkg_emodules_10="libedataserver-1.0"
738 pkg_emodules_11="libedataserver-1.1"
739 pkg_emodules_12="libedataserver-1.2"
740 pkg_ebook_10="libebook-1.0"
741 pkg_ebook_11="libebook-1.1"
742 pkg_ebook_12="libebook-1.2"
743 pkg_ecal_10="libecal-1.0"
744 pkg_ecal_11="libecal-1.1"
745 pkg_ecal_12="libecal-1.2"
746
747 anymissing="
748 Please install the development packages of Evolution and/or
749 set the PKG_CONFIG_PATH variable so that it points towards
750 the .pc files of libedataserver, libecal and libebook (the
751 latter two are optional).
752
753 You can check that these packages are available by running
754 pkg-config --list-all."
755
756 evomissing="No compatible evolution-data-server was found.
757 $anymissing"
758
759 dnl check for Evolution core packages
760 PKG_CHECK_MODULES(EPACKAGE, [$pkg_emodules_12], EDSFOUND=yes, [EDSFOUND=no])
761 if test "x${EDSFOUND}" = "xno"; then
762       PKG_CHECK_MODULES(EPACKAGE, [$pkg_emodules_11], EDSFOUND=yes, [EDSFOUND=no])
763       if test "x${EDSFOUND}" = "xno"; then
764               PKG_CHECK_MODULES(EPACKAGE, [$pkg_emodules_10], EDSFOUND=yes, [EDSFOUND=no])
765       fi
766 fi
767
768 dnl check for Evolution calendar packages
769 PKG_CHECK_MODULES(ECAL, [$pkg_ecal_12], ECALFOUND=yes, [ECALFOUND=no])
770 if test "x${ECALFOUND}" = "xno"; then
771         PKG_CHECK_MODULES(ECAL, [$pkg_ecal_11], ECALFOUND=yes, [ECALFOUND=no])
772         if test "x${ECALFOUND}" = "xno"; then
773                 PKG_CHECK_MODULES(ECAL, [$pkg_ecal_10], ECALFOUND=yes, [ECALFOUND=no])
774         fi
775 fi
776
777 dnl check for Evolution contact packages
778 PKG_CHECK_MODULES(EBOOK, [$pkg_ebook_12], EBOOKFOUND=yes, [EBOOKFOUND=no])
779 if test "x${EBOOKFOUND}" = "xno"; then
780         PKG_CHECK_MODULES(EBOOK, [$pkg_ebook_11], EBOOKFOUND=yes, [EBOOKFOUND=no])
781         if test "x${EBOOKFOUND}" = "xno"; then
782                 PKG_CHECK_MODULES(EBOOK, [$pkg_ebook_10], EBOOKFOUND=yes, [EBOOKFOUND=no])
783         fi
784 fi
785
786 AC_ARG_ENABLE_BACKEND(ebook, evolution,
787                       AS_HELP_STRING([--disable-ebook], [disable access to Evolution addressbooks (must be used to compile without it)]),
788                       [enable_ebook="$enableval"],
789                       [test "$EBOOKFOUND" = "yes" && enable_ebook="yes" ||
790                        AC_MSG_ERROR([libebook not found. Use --disable-ebook to compile without or install the necessary development files.])])
791 AC_ARG_ENABLE_BACKEND(ecal, evolution,
792                       AS_HELP_STRING([--disable-ecal], [disable access to Evolution calendars and tasks (must be used to compile without it)]),
793                       [enable_ecal="$enableval"],
794                       [test "$ECALFOUND" = "yes" && enable_ecal="yes" ||
795                        AC_MSG_ERROR([libecal not found. Use --disable-ecal to compile without or install the necessary development files.])])
796
797 enable_evo="no"
798 if test "$enable_ebook" = "yes"; then
799         test "x${EBOOKFOUND}" == "xyes" || AC_MSG_ERROR([--enable-ebook requires pkg-config information for libebook, which was not found])
800         AC_DEFINE(ENABLE_EBOOK, 1, [libebook available])
801         enable_evo="yes"
802 else
803         EBOOK_CFLAGS=
804         EBOOK_LIBS=
805 fi
806
807 AM_CONDITIONAL([ENABLE_ECAL], [test "$enable_ecal" == "yes"])
808 if test "$enable_ecal" = "yes"; then
809         test "x${ECALFOUND}" == "xyes" || AC_MSG_ERROR([--enable-ecal requires pkg-config information for libecal, which was not found"])
810         AC_DEFINE(ENABLE_ECAL, 1, [libecal available])
811         enable_evo="yes"
812 else
813         ECAL_CFLAGS=
814         ECAL_LIBS=
815 fi
816
817 PKG_CHECK_MODULES(LIBICAL_AVAILABLE,
818                   libical >= 0.43,
819                   AC_DEFINE(HAVE_LIBICAL_R, 1, [have recent enough libical with _r variants]),
820                   pass)
821
822 if test "$enable_evo" = "yes"; then
823         need_glib="yes"
824         if test "$EDSFOUND" = "yes"; then
825                 AC_DEFINE(HAVE_EDS, 1, [evolution-dataserver available])
826         else
827                 AC_MSG_ERROR($evomissing)
828         fi
829 else
830         EPACKAGE_CFLAGS=
831         EPACKAGE_LIBS=
832 fi
833
834 BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $EPACKAGE_CFLAGS $ECAL_CFLAGS $EBOOK_CFLAGS"
835 AC_CONFIG_FILES(src/backends/evolution/Makefile)
836 # ^^^^^^^^^^^^^^ src/backends/evolution/configure-sub.in ^^^^^^^^^^^^^^
837
838 # vvvvvvvvvvvvvv src/backends/file/configure-sub.in vvvvvvvvvvvvvv
839 dnl -*- mode: Autoconf; -*-
840 dnl Invoke autogen.sh to produce a configure script.
841
842 dnl Checks for required libraris can go here; none required for simple files.
843 dnl
844 dnl This is from the sqlite backend:
845 dnl PKG_CHECK_MODULES(SQLITE, sqlite3, SQLITEFOUND=yes, [SQLITEFOUND=no])
846 dnl AC_SUBST(SQLITE_CFLAGS)
847 dnl AC_SUBST(SQLITE_LIBS)
848
849 FILE_CFLAGS=
850 FILE_LIBS=
851 AC_SUBST(FILE_CFLAGS)
852 AC_SUBST(FILE_LIBS)
853
854 dnl If additional compile flags are necessary to include the header
855 dnl files of the backend, then add them here.
856 BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $FILE_CFLAGS"
857
858 dnl name of backend library (there could be more than one per directory),
859 dnl name of the directory,
860 dnl help string,
861 dnl --enable/disable chosen explicitly
862 dnl default, may depend on availability of prerequisites in more complex backends
863 AC_ARG_ENABLE_BACKEND(file,
864                       file,
865                       AS_HELP_STRING([--disable-file],
866                                      [disable file-based backend which stores items in separate files in a fixed directory (default on)]),
867                       [enable_file="$enableval"],
868                       [enable_file="yes"]
869                       )
870
871 if test "$enable_file" = "yes"; then
872         dnl It's good to check the prerequisites here, in case --enable-file was used.
873         dnl test "x${SQLITEFOUND}" == "xyes" || AC_MSG_ERROR([--enable-sqlite requires pkg-config information for sqlite3, which was not found])
874         AC_DEFINE(ENABLE_FILE, 1, [file available])
875 fi
876 AC_CONFIG_FILES(src/backends/file/Makefile)
877 # ^^^^^^^^^^^^^^ src/backends/file/configure-sub.in ^^^^^^^^^^^^^^
878
879 # vvvvvvvvvvvvvv src/backends/kcalextended/configure-sub.in vvvvvvvvvvvvvv
880 dnl -*- mode: Autoconf; -*-
881 dnl Invoke autogen.sh to produce a configure script.
882
883 # BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS ..."
884
885 AC_ARG_ENABLE_BACKEND(kcalextended,
886                       kcalextended,
887                       AS_HELP_STRING([--enable-kcalextended],
888                                      [enable support for Maemo's KCalExtended storage]),
889                       [enable_kcalextended="$enableval"],
890                       [enable_kcalextended="no"]
891                       )
892
893 if test "$enable_kcalextended" = "yes"; then
894         AC_DEFINE(ENABLE_KCALEXTENDED, 1, [KCalExtended available])
895         PKG_CHECK_MODULES(KCALEXTENDED, libmkcal libkcalcoren)
896 fi
897 AC_CONFIG_FILES(src/backends/kcalextended/Makefile)
898 # ^^^^^^^^^^^^^^ src/backends/kcalextended/configure-sub.in ^^^^^^^^^^^^^^
899
900 # vvvvvvvvvvvvvv src/backends/maemo/configure-sub.in vvvvvvvvvvvvvv
901 dnl -*- mode: Autoconf; -*-
902 dnl Invoke autogen.sh to produce a configure script.
903
904 dnl Check for calendar-backend
905 PKG_CHECK_MODULES(MCALB, calendar-backend, MCALBFOUND=yes, [MCALBFOUND=no])
906 AC_SUBST(MCALB_CFLAGS)
907 AC_SUBST(MCALB_LIBS)
908 BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $MCALB_CFLAGS"
909
910 AC_ARG_ENABLE_BACKEND(maemocal, maemo,
911                       AS_HELP_STRING([--enable-maemo-calendar],
912                                      [enable access to PIM data stored in Maemo 5 calendar application (default off)]),
913                       [enable_maemocal="$enableval"], [enable_maemocal="no"])
914
915 if test "$enable_maemocal" = "yes"; then
916         test "x${MCALBFOUND}" == "xyes" || AC_MSG_ERROR([--enable-maemo-calendar requires pkg-config information for calendar-backend, which was not found])
917         AC_DEFINE(ENABLE_MAEMO_CALENDAR, 1, [Maemo 5 calendar available])
918 fi
919 AC_CONFIG_FILES(src/backends/maemo/Makefile)
920 # ^^^^^^^^^^^^^^ src/backends/maemo/configure-sub.in ^^^^^^^^^^^^^^
921
922 # vvvvvvvvvvvvvv src/backends/qtcontacts/configure-sub.in vvvvvvvvvvvvvv
923 dnl -*- mode: Autoconf; -*-
924 dnl Invoke autogen.sh to produce a configure script.
925
926 # BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS ..."
927
928 AC_ARG_ENABLE_BACKEND(qtcontacts,
929                       qtcontacts,
930                       AS_HELP_STRING([--enable-qtcontacts],
931                                      [enable support for QtMobility's QtContacts storage]),
932                       [enable_qtcontacts="$enableval"],
933                       [enable_qtcontacts="no"]
934                       )
935
936 if test "$enable_qtcontacts" = "yes"; then
937         AC_DEFINE(ENABLE_QTCONTACTS, 1, [QtContacts available])
938         # AC_WITH_QT() will be called in configure-post if need_qt_modules is not empty,
939         # setting QT_* flags.
940         qt_config="$qt_config +mobility"
941         qt_misc="$qt_misc
942 MOBILITY += contacts versit"
943 fi
944 AC_SUBST(QT_CONTACTS_LIBS)
945 AC_CONFIG_FILES(src/backends/qtcontacts/Makefile)
946 # ^^^^^^^^^^^^^^ src/backends/qtcontacts/configure-sub.in ^^^^^^^^^^^^^^
947
948 # vvvvvvvvvvvvvv src/backends/sqlite/configure-sub.in vvvvvvvvvvvvvv
949 dnl -*- mode: Autoconf; -*-
950 dnl Invoke autogen.sh to produce a configure script.
951
952 dnl check for sqlite
953 PKG_CHECK_MODULES(SQLITE, sqlite3, SQLITEFOUND=yes, [SQLITEFOUND=no])
954 AC_SUBST(SQLITE_CFLAGS)
955 AC_SUBST(SQLITE_LIBS)
956 BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $SQLITE_CFLAGS"
957
958 AC_ARG_ENABLE_BACKEND(sqlite, sqlite,
959                       AS_HELP_STRING([--enable-sqlite], [enable access to PIM data stored in SQLite files (experimental, default off)]),
960                       [enable_sqlite="$enableval"], [enable_sqlite="no"])
961
962 if test "$enable_sqlite" = "yes"; then
963         test "x${SQLITEFOUND}" == "xyes" || AC_MSG_ERROR([--enable-sqlite requires pkg-config information for sqlite3, which was not found])
964         AC_DEFINE(ENABLE_SQLITE, 1, [sqlite available])
965 else
966         # avoid linking against it if not needed
967         SQLITE_CFLAGS=
968         SQLITE_LIBS=
969 fi
970 AC_CONFIG_FILES(src/backends/sqlite/Makefile)
971 # ^^^^^^^^^^^^^^ src/backends/sqlite/configure-sub.in ^^^^^^^^^^^^^^
972
973 # vvvvvvvvvvvvvv src/backends/xmlrpc/configure-sub.in vvvvvvvvvvvvvv
974 dnl -*- mode: Autoconf; -*-
975 dnl Invoke autogen.sh to produce a configure script.
976
977 dnl Checks for required libraries.
978 dnl
979 dnl This is from the sqlite backend:
980 dnl PKG_CHECK_MODULES(SQLITE, sqlite3, SQLITEFOUND=yes, [SQLITEFOUND=no])
981 dnl AC_SUBST(SQLITE_CFLAGS)
982 dnl AC_SUBST(SQLITE_LIBS)
983
984 dnl No pkg-config available for xmlrpc-c
985 dnl PKG_CHECK_MODULES(XMLRPC,xmlrpc-c,XMLRPCFOUND=yes, [XMLRPCFOUND=no])
986
987 dnl name of backend library (there could be more than one per directory),
988 dnl name of the directory,
989 dnl help string,
990 dnl --enable/disable chosen explicitly
991 dnl default, may depend on availability of prerequisites in more complex backends
992 AC_ARG_ENABLE_BACKEND(xmlrpc,
993                       xmlrpc,
994                       AS_HELP_STRING([--enable-xmlrpc],
995                                      [enable XMLRPC-based backend which stores items on a central web service (default off)]),
996                                   [enable_xmlrpc="$enableval"],
997                       [enable_xmlrpc="no"]
998                       )
999
1000 if test "$enable_xmlrpc" = "yes"; then
1001         dnl It's good to check the prerequisites here, in case --enable-xmlrpc was used.
1002         dnl test "x${SQLITEFOUND}" == "xyes" || AC_MSG_ERROR([--enable-sqlite requires pkg-config information for sqlite3, which was not found])
1003         
1004         test -e /usr/bin/xmlrpc-c-config || AC_MSG_ERROR([--enable-xmlrpc requires xmlrpc-c-config, which was not found])
1005         
1006         XMLRPC_CFLAGS=`/usr/bin/xmlrpc-c-config c++2 client --cflags`
1007         XMLRPC_LIBS=`/usr/bin/xmlrpc-c-config c++2 client --libs`
1008         AC_SUBST(XMLRPC_CFLAGS)
1009         AC_SUBST(XMLRPC_LIBS)
1010
1011         dnl If additional compile flags are necessary to include the header
1012         dnl files of the backend, then add them here.
1013         BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $XMLRPC_CFLAGS"
1014
1015         AC_DEFINE(ENABLE_XMLRPC, 1, [XMLRPC available])
1016 fi
1017 AC_CONFIG_FILES(src/backends/xmlrpc/Makefile)
1018 # ^^^^^^^^^^^^^^ src/backends/xmlrpc/configure-sub.in ^^^^^^^^^^^^^^
1019
1020 dnl -*- mode: Autoconf; -*-
1021 dnl Invoke autogen.sh to produce a configure script.
1022 dnl configure-pre.in and src/backends/*/configure-sub.in and configure-post.in come before this part
1023
1024 AC_SUBST(BACKEND_CPPFLAGS)
1025
1026 enable_any="no"
1027 backend_is_enabled () {
1028     eval echo \${enable_${1}}
1029 }
1030 for backend in $BACKENDS; do
1031     if test `backend_is_enabled $backend` == "yes"; then
1032        enable_any="yes"
1033        SYNCEVOLUTION_MODULES="$SYNCEVOLUTION_MODULES src/backends/sync${backend}.la"
1034     fi
1035 done
1036
1037 if test "$enable_any" = "no"; then
1038         AC_MSG_ERROR([no backend enabled - refusing to continue: $anymissing])
1039 fi
1040
1041 dnl check for programs.
1042 AC_PROG_CXX
1043 AC_PROG_LIBTOOL
1044 AC_PROG_MAKE_SET
1045
1046 dnl glib initialization is done only if requested by some configure-sub.in,
1047 dnl for not needed otherwise even if found
1048 if test "$need_glib" = "yes"; then
1049         # HAVE_GLIB (aka GLIBFOUND) are a catch-all for these
1050         # three GNOME libs. Assume we have all three unless one of
1051         # the checks fails.
1052         GLIBFOUND=yes
1053
1054         dnl check for glib - calling g_type_init() is expected on Maemo
1055         PKG_CHECK_MODULES(GLIB, "glib-2.0", , GLIBFOUND=no)
1056         # This check here is broken on Ubuntu 8.04: it calls glib-config,
1057         # which isn't found, but the error is not detected by configure.
1058         #if test "x${GLIBFOUND}" = "xno"; then
1059         #       PKG_CHECK_MODULES(GLIB, "glib", GLIBFOUND=yes, GLIBFOUND=no)
1060         #fi
1061
1062         PKG_CHECK_MODULES(GTHREAD, "gthread-2.0", , GLIBFOUND=no)
1063         PKG_CHECK_MODULES(GOBJECT, "gobject-2.0", , GLIBFOUND=no)
1064
1065         if  test "x${GLIBFOUND}" = "xyes"; then
1066             AC_DEFINE(HAVE_GLIB, 1, [glib found])
1067         else
1068             AC_ERROR([not all GNOME libraries found])
1069         fi
1070         BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $GLIB_CFLAGS $GTHREAD_CFLAGS $GOBJECT_CFLAGS"
1071 fi
1072
1073 # Check for Qt if some backend needs it.
1074 if test "$need_qt_modules"; then
1075    AT_WITH_QT([-gui $need_qt_modules],
1076               [$qt_config],
1077               [$qt_misc])
1078 fi
1079
1080 # determine from where we can get a SHA-256 implementation
1081 have_sha="no"
1082 if test "$GLIBFOUND" = "yes"; then
1083    # only use glib if we need it anyway, also has to be at lease 2.16
1084    PKG_CHECK_MODULES(GLIB216, [glib-2.0 >= 2.16],
1085                      [AC_DEFINE(USE_SHA256, 1, [choose implementation of SHA-256])
1086                       have_sha="glib"],
1087                      [true])
1088 fi
1089 if test "$have_sha" = "no"; then
1090    # Fallback is Mozilla NSS. In contrast to libgcrypt it has a .pc
1091    # file and a simple API.
1092    PKG_CHECK_MODULES(NSS, "nss",
1093                      [AC_DEFINE(USE_SHA256, 2, [choose implementation of SHA-256])
1094                       have_sha="nss"],
1095                      [true])
1096 fi
1097
1098 dnl figure out whether we link all code statically or as modules
1099 AM_CONDITIONAL([ENABLE_MODULES], [test "$enable_shared" == "yes"])
1100 if test "$enable_shared" == "yes"; then
1101         AC_DEFINE(ENABLE_MODULES, 1, [enable dynamically opening sync source backends])
1102 fi
1103 AC_SUBST(SYNCEVOLUTION_LDADD)
1104
1105 dnl CXXFLAGS gets applied to SyncEvolution and the client library.
1106 dnl For e.g. "-Wall -Werror" this might not be such a good idea;
1107 dnl SYNCEVOLUTION_CXXFLAGS can be used instead. It applies only
1108 dnl to the sources in the SyncEvolution repository.
1109 AC_SUBST(SYNCEVOLUTION_CXXFLAGS)
1110
1111 dnl a quick-and-dirty way to detect compilation for the iPhone
1112 if test "$host" == "arm-apple-darwin"; then
1113    AC_DEFINE(IPHONE, 1, [compiling for iPhone])
1114    DEVICE_TYPE=iPhone
1115 fi
1116
1117 dnl --enable-evolution-compatibility
1118 if test "$enable_evolution_compatibility" == "yes"; then
1119    AC_DEFINE(EVOLUTION_COMPATIBILITY, 1, [avoid hard dependency on Evolution shared objects])
1120 fi
1121 AM_CONDITIONAL([ENABLE_EVOLUTION_COMPATIBILITY], [test "$enable_evolution_compatibility" == "yes"])
1122
1123 dnl --enable-developer-mode
1124 if test "$enable_developer_mode" == "yes"; then
1125 backendsearchdir="`pwd`/src/backends/"
1126 else
1127 backendsearchdir='$(libdir)'/syncevolution/backends/
1128 fi
1129
1130 backenddir='$(libdir)'/syncevolution/backends
1131 AC_SUBST(backenddir)
1132 AC_SUBST(backendsearchdir)
1133
1134 dnl This string is sent as part of the SyncML DevInf (device
1135 dnl information) structure to the server. All SyncEvolution platforms
1136 dnl use "SyncEvolution" as HTTP user agent and "Mod" (model), so the
1137 dnl device type is the only way how different kinds of clients can be
1138 dnl distinguished.
1139 AC_DEFINE_UNQUOTED(DEVICE_TYPE, "$DEVICE_TYPE", "SyncML DevInf DevType")
1140
1141 AC_CHECK_HEADERS(stdarg.h valgrind/valgrind.h execinfo.h)
1142
1143 AC_DEFINE(SYNTHESIS, 1, "using Synthesis engine")
1144
1145 # fallback for lack of --with-docdir support in older automake
1146 if test ! "$docdir"; then
1147    docdir = ${datadir}/doc/syncevolution
1148    AC_SUBST(docdir)
1149 fi
1150
1151 AC_ARG_ENABLE(dbus-timeout-hack,
1152               AS_HELP_STRING([--enable-dbus-timeout-hack],
1153                              [Enables code which overrides the default timeout in dbus_connection_send_with_reply() so that the method call never times out. Needed for libecal/ebook >= 2.30, so enabled by default if either of these is enabled.]),
1154               [enable_dbus_timeout_hack=$enableval],
1155               [if test $enable_ebook = "yes" || test $enable_ecal = "yes"; then
1156                   enable_dbus_timeout_hack="yes"
1157                fi])
1158 if test $enable_dbus_timeout_hack = "yes"; then
1159    AC_DEFINE(ENABLE_DBUS_TIMEOUT_HACK, 1, [overrides the default D-Bus timeout so that synchronous calls never time out])
1160 fi
1161
1162 AC_CONFIG_FILES(Makefile src/dbus/interfaces/Makefile src/gdbus/Makefile src/dbus/Makefile src/Makefile src/syncevo/Makefile src/syncevo/syncevolution.pc src/syncevo/configs/Makefile src/synthesis-includes/Makefile src/gtk-ui/Makefile po/Makefile.in test/Makefile src/dbus/syncevo-dbus.pc)
1163 AC_OUTPUT
1164
1165 echo
1166 echo CONFIGURATION SUMMARY
1167 echo "Core SyncEvolution: $enable_core"
1168 for backend in $BACKENDS; do
1169     eval echo $backend: \${enable_${backend}}
1170 done
1171 echo "DBus service: $enable_dbus_service"
1172 echo "GNOME keyring: $enable_gnome_keyring"
1173 echo "UI (DBus client): $enable_gui"
1174 echo "Bluetooth transport: $have_bluetooth"
1175 echo "GNOME Bluetooth panel plugin: $enable_gnome_bluetooth_panel"
1176 echo "SHA-256: $have_sha"
1177 echo "API documentation: $enable_doc"
1178 echo "D-Bus Timeout Hack: $enable_dbus_timeout_hack"
1179 echo