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