update to openismus-work-3-8 branch
[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], [9])
5 m4_define([eds_micro_version], [90])
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.9
15 m4_define([base_version], [3.9])
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.34])
39 m4_define([glib_encoded_version], [GLIB_VERSION_2_34])
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.40.3])
47 m4_define([soup_encoded_version], [SOUP_VERSION_2_40])
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.2])
58 m4_define([gweather_minimum_version], [3.5.0])
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.AddressBook5"
77 CALENDAR_DBUS_SERVICE_NAME="org.gnome.evolution.dataserver.Calendar4"
78 SOURCES_DBUS_SERVICE_NAME="org.gnome.evolution.dataserver.Sources1"
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=17
110 LIBEDATASERVER_REVISION=0
111 LIBEDATASERVER_AGE=0
112
113 LIBECAL_CURRENT=15
114 LIBECAL_REVISION=0
115 LIBECAL_AGE=0
116
117 LIBEDATACAL_CURRENT=20
118 LIBEDATACAL_REVISION=0
119 LIBEDATACAL_AGE=0
120
121 LIBEDATABOOK_CURRENT=17
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=43
134 LIBCAMEL_REVISION=0
135 LIBCAMEL_AGE=0
136
137 LIBEBACKEND_CURRENT=6
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         -Wformat-security -Winit-self
186         -Wmissing-declarations -Wmissing-include-dirs
187         -Wmissing-noreturn -Wpointer-arith
188         -Wredundant-decls -Wundef -Wwrite-strings"
189
190 proposed_c_warning_flags="$proposed_warning_flags
191         -Werror-implicit-function-declaration
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"
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 ******************************
326 dnl Gtk Doc stuff
327 dnl ******************************
328 GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
329
330 dnl The private D-Bus documentation is for developers only.
331 AC_ARG_WITH([private-docs],
332         AS_HELP_STRING([--with-private-docs],
333         [Build documentation for private libraries ]
334         [(requires --enable-gtk-doc) [default=no]],),
335         [with_private_docs="$withval"],[with_private_docs="no"])
336 AM_CONDITIONAL(WITH_PRIVATE_DOCS, [test x$with_private_docs = xyes])
337
338 dnl This must appear after AC_CANONICAL_HOST, which defines $host.
339 case "$host" in
340 *openbsd*|*freebsd*)
341         dnl Do not set '-Wl,--no-undefined' on freebsd/openbsd
342         ;;
343 *)
344         LDFLAGS="$LDFLAGS -Wl,--no-undefined"
345         ;;
346 esac
347
348 dnl ******************************
349 dnl Check for Win32
350 dnl ******************************
351 AC_MSG_CHECKING([for Win32])
352 case "$host" in
353 *-mingw*)
354         os_win32='yes'
355         NO_UNDEFINED='-no-undefined'
356         SOCKET_LIBS='-lws2_32 -ldnsapi'
357         DL_LIB=''
358         LIBEXECDIR_IN_SERVER_FILE='../../../libexec'
359         AC_CACHE_VAL(ac_cv_have_addrinfo, [ac_cv_have_addrinfo=yes])
360         AC_DEFINE(_WIN32_WINNT, 0x501, [To get getaddrinfo etc declarations])
361         ;;
362 *openbsd*|*freebsd*)
363         os_win32='no'
364         NO_UNDEFINED=''
365         SOCKET_LIBS=''
366         DL_LIB=''
367         LIBEXECDIR_IN_SERVER_FILE="$libexecdir"
368         ;;
369 *)
370         os_win32='no'
371         NO_UNDEFINED=''
372         SOCKET_LIBS=''
373         DL_LIB='-ldl'
374         LIBEXECDIR_IN_SERVER_FILE="$libexecdir"
375         ;;
376 esac
377 AC_MSG_RESULT([$os_win32])
378 AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])
379 AC_SUBST(NO_UNDEFINED)
380 AC_SUBST(SOCKET_LIBS)
381 AC_SUBST(LIBEXECDIR_IN_SERVER_FILE)
382
383 dnl **************************************
384 dnl Check for posix compatible sys/wait.h
385 dnl **************************************
386 AC_HEADER_SYS_WAIT
387
388 dnl ************************************
389 dnl Check for posix compatible alloca()
390 dnl ************************************
391 AC_FUNC_ALLOCA
392
393 dnl ******************************
394 dnl Checks for functions
395 dnl ******************************
396 AC_CHECK_FUNCS(fsync strptime strtok_r nl_langinfo)
397
398 dnl ***********************************
399 dnl Check for base dependencies early.
400 dnl ***********************************
401 PKG_CHECK_MODULES(GNOME_PLATFORM,
402         [gio-2.0 >= glib_minimum_version
403         gmodule-2.0 >= glib_minimum_version
404         libxml-2.0 >= libxml_minimum_version
405         libsoup-2.4 >= soup_minimum_version])
406
407 if test x$os_win32 = xno; then
408         PKG_CHECK_MODULES(GIO_UNIX, [gio-unix-2.0])
409 fi
410
411 dnl ******************************
412 dnl Check for libphonenumber
413 dnl ******************************
414
415 EVO_PHONENUMBER_SUPPORT
416
417 dnl *******************
418 dnl Check for ICU
419 dnl *******************
420 dnl
421 dnl ICU recently started shipping pkg-config files but it's
422 dnl not present on many systems, if we don't find the pkg-config
423 dnl file then let's fallback on a manual check
424 enable_icu=no
425 PKG_CHECK_MODULES(ICU, icu-i18n, enable_icu=yes, [
426         enable_icu=yes
427         AC_CHECK_HEADERS(unicode/ucol.h,, enable_icu=no)
428         AC_MSG_CHECKING([for libicui18n])
429         LIBS_old=$LIBS
430         LIBS="$LIBS -licui18n -licuuc -licudata"
431         AC_TRY_LINK([#include <unicode/ucol.h>],
432                 [ucol_open ("", NULL);],
433                 AC_MSG_RESULT(yes),
434                 AC_MSG_RESULT(no); enable_icu=no)
435         LIBS=$LIBS_old
436         if [test x$enable_icu = xyes]; then
437                 ICU_CFLAGS=-D_REENTRANT
438                 ICU_LIBS="-licui18n -licuuc -licudata"
439                 AC_SUBST(ICU_CFLAGS)
440                 AC_SUBST(ICU_LIBS)
441         else
442                 AC_MSG_ERROR([ICU libs not found, icu-i18n is required.])
443         fi
444 ])
445
446 dnl *************************
447 dnl Check for GTK+
448 dnl *************************
449 AC_ARG_ENABLE([gtk],
450         [AS_HELP_STRING([--enable-gtk],
451         [enable GTK+ (default=yes)])],
452         [enable_gtk=$enableval], [enable_gtk=yes])
453 AC_MSG_CHECKING([if GTK+ support is enabled])
454 AC_MSG_RESULT([$enable_gtk])
455 if test "x$enable_gtk" = xyes; then
456         PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= gdk_minimum_version],,
457         [AC_MSG_ERROR([
458
459         gtk+-3.0 not found (or version < gdk_minimum_version)
460
461         If you want to disable GTK+ support,
462         please append --disable-gtk to configure.
463         ])])
464
465         AC_DEFINE(HAVE_GTK, 1, [Define to 1 if you have the gtk+-3.0 package.])
466 fi
467 AM_CONDITIONAL(HAVE_GTK, [test x$enable_gtk = xyes])
468
469 dnl *******************************
470 dnl Check for GNOME Online Accounts
471 dnl *******************************
472 AC_ARG_ENABLE([goa],
473         [AS_HELP_STRING([--enable-goa],
474         [enable GNOME Online Accounts support (default=yes)])],
475         [enable_goa=$enableval], [enable_goa=yes])
476 AC_MSG_CHECKING([if GNOME Online Accounts support is enabled])
477 AC_MSG_RESULT([$enable_goa])
478 if test "x$enable_goa" = xyes; then
479         PKG_CHECK_MODULES([GOA], [goa-1.0 >= goa_minimum_version],,
480         [AC_MSG_ERROR([
481
482         goa-1.0 not found (or version < goa_minimum_version)
483
484         If you want to disable GNOME Online Accounts support,
485         please append --disable-goa to configure.
486         ])])
487
488         AC_DEFINE(HAVE_GOA, 1, [Define to 1 if you have the goa-1.0 package.])
489 fi
490 AM_CONDITIONAL(HAVE_GOA, [test x$enable_goa = xyes])
491
492 dnl GoaPasswordBased was introduced in version 3.5.
493 if `$PKG_CONFIG --atleast-version=3.5 goa-1.0`; then
494         AC_DEFINE(HAVE_GOA_PASSWORD_BASED,1,[Have GoaPasswordBased in goa-1.0])
495 fi
496
497 dnl The "imap_smtp" provider was introduced around version 3.7.90.
498 if `$PKG_CONFIG --atleast-version=3.7.90 goa-1.0`; then
499         AC_DEFINE(HAVE_GOA_IMAP_SMTP,1,[Have IMAP/SMTP provider in goa-1.0])
500 fi
501
502 dnl ********************************
503 dnl Check for Ubuntu Online Accounts
504 dnl ********************************
505 AC_ARG_ENABLE([uoa],
506         [AS_HELP_STRING([--enable-uoa],
507         [enable Ubuntu Online Accounts support (default=yes)])],
508         [enable_uoa=$enableval], [enable_uoa=yes])
509 AC_MSG_CHECKING([if Ubuntu Online Accounts support is enabled])
510 AC_MSG_RESULT([$enable_uoa])
511 if test "x$enable_uoa" = xyes; then
512         PKG_CHECK_MODULES([LIBACCOUNTS_GLIB],
513                 [libaccounts-glib >= libaccounts_glib_minimum_version],,
514                 [AC_MSG_ERROR([
515
516         libaccounts-glib not found (or version < libaccounts_glib_minimum_version)
517
518         If you want to disable Ubuntu Online Accounts support,
519         please append --disable-uoa to configure.
520         ])])
521
522         PKG_CHECK_MODULES([LIBSIGNON_GLIB],
523                 [libsignon-glib >= libsignon_glib_minimum_version],,
524                 [AC_MSG_ERROR([
525
526         libsignon-glib not found (or version < libsignon_glib_minimum_version)
527
528         If you want to disable Ubuntu Online Accounts support,
529         please append --disable-uoa to configure.
530         ])])
531
532         PKG_CHECK_MODULES([JSON_GLIB], [json-glib-1.0],,
533                 [AC_MSG_ERROR([
534
535         json-glib-1.0 not found
536
537         If you want to disable Ubuntu Online Accounts support,
538         please append --disable-uoa to configure.
539         ])])
540
541         PKG_CHECK_MODULES([REST], [rest-0.7],,
542                 [AC_MSG_ERROR([
543
544         librest-0.7 not found
545
546         If you want to disable Ubuntu Online Accounts support,
547         please append --disable-uoa to configure.
548         ])])
549
550         AC_DEFINE(HAVE_UOA, 1, [Have libaccounts-glib])
551 fi
552 AM_CONDITIONAL(HAVE_UOA, [test x$enable_uoa = xyes])
553
554 dnl ***********************************
555 dnl Check for GNOME Keyring.
556 dnl ***********************************
557 if test x$os_win32 = xno; then
558         PKG_CHECK_MODULES(LIBSECRET,
559                 [libsecret-unstable >= libsecret_minimum_version])
560 fi
561 AC_SUBST(LIBSECRET_CFLAGS)
562 AC_SUBST(LIBSECRET_LIBS)
563
564 dnl **********************************************************
565 dnl gcr-base is needed for secure password exchange over D-Bus
566 dnl **********************************************************
567 PKG_CHECK_MODULES(GCR_BASE, [gcr-base-3 >= gcr_minimum_version])
568 AC_SUBST(GCR_BASE_CFLAGS)
569 AC_SUBST(GCR_BASE_LIBS)
570
571 LIBICAL_REQUIRED=libical_minimum_version
572 AC_SUBST(LIBICAL_REQUIRED)
573
574 dnl ******************************
575 dnl regex check
576 dnl ******************************
577 AC_CHECK_FUNCS(regexec,,[AC_CHECK_LIB(regex,regexec,
578                         [REGEX_LIBS=-lregex
579                         AC_DEFINE(HAVE_REGEXEC,1,[Define to 1 if you have the regexec function.])],
580                         [AC_MSG_ERROR([No regex library found])])])
581 AC_SUBST(REGEX_LIBS)
582
583 dnl ******************************
584 dnl libdb checking
585 dnl ******************************
586 AC_ARG_WITH([libdb],
587         AS_HELP_STRING([--with-libdb=PREFIX],
588         [Prefix where libdb is installed]),
589         [libdb_prefix="$withval"], [libdb_prefix='${prefix}'])
590
591 DB_CFLAGS="-I$libdb_prefix/include"
592 DB_LIBS="-L$libdb_prefix/lib -ldb"
593
594 AC_MSG_CHECKING([Berkeley DB])
595 save_cflags=$CFLAGS; CFLAGS=$DB_CFLAGS
596 save_libs=$LIBS; LIBS="$DB_LIBS"
597 AC_LINK_IFELSE([AC_LANG_PROGRAM(
598         [[#include <db.h>]],
599         [[db_create(NULL, NULL, 0)]])],
600         [AC_MSG_RESULT([yes])],
601         [AC_MSG_ERROR([Cannot find libdb])])
602 CFLAGS=$save_cflags
603 LIBS=$save_libs
604 AC_SUBST(DB_CFLAGS)
605 AC_SUBST(DB_LIBS)
606
607 dnl ******************************
608 dnl iconv checking
609 dnl ******************************
610 have_iconv="no"
611 save_LIBS="$LIBS"
612 LIBS="$LIBS -liconv"
613 AC_CACHE_CHECK([for iconv in -liconv], [ac_cv_libiconv],
614         AC_LINK_IFELSE([AC_LANG_PROGRAM(
615         [[
616                 #include <iconv.h>
617                 #include <stdlib.h>
618         ]],
619         [[
620                 iconv_t cd;
621                 cd = iconv_open ("UTF-8", "ISO-8859-1");
622         ]]
623         )],[ac_cv_libiconv=yes],[ac_cv_libiconv=no]))
624
625 if test "x$ac_cv_libiconv" = "xyes"; then
626         ICONV_LIBS="-liconv"
627         if test "x$os_win32" = "xyes"; then
628                 dnl Don't pointlessly auto-export the global symbols
629                 dnl from a potentially static libiconv.a
630                 ICONV_LIBS="$ICONV_LIBS -Wl,--exclude-libs=libiconv.a"
631         fi
632         have_iconv="yes"
633 else
634         LIBS="$save_LIBS"
635         AC_CHECK_FUNC(iconv, [have_iconv=yes], [have_iconv=no])
636 fi
637
638 if test "x$have_iconv" = "xyes"; then
639         if test "x$ac_cv_libiconv" = "xno"; then
640                 AC_CHECK_FUNCS(gnu_get_libc_version)
641         fi
642 AC_CACHE_CHECK([if iconv() handles UTF-8], [ac_cv_libiconv_utf8],
643         AC_RUN_IFELSE([AC_LANG_SOURCE([[
644                 #include <iconv.h>
645                 #include <stdlib.h>
646                 #include <string.h>
647                 #ifdef HAVE_GNU_GET_LIBC_VERSION
648                 #include <gnu/libc-version.h>
649                 #endif
650                 int main() {
651                         char *jp = "\x1B\x24\x42\x46\x7C\x4B\x5C\x38\x6C";
652                         char *utf8 = "\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E";
653                         char *transbuf = malloc (10), *trans = transbuf;
654                         iconv_t cd;
655                         size_t jp_len = strlen (jp), utf8_len = 10;
656                         size_t utf8_real_len = strlen (utf8);
657
658                         #ifdef HAVE_GNU_GET_LIBC_VERSION
659                         /* glibc 2.1.2's iconv is broken in hard to test ways. */
660                         if (!strcmp (gnu_get_libc_version (), "2.1.2"))
661                                 exit (1);
662                         #endif
663
664                         cd = iconv_open ("UTF-8", "ISO-2022-JP");
665                         if (cd == (iconv_t) -1)
666                                 exit (1);
667                         if (iconv (cd, &jp, &jp_len, &trans, &utf8_len) == -1 || jp_len != 0)
668                                 exit (1);
669                         if (memcmp (utf8, transbuf, utf8_real_len) != 0)
670                                 exit (1);
671                         return (0);}
672                 ]])
673         ],[ac_cv_libiconv_utf8=yes],[ac_cv_libiconv_utf8=no; have_iconv=no],[ac_cv_libiconv_utf8=hopefully]))
674 fi
675
676 if test "x$have_iconv" = "xno"; then
677         AC_MSG_ERROR([You need to install a working iconv implementation, such as ftp://ftp.gnu.org/pub/gnu/libiconv])
678 fi
679 AC_SUBST(ICONV_LIBS)
680
681 CFLAGS="$CFLAGS -I$srcdir"
682
683 AC_MSG_CHECKING([preferred charset name formats for system iconv])
684 AC_RUN_IFELSE([AC_LANG_SOURCE([[
685         #define CONFIGURE_IN
686         #include "iconv-detect.c"
687         ]])],
688         [AC_MSG_RESULT([found])],
689         [AC_MSG_RESULT([not found])
690                 AC_MSG_WARN([
691                 *** The iconv-detect program was unable to determine the
692                 *** preferred charset name formats recognized by your
693                 *** iconv library. It is suggested that you install a
694                 *** working iconv library such as the one found at
695                 *** ftp://ftp.gnu.org/pub/gnu/libiconv
696         ])],
697         [if test "x$os_win32" = xyes; then
698                 AC_MSG_RESULT([using known win32 result])
699                 echo '/* This is an auto-generated header, DO NOT EDIT! */' > iconv-detect.h
700                 echo  >>iconv-detect.h
701                 echo '#define ICONV_ISO_D_FORMAT "iso-%d-%d"' >>iconv-detect.h
702                 echo '#define ICONV_ISO_S_FORMAT "iso-%d-%s"' >>iconv-detect.h
703                 echo '#define ICONV_10646 "UCS-4BE"' >>iconv-detect.h
704         else
705                 AC_MSG_RESULT([unknown])
706                 AC_MSG_WARN([
707                 *** We can't determine the preferred charset name formats
708                 *** recognized by your iconv library. You are
709                 *** cross-compiling and supposed to know what you are doing.
710                 *** Please construct the iconv-detect.h file manually.
711                 ])
712         fi
713 ])
714
715 CFLAGS="$save_CFLAGS"
716 LIBS="$save_LIBS"
717
718 AC_ARG_ENABLE([backtraces],
719         [AS_HELP_STRING([--enable-backtraces],
720         [enable backtraces for camel_pointer_tracker (default=no)])],
721         [enable_backtraces=$enableval], [enable_backtraces=no])
722
723 if test "x$enable_backtraces" = xyes; then
724         dnl ****************************
725         dnl Check for backtrace_symbols function and dwfl from elfutils
726         dnl ****************************
727         AC_MSG_CHECKING([libc backtrace_symbols function])
728         AC_LINK_IFELSE([AC_LANG_PROGRAM(
729                 [[#include <execinfo.h>]],
730                 [[{ void *bt[1]; backtrace_symbols (bt, backtrace(bt, 1)); }]])],
731                 [AC_DEFINE(HAVE_BACKTRACE_SYMBOLS, 1, [libc provides backtrace_symbols function]) ac_cv_have_bsf=yes],[ac_cv_have_bsf=no])
732         AC_MSG_RESULT([$ac_cv_have_bsf])
733
734         if test "x$ac_cv_have_bsf" = xyes; then
735                 LIBS="$LIBS -ldw"
736
737                 AC_MSG_CHECKING([elfutils/libdwfl])
738                 AC_LINK_IFELSE([AC_LANG_PROGRAM(
739                         [[#include <elfutils/libdwfl.h>]],
740                         [[{
741                                 Dwfl *dwfl;
742                                 Dwfl_Module *module;
743                                 Dwarf_Addr module_low_addr;
744                                 Dwfl_Line *line;
745
746                                 dwfl_standard_find_debuginfo;
747                                 dwfl_linux_proc_find_elf;
748                                 dwfl_begin (NULL);
749                                 dwfl_linux_proc_report (NULL, 1);
750                                 dwfl_report_end (NULL, NULL, NULL);
751                                 dwfl_end (NULL);
752                                 dwfl_module_addrname (NULL, NULL);
753                                 dwfl_module_getsrc (NULL, NULL);
754                                 dwfl_lineinfo (NULL, NULL, NULL, NULL, NULL, NULL);
755                                 DWARF_CB_ABORT; DWARF_CB_OK;
756                                 dwfl_getmodules (NULL, NULL, NULL, 0);
757                         }]])],
758                         [AC_DEFINE(HAVE_ELFUTILS_LIBDWFL, 1, [have elfutils/libdwfl.h functions]) ac_cv_have_elfdwfl=yes],[ac_cv_have_elfdwfl=no])
759                 AC_MSG_RESULT([$ac_cv_have_elfdwfl])
760
761                 LIBS="$save_LIBS"
762
763                 if test "x$ac_cv_have_elfdwfl" = xyes; then
764                         LIBDWFL_LIBS="-ldw"
765                         AC_SUBST(LIBDWFL_LIBS)
766                 fi
767         fi
768 fi
769
770 dnl ******************************
771 dnl Check for nl_langinfo features
772 dnl ******************************
773 EVO_CHECK_LANGINFO([CODESET])
774 EVO_CHECK_LANGINFO([_NL_ADDRESS_COUNTRY_AB2])
775
776 dnl *******************************************************
777 dnl Check to see if strftime supports the use of %l and %k
778 dnl *******************************************************
779 AC_MSG_CHECKING([for %l and %k support in strftime])
780 AC_RUN_IFELSE([AC_LANG_SOURCE(
781         [[      #include <stdlib.h>
782                 #include <string.h>
783                 #include <time.h>
784                 int main(int argc, char **argv) {
785                 char buf[10];
786                 time_t rawtime;
787                 struct tm *timeinfo;
788
789                 time(&rawtime);
790                 timeinfo=localtime(&rawtime);
791                 buf[0] = '\0';
792                 strftime(buf, 10, "%lx%k", timeinfo);
793
794                 if (buf[0] == '\0' || buf[0] == 'x' || strstr(buf, "l") || strstr(buf, "k"))
795                         exit(1);
796                 else
797                         exit(0);
798                 return 0;
799                 }
800         ]]
801         )],[AC_DEFINE(HAVE_LKSTRFTIME, 1, [strftime supports use of l and k]) ac_cv_lkstrftime=yes],[ac_cv_lkstrftime=no],[ac_cv_lkstrftime=no])
802 AC_MSG_RESULT([$ac_cv_lkstrftime])
803
804 dnl ********************************************************************************
805 dnl security extension support (SSL and S/MIME)
806 dnl
807 dnl The following voodoo does detection of mozilla libraries (nspr and nss)
808 dnl needed by Camel (SSL and S/MIME).
809 dnl
810 dnl The Evolution security extensions are only built if these libraries are found
811 dnl ********************************************************************************
812 msg_smime="no"
813
814 AC_ARG_ENABLE([smime],
815         AS_HELP_STRING([--enable-smime],
816         [Enable SMIME support through Mozilla nss @<:@default=yes@:>@ ]),
817         [enable_smime="$enableval"],[enable_smime="yes"])
818
819 AC_ARG_WITH([nspr-includes],
820         AS_HELP_STRING([--with-nspr-includes],
821         [Prefix of Mozilla nspr4 includes.]),
822         [with_nspr_includes="$withval"])
823
824 AC_ARG_WITH([nspr-libs],
825         AS_HELP_STRING([--with-nspr-libs],
826         [Prefix of Mozilla nspr4 libs.]),
827         [with_nspr_libs="$withval"])
828
829 AC_ARG_WITH([nss-includes],
830         AS_HELP_STRING([--with-nss-includes],
831         [Prefix of Mozilla nss3 includes.]),
832         [with_nss_includes="$withval"])
833
834 AC_ARG_WITH([nss-libs],
835         AS_HELP_STRING([--with-nss-libs],
836         [Prefix of Mozilla nss3 libs.]),
837         [with_nss_libs="$withval"])
838
839 if test -n "${with_nspr_includes}" || test -n "${with_nspr_libs}" || test -n "${with_nss_includes}" || test -n "${with_nss_libs}"; then
840         check_manually="yes"
841 else
842         check_manually="no"
843 fi
844
845 dnl check if pkg-config files exist (which are only shipped by distributions, not upstream)
846 if test "x${check_manually}" = "xno"; then
847         AC_MSG_CHECKING(Mozilla NSPR pkg-config module name)
848         mozilla_nspr_pcs="nspr mozilla-nspr firefox-nspr xulrunner-nspr seamonkey-nspr"
849         for pc in $mozilla_nspr_pcs; do
850                 if $PKG_CONFIG --exists $pc; then
851                         AC_MSG_RESULT($pc)
852                         mozilla_nspr=$pc
853                         break;
854                 fi
855         done
856
857         AC_MSG_CHECKING(Mozilla NSS pkg-config module name)
858         mozilla_nss_pcs="nss mozilla-nss firefox-nss xulrunner-nss seamonkey-nss"
859         for pc in $mozilla_nss_pcs; do
860                 if $PKG_CONFIG --exists $pc; then
861                         AC_MSG_RESULT($pc)
862                         mozilla_nss=$pc
863                         break;
864                 fi
865         done
866
867         if test -n "$mozilla_nspr" -a -n "$mozilla_nss"; then
868                 if test "x$enable_smime" = "xyes"; then
869                         AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled])
870                         msg_smime="yes"
871                 fi
872                 MANUAL_NSPR_CFLAGS=""
873                 MANUAL_NSPR_LIBS=""
874                 MANUAL_NSS_CFLAGS=""
875                 MANUAL_NSS_LIBS=""
876         else
877                 check_manually="yes"
878                 mozilla_nspr=""
879                 mozilla_nss=""
880         fi
881 fi
882
883 if test "x${check_manually}" = "xyes"; then
884 dnl ******************
885 dnl Check for NSPR 4
886 dnl ******************
887         AC_MSG_CHECKING([for Mozilla nspr4 includes])
888                 CPPFLAGS_save="$CPPFLAGS"
889                 if test -n "$with_nspr_includes"; then
890                         CPPFLAGS="$CPPFLAGS -I$with_nspr_includes"
891                 fi
892
893                 AC_CHECK_HEADERS(nspr.h prio.h,
894                 [moz_nspr_includes="yes"],[moz_nspr_includes="no"])
895                 CPPFLAGS="$CPPFLAGS_save"
896
897                 if test "x${moz_nspr_includes}" = "xyes"; then
898                         MANUAL_NSPR_CFLAGS="-I$with_nspr_includes"
899                 else
900                         AC_MSG_FAILURE([NSPR headers not found. Use --with-nspr-includes to specify the include dir of NSPR.])
901                 fi
902         AC_MSG_RESULT([$moz_nspr_includes])
903
904         AC_MSG_CHECKING([for Mozilla nspr libraries])
905                 CFLAGS_save="$CFLAGS"
906                 LDFLAGS_save="$LDFLAGS"
907                 LIBS_save="$LIBS"
908                 nsprlibs="$DL_LIB -lplc4 -lplds4 -lnspr4"
909
910                 CFLAGS="$CFLAGS $MANUAL_NSPR_CFLAGS"
911                 LIBS="$nsprlibs"
912                 dnl Test to protect from giving libtool an -L , which results in failure (used below,too)
913                 if test -n "${with_nspr_libs}"; then
914                         LDFLAGS="$LDFLAGS -L$with_nspr_libs"
915                 else
916                         LDFLAGS="$LDFLAGS"
917                 fi
918
919                 AC_LINK_IFELSE([AC_LANG_CALL([],[PR_Init])],
920                 [moz_nspr_libs="yes"],[moz_nspr_libs="no"])
921
922                 CFLAGS="$CFLAGS_save"
923                 LDFLAGS="$LDFLAGS_save"
924                 LIBS="$LIBS_save"
925
926                 if test "x${moz_nspr_libs}" = "xyes"; then
927                         if test -n "${with_nspr_libs}"; then
928                                 MANUAL_NSPR_LIBS="-L$with_nspr_libs $nsprlibs"
929                         else
930                                 MANUAL_NSPR_LIBS="$nsprlibs"
931                         fi
932                 else
933                         AC_MSG_FAILURE([NSPR libs not found. Use --with-nspr-libs to specify the libdir of NSPR.])
934                 fi
935         AC_MSG_RESULT([$moz_nspr_libs])
936
937 dnl *****************
938 dnl Check for NSS 3
939 dnl *****************
940         AC_MSG_CHECKING([for Mozilla nss3 includes])
941                 CPPFLAGS_save="$CPPFLAGS"
942                 CPPFLAGS="$CPPFLAGS -I$with_nspr_includes -I$with_nss_includes"
943
944                 AC_CHECK_HEADERS(nss.h ssl.h smime.h,
945                 [moz_nss_includes="yes"],[moz_nss_includes="no"])
946                 CPPFLAGS="$CPPFLAGS_save"
947
948                 if test "x${moz_nss_includes}" = "xyes"; then
949                         MANUAL_NSS_CFLAGS="-I$with_nss_includes"
950                 else
951                         AC_MSG_FAILURE([NSS headers not found. Use --with-nss-includes to specify the include dir of NSS.])
952                 fi
953         AC_MSG_RESULT($moz_nss_includes)
954
955         AC_MSG_CHECKING([for Mozilla nss libraries])
956                 LDFLAGS_save="$LDFLAGS"
957                 LIBS_save="$LIBS"
958                 nsslibs="-lssl3 -lsmime3 -lnss3"
959
960                 LIBS="$nsslibs $nsprlibs"
961                 dnl Test to protect from giving libtool an -L , which results in failure (used below,too)
962                 if test -n "${with_nss_libs}"; then
963                         LDFLAGS="$LDFLAGS -L$with_nss_libs $MANUAL_NSPR_LIBS"
964                 else
965                         LDFLAGS="$LDFLAGS $LDFLAGS_NSPR $MANUAL_NSPR_LIBS"
966                 fi
967
968                 AC_LINK_IFELSE([AC_LANG_CALL([],[NSS_Init])],
969                 [moz_nss_libs="yes"],[moz_nss_libs="no"])
970                 LDFLAGS="$LDFLAGS_save"
971                 LIBS="$LIBS_save"
972
973                 if test "x${moz_nss_libs}" = "xyes"; then
974                         if test "x${enable_smime}" = "xyes"; then
975                                 AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled])
976                                 msg_smime="yes"
977                         fi
978                         if test -n "${with_nss_libs}"; then
979                                 MANUAL_NSS_LIBS="-L$with_nss_libs $nsslibs"
980                         else
981                                 MANUAL_NSS_LIBS="$nsslibs"
982                         fi
983                 else
984                         AC_MSG_FAILURE([NSS libs not found. Use --with-nss-libs to specify the libdir of NSS.])
985                 fi
986         AC_MSG_RESULT([$moz_nss_libs])
987
988         MANUAL_NSS_CFLAGS="$MANUAL_NSPR_CFLAGS $MANUAL_NSS_CFLAGS"
989         MANUAL_NSS_LIBS="$MANUAL_NSPR_LIBS $MANUAL_NSS_LIBS"
990 fi
991
992 AM_CONDITIONAL(ENABLE_SMIME, test "x$msg_smime" != "xno")
993
994 dnl For pkgconfig files.
995 AC_SUBST(mozilla_nss)
996 AC_SUBST(mozilla_nspr)
997
998 AC_SUBST(MANUAL_NSPR_CFLAGS)
999 AC_SUBST(MANUAL_NSPR_LIBS)
1000 AC_SUBST(MANUAL_NSS_CFLAGS)
1001 AC_SUBST(MANUAL_NSS_LIBS)
1002
1003 dnl ******************************
1004 dnl system mail stuff
1005 dnl ******************************
1006 AC_PATH_PROG(SENDMAIL, sendmail, [/usr/sbin/sendmail], [/usr/sbin:/usr/lib])
1007 AC_DEFINE_UNQUOTED(SENDMAIL_PATH, "$SENDMAIL", [Path to a sendmail binary, or equivalent])
1008
1009 AC_MSG_CHECKING([system mail directory])
1010 if test -d /var/mail -a '!' -h /var/mail ; then
1011         system_mail_dir="/var/mail"
1012 else
1013         system_mail_dir="/var/spool/mail"
1014 fi
1015 AC_DEFINE_UNQUOTED(SYSTEM_MAIL_DIR, "$system_mail_dir", [Directory local mail is delivered to])
1016
1017 case `ls -ld $system_mail_dir 2>&1 | awk '{print $1;}'` in
1018         d??????rw?)
1019                 CAMEL_LOCK_HELPER_USER=""
1020                 CAMEL_LOCK_HELPER_GROUP=""
1021                 system_mail_perm="world writable"
1022         ;;
1023         d???rw????)
1024                 CAMEL_LOCK_HELPER_USER=""
1025                 CAMEL_LOCK_HELPER_GROUP=`ls -ld $system_mail_dir 2>&1 | awk '{print $4;}'`
1026                 system_mail_perm="writable by group $CAMEL_LOCK_HELPER_GROUP"
1027         ;;
1028         drw???????)
1029                 CAMEL_LOCK_HELPER_USER=`ls -ld $system_mail_dir 2>&1 | awk '{print $3;}'`
1030                 CAMEL_LOCK_HELPER_GROUP=""
1031                 system_mail_perm="writable by user $CAMEL_LOCK_HELPER_USER"
1032         ;;
1033         *)
1034                 CAMEL_LOCK_HELPER_USER=""
1035                 CAMEL_LOCK_HELPER_GROUP=""
1036                 system_mail_perm="???"
1037         ;;
1038 esac
1039
1040 AC_MSG_RESULT([$system_mail_dir, $system_mail_perm])
1041 AC_SUBST(CAMEL_LOCK_HELPER_USER)
1042 AC_SUBST(CAMEL_LOCK_HELPER_GROUP)
1043
1044 dnl ******************************
1045 dnl Timezone checks
1046 dnl ******************************
1047 AC_CACHE_CHECK(for tm_gmtoff in struct tm, [ac_cv_struct_tm_gmtoff],
1048         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1049         [[      #include <time.h>       ]],
1050         [[
1051                 struct tm tm;
1052                 tm.tm_gmtoff = 1;
1053         ]]
1054         )],[ac_cv_struct_tm_gmtoff=yes],[ac_cv_struct_tm_gmtoff=no]))
1055 if test "x$ac_cv_struct_tm_gmtoff" = "xyes"; then
1056         AC_DEFINE(HAVE_TM_GMTOFF, 1, [Define if struct tm has a tm_gmtoff member])
1057 else
1058         AC_CACHE_CHECK(for timezone variable, [ac_cv_var_timezone],
1059                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1060                 [[      #include <time.h> ]],
1061                 [[      timezone = 1;   ]]
1062                 )],[ac_cv_var_timezone=yes],[ac_cv_var_timezone=no]))
1063         if test "x$ac_cv_var_timezone" = "xyes"; then
1064                 AC_DEFINE(HAVE_TIMEZONE, 1, [Define if libc defines a timezone variable])
1065                 AC_CACHE_CHECK(for altzone variable, [ac_cv_var_altzone],
1066                         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1067                         [[      #include <time.h>       ]],
1068                         [[      altzone = 1; ]]
1069                         )],[ac_cv_var_altzone=yes],[ac_cv_var_altzone=no]))
1070                 if test "x$ac_cv_var_altzone" = "xyes"; then
1071                         AC_DEFINE(HAVE_ALTZONE, 1, [Define if libc defines an altzone variable])
1072                 fi
1073         else
1074                 AC_MSG_ERROR([unable to find a way to determine timezone])
1075         fi
1076 fi
1077
1078 dnl ******************************
1079 dnl ctime_r prototype
1080 dnl ******************************
1081 AC_CACHE_CHECK([if ctime_r wants three arguments], [ac_cv_ctime_r_three_args],
1082 [
1083         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1084         [[      #include <time.h> ]],
1085         [[      char *buf;
1086                 time_t date;
1087                 ctime_r (&date, buf, 100); ]]
1088         )],[ac_cv_ctime_r_three_args=yes],[ac_cv_ctime_r_three_args=no])
1089 ])
1090
1091 if test "x$ac_cv_ctime_r_three_args" = "xyes" ; then
1092         AC_DEFINE(CTIME_R_THREE_ARGS, 1, [Solaris-style ctime_r])
1093 fi
1094
1095 dnl ******************************
1096 dnl gethostbyname_r prototype
1097 dnl ******************************
1098 AC_CHECK_FUNCS(gethostbyname_r,[
1099 AC_CACHE_CHECK([if gethostbyname_r wants five arguments], [ac_cv_gethostbyname_r_five_args],
1100 [
1101         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1102         [[
1103                 #include "confdefs.h"
1104                 #include <sys/types.h>
1105                 #include <sys/socket.h>
1106                 #include <netinet/in.h>
1107                 #include <netdb.h>
1108                 #define BUFSIZE (sizeof(struct hostent)+10)
1109         ]],
1110         [[
1111                 struct hostent hent;
1112                 char buffer[BUFSIZE];
1113                 int bufsize=BUFSIZE;
1114                 int h_errno;
1115                 (void)gethostbyname_r ("www.ximian.com", &hent, buffer, bufsize, &h_errno);
1116         ]]
1117         )],[ac_cv_gethostbyname_r_five_args=yes],[ac_cv_gethostbyname_r_five_args=no])
1118 ])])
1119
1120 if test "x$ac_cv_gethostbyname_r_five_args" = "xyes" ; then
1121         AC_DEFINE(GETHOSTBYNAME_R_FIVE_ARGS, 1, [Solaris-style gethostbyname_r])
1122 fi
1123
1124 dnl ******************************
1125 dnl gethostbyaddr_r prototype
1126 dnl ******************************
1127 AC_CHECK_FUNCS(gethostbyaddr_r,[
1128 AC_CACHE_CHECK([if gethostbyaddr_r wants seven arguments], [ac_cv_gethostbyaddr_r_seven_args],
1129 [
1130         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1131         [[
1132                 #include "confdefs.h"
1133                 #include <sys/types.h>
1134                 #include <sys/socket.h>
1135                 #include <netinet/in.h>
1136                 #include <netdb.h>
1137                 #define BUFSIZE (sizeof(struct hostent)+10)
1138         ]],
1139         [[
1140                 struct hostent hent;
1141                 char buffer[BUFSIZE];
1142                 int bufsize=BUFSIZE;
1143                 int h_errno;
1144                 (void)gethostbyaddr_r ("www.ximian.com", 14, AF_INET, &hent, buffer, bufsize, &h_errno); ]]
1145         )],[ac_cv_gethostbyaddr_r_seven_args=yes],[ac_cv_gethostbyaddr_r_seven_args=no])
1146 ])])
1147
1148 if test "x$ac_cv_gethostbyaddr_r_seven_args" = "xyes" ; then
1149         AC_DEFINE(GETHOSTBYADDR_R_SEVEN_ARGS, 1, [Solaris-style gethostbyaddr_r])
1150 fi
1151
1152 dnl ******************************
1153 dnl stat(v)fs location/type
1154 dnl ******************************
1155 AC_CHECK_HEADER([sys/statvfs.h],
1156         [AC_DEFINE([HAVE_SYS_STATVFS_H], 1, [Have <sys/statvfs.h>])],,
1157         [[      #if HAVE_SYS_STATVFS_H
1158                 #include <sys/statvfs.h>
1159                 #endif
1160         ]])
1161 AC_CHECK_FUNCS(statvfs)
1162
1163 AC_CHECK_HEADER([sys/param.h],
1164         [AC_DEFINE([HAVE_SYS_PARAM_H], 1, [Have <sys/param.h>])],,
1165         [[      #if HAVE_SYS_PARAM_H
1166                 #include <sys/param.h>
1167                 #endif
1168         ]])
1169 AC_CHECK_HEADER([sys/mount.h],
1170         [AC_DEFINE([HAVE_SYS_MOUNT_H], 1, [Have <sys/mount.h>])],,
1171         [[      #if HAVE_SYS_MOUNT_H
1172                 #include <sys/mount.h>
1173                 #endif
1174         ]])
1175 AC_CHECK_FUNCS(statfs)
1176
1177 dnl ******************************
1178 dnl IPv6 support and getaddrinfo calls
1179 dnl ******************************
1180 AC_CACHE_CHECK([if system supports getaddrinfo and getnameinfo], [ac_cv_have_addrinfo],
1181 [
1182         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1183         [[      #include "confdefs.h"
1184                 #include <sys/types.h>
1185                 #include <sys/socket.h>
1186                 #include <netinet/in.h>
1187                 #include <netdb.h>
1188                 #include <stddef.h>
1189         ]],
1190         [[      #ifndef NI_MAXHOST
1191                 #define NI_MAXHOST      1025
1192                 #endif
1193
1194                 #ifndef NI_MAXSERV
1195                 #define NI_MAXSERV      32
1196                 #endif
1197
1198                 struct addrinfo hints, *res;
1199                 struct sockaddr_in6 sin6;
1200                 int af = AF_INET6;
1201                 char host[NI_MAXHOST];
1202                 char serv[NI_MAXSERV];
1203
1204                 getaddrinfo ("www.ximian.com", NULL, &hints, &res);
1205                 freeaddrinfo (res);
1206                 getnameinfo((struct sockaddr *)&sin6, sizeof(sin6), host, sizeof(host), serv, sizeof(serv), 0); ]]
1207         )],[ac_cv_have_addrinfo=yes],[ac_cv_have_addrinfo=no])
1208 ])
1209
1210 if test "x$ac_cv_have_addrinfo" = "xno" ; then
1211         AC_DEFINE(NEED_ADDRINFO,1,[Enable getaddrinfo emulation])
1212         if test "x$enable_ipv6" = "xyes" ; then
1213                 AC_MSG_ERROR([system doesn't support necessary interfaces for ipv6 support])
1214         fi
1215         msg_ipv6="no"
1216 else
1217         AC_ARG_ENABLE([ipv6],
1218         AS_HELP_STRING([--enable-ipv6=no/yes],
1219         [Enable support for resolving IPv6 addresses.]),
1220         [enable_ipv6=$enableval],[enable_ipv6=yes])
1221         if test "x$enable_ipv6" = "xyes"; then
1222                 msg_ipv6="yes"
1223                 AC_DEFINE(ENABLE_IPv6,1,[Enable IPv6 support])
1224                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1225                 [[      #include "confdefs.h"
1226                         #include <sys/types.h>
1227                         #include <sys/socket.h>
1228                         #include <netinet/in.h>
1229                         #include <netdb.h>
1230                 ]],
1231                 [[      struct addrinfo hints;
1232                         hints.ai_flags = AI_ADDRCONFIG;
1233                 ]]
1234                 )],[AC_DEFINE(HAVE_AI_ADDRCONFIG,1,[Define if the system defines the AI_ADDRCONFIG flag for getaddrinfo])],[])
1235         else
1236                 msg_ipv6="no"
1237         fi
1238 fi
1239
1240 AM_CONDITIONAL(ENABLE_IPv6, [test "x$enable_ipv6" = "xyes"])
1241
1242 AC_CHECK_HEADER([wspiapi.h],
1243         [AC_DEFINE([HAVE_WSPIAPI_H], 1, [Have <wspiapi.h>])],,)
1244
1245 dnl **********************************
1246 dnl Weather calendar backend support
1247 dnl **********************************
1248 AC_MSG_CHECKING([if we should build the weather calendar backend])
1249 AC_ARG_ENABLE([weather],
1250         [AS_HELP_STRING([--enable-weather],
1251         [Build the weather calendar backend (default=yes)])],
1252         [use_gweather=$enableval], [use_gweather=yes])
1253
1254 AC_MSG_RESULT([$use_gweather])
1255 if test "x$use_gweather" = "xyes"; then
1256         PKG_CHECK_MODULES([LIBGWEATHER], [gweather-3.0 >= gweather_minimum_version],[],
1257         [AC_MSG_ERROR([The weather calendar backend requires GWeather >= gweather_minimum_version. Alternatively, you may specify --disable-weather as a configure option to avoid building the backend.])])
1258 fi
1259 AM_CONDITIONAL(ENABLE_WEATHER, [test $use_gweather = yes])
1260
1261 dnl ******************************
1262 dnl NNTP support.
1263 dnl ******************************
1264 AC_ARG_ENABLE([nntp],
1265         AS_HELP_STRING([--enable-nntp],
1266         [Build Usenet news (NNTP) backend]),
1267         [enable_nntp=$enableval],[enable_nntp=yes])
1268 if test "x$enable_nntp" = "xyes"; then
1269         AC_DEFINE(ENABLE_NNTP,1,[Build NNTP backend])
1270         msg_nntp="yes"
1271 else
1272         msg_nntp="no"
1273 fi
1274 AM_CONDITIONAL(ENABLE_NNTP, [test x$enable_nntp = xyes])
1275
1276 AC_DEFINE(HANDLE_LIBICAL_MEMORY, 1, [Define it once memory returned by libical is free'ed properly])
1277
1278 dnl ******************************
1279 dnl File locking
1280 dnl ******************************
1281 AC_ARG_ENABLE([dot-locking],
1282         AS_HELP_STRING([--enable-dot-locking=yes/no],
1283         [Enable support for locking mail files with dot locking]),
1284         [enable_dot_locking=$enableval],[enable_dot_locking=yes])
1285
1286 if test "x$os_win32" != "xyes" -a "x$enable_dot_locking" = "xyes"; then
1287         AC_DEFINE(USE_DOT,1,[Define to use dot locking for mbox files])
1288         msg_dot="yes"
1289 else
1290         msg_dot="no"
1291 fi
1292
1293 AC_ARG_ENABLE([file-locking],
1294         AS_HELP_STRING([--enable-file-locking=fcntl/flock/no],
1295         [Enable support for locking mail files with file locking]),
1296         [],[enable_file_locking=fcntl])
1297
1298 if test "x$os_win32" != "xyes" -a "x$enable_file_locking" = "xfcntl"; then
1299         AC_DEFINE(USE_FCNTL,1,[Define to use fcntl locking for mbox files])
1300         msg_file="fcntl"
1301 else
1302         if test "x$os_win32" != "xyes" -a "x$enable_file_locking" = "xflock"; then
1303                 AC_DEFINE(USE_FLOCK,1,[Define to use flock locking for mbox files])
1304                 msg_file="flock"
1305         else
1306                 msg_file="no"
1307         fi
1308 fi
1309
1310 dnl ******************************
1311 dnl sendmail operation
1312 dnl ******************************
1313 AC_MSG_CHECKING([for SunOS broken spool format])
1314 if test "x$host_os" = "xsunos" ; then
1315         with_broken_spool="yes"
1316 fi
1317
1318 AC_ARG_WITH([broken-spool],
1319         AS_HELP_STRING([--with-broken-spool=yes/no],
1320         [Using SunOS/Solaris sendmail which has a broken spool format]),
1321         [with_broken_spool=$enableval],[with_broken_spool=${with_broken_spool:=no}])
1322
1323 if test "x$with_broken_spool" = "xyes"; then
1324         AC_DEFINE(HAVE_BROKEN_SPOOL,1,[Define if mail delivered to the system mail directory is in broken Content-Length format])
1325 fi
1326
1327 AC_MSG_RESULT([$with_broken_spool])
1328
1329 dnl ***********
1330 dnl Kerberos 5
1331 dnl ***********
1332 EVO_KRB5_SUPPORT(no)
1333
1334 dnl ******************************
1335 dnl Purify support
1336 dnl ******************************
1337 EVO_PURIFY_SUPPORT
1338
1339 dnl ******************************
1340 dnl LDAP support.
1341 dnl ******************************
1342 if test "x$os_win32" != "xyes"; then
1343         EVO_LDAP_CHECK(no)
1344         case $with_openldap in
1345         no)
1346                 msg_ldap="no"
1347         ;;
1348         *)
1349                 case $with_static_ldap in
1350                 yes)
1351                         msg_ldap="$with_openldap (static)"
1352                         ;;
1353                 *)
1354                         msg_ldap="$with_openldap (dynamic)"
1355                         ;;
1356                 esac
1357         esac
1358
1359 dnl SunLDAP support, but if OpenLDAP support, skip check SunLDAP.
1360         if test "x$with_openldap" = "xno" ; then
1361                 EVO_SUNLDAP_CHECK(no)
1362                 case $with_sunldap in
1363                 no)
1364                         msg_ldap="no"
1365                         ;;
1366                 *)
1367                         case $with_static_sunldap in
1368                         yes)
1369                                 msg_ldap="$with_sunldap (static)"
1370                                 ;;
1371                         *)
1372                                 msg_ldap="$with_sunldap (dynamic)"
1373                                 ;;
1374                 esac
1375         esac
1376         else
1377                 with_sunldap="no"
1378         fi
1379         AM_CONDITIONAL(SUNLDAP, [test "$with_sunldap" != no])
1380
1381         LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_DEPRECATED"
1382 else
1383         dnl Win32 LDAP support
1384         LDAP_CFLAGS="-DLDAP_DEPRECATED"
1385         LDAP_LIBS="-lwldap32"
1386         AC_SUBST(LDAP_CFLAGS)
1387         AC_SUBST(LDAP_LIBS)
1388         AC_DEFINE(HAVE_LDAP,1,[Define if you have LDAP support])
1389         AM_CONDITIONAL(ENABLE_LDAP, true)
1390         AM_CONDITIONAL(SUNLDAP, false)
1391         msg_ldap="yes"
1392 fi
1393
1394 dnl ******************************
1395 dnl GObject marshalling
1396 dnl ******************************
1397 AM_PATH_GLIB_2_0
1398
1399 dnl We use AC_SUBST_FILE because AC_SUBST won't deal with newlines
1400 EVO_MARSHAL_RULE=$srcdir/marshal.mk
1401 AC_SUBST_FILE(EVO_MARSHAL_RULE)
1402
1403 dnl ******************************
1404 dnl Utility macro to set compiler flags for a specific lib.
1405 dnl EVO_SET_COMPILE_FLAGS(VAR-PREFIX, DEPS, EXTRA-CFLAGS, EXTRA-LIBS)
1406 dnl ******************************
1407 AC_DEFUN([EVO_SET_COMPILE_FLAGS], [
1408         PKG_CHECK_MODULES([$1], [$2])
1409         $1_CFLAGS="[$]$1_CFLAGS $3 "
1410         $1_LIBS="[$]$1_LIBS $4 "
1411 ])
1412
1413 dnl ******************************
1414 dnl sqlite3 flags
1415 dnl ******************************
1416 PKG_CHECK_MODULES(SQLITE3, [sqlite3 >= sqlite_minimum_version])
1417
1418 if test "x$enable_maintainer_mode" = "xyes" ; then
1419         EVO_SET_COMPILE_FLAGS(FACTORY_GTK, "gtk+-3.0")
1420         AC_SUBST(FACTORY_GTK_CFLAGS)
1421         AC_SUBST(FACTORY_GTK_LIBS)
1422 fi
1423
1424 dnl ******************************
1425 dnl libedataserver flags
1426 dnl ******************************
1427 E_DATA_SERVER_DEPS="gio-2.0 gmodule-2.0 libsecret-1 libxml-2.0 libsoup-2.4 $mozilla_nspr"
1428
1429 EVO_SET_COMPILE_FLAGS(E_DATA_SERVER, $E_DATA_SERVER_DEPS, $MANUAL_NSPR_CFLAGS, $MANUAL_NSPR_LIBS)
1430 AC_SUBST(E_DATA_SERVER_CFLAGS)
1431 AC_SUBST(E_DATA_SERVER_LIBS)
1432
1433 dnl ******************************
1434 dnl libebackend flags
1435 dnl ******************************
1436 E_BACKEND_DEPS="gio-2.0 gmodule-2.0 libsecret-1 libsoup-2.4 libxml-2.0"
1437
1438 EVO_SET_COMPILE_FLAGS(E_BACKEND, $E_BACKEND_DEPS)
1439 AC_SUBST(E_BACKEND_CFLAGS)
1440 AC_SUBST(E_BACKEND_LIBS)
1441
1442 dnl ******************************
1443 dnl evolution-addressbook flags
1444 dnl ******************************
1445 EVOLUTION_ADDRESSBOOK_DEPS="gio-2.0 libxml-2.0 libsoup-2.4 libsecret-1"
1446
1447 EVO_SET_COMPILE_FLAGS(EVOLUTION_ADDRESSBOOK, $EVOLUTION_ADDRESSBOOK_DEPS)
1448 AC_SUBST(EVOLUTION_ADDRESSBOOK_CFLAGS)
1449 AC_SUBST(EVOLUTION_ADDRESSBOOK_LIBS)
1450
1451 dnl ******************************
1452 dnl evolution-calendar flags
1453 dnl ******************************
1454 EVOLUTION_CALENDAR_DEPS="gio-2.0 libical >= libical_minimum_version libsoup-2.4 libxml-2.0 libsecret-1"
1455
1456 dnl *****
1457 dnl libical.pc from libical-0.43 has a bug in it's CFlags.
1458 dnl It wants apps to include <libical/ical*.h> but it's CFlags make it difficult
1459 dnl to differentiate between <libical/ical.h> and <ical.h>
1460 dnl We have fixed all our instances to use <libical/ical.h>. Until the .pc from
1461 dnl libical is fixed, we have to work-around the buggy CFlags.
1462 dnl *****
1463         LIBICAL_EXTRA_CFLAGS=" -I`$PKG_CONFIG --variable=includedir libical` "
1464         LIBICAL_EXTRA_LIBS=""
1465         AC_SUBST(LIBICAL_EXTRA_CFLAGS)
1466         AC_SUBST(LIBICAL_EXTRA_LIBS)
1467
1468         EVO_SET_COMPILE_FLAGS(EVOLUTION_CALENDAR, $EVOLUTION_CALENDAR_DEPS, $LIBICAL_EXTRA_CFLAGS, $LIBICAL_EXTRA_LIBS)
1469         AC_SUBST(EVOLUTION_CALENDAR_CFLAGS)
1470         AC_SUBST(EVOLUTION_CALENDAR_LIBS)
1471
1472         dnl ****************************
1473         dnl Check for ical_set_unknown_token_handling_setting function
1474         dnl ****************************
1475         AC_MSG_CHECKING([ical_set_unknown_token_handling_setting function])
1476         save_cflags=$CFLAGS; CFLAGS=$EVOLUTION_CALENDAR_CFLAGS
1477         save_libs=$LIBS; LIBS="$EVOLUTION_CALENDAR_LIBS"
1478         AC_LINK_IFELSE([AC_LANG_PROGRAM(
1479                 [[#include <libical/ical.h>]],
1480                 [[ical_set_unknown_token_handling_setting (ICAL_DISCARD_TOKEN)]])],
1481                 [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])
1482         CFLAGS=$save_cflags
1483         LIBS=$save_libs
1484         AC_MSG_RESULT([$ac_cv_have_iuth])
1485
1486 dnl ******************************
1487 dnl Google flags
1488 dnl ******************************
1489 LIBGDATA_REQUIRED=libgdata_minimum_version
1490 AC_SUBST(LIBGDATA_REQUIRED)
1491 AC_ARG_ENABLE([google],
1492         [AS_HELP_STRING([--enable-google],
1493         [enable Google Contacts support (default=yes)])],
1494         [enable_google=$enableval], [enable_google=yes])
1495 AC_MSG_CHECKING([if Google Contacts support is enabled])
1496 AC_MSG_RESULT([$enable_google])
1497 if test "x$enable_google" = xyes; then
1498         EVO_SET_COMPILE_FLAGS(GDATA, libgdata >= libgdata_minimum_version)
1499         AC_SUBST(GDATA_CFLAGS)
1500         AC_SUBST(GDATA_LIBS)
1501
1502         AC_DEFINE(HAVE_GOOGLE, 1, [Define to 1 if you have the google-1.0 package.])
1503 fi
1504 AM_CONDITIONAL(HAVE_GOOGLE, [test x$enable_google = xyes])
1505
1506 EVO_SET_COMPILE_FLAGS(SOUP, libsoup-2.4)
1507 AC_SUBST(SOUP_CFLAGS)
1508 AC_SUBST(SOUP_LIBS)
1509
1510 dnl ******************************
1511 dnl Camel flags
1512 dnl ******************************
1513 SQLITE_REQUIRED=sqlite_minimum_version
1514 AC_SUBST(SQLITE_REQUIRED)
1515
1516 zlib_found="false"
1517 dnl deflateInit is a #define, use deflateEnd instead
1518 AC_CHECK_LIB([z], [deflateEnd], [AC_CHECK_HEADER(zlib.h, [zlib_found=true])])
1519
1520 if test "x$zlib_found" = "xfalse"; then
1521         AC_MSG_ERROR([*** zlib is required])
1522 fi
1523
1524 dnl ******************************
1525 dnl Checks for large file support
1526 dnl ******************************
1527 AC_ARG_ENABLE([largefile],
1528         AS_HELP_STRING([--enable-largefile],
1529         [enable support for large files [[default=no]]]),
1530         [],[enable_largefile="yes"])
1531
1532 if test "x$enable_largefile" != "xno"; then
1533         AC_SYS_LARGEFILE
1534         AC_CACHE_CHECK([for _LARGEFILE64_SOURCE value needed for large files], [ac_cv_largefile64_source],
1535         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1536         [[      #include <sys/types.h>
1537                 #include <sys/stat.h>
1538                 #include <fcntl.h>
1539         ]],
1540         [[      int fd = open ("__o_largefile", O_CREAT | O_RDWR | O_LARGEFILE, 0644);  ]]
1541         )],[ac_cv_largefile64_source="no"],
1542                 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1543                 [[      #define _LARGEFILE64_SOURCE
1544                         #include <sys/types.h>
1545                         #include <sys/stat.h>
1546                         #include <fcntl.h>
1547                 ]],
1548                 [[ int fd = open ("__o_largefile", O_CREAT | O_RDWR | O_LARGEFILE, 0644); ]])],[ac_cv_largefile64_source="yes"],
1549                 [ac_cv_largefile64_source="unknown"])])
1550         ])
1551
1552         enable_largefile="no"
1553
1554         if test "x$ac_cv_largefile64_source" = "xyes"; then
1555                 LARGEFILE_CFLAGS="-D_LARGEFILE64_SOURCE"
1556                 enable_largefile="yes"
1557         elif test "x$ac_cv_largefile64_source" = "xunknown"; then
1558                 AC_DEFINE(O_LARGEFILE, 0, [Define to 0 if your system does not have the O_LARGEFILE flag])
1559         fi
1560
1561         if test -n "$ac_cv_sys_large_files" -a "x$ac_cv_sys_large_files" != "xno"; then
1562                 LARGEFILE_CFLAGS="$LARGEFILE_CFLAGS -D_LARGE_FILES"
1563                 enable_largefile="yes"
1564         fi
1565
1566         if test "x$ac_cv_sys_file_offset_bits" != "xno"; then
1567                 LARGEFILE_CFLAGS="$LARGEFILE_CFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
1568                 enable_largefile="yes"
1569         fi
1570 else
1571         AC_DEFINE(O_LARGEFILE, 0, [Define to 0 if your system does not have the O_LARGEFILE flag])
1572         LARGEFILE_CFLAGS=""
1573 fi
1574
1575 AM_CONDITIONAL(ENABLE_LARGEFILE, [test "x$enable_largefile" = "xyes"])
1576
1577 EVO_SET_COMPILE_FLAGS(CAMEL, gio-2.0 gmodule-2.0 $mozilla_nss sqlite3 >= sqlite_minimum_version, $KRB5_CFLAGS $MANUAL_NSS_CFLAGS $LARGEFILE_CFLAGS, -lz $KRB5_LIBS $MANUAL_NSS_LIBS)
1578 AC_SUBST(CAMEL_CFLAGS)
1579 AC_SUBST(CAMEL_LIBS)
1580
1581 dnl ******************************
1582 dnl Special directories
1583 dnl ******************************
1584
1585 dnl If you add something here, consider whether or not you also
1586 dnl need to add it to one or more .pc.in files (for Connector,
1587 dnl etc)
1588
1589 privdatadir='${datadir}'/evolution-data-server
1590 AC_SUBST(privdatadir)
1591
1592 privincludedir='${includedir}'/evolution-data-server
1593 AC_SUBST(privincludedir)
1594
1595 privlibdir='${libdir}'/evolution-data-server
1596 AC_SUBST(privlibdir)
1597
1598 imagesdir='${datadir}'/pixmaps/evolution-data-server
1599 AC_SUBST(imagesdir)
1600
1601 moduledir='${privlibdir}'/registry-modules
1602 AC_SUBST(moduledir)
1603
1604 ebook_backenddir='${privlibdir}'/addressbook-backends
1605 AC_SUBST(ebook_backenddir)
1606
1607 ecal_backenddir='${privlibdir}'/calendar-backends
1608 AC_SUBST(ecal_backenddir)
1609
1610 ro_sourcesdir='${privdatadir}'/ro-sources
1611 AC_SUBST(ro_sourcesdir)
1612
1613 rw_sourcesdir='${privdatadir}'/rw-sources
1614 AC_SUBST(rw_sourcesdir)
1615
1616 if test "x$use_gweather" = "xyes"; then
1617         weatherdatadir="$privdatadir/weather"
1618         AC_SUBST(weatherdatadir)
1619 fi
1620
1621 dnl separate camel from e-d-s? or should it be under the same spot? same for now.
1622 camel_providerdir='${privlibdir}'/camel-providers
1623 AC_SUBST(camel_providerdir)
1624
1625 dnl *******************
1626 dnl D-BUS service stuff
1627 dnl *******************
1628 m4_pattern_allow([AM_V_GEN])
1629 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)|" $< > $@'
1630 AC_SUBST(EVO_SUBST_SERVICE_RULE)
1631
1632 dnl ******************************
1633 dnl GLib stuff
1634 dnl ******************************
1635 GLIB_GSETTINGS
1636 AM_PATH_GLIB_2_0
1637
1638 dnl We use AC_SUBST_FILE because AC_SUBST won't deal with newlines
1639 EVO_MARSHAL_RULE=$srcdir/marshal.mk
1640 AC_SUBST_FILE(EVO_MARSHAL_RULE)
1641
1642 dnl ******************************
1643 dnl gperf stuff
1644 dnl ******************************
1645 AC_PATH_PROG(GPERF, gperf, [no])
1646 if test "x$GPERF" = "xno"; then
1647   AC_MSG_ERROR([You need gperf to build evolution-data-server])
1648 fi
1649
1650 GOBJECT_INTROSPECTION_CHECK([0.9.12])
1651
1652 dnl ******************************
1653 dnl Vala binding
1654 dnl ******************************
1655 AC_ARG_ENABLE(vala-bindings,
1656         AC_HELP_STRING([--enable-vala-bindings],
1657         [build the EXPERIMENTAL Vala bindings]),
1658         enable_vala_bindings=$enableval,
1659         enable_vala_bindings=no)
1660
1661 if test x$enable_vala_bindings = xyes; then
1662   if test "x$INTROSPECTION_SCANNER" = x; then
1663     AC_MSG_ERROR([GObject-Introspection must be enabled for Vala bindings])
1664   fi
1665
1666   AM_PROG_VALAC([0.13.0])
1667   have_vala=yes
1668
1669   AC_PATH_PROG(VALAC, valac, valac)
1670   AC_SUBST(VALAC)
1671   AC_SUBST(VALAFLAGS)
1672
1673   AC_PATH_PROG([VAPIGEN], [vapigen], [false])
1674
1675   if test "x$VAPIGEN" = "xfalse"; then
1676     AC_MSG_ERROR([vapigen not found. Was vala compiled with --enable-vapigen?])
1677   fi
1678
1679   AC_SUBST(VAPIGEN)
1680 fi
1681
1682 AM_CONDITIONAL([HAVE_VALA], [test "x$have_vala" = "xyes"])
1683 AC_SUBST(HAVE_VALA)
1684
1685 dnl ******************************
1686 dnl Makefiles
1687 dnl ******************************
1688 export privlibdir
1689 export privincludedir
1690 export privdatadir
1691
1692 AC_CONFIG_FILES([
1693 Makefile
1694 evolution-data-server-zip
1695 evolution-data-server.pc
1696 addressbook/Makefile
1697 addressbook/libebook/Makefile
1698 addressbook/libebook/libebook.pc
1699 addressbook/libebook-contacts/Makefile
1700 addressbook/libebook-contacts/libebook-contacts.pc
1701 addressbook/libedata-book/Makefile
1702 addressbook/libedata-book/libedata-book.pc
1703 addressbook/libegdbus/Makefile
1704 addressbook/backends/Makefile
1705 addressbook/backends/file/Makefile
1706 addressbook/backends/ldap/Makefile
1707 addressbook/backends/google/Makefile
1708 addressbook/backends/google/tests/Makefile
1709 addressbook/backends/webdav/Makefile
1710 art/Makefile
1711 calendar/Makefile
1712 calendar/libecal/Makefile
1713 calendar/libecal/libecal.pc
1714 calendar/libedata-cal/Makefile
1715 calendar/libedata-cal/libedata-cal.pc
1716 calendar/libegdbus/Makefile
1717 calendar/backends/Makefile
1718 calendar/backends/caldav/Makefile
1719 calendar/backends/file/Makefile
1720 calendar/backends/http/Makefile
1721 calendar/backends/contacts/Makefile
1722 calendar/backends/weather/Makefile
1723 camel/Makefile
1724 camel/providers/Makefile
1725 camel/providers/imapx/Makefile
1726 camel/providers/local/Makefile
1727 camel/providers/nntp/Makefile
1728 camel/providers/pop3/Makefile
1729 camel/providers/sendmail/Makefile
1730 camel/providers/smtp/Makefile
1731 camel/tests/Makefile
1732 camel/tests/folder/Makefile
1733 camel/tests/lib/Makefile
1734 camel/tests/message/Makefile
1735 camel/tests/mime-filter/Makefile
1736 camel/tests/misc/Makefile
1737 camel/tests/smime/Makefile
1738 camel/camel.pc
1739 data/Makefile
1740 libebackend/Makefile
1741 libebackend/libebackend.pc
1742 libedataserver/Makefile
1743 libedataserver/eds-version.h
1744 libedataserver/libedataserver.pc
1745 modules/Makefile
1746 modules/cache-reaper/Makefile
1747 modules/gnome-online-accounts/Makefile
1748 modules/google-backend/Makefile
1749 modules/owncloud-backend/Makefile
1750 modules/ubuntu-online-accounts/Makefile
1751 modules/ubuntu-online-accounts/calendar.service-type.in
1752 modules/ubuntu-online-accounts/contacts.service-type.in
1753 modules/ubuntu-online-accounts/evolution-data-server.application.in
1754 modules/ubuntu-online-accounts/google-calendar.service.in
1755 modules/ubuntu-online-accounts/google-contacts.service.in
1756 modules/ubuntu-online-accounts/google-gmail.service.in
1757 modules/ubuntu-online-accounts/mail.service-type.in
1758 modules/ubuntu-online-accounts/yahoo-calendar.service.in
1759 modules/ubuntu-online-accounts/yahoo-mail.service.in
1760 modules/trust-prompt/Makefile
1761 modules/yahoo-backend/Makefile
1762 private/Makefile
1763 services/Makefile
1764 services/evolution-addressbook-factory/Makefile
1765 services/evolution-calendar-factory/Makefile
1766 services/evolution-source-registry/Makefile
1767 services/evolution-user-prompter/Makefile
1768 tests/Makefile
1769 tests/libedata-book/Makefile
1770 tests/libebook/Makefile
1771 tests/libebook-contacts/Makefile
1772 tests/libebook/client/Makefile
1773 tests/libebook/vcard/Makefile
1774 tests/libecal/Makefile
1775 tests/libecal/client/Makefile
1776 tests/libedata-cal/Makefile
1777 tests/libedataserver/Makefile
1778 tests/test-server-utils/Makefile
1779 tests/test-server-utils/services/Makefile
1780 tests/test-server-utils/services/org.gnome.evolution.dataserver.AddressBook.service
1781 tests/test-server-utils/services/org.gnome.evolution.dataserver.Calendar.service
1782 tests/test-server-utils/services/org.gnome.evolution.dataserver.Sources.service
1783 docs/Makefile
1784 docs/reference/Makefile
1785 docs/reference/addressbook/Makefile
1786 docs/reference/addressbook/libebook/Makefile
1787 docs/reference/addressbook/libebook-contacts/Makefile
1788 docs/reference/addressbook/libedata-book/Makefile
1789 docs/reference/calendar/Makefile
1790 docs/reference/calendar/libecal/Makefile
1791 docs/reference/calendar/libedata-cal/Makefile
1792 docs/reference/camel/Makefile
1793 docs/reference/libedataserver/Makefile
1794 docs/reference/libebackend/Makefile
1795 docs/reference/private/Makefile
1796 po/Makefile.in
1797 vala/Makefile
1798 ])
1799 AC_OUTPUT
1800
1801 echo "
1802         evolution-data-server has been configured as follows:
1803         Weather calendar:       $use_gweather
1804         Mail Directory:         $system_mail_dir, $system_mail_perm
1805         LDAP support:           $msg_ldap
1806         NNTP support:           $msg_nntp
1807         Kerberos 5:             $msg_krb5
1808         SMIME support:          $msg_smime
1809         IPv6 support:           $msg_ipv6
1810         Phone number support:   $msg_phonenumber
1811         Dot Locking:            $msg_dot
1812         File Locking:           $msg_file
1813         Large files:            $enable_largefile
1814         Gtk Doc:                $enable_gtk_doc
1815         Introspection:          $enable_introspection
1816         Vala bindings:          $enable_vala_bindings
1817         GNOME Online Accounts   $enable_goa
1818         Ubuntu Online Accounts  $enable_uoa
1819         Google Contacts         $enable_google
1820         GTK+:                   $enable_gtk
1821         Code coverage (gcov):   $enable_code_coverage
1822         Strict building:        $enable_strict
1823 "