Use EDS_INSTALLED_TESTS macros to install tests
[platform/upstream/evolution-data-server.git] / configure.ac
1
2 dnl Evolution-Data-Server version
3 m4_define([eds_major_version], [3])
4 m4_define([eds_minor_version], [11])
5 m4_define([eds_micro_version], [3])
6
7 m4_define([eds_version],
8         [eds_major_version.eds_minor_version.eds_micro_version])
9
10 dnl Base Version: This is for API/version tracking for things like
11 dnl Bonobo server files.  This should always be the major/minor of
12 dnl the stable version or stable version to be.  Note, this is set
13 dnl the way it is so that GETTEXT_PACKAGE will be parsed correctly.
14 BASE_VERSION=3.12
15 m4_define([base_version], [3.12])
16
17 dnl This number is meaningless, but we're now stuck with it in our
18 dnl library names for backward compatibility.
19 m4_define([api_version], [1.2])
20
21 dnl Autoconf / Automake Initialization
22 AC_PREREQ(2.62)
23 AC_INIT([evolution-data-server],[eds_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=Evolution-Data-Server])
24 AM_INIT_AUTOMAKE([gnu 1.10 tar-ustar dist-xz no-dist-gzip -Wall -Wno-portability foreign])
25 AC_CONFIG_MACRO_DIR([m4])
26 AC_CONFIG_SRCDIR(README)
27 AC_CONFIG_HEADERS(config.h)
28
29 dnl This is for the autoconf tests only - it set's the language we use
30 AC_LANG(C)
31
32 dnl Automake 1.11 - Silent Build Rules
33 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
34
35 dnl Required Package Versions
36
37 dnl Keep these two definitions in agreement.
38 m4_define([glib_minimum_version], [2.36])
39 m4_define([glib_encoded_version], [GLIB_VERSION_2_36])
40
41 dnl Keep these two definitions in agreement.
42 m4_define([gdk_minimum_version], [3.2])
43 m4_define([gdk_encoded_version], [GDK_VERSION_3_2])
44
45 dnl Keep these two definitions in agreement.
46 m4_define([soup_minimum_version], [2.42])
47 m4_define([soup_encoded_version], [SOUP_VERSION_2_42])
48
49 m4_define([gcr_minimum_version], [3.4])
50 m4_define([libsecret_minimum_version], [0.5])
51 m4_define([libxml_minimum_version], [2.0.0])            dnl XXX Just a Guess
52 m4_define([libgdata_minimum_version], [0.10])
53 m4_define([sqlite_minimum_version], [3.5])
54 m4_define([libical_minimum_version], [0.43])
55
56 dnl Optional Packages
57 m4_define([goa_minimum_version], [3.8])
58 m4_define([gweather_minimum_version], [3.8])
59 m4_define([libaccounts_glib_minimum_version], [1.4])
60 m4_define([libsignon_glib_minimum_version], [1.8])
61
62 AC_SUBST([BASE_VERSION],[base_version])
63 AC_SUBST([API_VERSION],[api_version])
64 AC_DEFINE_UNQUOTED(BASE_VERSION, ["$BASE_VERSION"], [Base version (Major.Minor)])
65 AC_DEFINE_UNQUOTED(API_VERSION, ["$API_VERSION"], [API version (Major.Minor)])
66
67 EDS_MAJOR_VERSION=eds_major_version
68 EDS_MINOR_VERSION=eds_minor_version
69 EDS_MICRO_VERSION=eds_micro_version
70
71 GLIB_GSETTINGS
72
73 dnl ******************************
74 dnl D-Bus versioning
75 dnl ******************************
76 ADDRESS_BOOK_DBUS_SERVICE_NAME="org.gnome.evolution.dataserver.AddressBook6"
77 CALENDAR_DBUS_SERVICE_NAME="org.gnome.evolution.dataserver.Calendar4"
78 SOURCES_DBUS_SERVICE_NAME="org.gnome.evolution.dataserver.Sources2"
79 USER_PROMPTER_DBUS_SERVICE_NAME="org.gnome.evolution.dataserver.UserPrompter0"
80
81 AC_DEFINE_UNQUOTED(
82        ADDRESS_BOOK_DBUS_SERVICE_NAME,
83        ["$ADDRESS_BOOK_DBUS_SERVICE_NAME"],
84        [D-Bus service name for the address book factory])
85
86 AC_DEFINE_UNQUOTED(
87        CALENDAR_DBUS_SERVICE_NAME,
88        ["$CALENDAR_DBUS_SERVICE_NAME"],
89        [D-Bus service name for the calendar factory])
90
91 AC_DEFINE_UNQUOTED(
92         SOURCES_DBUS_SERVICE_NAME,
93         ["$SOURCES_DBUS_SERVICE_NAME"],
94         [D-Bus service name for the source registry])
95
96 AC_DEFINE_UNQUOTED(
97         USER_PROMPTER_DBUS_SERVICE_NAME,
98         ["$USER_PROMPTER_DBUS_SERVICE_NAME"],
99         [D-Bus service name for the user prompter])
100
101 AC_SUBST(ADDRESS_BOOK_DBUS_SERVICE_NAME)
102 AC_SUBST(CALENDAR_DBUS_SERVICE_NAME)
103 AC_SUBST(SOURCES_DBUS_SERVICE_NAME)
104 AC_SUBST(USER_PROMPTER_DBUS_SERVICE_NAME)
105
106 dnl ******************************
107 dnl Libtool versioning
108 dnl ******************************
109 LIBEDATASERVER_CURRENT=18
110 LIBEDATASERVER_REVISION=0
111 LIBEDATASERVER_AGE=0
112
113 LIBECAL_CURRENT=16
114 LIBECAL_REVISION=0
115 LIBECAL_AGE=0
116
117 LIBEDATACAL_CURRENT=23
118 LIBEDATACAL_REVISION=0
119 LIBEDATACAL_AGE=0
120
121 LIBEDATABOOK_CURRENT=20
122 LIBEDATABOOK_REVISION=0
123 LIBEDATABOOK_AGE=0
124
125 LIBEBOOK_CURRENT=17
126 LIBEBOOK_REVISION=1
127 LIBEBOOK_AGE=3
128
129 LIBEBOOK_CONTACTS_CURRENT=0
130 LIBEBOOK_CONTACTS_REVISION=0
131 LIBEBOOK_CONTACTS_AGE=0
132
133 LIBCAMEL_CURRENT=48
134 LIBCAMEL_REVISION=0
135 LIBCAMEL_AGE=0
136
137 LIBEBACKEND_CURRENT=7
138 LIBEBACKEND_REVISION=0
139 LIBEBACKEND_AGE=0
140
141 AC_SUBST(EDS_MAJOR_VERSION)
142 AC_SUBST(EDS_MINOR_VERSION)
143 AC_SUBST(EDS_MICRO_VERSION)
144 AC_SUBST(LIBEDATASERVER_CURRENT)
145 AC_SUBST(LIBEDATASERVER_REVISION)
146 AC_SUBST(LIBEDATASERVER_AGE)
147 AC_SUBST(LIBECAL_CURRENT)
148 AC_SUBST(LIBECAL_REVISION)
149 AC_SUBST(LIBECAL_AGE)
150 AC_SUBST(LIBEDATACAL_CURRENT)
151 AC_SUBST(LIBEDATACAL_REVISION)
152 AC_SUBST(LIBEDATACAL_AGE)
153 AC_SUBST(LIBEBOOK_CURRENT)
154 AC_SUBST(LIBEBOOK_REVISION)
155 AC_SUBST(LIBEBOOK_AGE)
156 AC_SUBST(LIBEBOOK_CONTACTS_CURRENT)
157 AC_SUBST(LIBEBOOK_CONTACTS_REVISION)
158 AC_SUBST(LIBEBOOK_CONTACTS_AGE)
159 AC_SUBST(LIBEDATABOOK_CURRENT)
160 AC_SUBST(LIBEDATABOOK_REVISION)
161 AC_SUBST(LIBEDATABOOK_AGE)
162 AC_SUBST(LIBCAMEL_CURRENT)
163 AC_SUBST(LIBCAMEL_REVISION)
164 AC_SUBST(LIBCAMEL_AGE)
165 AC_SUBST(LIBEBACKEND_CURRENT)
166 AC_SUBST(LIBEBACKEND_REVISION)
167 AC_SUBST(LIBEBACKEND_AGE)
168
169 dnl **************************************
170 dnl Put the ACLOCAL flags in the Makefile
171 dnl **************************************
172 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
173
174 dnl *********************************************
175 dnl Figure out early if we'll need a C++ compiler
176 dnl *********************************************
177
178 EVO_PHONENUMBER_ARGS
179
180 dnl ******************************
181 dnl Compiler Warning Flags
182 dnl ******************************
183 proposed_warning_flags="-Wall -Wextra
184         -Wdeprecated-declarations
185         -Werror-implicit-function-declaration
186         -Wformat-security -Winit-self
187         -Wmissing-declarations -Wmissing-include-dirs
188         -Wmissing-noreturn -Wpointer-arith
189         -Wredundant-decls -Wundef -Wwrite-strings"
190
191 proposed_c_warning_flags="$proposed_warning_flags
192         -Wdeclaration-after-statement
193         -Wno-missing-field-initializers
194         -Wno-sign-compare
195         -Wno-unused-parameter
196         -Wnested-externs"
197
198 proposed_cxx_warning_flags="$proposed_warning_flags
199         -Wabi -Wnoexcept"
200
201 AS_COMPILER_FLAGS(WARNING_FLAGS, [$proposed_c_warning_flags])
202 AC_SUBST(WARNING_FLAGS)
203
204 dnl Other useful compiler warnings for test builds only.
205 dnl These may produce warnings we have no control over,
206 dnl or false positives we don't always want to see.
207 dnl
208 dnl     -Wformat-nonliteral
209 dnl     -Wmissing-format-attribute
210 dnl     -Wshadow
211 dnl     -Wstrict-aliasing=2
212
213 AM_CFLAGS="$WARNING_FLAGS -fno-strict-aliasing"
214 AC_SUBST(AM_CFLAGS)
215
216 dnl C++ Compiler flags, needed for ICU C++ access and libphonenumber usage
217 AC_PROG_CXX
218
219 AC_LANG_PUSH([C++])
220 AS_COMPILER_FLAGS(CXX_WARNING_FLAGS, [$proposed_cxx_warning_flags])
221 AC_SUBST(CXX_WARNING_FLAGS)
222 AM_CXXFLAGS="$CXX_WARNING_FLAGS"
223 AC_SUBST(AM_CXXFLAGS)
224 AC_LANG_POP([C++])
225
226 dnl Permits linking of C++ based libraries using the C linker if needed.
227 AC_SUBST([predeps_CXX])
228 AC_SUBST([postdeps_CXX])
229
230 dnl *******************************
231 dnl Check for --enable-strict
232 dnl *******************************
233 AC_ARG_ENABLE([strict],
234         [AS_HELP_STRING([--enable-strict],
235         [enable strict building, like without deprecated symbols (default=auto); auto enables strict building only if .git subdirectory exists])],
236         [enable_strict=$enableval], [enable_strict=auto])
237
238 AC_MSG_CHECKING([if strict building is enabled])
239 if test "x$enable_strict" = xauto; then
240         dnl Be strict when compiling with .git subdirectory
241         if test -d .git ; then
242                 enable_strict=yes
243         else
244                 enable_strict=no
245         fi
246 fi
247 AC_MSG_RESULT([$enable_strict])
248
249 AM_CPPFLAGS=
250
251 if test "x$enable_strict" = xyes; then
252         AM_CPPFLAGS="$AM_CPPFLAGS -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
253 fi
254
255 dnl Warn about API usage that violates our minimum requirements.
256 AM_CPPFLAGS="$AM_CPPFLAGS -DGLIB_VERSION_MAX_ALLOWED=glib_encoded_version"
257 AM_CPPFLAGS="$AM_CPPFLAGS -DGDK_VERSION_MAX_ALLOWED=gdk_encoded_version"
258 AM_CPPFLAGS="$AM_CPPFLAGS -DSOUP_VERSION_MAX_ALLOWED=soup_encoded_version"
259
260 dnl These will suppress warnings about newly-deprecated symbols.  Ideally
261 dnl these settings should match our minimum requirements and we will clean
262 dnl up any new deprecation warnings after bumping our minimum requirements.
263 dnl But if the warnings get to be overwhelming, use fixed versions instead.
264 AM_CPPFLAGS="$AM_CPPFLAGS -DGLIB_VERSION_MIN_REQUIRED=glib_encoded_version"
265 AM_CPPFLAGS="$AM_CPPFLAGS -DGDK_VERSION_MIN_REQUIRED=gdk_encoded_version"
266 AM_CPPFLAGS="$AM_CPPFLAGS -DSOUP_VERSION_MIN_REQUIRED=soup_encoded_version"
267
268 AC_SUBST(AM_CPPFLAGS)
269
270 dnl ******************************
271 dnl Initialize maintainer mode
272 dnl ******************************
273 AM_MAINTAINER_MODE([enable])
274
275 if test "x$enable_maintainer_mode" = "xyes" ; then
276         AC_DEFINE(ENABLE_MAINTAINER_MODE, 1, [Configured with enabled maintainer mode])
277 fi
278
279 AC_PROG_CC
280 AC_PROG_CPP
281 AC_C_INLINE
282 AM_PROG_CC_C_O
283 AC_PROG_INSTALL
284 AC_PROG_LN_S
285 AC_PROG_MAKE_SET
286
287 dnl For gen-western-table.py
288 AM_PATH_PYTHON
289
290 dnl GCC 4.4 got more aggressive in its aliasing optimizations, changing
291 dnl behavior that -- according to the C99 standard -- is supposed to be
292 dnl undefined.  We may still have aliasing abuses lying around that rely
293 dnl on GCC's previous "undefined" behavior, so disable strict-aliasing
294 dnl optimization until we can find and fix all the abuses.
295 dnl (AC_PROG_CC must run first to set the GCC variable.)
296 dnl XXX This really belongs in AM_CFLAGS.
297 if test "x${GCC}" = "xyes"; then
298         CFLAGS="$CFLAGS -fno-strict-aliasing"
299 fi
300
301 dnl ******************************
302 dnl I18N stuff
303 dnl ******************************
304 IT_PROG_INTLTOOL([0.35.5])
305
306 GETTEXT_PACKAGE=evolution-data-server-$BASE_VERSION
307 AC_SUBST(GETTEXT_PACKAGE)
308 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext])
309
310 localedir='$(prefix)/$(DATADIRNAME)/locale'
311 AC_SUBST(localedir)
312
313 dnl ******************************
314 dnl Initialize libtool
315 dnl ******************************
316 LT_PREREQ(2.2)
317 LT_INIT(disable-static win32-dll)
318
319 PKG_PROG_PKG_CONFIG
320
321 dnl This relies on $SED, which is defined in ltmain.sh, which
322 dnl is invoked by LT_INIT (at least I think that's how it works).
323 GNOME_CODE_COVERAGE
324
325 dnl Add the option install unit tests
326 EDS_INSTALLED_TESTS
327
328 dnl ******************************
329 dnl Gtk Doc stuff
330 dnl ******************************
331 GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
332
333 dnl The private D-Bus documentation is for developers only.
334 AC_ARG_WITH([private-docs],
335         AS_HELP_STRING([--with-private-docs],
336         [Build documentation for private libraries ]
337         [(requires --enable-gtk-doc) [default=no]],),
338         [with_private_docs="$withval"],[with_private_docs="no"])
339 AM_CONDITIONAL(WITH_PRIVATE_DOCS, [test x$with_private_docs = xyes])
340
341 dnl This must appear after AC_CANONICAL_HOST, which defines $host.
342 case "$host" in
343 *openbsd*|*freebsd*)
344         dnl Do not set '-Wl,--no-undefined' on freebsd/openbsd
345         ;;
346 *)
347         LDFLAGS="$LDFLAGS -Wl,--no-undefined"
348         ;;
349 esac
350
351 dnl ******************************
352 dnl Check for Win32
353 dnl ******************************
354 AC_MSG_CHECKING([for Win32])
355 case "$host" in
356 *-mingw*)
357         os_win32='yes'
358         NO_UNDEFINED='-no-undefined'
359         SOCKET_LIBS='-lws2_32 -ldnsapi'
360         DL_LIB=''
361         LIBEXECDIR_IN_SERVER_FILE='../../../libexec'
362         AC_CACHE_VAL(ac_cv_have_addrinfo, [ac_cv_have_addrinfo=yes])
363         AC_DEFINE(_WIN32_WINNT, 0x501, [To get getaddrinfo etc declarations])
364         ;;
365 *openbsd*|*freebsd*)
366         os_win32='no'
367         NO_UNDEFINED=''
368         SOCKET_LIBS=''
369         DL_LIB=''
370         LIBEXECDIR_IN_SERVER_FILE="$libexecdir"
371         ;;
372 *)
373         os_win32='no'
374         NO_UNDEFINED=''
375         SOCKET_LIBS=''
376         DL_LIB='-ldl'
377         LIBEXECDIR_IN_SERVER_FILE="$libexecdir"
378         ;;
379 esac
380 AC_MSG_RESULT([$os_win32])
381 AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])
382 AC_SUBST(NO_UNDEFINED)
383 AC_SUBST(SOCKET_LIBS)
384 AC_SUBST(LIBEXECDIR_IN_SERVER_FILE)
385
386 dnl **************************************
387 dnl Check for posix compatible sys/wait.h
388 dnl **************************************
389 AC_HEADER_SYS_WAIT
390
391 dnl ************************************
392 dnl Check for posix compatible alloca()
393 dnl ************************************
394 AC_FUNC_ALLOCA
395
396 dnl ******************************
397 dnl Checks for functions
398 dnl ******************************
399 AC_CHECK_FUNCS(fsync strptime strtok_r nl_langinfo)
400
401 dnl ***********************************
402 dnl Check for base dependencies early.
403 dnl ***********************************
404 PKG_CHECK_MODULES(GNOME_PLATFORM,
405         [gio-2.0 >= glib_minimum_version
406         gmodule-2.0 >= glib_minimum_version
407         libxml-2.0 >= libxml_minimum_version
408         libsoup-2.4 >= soup_minimum_version])
409
410 if test x$os_win32 = xno; then
411         PKG_CHECK_MODULES(GIO_UNIX, [gio-unix-2.0])
412 fi
413
414 dnl ******************************
415 dnl Check for libphonenumber
416 dnl ******************************
417
418 EVO_PHONENUMBER_SUPPORT
419
420 dnl *******************
421 dnl Check for ICU
422 dnl *******************
423 dnl
424 dnl ICU recently started shipping pkg-config files but it's
425 dnl not present on many systems, if we don't find the pkg-config
426 dnl file then let's fallback on a manual check
427 enable_icu=no
428 PKG_CHECK_MODULES(ICU, icu-i18n, enable_icu=yes, [
429         enable_icu=yes
430         AC_CHECK_HEADERS(unicode/ucol.h,, enable_icu=no)
431         AC_MSG_CHECKING([for libicui18n])
432         LIBS_old=$LIBS
433         LIBS="$LIBS -licui18n -licuuc -licudata"
434         AC_TRY_LINK([#include <unicode/ucol.h>],
435                 [ucol_open ("", NULL);],
436                 AC_MSG_RESULT(yes),
437                 AC_MSG_RESULT(no); enable_icu=no)
438         LIBS=$LIBS_old
439         if [test x$enable_icu = xyes]; then
440                 ICU_CFLAGS=-D_REENTRANT
441                 ICU_LIBS="-licui18n -licuuc -licudata"
442                 AC_SUBST(ICU_CFLAGS)
443                 AC_SUBST(ICU_LIBS)
444         else
445                 AC_MSG_ERROR([ICU libs not found, icu-i18n is required.])
446         fi
447 ])
448
449 dnl *************************
450 dnl Check for GTK+
451 dnl *************************
452 AC_ARG_ENABLE([gtk],
453         [AS_HELP_STRING([--enable-gtk],
454         [enable GTK+ (default=yes)])],
455         [enable_gtk=$enableval], [enable_gtk=yes])
456 AC_MSG_CHECKING([if GTK+ support is enabled])
457 AC_MSG_RESULT([$enable_gtk])
458 if test "x$enable_gtk" = xyes; then
459         PKG_CHECK_MODULES(
460                 [GTK], [gtk+-3.0 >= gdk_minimum_version],,
461                 [AC_MSG_ERROR([
462
463         gtk+-3.0 not found (or version < gdk_minimum_version)
464
465         If you want to disable GTK+ support,
466         please append --disable-gtk to configure.
467
468         ])])
469
470         PKG_CHECK_MODULES(
471                 [GCR], [gcr-3 >= gcr_minimum_version],,
472                 [AC_MSG_ERROR([
473
474         gcr-3.0 not found (or version < gcr_minimum_version)
475
476         If you want to disable gcr-3.0's GTK+ widgets,
477         please append --disable-gtk to configure.
478
479         ])])
480
481         AC_DEFINE(HAVE_GTK, 1, [Define to 1 if you have the gtk+-3.0 package.])
482 fi
483 AM_CONDITIONAL(HAVE_GTK, [test x$enable_gtk = xyes])
484
485
486 dnl ******************************************
487 dnl Check whether to build examples/demos
488 dnl ******************************************
489 AC_ARG_ENABLE([examples],
490         [AS_HELP_STRING([--enable-examples],
491         [enable the building examples (default=yes)])],
492         [enable_examples=$enableval], [enable_examples=yes])
493 AC_MSG_CHECKING([if examples should be built])
494 AC_MSG_RESULT([$enable_examples])
495 if test "x$enable_examples" = xyes; then
496         PKG_CHECK_MODULES([EXAMPLES],
497                 [gtk+-3.0 >= 3.10 glib-2.0 >= 2.38],,
498         [AC_MSG_ERROR([
499         Some packages were not available to build the example program(s).
500
501         If you want to disable examples, please
502         append --disable-examples to configure.
503         ])])
504
505         AC_DEFINE(BUILD_EXAMPLES, 1, [Define to 1 if the examples should be built.])
506 fi
507 AM_CONDITIONAL(BUILD_EXAMPLES, [test x$enable_examples = xyes])
508
509
510 dnl *******************************
511 dnl Check for GNOME Online Accounts
512 dnl *******************************
513 AC_ARG_ENABLE([goa],
514         [AS_HELP_STRING([--enable-goa],
515         [enable GNOME Online Accounts support (default=yes)])],
516         [enable_goa=$enableval], [enable_goa=yes])
517 AC_MSG_CHECKING([if GNOME Online Accounts support is enabled])
518 AC_MSG_RESULT([$enable_goa])
519 if test "x$enable_goa" = xyes; then
520         PKG_CHECK_MODULES(
521                 [GOA], [goa-1.0 >= goa_minimum_version],,
522                 [AC_MSG_ERROR([
523
524         goa-1.0 not found (or version < goa_minimum_version)
525
526         If you want to disable GNOME Online Accounts support,
527         please append --disable-goa to configure.
528
529         ])])
530
531         AC_DEFINE(HAVE_GOA, 1, [Define to 1 if you have the goa-1.0 package.])
532 fi
533 AM_CONDITIONAL(HAVE_GOA, [test x$enable_goa = xyes])
534
535 dnl ********************************
536 dnl Check for Ubuntu Online Accounts
537 dnl ********************************
538 AC_ARG_ENABLE([uoa],
539         [AS_HELP_STRING([--enable-uoa],
540         [enable Ubuntu Online Accounts support (default=yes)])],
541         [enable_uoa=$enableval], [enable_uoa=yes])
542 AC_MSG_CHECKING([if Ubuntu Online Accounts support is enabled])
543 AC_MSG_RESULT([$enable_uoa])
544 if test "x$enable_uoa" = xyes; then
545         PKG_CHECK_MODULES(
546                 [LIBACCOUNTS_GLIB],
547                 [libaccounts-glib >= libaccounts_glib_minimum_version],,
548                 [AC_MSG_ERROR([
549
550         libaccounts-glib not found (or version < libaccounts_glib_minimum_version)
551
552         If you want to disable Ubuntu Online Accounts support,
553         please append --disable-uoa to configure.
554
555         ])])
556
557         PKG_CHECK_MODULES(
558                 [LIBSIGNON_GLIB],
559                 [libsignon-glib >= libsignon_glib_minimum_version],,
560                 [AC_MSG_ERROR([
561
562         libsignon-glib not found (or version < libsignon_glib_minimum_version)
563
564         If you want to disable Ubuntu Online Accounts support,
565         please append --disable-uoa to configure.
566
567         ])])
568
569         PKG_CHECK_MODULES(
570                 [JSON_GLIB], [json-glib-1.0],,
571                 [AC_MSG_ERROR([
572
573         json-glib-1.0 not found
574
575         If you want to disable Ubuntu Online Accounts support,
576         please append --disable-uoa to configure.
577
578         ])])
579
580         PKG_CHECK_MODULES(
581                 [REST], [rest-0.7],,
582                 [AC_MSG_ERROR([
583
584         librest-0.7 not found
585
586         If you want to disable Ubuntu Online Accounts support,
587         please append --disable-uoa to configure.
588
589         ])])
590
591         AC_DEFINE(HAVE_UOA, 1, [Have libaccounts-glib])
592 fi
593 AM_CONDITIONAL(HAVE_UOA, [test x$enable_uoa = xyes])
594
595 dnl ***********************************
596 dnl Check for GNOME Keyring.
597 dnl ***********************************
598 if test x$os_win32 = xno; then
599         PKG_CHECK_MODULES(LIBSECRET,
600                 [libsecret-unstable >= libsecret_minimum_version])
601 fi
602 AC_SUBST(LIBSECRET_CFLAGS)
603 AC_SUBST(LIBSECRET_LIBS)
604
605 dnl **********************************************************
606 dnl gcr-base is needed for secure password exchange over D-Bus
607 dnl **********************************************************
608 PKG_CHECK_MODULES(GCR_BASE, [gcr-base-3 >= gcr_minimum_version])
609 AC_SUBST(GCR_BASE_CFLAGS)
610 AC_SUBST(GCR_BASE_LIBS)
611
612 LIBICAL_REQUIRED=libical_minimum_version
613 AC_SUBST(LIBICAL_REQUIRED)
614
615 dnl ******************************
616 dnl regex check
617 dnl ******************************
618 AC_CHECK_FUNCS(regexec,,[AC_CHECK_LIB(regex,regexec,
619                         [REGEX_LIBS=-lregex
620                         AC_DEFINE(HAVE_REGEXEC,1,[Define to 1 if you have the regexec function.])],
621                         [AC_MSG_ERROR([No regex library found])])])
622 AC_SUBST(REGEX_LIBS)
623
624 dnl ******************************
625 dnl libdb checking
626 dnl ******************************
627 AC_ARG_WITH([libdb],
628         AS_HELP_STRING([--with-libdb=PREFIX],
629         [Prefix where libdb is installed]),
630         [libdb_prefix="$withval"], [libdb_prefix='${prefix}'])
631
632 DB_CFLAGS="-I$libdb_prefix/include"
633 DB_LIBS="-L$libdb_prefix/lib -ldb"
634
635 AC_MSG_CHECKING([Berkeley DB])
636 save_cflags=$CFLAGS; CFLAGS=$DB_CFLAGS
637 save_libs=$LIBS; LIBS="$DB_LIBS"
638 AC_LINK_IFELSE([AC_LANG_PROGRAM(
639         [[#include <db.h>]],
640         [[db_create(NULL, NULL, 0)]])],
641         [AC_MSG_RESULT([yes])],
642         [AC_MSG_ERROR([Cannot find libdb])])
643 CFLAGS=$save_cflags
644 LIBS=$save_libs
645 AC_SUBST(DB_CFLAGS)
646 AC_SUBST(DB_LIBS)
647
648 dnl ******************************
649 dnl db_load checking
650 dnl ******************************
651 have_db_load=no
652 AC_PATH_PROG(DB_LOAD, [db_load])
653 if test -z "$DB_LOAD"; then
654    AC_MSG_WARN([db_load not found, some unit tests will not be run.])
655 else
656    have_db_load=yes
657 fi
658
659 AM_CONDITIONAL(HAVE_DB_LOAD, test x"$have_db_load" = "xyes")
660
661 dnl ******************************
662 dnl iconv checking
663 dnl ******************************
664 have_iconv="no"
665 save_LIBS="$LIBS"
666 LIBS="$LIBS -liconv"
667 AC_CACHE_CHECK([for iconv in -liconv], [ac_cv_libiconv],
668         AC_LINK_IFELSE([AC_LANG_PROGRAM(
669         [[
670                 #include <iconv.h>
671                 #include <stdlib.h>
672         ]],
673         [[
674                 iconv_t cd;
675                 cd = iconv_open ("UTF-8", "ISO-8859-1");
676         ]]
677         )],[ac_cv_libiconv=yes],[ac_cv_libiconv=no]))
678
679 if test "x$ac_cv_libiconv" = "xyes"; then
680         ICONV_LIBS="-liconv"
681         if test "x$os_win32" = "xyes"; then
682                 dnl Don't pointlessly auto-export the global symbols
683                 dnl from a potentially static libiconv.a
684                 ICONV_LIBS="$ICONV_LIBS -Wl,--exclude-libs=libiconv.a"
685         fi
686         have_iconv="yes"
687 else
688         LIBS="$save_LIBS"
689         AC_CHECK_FUNC(iconv, [have_iconv=yes], [have_iconv=no])
690 fi
691
692 if test "x$have_iconv" = "xyes"; then
693         if test "x$ac_cv_libiconv" = "xno"; then
694                 AC_CHECK_FUNCS(gnu_get_libc_version)
695         fi
696 AC_CACHE_CHECK([if iconv() handles UTF-8], [ac_cv_libiconv_utf8],
697         AC_RUN_IFELSE([AC_LANG_SOURCE([[
698                 #include <iconv.h>
699                 #include <stdlib.h>
700                 #include <string.h>
701                 #ifdef HAVE_GNU_GET_LIBC_VERSION
702                 #include <gnu/libc-version.h>
703                 #endif
704                 int main() {
705                         char *jp = "\x1B\x24\x42\x46\x7C\x4B\x5C\x38\x6C";
706                         char *utf8 = "\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E";
707                         char *transbuf = malloc (10), *trans = transbuf;
708                         iconv_t cd;
709                         size_t jp_len = strlen (jp), utf8_len = 10;
710                         size_t utf8_real_len = strlen (utf8);
711
712                         #ifdef HAVE_GNU_GET_LIBC_VERSION
713                         /* glibc 2.1.2's iconv is broken in hard to test ways. */
714                         if (!strcmp (gnu_get_libc_version (), "2.1.2"))
715                                 exit (1);
716                         #endif
717
718                         cd = iconv_open ("UTF-8", "ISO-2022-JP");
719                         if (cd == (iconv_t) -1)
720                                 exit (1);
721                         if (iconv (cd, &jp, &jp_len, &trans, &utf8_len) == -1 || jp_len != 0)
722                                 exit (1);
723                         if (memcmp (utf8, transbuf, utf8_real_len) != 0)
724                                 exit (1);
725                         return (0);}
726                 ]])
727         ],[ac_cv_libiconv_utf8=yes],[ac_cv_libiconv_utf8=no; have_iconv=no],[ac_cv_libiconv_utf8=hopefully]))
728 fi
729
730 if test "x$have_iconv" = "xno"; then
731         AC_MSG_ERROR([You need to install a working iconv implementation, such as ftp://ftp.gnu.org/pub/gnu/libiconv])
732 fi
733 AC_SUBST(ICONV_LIBS)
734
735 CFLAGS="$CFLAGS -I$srcdir"
736
737 AC_MSG_CHECKING([preferred charset name formats for system iconv])
738 AC_RUN_IFELSE([AC_LANG_SOURCE([[
739         #define CONFIGURE_IN
740         #include "iconv-detect.c"
741         ]])],
742         [AC_MSG_RESULT([found])],
743         [AC_MSG_RESULT([not found])
744                 AC_MSG_WARN([
745                 *** The iconv-detect program was unable to determine the
746                 *** preferred charset name formats recognized by your
747                 *** iconv library. It is suggested that you install a
748                 *** working iconv library such as the one found at
749                 *** ftp://ftp.gnu.org/pub/gnu/libiconv
750         ])],
751         [if test "x$os_win32" = xyes; then
752                 AC_MSG_RESULT([using known win32 result])
753                 echo '/* This is an auto-generated header, DO NOT EDIT! */' > iconv-detect.h
754                 echo  >>iconv-detect.h
755                 echo '#define ICONV_ISO_D_FORMAT "iso-%d-%d"' >>iconv-detect.h
756                 echo '#define ICONV_ISO_S_FORMAT "iso-%d-%s"' >>iconv-detect.h
757                 echo '#define ICONV_10646 "UCS-4BE"' >>iconv-detect.h
758         else
759                 AC_MSG_RESULT([unknown])
760                 AC_MSG_WARN([
761                 *** We can't determine the preferred charset name formats
762                 *** recognized by your iconv library. You are
763                 *** cross-compiling and supposed to know what you are doing.
764                 *** Please construct the iconv-detect.h file manually.
765                 ])
766         fi
767 ])
768
769 CFLAGS="$save_CFLAGS"
770 LIBS="$save_LIBS"
771
772 AC_ARG_ENABLE([backtraces],
773         [AS_HELP_STRING([--enable-backtraces],
774         [enable backtraces for camel_pointer_tracker (default=no)])],
775         [enable_backtraces=$enableval], [enable_backtraces=no])
776
777 if test "x$enable_backtraces" = xyes; then
778         dnl ****************************
779         dnl Check for backtrace_symbols function and dwfl from elfutils
780         dnl ****************************
781         AC_MSG_CHECKING([libc backtrace_symbols function])
782         AC_LINK_IFELSE([AC_LANG_PROGRAM(
783                 [[#include <execinfo.h>]],
784                 [[{ void *bt[1]; backtrace_symbols (bt, backtrace(bt, 1)); }]])],
785                 [AC_DEFINE(HAVE_BACKTRACE_SYMBOLS, 1, [libc provides backtrace_symbols function]) ac_cv_have_bsf=yes],[ac_cv_have_bsf=no])
786         AC_MSG_RESULT([$ac_cv_have_bsf])
787
788         if test "x$ac_cv_have_bsf" = xyes; then
789                 LIBS="$LIBS -ldw"
790
791                 AC_MSG_CHECKING([elfutils/libdwfl])
792                 AC_LINK_IFELSE([AC_LANG_PROGRAM(
793                         [[#include <elfutils/libdwfl.h>]],
794                         [[{
795                                 Dwfl *dwfl;
796                                 Dwfl_Module *module;
797                                 Dwarf_Addr module_low_addr;
798                                 Dwfl_Line *line;
799
800                                 dwfl_standard_find_debuginfo;
801                                 dwfl_linux_proc_find_elf;
802                                 dwfl_begin (NULL);
803                                 dwfl_linux_proc_report (NULL, 1);
804                                 dwfl_report_end (NULL, NULL, NULL);
805                                 dwfl_end (NULL);
806                                 dwfl_module_addrname (NULL, NULL);
807                                 dwfl_module_getsrc (NULL, NULL);
808                                 dwfl_lineinfo (NULL, NULL, NULL, NULL, NULL, NULL);
809                                 DWARF_CB_ABORT; DWARF_CB_OK;
810                                 dwfl_getmodules (NULL, NULL, NULL, 0);
811                         }]])],
812                         [AC_DEFINE(HAVE_ELFUTILS_LIBDWFL, 1, [have elfutils/libdwfl.h functions]) ac_cv_have_elfdwfl=yes],[ac_cv_have_elfdwfl=no])
813                 AC_MSG_RESULT([$ac_cv_have_elfdwfl])
814
815                 LIBS="$save_LIBS"
816
817                 if test "x$ac_cv_have_elfdwfl" = xyes; then
818                         LIBDWFL_LIBS="-ldw"
819                         AC_SUBST(LIBDWFL_LIBS)
820                 fi
821         fi
822 fi
823
824 dnl ******************************
825 dnl Check for nl_langinfo features
826 dnl ******************************
827 EVO_CHECK_LANGINFO([CODESET])
828 EVO_CHECK_LANGINFO([_NL_ADDRESS_COUNTRY_AB2])
829
830 dnl *******************************************************
831 dnl Check to see if strftime supports the use of %l and %k
832 dnl *******************************************************
833 AC_MSG_CHECKING([for %l and %k support in strftime])
834 AC_RUN_IFELSE([AC_LANG_SOURCE(
835         [[      #include <stdlib.h>
836                 #include <string.h>
837                 #include <time.h>
838                 int main(int argc, char **argv) {
839                 char buf[10];
840                 time_t rawtime;
841                 struct tm *timeinfo;
842
843                 time(&rawtime);
844                 timeinfo=localtime(&rawtime);
845                 buf[0] = '\0';
846                 strftime(buf, 10, "%lx%k", timeinfo);
847
848                 if (buf[0] == '\0' || buf[0] == 'x' || strstr(buf, "l") || strstr(buf, "k"))
849                         exit(1);
850                 else
851                         exit(0);
852                 return 0;
853                 }
854         ]]
855         )],[AC_DEFINE(HAVE_LKSTRFTIME, 1, [strftime supports use of l and k]) ac_cv_lkstrftime=yes],[ac_cv_lkstrftime=no],[ac_cv_lkstrftime=no])
856 AC_MSG_RESULT([$ac_cv_lkstrftime])
857
858 dnl ********************************************************************************
859 dnl security extension support (SSL and S/MIME)
860 dnl
861 dnl The following voodoo does detection of mozilla libraries (nspr and nss)
862 dnl needed by Camel (SSL and S/MIME).
863 dnl
864 dnl The Evolution security extensions are only built if these libraries are found
865 dnl ********************************************************************************
866 msg_smime="no"
867
868 AC_ARG_ENABLE([smime],
869         AS_HELP_STRING([--enable-smime],
870         [Enable SMIME support through Mozilla nss @<:@default=yes@:>@ ]),
871         [enable_smime="$enableval"],[enable_smime="yes"])
872
873 AC_ARG_WITH([nspr-includes],
874         AS_HELP_STRING([--with-nspr-includes],
875         [Prefix of Mozilla nspr4 includes.]),
876         [with_nspr_includes="$withval"])
877
878 AC_ARG_WITH([nspr-libs],
879         AS_HELP_STRING([--with-nspr-libs],
880         [Prefix of Mozilla nspr4 libs.]),
881         [with_nspr_libs="$withval"])
882
883 AC_ARG_WITH([nss-includes],
884         AS_HELP_STRING([--with-nss-includes],
885         [Prefix of Mozilla nss3 includes.]),
886         [with_nss_includes="$withval"])
887
888 AC_ARG_WITH([nss-libs],
889         AS_HELP_STRING([--with-nss-libs],
890         [Prefix of Mozilla nss3 libs.]),
891         [with_nss_libs="$withval"])
892
893 if test -n "${with_nspr_includes}" || test -n "${with_nspr_libs}" || test -n "${with_nss_includes}" || test -n "${with_nss_libs}"; then
894         check_manually="yes"
895 else
896         check_manually="no"
897 fi
898
899 dnl check if pkg-config files exist (which are only shipped by distributions, not upstream)
900 if test "x${check_manually}" = "xno"; then
901         AC_MSG_CHECKING(Mozilla NSPR pkg-config module name)
902         mozilla_nspr_pcs="nspr mozilla-nspr firefox-nspr xulrunner-nspr seamonkey-nspr"
903         for pc in $mozilla_nspr_pcs; do
904                 if $PKG_CONFIG --exists $pc; then
905                         AC_MSG_RESULT($pc)
906                         mozilla_nspr=$pc
907                         break;
908                 fi
909         done
910
911         AC_MSG_CHECKING(Mozilla NSS pkg-config module name)
912         mozilla_nss_pcs="nss mozilla-nss firefox-nss xulrunner-nss seamonkey-nss"
913         for pc in $mozilla_nss_pcs; do
914                 if $PKG_CONFIG --exists $pc; then
915                         AC_MSG_RESULT($pc)
916                         mozilla_nss=$pc
917                         break;
918                 fi
919         done
920
921         if test -n "$mozilla_nspr" -a -n "$mozilla_nss"; then
922                 if test "x$enable_smime" = "xyes"; then
923                         AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled])
924                         msg_smime="yes"
925                 fi
926                 MANUAL_NSPR_CFLAGS=""
927                 MANUAL_NSPR_LIBS=""
928                 MANUAL_NSS_CFLAGS=""
929                 MANUAL_NSS_LIBS=""
930         else
931                 check_manually="yes"
932                 mozilla_nspr=""
933                 mozilla_nss=""
934         fi
935 fi
936
937 if test "x${check_manually}" = "xyes"; then
938 dnl ******************
939 dnl Check for NSPR 4
940 dnl ******************
941         AC_MSG_CHECKING([for Mozilla nspr4 includes])
942                 CPPFLAGS_save="$CPPFLAGS"
943                 if test -n "$with_nspr_includes"; then
944                         CPPFLAGS="$CPPFLAGS -I$with_nspr_includes"
945                 fi
946
947                 AC_CHECK_HEADERS(nspr.h prio.h,
948                 [moz_nspr_includes="yes"],[moz_nspr_includes="no"])
949                 CPPFLAGS="$CPPFLAGS_save"
950
951                 if test "x${moz_nspr_includes}" = "xyes"; then
952                         MANUAL_NSPR_CFLAGS="-I$with_nspr_includes"
953                 else
954                         AC_MSG_FAILURE([NSPR headers not found. Use --with-nspr-includes to specify the include dir of NSPR.])
955                 fi
956         AC_MSG_RESULT([$moz_nspr_includes])
957
958         AC_MSG_CHECKING([for Mozilla nspr libraries])
959                 CFLAGS_save="$CFLAGS"
960                 LDFLAGS_save="$LDFLAGS"
961                 LIBS_save="$LIBS"
962                 nsprlibs="$DL_LIB -lplc4 -lplds4 -lnspr4"
963
964                 CFLAGS="$CFLAGS $MANUAL_NSPR_CFLAGS"
965                 LIBS="$nsprlibs"
966                 dnl Test to protect from giving libtool an -L , which results in failure (used below,too)
967                 if test -n "${with_nspr_libs}"; then
968                         LDFLAGS="$LDFLAGS -L$with_nspr_libs"
969                 else
970                         LDFLAGS="$LDFLAGS"
971                 fi
972
973                 AC_LINK_IFELSE([AC_LANG_CALL([],[PR_Init])],
974                 [moz_nspr_libs="yes"],[moz_nspr_libs="no"])
975
976                 CFLAGS="$CFLAGS_save"
977                 LDFLAGS="$LDFLAGS_save"
978                 LIBS="$LIBS_save"
979
980                 if test "x${moz_nspr_libs}" = "xyes"; then
981                         if test -n "${with_nspr_libs}"; then
982                                 MANUAL_NSPR_LIBS="-L$with_nspr_libs $nsprlibs"
983                         else
984                                 MANUAL_NSPR_LIBS="$nsprlibs"
985                         fi
986                 else
987                         AC_MSG_FAILURE([NSPR libs not found. Use --with-nspr-libs to specify the libdir of NSPR.])
988                 fi
989         AC_MSG_RESULT([$moz_nspr_libs])
990
991 dnl *****************
992 dnl Check for NSS 3
993 dnl *****************
994         AC_MSG_CHECKING([for Mozilla nss3 includes])
995                 CPPFLAGS_save="$CPPFLAGS"
996                 CPPFLAGS="$CPPFLAGS -I$with_nspr_includes -I$with_nss_includes"
997
998                 AC_CHECK_HEADERS(nss.h ssl.h smime.h,
999                 [moz_nss_includes="yes"],[moz_nss_includes="no"])
1000                 CPPFLAGS="$CPPFLAGS_save"
1001
1002                 if test "x${moz_nss_includes}" = "xyes"; then
1003                         MANUAL_NSS_CFLAGS="-I$with_nss_includes"
1004                 else
1005                         AC_MSG_FAILURE([NSS headers not found. Use --with-nss-includes to specify the include dir of NSS.])
1006                 fi
1007         AC_MSG_RESULT($moz_nss_includes)
1008
1009         AC_MSG_CHECKING([for Mozilla nss libraries])
1010                 LDFLAGS_save="$LDFLAGS"
1011                 LIBS_save="$LIBS"
1012                 nsslibs="-lssl3 -lsmime3 -lnss3"
1013
1014                 LIBS="$nsslibs $nsprlibs"
1015                 dnl Test to protect from giving libtool an -L , which results in failure (used below,too)
1016                 if test -n "${with_nss_libs}"; then
1017                         LDFLAGS="$LDFLAGS -L$with_nss_libs $MANUAL_NSPR_LIBS"
1018                 else
1019                         LDFLAGS="$LDFLAGS $LDFLAGS_NSPR $MANUAL_NSPR_LIBS"
1020                 fi
1021
1022                 AC_LINK_IFELSE([AC_LANG_CALL([],[NSS_Init])],
1023                 [moz_nss_libs="yes"],[moz_nss_libs="no"])
1024                 LDFLAGS="$LDFLAGS_save"
1025                 LIBS="$LIBS_save"
1026
1027                 if test "x${moz_nss_libs}" = "xyes"; then
1028                         if test "x${enable_smime}" = "xyes"; then
1029                                 AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled])
1030                                 msg_smime="yes"
1031                         fi
1032                         if test -n "${with_nss_libs}"; then
1033                                 MANUAL_NSS_LIBS="-L$with_nss_libs $nsslibs"
1034                         else
1035                                 MANUAL_NSS_LIBS="$nsslibs"
1036                         fi
1037                 else
1038                         AC_MSG_FAILURE([NSS libs not found. Use --with-nss-libs to specify the libdir of NSS.])
1039                 fi
1040         AC_MSG_RESULT([$moz_nss_libs])
1041
1042         MANUAL_NSS_CFLAGS="$MANUAL_NSPR_CFLAGS $MANUAL_NSS_CFLAGS"
1043         MANUAL_NSS_LIBS="$MANUAL_NSPR_LIBS $MANUAL_NSS_LIBS"
1044 fi
1045
1046 AM_CONDITIONAL(ENABLE_SMIME, test "x$msg_smime" != "xno")
1047
1048 dnl For pkgconfig files.
1049 AC_SUBST(mozilla_nss)
1050 AC_SUBST(mozilla_nspr)
1051
1052 AC_SUBST(MANUAL_NSPR_CFLAGS)
1053 AC_SUBST(MANUAL_NSPR_LIBS)
1054 AC_SUBST(MANUAL_NSS_CFLAGS)
1055 AC_SUBST(MANUAL_NSS_LIBS)
1056
1057 dnl ******************************
1058 dnl system mail stuff
1059 dnl ******************************
1060 AC_PATH_PROG(SENDMAIL, sendmail, [/usr/sbin/sendmail], [/usr/sbin:/usr/lib])
1061 AC_DEFINE_UNQUOTED(SENDMAIL_PATH, "$SENDMAIL", [Path to a sendmail binary, or equivalent])
1062
1063 AC_MSG_CHECKING([system mail directory])
1064 if test -d /var/mail -a '!' -h /var/mail ; then
1065         system_mail_dir="/var/mail"
1066 else
1067         system_mail_dir="/var/spool/mail"
1068 fi
1069 AC_DEFINE_UNQUOTED(SYSTEM_MAIL_DIR, "$system_mail_dir", [Directory local mail is delivered to])
1070
1071 case `ls -ld $system_mail_dir 2>&1 | awk '{print $1;}'` in
1072         d??????rw?)
1073                 CAMEL_LOCK_HELPER_USER=""
1074                 CAMEL_LOCK_HELPER_GROUP=""
1075                 system_mail_perm="world writable"
1076         ;;
1077         d???rw????)
1078                 CAMEL_LOCK_HELPER_USER=""
1079                 CAMEL_LOCK_HELPER_GROUP=`ls -ld $system_mail_dir 2>&1 | awk '{print $4;}'`
1080                 system_mail_perm="writable by group $CAMEL_LOCK_HELPER_GROUP"
1081         ;;
1082         drw???????)
1083                 CAMEL_LOCK_HELPER_USER=`ls -ld $system_mail_dir 2>&1 | awk '{print $3;}'`
1084                 CAMEL_LOCK_HELPER_GROUP=""
1085                 system_mail_perm="writable by user $CAMEL_LOCK_HELPER_USER"
1086         ;;
1087         *)
1088                 CAMEL_LOCK_HELPER_USER=""
1089                 CAMEL_LOCK_HELPER_GROUP=""
1090                 system_mail_perm="???"
1091         ;;
1092 esac
1093
1094 AC_MSG_RESULT([$system_mail_dir, $system_mail_perm])
1095 AC_SUBST(CAMEL_LOCK_HELPER_USER)
1096 AC_SUBST(CAMEL_LOCK_HELPER_GROUP)
1097
1098 dnl ******************************
1099 dnl Timezone checks
1100 dnl ******************************
1101 AC_CACHE_CHECK(for tm_gmtoff in struct tm, [ac_cv_struct_tm_gmtoff],
1102         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1103         [[      #include <time.h>       ]],
1104         [[
1105                 struct tm tm;
1106                 tm.tm_gmtoff = 1;
1107         ]]
1108         )],[ac_cv_struct_tm_gmtoff=yes],[ac_cv_struct_tm_gmtoff=no]))
1109 if test "x$ac_cv_struct_tm_gmtoff" = "xyes"; then
1110         AC_DEFINE(HAVE_TM_GMTOFF, 1, [Define if struct tm has a tm_gmtoff member])
1111 else
1112         AC_CACHE_CHECK(for timezone variable, [ac_cv_var_timezone],
1113                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1114                 [[      #include <time.h> ]],
1115                 [[      timezone = 1;   ]]
1116                 )],[ac_cv_var_timezone=yes],[ac_cv_var_timezone=no]))
1117         if test "x$ac_cv_var_timezone" = "xyes"; then
1118                 AC_DEFINE(HAVE_TIMEZONE, 1, [Define if libc defines a timezone variable])
1119                 AC_CACHE_CHECK(for altzone variable, [ac_cv_var_altzone],
1120                         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1121                         [[      #include <time.h>       ]],
1122                         [[      altzone = 1; ]]
1123                         )],[ac_cv_var_altzone=yes],[ac_cv_var_altzone=no]))
1124                 if test "x$ac_cv_var_altzone" = "xyes"; then
1125                         AC_DEFINE(HAVE_ALTZONE, 1, [Define if libc defines an altzone variable])
1126                 fi
1127         else
1128                 AC_MSG_ERROR([unable to find a way to determine timezone])
1129         fi
1130 fi
1131
1132 dnl ******************************
1133 dnl ctime_r prototype
1134 dnl ******************************
1135 AC_CACHE_CHECK([if ctime_r wants three arguments], [ac_cv_ctime_r_three_args],
1136 [
1137         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1138         [[      #include <time.h> ]],
1139         [[      char *buf;
1140                 time_t date;
1141                 ctime_r (&date, buf, 100); ]]
1142         )],[ac_cv_ctime_r_three_args=yes],[ac_cv_ctime_r_three_args=no])
1143 ])
1144
1145 if test "x$ac_cv_ctime_r_three_args" = "xyes" ; then
1146         AC_DEFINE(CTIME_R_THREE_ARGS, 1, [Solaris-style ctime_r])
1147 fi
1148
1149 dnl ******************************
1150 dnl gethostbyname_r prototype
1151 dnl ******************************
1152 AC_CHECK_FUNCS(gethostbyname_r,[
1153 AC_CACHE_CHECK([if gethostbyname_r wants five arguments], [ac_cv_gethostbyname_r_five_args],
1154 [
1155         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1156         [[
1157                 #include "confdefs.h"
1158                 #include <sys/types.h>
1159                 #include <sys/socket.h>
1160                 #include <netinet/in.h>
1161                 #include <netdb.h>
1162                 #define BUFSIZE (sizeof(struct hostent)+10)
1163         ]],
1164         [[
1165                 struct hostent hent;
1166                 char buffer[BUFSIZE];
1167                 int bufsize=BUFSIZE;
1168                 int h_errno;
1169                 (void)gethostbyname_r ("www.ximian.com", &hent, buffer, bufsize, &h_errno);
1170         ]]
1171         )],[ac_cv_gethostbyname_r_five_args=yes],[ac_cv_gethostbyname_r_five_args=no])
1172 ])])
1173
1174 if test "x$ac_cv_gethostbyname_r_five_args" = "xyes" ; then
1175         AC_DEFINE(GETHOSTBYNAME_R_FIVE_ARGS, 1, [Solaris-style gethostbyname_r])
1176 fi
1177
1178 dnl ******************************
1179 dnl gethostbyaddr_r prototype
1180 dnl ******************************
1181 AC_CHECK_FUNCS(gethostbyaddr_r,[
1182 AC_CACHE_CHECK([if gethostbyaddr_r wants seven arguments], [ac_cv_gethostbyaddr_r_seven_args],
1183 [
1184         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1185         [[
1186                 #include "confdefs.h"
1187                 #include <sys/types.h>
1188                 #include <sys/socket.h>
1189                 #include <netinet/in.h>
1190                 #include <netdb.h>
1191                 #define BUFSIZE (sizeof(struct hostent)+10)
1192         ]],
1193         [[
1194                 struct hostent hent;
1195                 char buffer[BUFSIZE];
1196                 int bufsize=BUFSIZE;
1197                 int h_errno;
1198                 (void)gethostbyaddr_r ("www.ximian.com", 14, AF_INET, &hent, buffer, bufsize, &h_errno); ]]
1199         )],[ac_cv_gethostbyaddr_r_seven_args=yes],[ac_cv_gethostbyaddr_r_seven_args=no])
1200 ])])
1201
1202 if test "x$ac_cv_gethostbyaddr_r_seven_args" = "xyes" ; then
1203         AC_DEFINE(GETHOSTBYADDR_R_SEVEN_ARGS, 1, [Solaris-style gethostbyaddr_r])
1204 fi
1205
1206 dnl ******************************
1207 dnl stat(v)fs location/type
1208 dnl ******************************
1209 AC_CHECK_HEADER([sys/statvfs.h],
1210         [AC_DEFINE([HAVE_SYS_STATVFS_H], 1, [Have <sys/statvfs.h>])],,
1211         [[      #if HAVE_SYS_STATVFS_H
1212                 #include <sys/statvfs.h>
1213                 #endif
1214         ]])
1215 AC_CHECK_FUNCS(statvfs)
1216
1217 AC_CHECK_HEADER([sys/param.h],
1218         [AC_DEFINE([HAVE_SYS_PARAM_H], 1, [Have <sys/param.h>])],,
1219         [[      #if HAVE_SYS_PARAM_H
1220                 #include <sys/param.h>
1221                 #endif
1222         ]])
1223 AC_CHECK_HEADER([sys/mount.h],
1224         [AC_DEFINE([HAVE_SYS_MOUNT_H], 1, [Have <sys/mount.h>])],,
1225         [[      #if HAVE_SYS_MOUNT_H
1226                 #include <sys/mount.h>
1227                 #endif
1228         ]])
1229 AC_CHECK_FUNCS(statfs)
1230
1231 dnl ******************************
1232 dnl IPv6 support and getaddrinfo calls
1233 dnl ******************************
1234 AC_CACHE_CHECK([if system supports getaddrinfo and getnameinfo], [ac_cv_have_addrinfo],
1235 [
1236         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1237         [[      #include "confdefs.h"
1238                 #include <sys/types.h>
1239                 #include <sys/socket.h>
1240                 #include <netinet/in.h>
1241                 #include <netdb.h>
1242                 #include <stddef.h>
1243         ]],
1244         [[      #ifndef NI_MAXHOST
1245                 #define NI_MAXHOST      1025
1246                 #endif
1247
1248                 #ifndef NI_MAXSERV
1249                 #define NI_MAXSERV      32
1250                 #endif
1251
1252                 struct addrinfo hints, *res;
1253                 struct sockaddr_in6 sin6;
1254                 int af = AF_INET6;
1255                 char host[NI_MAXHOST];
1256                 char serv[NI_MAXSERV];
1257
1258                 getaddrinfo ("www.ximian.com", NULL, &hints, &res);
1259                 freeaddrinfo (res);
1260                 getnameinfo((struct sockaddr *)&sin6, sizeof(sin6), host, sizeof(host), serv, sizeof(serv), 0); ]]
1261         )],[ac_cv_have_addrinfo=yes],[ac_cv_have_addrinfo=no])
1262 ])
1263
1264 if test "x$ac_cv_have_addrinfo" = "xno" ; then
1265         AC_DEFINE(NEED_ADDRINFO,1,[Enable getaddrinfo emulation])
1266         if test "x$enable_ipv6" = "xyes" ; then
1267                 AC_MSG_ERROR([system doesn't support necessary interfaces for ipv6 support])
1268         fi
1269         msg_ipv6="no"
1270 else
1271         AC_ARG_ENABLE([ipv6],
1272         AS_HELP_STRING([--enable-ipv6=no/yes],
1273         [Enable support for resolving IPv6 addresses.]),
1274         [enable_ipv6=$enableval],[enable_ipv6=yes])
1275         if test "x$enable_ipv6" = "xyes"; then
1276                 msg_ipv6="yes"
1277                 AC_DEFINE(ENABLE_IPv6,1,[Enable IPv6 support])
1278                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1279                 [[      #include "confdefs.h"
1280                         #include <sys/types.h>
1281                         #include <sys/socket.h>
1282                         #include <netinet/in.h>
1283                         #include <netdb.h>
1284                 ]],
1285                 [[      struct addrinfo hints;
1286                         hints.ai_flags = AI_ADDRCONFIG;
1287                 ]]
1288                 )],[AC_DEFINE(HAVE_AI_ADDRCONFIG,1,[Define if the system defines the AI_ADDRCONFIG flag for getaddrinfo])],[])
1289         else
1290                 msg_ipv6="no"
1291         fi
1292 fi
1293
1294 AM_CONDITIONAL(ENABLE_IPv6, [test "x$enable_ipv6" = "xyes"])
1295
1296 AC_CHECK_HEADER([wspiapi.h],
1297         [AC_DEFINE([HAVE_WSPIAPI_H], 1, [Have <wspiapi.h>])],,)
1298
1299 dnl **********************************
1300 dnl Weather calendar backend support
1301 dnl **********************************
1302 AC_MSG_CHECKING([if we should build the weather calendar backend])
1303 AC_ARG_ENABLE([weather],
1304         [AS_HELP_STRING([--enable-weather],
1305         [Build the weather calendar backend (default=yes)])],
1306         [use_gweather=$enableval], [use_gweather=yes])
1307
1308 AC_MSG_RESULT([$use_gweather])
1309 if test "x$use_gweather" = "xyes"; then
1310         PKG_CHECK_MODULES(
1311                 [LIBGWEATHER], [gweather-3.0 >= gweather_minimum_version],[],
1312                 [AC_MSG_ERROR([
1313
1314         gweather-3.0 not found (or version < gweather_minimum_version)
1315
1316         If you want to disable weather calendar support,
1317         please append --disable-weather to configure.
1318
1319         ])])
1320 fi
1321 AM_CONDITIONAL(ENABLE_WEATHER, [test $use_gweather = yes])
1322
1323 AC_DEFINE(HANDLE_LIBICAL_MEMORY, 1, [Define it once memory returned by libical is free'ed properly])
1324
1325 dnl ******************************
1326 dnl File locking
1327 dnl ******************************
1328 AC_ARG_ENABLE([dot-locking],
1329         AS_HELP_STRING([--enable-dot-locking=yes/no],
1330         [Enable support for locking mail files with dot locking]),
1331         [enable_dot_locking=$enableval],[enable_dot_locking=yes])
1332
1333 if test "x$os_win32" != "xyes" -a "x$enable_dot_locking" = "xyes"; then
1334         AC_DEFINE(USE_DOT,1,[Define to use dot locking for mbox files])
1335         msg_dot="yes"
1336 else
1337         msg_dot="no"
1338 fi
1339
1340 AC_ARG_ENABLE([file-locking],
1341         AS_HELP_STRING([--enable-file-locking=fcntl/flock/no],
1342         [Enable support for locking mail files with file locking]),
1343         [],[enable_file_locking=fcntl])
1344
1345 if test "x$os_win32" != "xyes" -a "x$enable_file_locking" = "xfcntl"; then
1346         AC_DEFINE(USE_FCNTL,1,[Define to use fcntl locking for mbox files])
1347         msg_file="fcntl"
1348 else
1349         if test "x$os_win32" != "xyes" -a "x$enable_file_locking" = "xflock"; then
1350                 AC_DEFINE(USE_FLOCK,1,[Define to use flock locking for mbox files])
1351                 msg_file="flock"
1352         else
1353                 msg_file="no"
1354         fi
1355 fi
1356
1357 dnl ******************************
1358 dnl sendmail operation
1359 dnl ******************************
1360 AC_MSG_CHECKING([for SunOS broken spool format])
1361 if test "x$host_os" = "xsunos" ; then
1362         with_broken_spool="yes"
1363 fi
1364
1365 AC_ARG_WITH([broken-spool],
1366         AS_HELP_STRING([--with-broken-spool=yes/no],
1367         [Using SunOS/Solaris sendmail which has a broken spool format]),
1368         [with_broken_spool=$enableval],[with_broken_spool=${with_broken_spool:=no}])
1369
1370 if test "x$with_broken_spool" = "xyes"; then
1371         AC_DEFINE(HAVE_BROKEN_SPOOL,1,[Define if mail delivered to the system mail directory is in broken Content-Length format])
1372 fi
1373
1374 AC_MSG_RESULT([$with_broken_spool])
1375
1376 dnl ***********
1377 dnl Kerberos 5
1378 dnl ***********
1379 EVO_KRB5_SUPPORT(no)
1380
1381 dnl ******************************
1382 dnl Purify support
1383 dnl ******************************
1384 EVO_PURIFY_SUPPORT
1385
1386 dnl ******************************
1387 dnl LDAP support.
1388 dnl ******************************
1389 if test "x$os_win32" != "xyes"; then
1390         EVO_LDAP_CHECK(no)
1391         case $with_openldap in
1392         no)
1393                 msg_ldap="no"
1394         ;;
1395         *)
1396                 case $with_static_ldap in
1397                 yes)
1398                         msg_ldap="$with_openldap (static)"
1399                         ;;
1400                 *)
1401                         msg_ldap="$with_openldap (dynamic)"
1402                         ;;
1403                 esac
1404         esac
1405
1406 dnl SunLDAP support, but if OpenLDAP support, skip check SunLDAP.
1407         if test "x$with_openldap" = "xno" ; then
1408                 EVO_SUNLDAP_CHECK(no)
1409                 case $with_sunldap in
1410                 no)
1411                         msg_ldap="no"
1412                         ;;
1413                 *)
1414                         case $with_static_sunldap in
1415                         yes)
1416                                 msg_ldap="$with_sunldap (static)"
1417                                 ;;
1418                         *)
1419                                 msg_ldap="$with_sunldap (dynamic)"
1420                                 ;;
1421                 esac
1422         esac
1423         else
1424                 with_sunldap="no"
1425         fi
1426         AM_CONDITIONAL(SUNLDAP, [test "$with_sunldap" != no])
1427
1428         LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_DEPRECATED"
1429 else
1430         dnl Win32 LDAP support
1431         LDAP_CFLAGS="-DLDAP_DEPRECATED"
1432         LDAP_LIBS="-lwldap32"
1433         AC_SUBST(LDAP_CFLAGS)
1434         AC_SUBST(LDAP_LIBS)
1435         AC_DEFINE(HAVE_LDAP,1,[Define if you have LDAP support])
1436         AM_CONDITIONAL(ENABLE_LDAP, true)
1437         AM_CONDITIONAL(SUNLDAP, false)
1438         msg_ldap="yes"
1439 fi
1440
1441 dnl ******************************
1442 dnl Utility macro to set compiler flags for a specific lib.
1443 dnl EVO_SET_COMPILE_FLAGS(VAR-PREFIX, DEPS, EXTRA-CFLAGS, EXTRA-LIBS)
1444 dnl ******************************
1445 AC_DEFUN([EVO_SET_COMPILE_FLAGS], [
1446         PKG_CHECK_MODULES([$1], [$2])
1447         $1_CFLAGS="[$]$1_CFLAGS $3 "
1448         $1_LIBS="[$]$1_LIBS $4 "
1449 ])
1450
1451 dnl ******************************
1452 dnl sqlite3 flags
1453 dnl ******************************
1454 PKG_CHECK_MODULES(SQLITE3, [sqlite3 >= sqlite_minimum_version])
1455
1456 if test "x$enable_maintainer_mode" = "xyes" ; then
1457         EVO_SET_COMPILE_FLAGS(FACTORY_GTK, "gtk+-3.0")
1458         AC_SUBST(FACTORY_GTK_CFLAGS)
1459         AC_SUBST(FACTORY_GTK_LIBS)
1460 fi
1461
1462 dnl ******************************
1463 dnl libedataserver flags
1464 dnl ******************************
1465 E_DATA_SERVER_DEPS="gio-2.0 gmodule-2.0 libsecret-1 libxml-2.0 libsoup-2.4 $mozilla_nspr"
1466
1467 EVO_SET_COMPILE_FLAGS(E_DATA_SERVER, $E_DATA_SERVER_DEPS, $MANUAL_NSPR_CFLAGS, $MANUAL_NSPR_LIBS)
1468 AC_SUBST(E_DATA_SERVER_CFLAGS)
1469 AC_SUBST(E_DATA_SERVER_LIBS)
1470
1471 dnl ******************************
1472 dnl libebackend flags
1473 dnl ******************************
1474 E_BACKEND_DEPS="gio-2.0 gmodule-2.0 libsecret-1 libsoup-2.4 libxml-2.0"
1475
1476 EVO_SET_COMPILE_FLAGS(E_BACKEND, $E_BACKEND_DEPS)
1477 AC_SUBST(E_BACKEND_CFLAGS)
1478 AC_SUBST(E_BACKEND_LIBS)
1479
1480 dnl ******************************
1481 dnl evolution-addressbook flags
1482 dnl ******************************
1483 EVOLUTION_ADDRESSBOOK_DEPS="gio-2.0 libxml-2.0 libsoup-2.4 libsecret-1"
1484
1485 EVO_SET_COMPILE_FLAGS(EVOLUTION_ADDRESSBOOK, $EVOLUTION_ADDRESSBOOK_DEPS)
1486 AC_SUBST(EVOLUTION_ADDRESSBOOK_CFLAGS)
1487 AC_SUBST(EVOLUTION_ADDRESSBOOK_LIBS)
1488
1489 dnl ******************************
1490 dnl evolution-calendar flags
1491 dnl ******************************
1492 EVOLUTION_CALENDAR_DEPS="gio-2.0 libical >= libical_minimum_version libsoup-2.4 libxml-2.0 libsecret-1"
1493
1494 dnl *****
1495 dnl libical.pc from libical-0.43 has a bug in it's CFlags.
1496 dnl It wants apps to include <libical/ical*.h> but it's CFlags make it difficult
1497 dnl to differentiate between <libical/ical.h> and <ical.h>
1498 dnl We have fixed all our instances to use <libical/ical.h>. Until the .pc from
1499 dnl libical is fixed, we have to work-around the buggy CFlags.
1500 dnl *****
1501         LIBICAL_EXTRA_CFLAGS=" -I`$PKG_CONFIG --variable=includedir libical` "
1502         LIBICAL_EXTRA_LIBS=""
1503         AC_SUBST(LIBICAL_EXTRA_CFLAGS)
1504         AC_SUBST(LIBICAL_EXTRA_LIBS)
1505
1506         EVO_SET_COMPILE_FLAGS(EVOLUTION_CALENDAR, $EVOLUTION_CALENDAR_DEPS, $LIBICAL_EXTRA_CFLAGS, $LIBICAL_EXTRA_LIBS)
1507         AC_SUBST(EVOLUTION_CALENDAR_CFLAGS)
1508         AC_SUBST(EVOLUTION_CALENDAR_LIBS)
1509
1510         dnl ****************************
1511         dnl Check for ical_set_unknown_token_handling_setting function
1512         dnl ****************************
1513         AC_MSG_CHECKING([ical_set_unknown_token_handling_setting function])
1514         save_cflags=$CFLAGS; CFLAGS=$EVOLUTION_CALENDAR_CFLAGS
1515         save_libs=$LIBS; LIBS="$EVOLUTION_CALENDAR_LIBS"
1516         AC_LINK_IFELSE([AC_LANG_PROGRAM(
1517                 [[#include <libical/ical.h>]],
1518                 [[ical_set_unknown_token_handling_setting (ICAL_DISCARD_TOKEN)]])],
1519                 [AC_DEFINE(HAVE_ICAL_UNKNOWN_TOKEN_HANDLING, 1, [libical provides ical_set_unknown_token_handling_setting function]) ac_cv_have_iuth=yes],[ac_cv_have_iuth=no])
1520         CFLAGS=$save_cflags
1521         LIBS=$save_libs
1522         AC_MSG_RESULT([$ac_cv_have_iuth])
1523
1524 dnl ******************************
1525 dnl Google flags
1526 dnl ******************************
1527 LIBGDATA_REQUIRED=libgdata_minimum_version
1528 AC_SUBST(LIBGDATA_REQUIRED)
1529 AC_ARG_ENABLE([google],
1530         [AS_HELP_STRING([--enable-google],
1531         [enable Google Contacts support (default=yes)])],
1532         [enable_google=$enableval], [enable_google=yes])
1533 AC_MSG_CHECKING([if Google Contacts support is enabled])
1534 AC_MSG_RESULT([$enable_google])
1535 if test "x$enable_google" = xyes; then
1536         EVO_SET_COMPILE_FLAGS(GDATA, libgdata >= libgdata_minimum_version)
1537         AC_SUBST(GDATA_CFLAGS)
1538         AC_SUBST(GDATA_LIBS)
1539
1540         AC_DEFINE(HAVE_GOOGLE, 1, [Define to 1 if you have the google-1.0 package.])
1541 fi
1542 AM_CONDITIONAL(HAVE_GOOGLE, [test x$enable_google = xyes])
1543
1544 EVO_SET_COMPILE_FLAGS(SOUP, libsoup-2.4)
1545 AC_SUBST(SOUP_CFLAGS)
1546 AC_SUBST(SOUP_LIBS)
1547
1548 dnl ******************************
1549 dnl Camel flags
1550 dnl ******************************
1551 SQLITE_REQUIRED=sqlite_minimum_version
1552 AC_SUBST(SQLITE_REQUIRED)
1553
1554 zlib_found="false"
1555 dnl deflateInit is a #define, use deflateEnd instead
1556 AC_CHECK_LIB([z], [deflateEnd], [AC_CHECK_HEADER(zlib.h, [zlib_found=true])])
1557
1558 if test "x$zlib_found" = "xfalse"; then
1559         AC_MSG_ERROR([*** zlib is required])
1560 fi
1561
1562 dnl ******************************
1563 dnl Checks for large file support
1564 dnl ******************************
1565 AC_ARG_ENABLE([largefile],
1566         AS_HELP_STRING([--enable-largefile],
1567         [enable support for large files [[default=yes]]]),
1568         [],[enable_largefile="yes"])
1569
1570 if test "x$enable_largefile" != "xno"; then
1571         AC_SYS_LARGEFILE
1572         AC_CACHE_CHECK([for _LARGEFILE64_SOURCE value needed for large files], [ac_cv_largefile64_source],
1573         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1574         [[      #include <sys/types.h>
1575                 #include <sys/stat.h>
1576                 #include <fcntl.h>
1577         ]],
1578         [[      int fd = open ("__o_largefile", O_CREAT | O_RDWR | O_LARGEFILE, 0644);  ]]
1579         )],[ac_cv_largefile64_source="no"],
1580                 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1581                 [[      #define _LARGEFILE64_SOURCE
1582                         #include <sys/types.h>
1583                         #include <sys/stat.h>
1584                         #include <fcntl.h>
1585                 ]],
1586                 [[ int fd = open ("__o_largefile", O_CREAT | O_RDWR | O_LARGEFILE, 0644); ]])],[ac_cv_largefile64_source="yes"],
1587                 [ac_cv_largefile64_source="unknown"])])
1588         ])
1589
1590         enable_largefile="no"
1591
1592         if test "x$ac_cv_largefile64_source" = "xyes"; then
1593                 LARGEFILE_CFLAGS="-D_LARGEFILE64_SOURCE"
1594                 enable_largefile="yes"
1595         elif test "x$ac_cv_largefile64_source" = "xunknown"; then
1596                 AC_DEFINE(O_LARGEFILE, 0, [Define to 0 if your system does not have the O_LARGEFILE flag])
1597         fi
1598
1599         if test -n "$ac_cv_sys_large_files" -a "x$ac_cv_sys_large_files" != "xno"; then
1600                 LARGEFILE_CFLAGS="$LARGEFILE_CFLAGS -D_LARGE_FILES"
1601                 enable_largefile="yes"
1602         fi
1603
1604         if test "x$ac_cv_sys_file_offset_bits" != "xno"; then
1605                 LARGEFILE_CFLAGS="$LARGEFILE_CFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
1606                 enable_largefile="yes"
1607         fi
1608 else
1609         AC_DEFINE(O_LARGEFILE, 0, [Define to 0 if your system does not have the O_LARGEFILE flag])
1610         LARGEFILE_CFLAGS=""
1611 fi
1612
1613 AM_CONDITIONAL(ENABLE_LARGEFILE, [test "x$enable_largefile" = "xyes"])
1614
1615 EVO_SET_COMPILE_FLAGS(CAMEL, gio-2.0 gmodule-2.0 $mozilla_nss $mozilla_nspr sqlite3 >= sqlite_minimum_version, $KRB5_CFLAGS $MANUAL_NSS_CFLAGS $MANUAL_NSPR_CFLAGS $LARGEFILE_CFLAGS, -lz $KRB5_LIBS $MANUAL_NSS_LIBS $MANUAL_NSPR_LIBS)
1616 AC_SUBST(CAMEL_CFLAGS)
1617 AC_SUBST(CAMEL_LIBS)
1618
1619 dnl ******************************
1620 dnl Special directories
1621 dnl ******************************
1622
1623 dnl If you add something here, consider whether or not you also
1624 dnl need to add it to one or more .pc.in files (for Connector,
1625 dnl etc)
1626
1627 privdatadir='${datadir}'/evolution-data-server
1628 AC_SUBST(privdatadir)
1629
1630 privincludedir='${includedir}'/evolution-data-server
1631 AC_SUBST(privincludedir)
1632
1633 privlibdir='${libdir}'/evolution-data-server
1634 AC_SUBST(privlibdir)
1635
1636 imagesdir='${datadir}'/pixmaps/evolution-data-server
1637 AC_SUBST(imagesdir)
1638
1639 moduledir='${privlibdir}'/registry-modules
1640 AC_SUBST(moduledir)
1641
1642 ebook_backenddir='${privlibdir}'/addressbook-backends
1643 AC_SUBST(ebook_backenddir)
1644
1645 ecal_backenddir='${privlibdir}'/calendar-backends
1646 AC_SUBST(ecal_backenddir)
1647
1648 ro_sourcesdir='${privdatadir}'/ro-sources
1649 AC_SUBST(ro_sourcesdir)
1650
1651 rw_sourcesdir='${privdatadir}'/rw-sources
1652 AC_SUBST(rw_sourcesdir)
1653
1654 if test "x$use_gweather" = "xyes"; then
1655         weatherdatadir="$privdatadir/weather"
1656         AC_SUBST(weatherdatadir)
1657 fi
1658
1659 dnl separate camel from e-d-s? or should it be under the same spot? same for now.
1660 camel_providerdir='${privlibdir}'/camel-providers
1661 AC_SUBST(camel_providerdir)
1662
1663 dnl *******************
1664 dnl D-BUS service stuff
1665 dnl *******************
1666 m4_pattern_allow([AM_V_GEN])
1667 EVO_SUBST_SERVICE_RULE='%.service: %.service.in Makefile ; $(AM_V_GEN) sed -e "s|\@libexecdir\@|$(libexecdir)|" -e s"|\@ADDRESS_BOOK_DBUS_SERVICE_NAME\@|$(ADDRESS_BOOK_DBUS_SERVICE_NAME)|" -e "s|\@CALENDAR_DBUS_SERVICE_NAME\@|$(CALENDAR_DBUS_SERVICE_NAME)|" -e "s|\@SOURCES_DBUS_SERVICE_NAME\@|$(SOURCES_DBUS_SERVICE_NAME)|" -e "s|\@USER_PROMPTER_DBUS_SERVICE_NAME\@|$(USER_PROMPTER_DBUS_SERVICE_NAME)|" $< > $@'
1668 AC_SUBST(EVO_SUBST_SERVICE_RULE)
1669
1670 dnl ******************************
1671 dnl GLib stuff
1672 dnl ******************************
1673 GLIB_GSETTINGS
1674 AM_PATH_GLIB_2_0
1675
1676 dnl ******************************
1677 dnl gperf stuff
1678 dnl ******************************
1679 AC_PATH_PROG(GPERF, gperf, [no])
1680 if test "x$GPERF" = "xno"; then
1681   AC_MSG_ERROR([You need gperf to build evolution-data-server])
1682 fi
1683
1684 GOBJECT_INTROSPECTION_CHECK([0.9.12])
1685
1686 dnl ******************************
1687 dnl Vala binding
1688 dnl ******************************
1689 AC_ARG_ENABLE(vala-bindings,
1690         AC_HELP_STRING([--enable-vala-bindings],
1691         [build the EXPERIMENTAL Vala bindings]),
1692         enable_vala_bindings=$enableval,
1693         enable_vala_bindings=no)
1694
1695 if test x$enable_vala_bindings = xyes; then
1696   if test "x$INTROSPECTION_SCANNER" = x; then
1697     AC_MSG_ERROR([GObject-Introspection must be enabled for Vala bindings])
1698   fi
1699
1700   AM_PROG_VALAC([0.13.0])
1701   have_vala=yes
1702
1703   AC_PATH_PROG(VALAC, valac, valac)
1704   AC_SUBST(VALAC)
1705   AC_SUBST(VALAFLAGS)
1706
1707   AC_PATH_PROG([VAPIGEN], [vapigen], [false])
1708
1709   if test "x$VAPIGEN" = "xfalse"; then
1710     AC_MSG_ERROR([vapigen not found. Was vala compiled with --enable-vapigen?])
1711   fi
1712
1713   AC_SUBST(VAPIGEN)
1714 fi
1715
1716 AM_CONDITIONAL([HAVE_VALA], [test "x$have_vala" = "xyes"])
1717 AC_SUBST(HAVE_VALA)
1718
1719 dnl ******************************
1720 dnl Makefiles
1721 dnl ******************************
1722 export privlibdir
1723 export privincludedir
1724 export privdatadir
1725
1726 AC_CONFIG_FILES([
1727 Makefile
1728 evolution-data-server-zip
1729 evolution-data-server.pc
1730 addressbook/Makefile
1731 addressbook/libebook/Makefile
1732 addressbook/libebook/libebook.pc
1733 addressbook/libebook-contacts/Makefile
1734 addressbook/libebook-contacts/libebook-contacts.pc
1735 addressbook/libedata-book/Makefile
1736 addressbook/libedata-book/libedata-book.pc
1737 addressbook/libegdbus/Makefile
1738 addressbook/backends/Makefile
1739 addressbook/backends/file/Makefile
1740 addressbook/backends/ldap/Makefile
1741 addressbook/backends/google/Makefile
1742 addressbook/backends/google/tests/Makefile
1743 addressbook/backends/webdav/Makefile
1744 art/Makefile
1745 calendar/Makefile
1746 calendar/libecal/Makefile
1747 calendar/libecal/libecal.pc
1748 calendar/libedata-cal/Makefile
1749 calendar/libedata-cal/libedata-cal.pc
1750 calendar/libegdbus/Makefile
1751 calendar/backends/Makefile
1752 calendar/backends/caldav/Makefile
1753 calendar/backends/file/Makefile
1754 calendar/backends/http/Makefile
1755 calendar/backends/contacts/Makefile
1756 calendar/backends/weather/Makefile
1757 camel/Makefile
1758 camel/providers/Makefile
1759 camel/providers/imapx/Makefile
1760 camel/providers/local/Makefile
1761 camel/providers/nntp/Makefile
1762 camel/providers/pop3/Makefile
1763 camel/providers/sendmail/Makefile
1764 camel/providers/smtp/Makefile
1765 camel/tests/Makefile
1766 camel/tests/folder/Makefile
1767 camel/tests/lib/Makefile
1768 camel/tests/message/Makefile
1769 camel/tests/mime-filter/Makefile
1770 camel/tests/misc/Makefile
1771 camel/tests/smime/Makefile
1772 camel/camel.pc
1773 data/Makefile
1774 libebackend/Makefile
1775 libebackend/libebackend.pc
1776 libedataserver/Makefile
1777 libedataserver/eds-version.h
1778 libedataserver/libedataserver.pc
1779 modules/Makefile
1780 modules/cache-reaper/Makefile
1781 modules/gnome-online-accounts/Makefile
1782 modules/google-backend/Makefile
1783 modules/outlook-backend/Makefile
1784 modules/owncloud-backend/Makefile
1785 modules/ubuntu-online-accounts/Makefile
1786 modules/ubuntu-online-accounts/calendar.service-type.in
1787 modules/ubuntu-online-accounts/contacts.service-type.in
1788 modules/ubuntu-online-accounts/evolution-data-server.application.in
1789 modules/ubuntu-online-accounts/evolution-data-server-uoa.desktop.in
1790 modules/ubuntu-online-accounts/google-calendar.service.in
1791 modules/ubuntu-online-accounts/google-contacts.service.in
1792 modules/ubuntu-online-accounts/google-gmail.service.in
1793 modules/ubuntu-online-accounts/mail.service-type.in
1794 modules/ubuntu-online-accounts/windows-live-mail.service.in
1795 modules/ubuntu-online-accounts/yahoo-calendar.service.in
1796 modules/ubuntu-online-accounts/yahoo-mail.service.in
1797 modules/trust-prompt/Makefile
1798 modules/yahoo-backend/Makefile
1799 private/Makefile
1800 services/Makefile
1801 services/evolution-addressbook-factory/Makefile
1802 services/evolution-calendar-factory/Makefile
1803 services/evolution-source-registry/Makefile
1804 services/evolution-user-prompter/Makefile
1805 tests/Makefile
1806 tests/libedata-book/Makefile
1807 tests/libebook/Makefile
1808 tests/libebook-contacts/Makefile
1809 tests/libebook/client/Makefile
1810 tests/libebook/vcard/Makefile
1811 tests/book-migration/Makefile
1812 tests/book-migration/db/Makefile
1813 tests/libecal/Makefile
1814 tests/libecal/client/Makefile
1815 tests/libedata-cal/Makefile
1816 tests/libedataserver/Makefile
1817 tests/test-server-utils/Makefile
1818 tests/test-server-utils/services/Makefile
1819 tests/test-server-utils/services/org.gnome.evolution.dataserver.AddressBook.service
1820 tests/test-server-utils/services/org.gnome.evolution.dataserver.Calendar.service
1821 tests/test-server-utils/services/org.gnome.evolution.dataserver.Sources.service
1822 tests/cursor-example/Makefile
1823 docs/Makefile
1824 docs/reference/Makefile
1825 docs/reference/addressbook/Makefile
1826 docs/reference/addressbook/libebook/Makefile
1827 docs/reference/addressbook/libebook-contacts/Makefile
1828 docs/reference/addressbook/libedata-book/Makefile
1829 docs/reference/calendar/Makefile
1830 docs/reference/calendar/libecal/Makefile
1831 docs/reference/calendar/libedata-cal/Makefile
1832 docs/reference/camel/Makefile
1833 docs/reference/libedataserver/Makefile
1834 docs/reference/libebackend/Makefile
1835 docs/reference/private/Makefile
1836 po/Makefile.in
1837 vala/Makefile
1838 ])
1839 AC_OUTPUT
1840
1841 echo "
1842         evolution-data-server has been configured as follows:
1843         Weather calendar:       $use_gweather
1844         Mail Directory:         $system_mail_dir, $system_mail_perm
1845         LDAP support:           $msg_ldap
1846         Kerberos 5:             $msg_krb5
1847         SMIME support:          $msg_smime
1848         IPv6 support:           $msg_ipv6
1849         Phone number support:   $msg_phonenumber
1850         Dot Locking:            $msg_dot
1851         File Locking:           $msg_file
1852         Large files:            $enable_largefile
1853         Gtk Doc:                $enable_gtk_doc
1854         Introspection:          $enable_introspection
1855         Vala bindings:          $enable_vala_bindings
1856         GNOME Online Accounts   $enable_goa
1857         Ubuntu Online Accounts  $enable_uoa
1858         Google Contacts         $enable_google
1859         GTK+:                   $enable_gtk
1860         Examples:               $enable_examples
1861         Code coverage (gcov):   $enable_code_coverage
1862         Strict building:        $enable_strict
1863         Installed tests:        $enable_installed_tests
1864 "