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