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