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