Bug 586811 – Require automake 1.9 and fix whitespace
[platform/upstream/evolution-data-server.git] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.54)
3
4 # Evolution-Data-Server version */
5 m4_define([eds_major_version], [2])
6 m4_define([eds_minor_version], [27])
7 m4_define([eds_micro_version], [4])
8
9 m4_define([eds_version],
10           [eds_major_version.eds_minor_version.eds_micro_version])
11
12 # This is for API/version tracking for things like Bonobo server files.
13 # This should always be the major/minor of the stable version or stable
14 # version to be.  (XXX The API version is no longer meaningful.)
15 m4_define([base_version], [2.28])
16 m4_define([api_version], [1.2])
17
18 AC_INIT(evolution-data-server, [eds_version], http://bugzilla.gnome.org/enter_bug.cgi?product=Evolution-Data-Server)
19 AM_INIT_AUTOMAKE([gnu 1.9])
20 AC_CONFIG_SRCDIR(README)
21 AC_CONFIG_HEADERS(config.h)
22
23 # Required Package Versions
24 m4_define([glib_minimum_version], [2.16.1])
25 m4_define([gtk_minimum_version], [2.14.0])
26 m4_define([ORBit_minimum_version], [2.9.8])
27 m4_define([libbonobo_minimum_version], [2.20.3])
28 m4_define([gconf_minimum_version], [2.0.0])             # XXX Just a Guess
29 m4_define([libglade_minimum_version], [2.0.0])          # XXX Just a Guess
30 m4_define([libxml_minimum_version], [2.0.0])            # XXX Just a Guess
31 m4_define([libsoup_minimum_version], [2.3.0])
32 m4_define([gnome_keyring_minimum_version], [2.20.1])
33 m4_define([sqlite_minimum_version], [3.5])
34 m4_define([gweather_minimum_version], [2.25.4])
35 m4_define([libical_minimum_version], [0.43])
36
37 AC_SUBST([BASE_VERSION],[base_version])
38 AC_SUBST([API_VERSION],[api_version])
39 AC_DEFINE_UNQUOTED(BASE_VERSION, ["$BASE_VERSION"], [Base version (Major.Minor)])
40 AC_DEFINE_UNQUOTED(API_VERSION, ["$API_VERSION"], [API version (Major.Minor)])
41
42 EDS_MAJOR_VERSION=eds_major_version
43 EDS_MINOR_VERSION=eds_minor_version
44 EDS_MICRO_VERSION=eds_micro_version
45
46 # Libtool versioning
47 LIBEDATASERVER_CURRENT=11
48 LIBEDATASERVER_REVISION=1
49 LIBEDATASERVER_AGE=0
50
51 LIBEDATASERVERUI_CURRENT=9
52 LIBEDATASERVERUI_REVISION=1
53 LIBEDATASERVERUI_AGE=1
54
55 LIBECAL_CURRENT=9
56 LIBECAL_REVISION=2
57 LIBECAL_AGE=2
58
59 LIBEDATACAL_CURRENT=6
60 LIBEDATACAL_REVISION=2
61 LIBEDATACAL_AGE=0
62
63 LIBEDATABOOK_CURRENT=6
64 LIBEDATABOOK_REVISION=1
65 LIBEDATABOOK_AGE=4
66
67 LIBEBOOK_CURRENT=12
68 LIBEBOOK_REVISION=1
69 LIBEBOOK_AGE=3
70
71 LIBEGROUPWISE_CURRENT=13
72 LIBEGROUPWISE_REVISION=1
73 LIBEGROUPWISE_AGE=0
74
75 LIBCAMEL_CURRENT=14
76 LIBCAMEL_REVISION=1
77 LIBCAMEL_AGE=0
78
79 LIBEXCHANGE_STORAGE_CURRENT=3
80 LIBEXCHANGE_STORAGE_REVISION=0
81 LIBEXCHANGE_STORAGE_AGE=0
82
83 LIBGDATA_CURRENT=1
84 LIBGDATA_REVISION=0
85 LIBGDATA_AGE=0
86
87 LIBGDATA_GOOGLE_CURRENT=1
88 LIBGDATA_GOOGLE_REVISION=0
89 LIBGDATA_GOOGLE_AGE=0
90
91 LIBEBACKEND_CURRENT=0
92 LIBEBACKEND_REVISION=1
93 LIBEBACKEND_AGE=0
94
95 AC_SUBST(EDS_MAJOR_VERSION)
96 AC_SUBST(EDS_MINOR_VERSION)
97 AC_SUBST(EDS_MICRO_VERSION)
98 AC_SUBST(LIBEDATASERVER_CURRENT)
99 AC_SUBST(LIBEDATASERVER_REVISION)
100 AC_SUBST(LIBEDATASERVER_AGE)
101 AC_SUBST(LIBEDATASERVERUI_CURRENT)
102 AC_SUBST(LIBEDATASERVERUI_REVISION)
103 AC_SUBST(LIBEDATASERVERUI_AGE)
104 AC_SUBST(LIBECAL_CURRENT)
105 AC_SUBST(LIBECAL_REVISION)
106 AC_SUBST(LIBECAL_AGE)
107 AC_SUBST(LIBEDATACAL_CURRENT)
108 AC_SUBST(LIBEDATACAL_REVISION)
109 AC_SUBST(LIBEDATACAL_AGE)
110 AC_SUBST(LIBEBOOK_CURRENT)
111 AC_SUBST(LIBEBOOK_REVISION)
112 AC_SUBST(LIBEBOOK_AGE)
113 AC_SUBST(LIBEDATABOOK_CURRENT)
114 AC_SUBST(LIBEDATABOOK_REVISION)
115 AC_SUBST(LIBEDATABOOK_AGE)
116 AC_SUBST(LIBEGROUPWISE_CURRENT)
117 AC_SUBST(LIBEGROUPWISE_REVISION)
118 AC_SUBST(LIBEGROUPWISE_AGE)
119 AC_SUBST(LIBCAMEL_CURRENT)
120 AC_SUBST(LIBCAMEL_REVISION)
121 AC_SUBST(LIBCAMEL_AGE)
122 AC_SUBST(LIBEXCHANGE_STORAGE_CURRENT)
123 AC_SUBST(LIBEXCHANGE_STORAGE_REVISION)
124 AC_SUBST(LIBEXCHANGE_STORAGE_AGE)
125 AC_SUBST(LIBGDATA_CURRENT)
126 AC_SUBST(LIBGDATA_REVISION)
127 AC_SUBST(LIBGDATA_AGE)
128 AC_SUBST(LIBGDATA_GOOGLE_CURRENT)
129 AC_SUBST(LIBGDATA_GOOGLE_REVISION)
130 AC_SUBST(LIBGDATA_GOOGLE_AGE)
131 AC_SUBST(LIBEBACKEND_CURRENT)
132 AC_SUBST(LIBEBACKEND_REVISION)
133 AC_SUBST(LIBEBACKEND_AGE)
134
135 dnl Put the ACLOCAL flags in the Makefile
136 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
137
138 # Compiler Warning Flags
139
140 AS_COMPILER_FLAGS(WARNING_FLAGS,
141         "-DG_DISABLE_DEPRECATED
142         -DPANGO_DISABLE_DEPRECATED
143         -DGDK_DISABLE_DEPRECATED
144         -DGDK_PIXBUF_DISABLE_DEPRECATED
145         -Wall -Wextra
146         -Wno-missing-field-initializers
147         -Wno-sign-compare
148         -Wno-unused-parameter
149         -Wdeclaration-after-statement
150         -Werror-implicit-function-declaration
151         -Wformat-security -Winit-self
152         -Wmissing-declarations -Wmissing-include-dirs
153         -Wmissing-noreturn -Wnested-externs -Wpointer-arith
154         -Wredundant-decls -Wundef -Wwrite-strings")
155 AC_SUBST(WARNING_FLAGS)
156
157 # Other useful compiler warnings for test builds only.
158 # These may produce warnings we have no control over.
159 #
160 #       -Wformat-nonliteral
161 #       -Wmissing-format-attribute
162 #       -Wshadow
163
164 CFLAGS="$CFLAGS $WARNING_FLAGS"
165
166 dnl Initialize maintainer mode
167 AM_MAINTAINER_MODE
168
169 AC_ISC_POSIX
170 AC_PROG_CC
171 AC_PROG_CPP
172 AC_C_INLINE
173 AM_PROG_LEX
174 AC_PROG_YACC
175 case $YACC in
176 *yacc*)
177         AC_MSG_ERROR(You need bison to build evolution-data-server)
178         ;;
179 esac
180 AC_STDC_HEADERS
181 AC_PROG_INSTALL
182 AC_PROG_LN_S
183 AC_PROG_MAKE_SET
184
185 dnl  Test whether jw is installed
186 AC_PATH_PROG(JW,jw,no)
187 if test x$JW = xno; then
188   HAVE_JW="no"
189 else
190   HAVE_JW="yes"
191 fi
192 AM_CONDITIONAL(HAVE_JW, test "x$HAVE_JW" = "xyes")
193 AC_SUBST(HAVE_JW)
194
195 dnl I18N stuff
196 IT_PROG_INTLTOOL([0.35.5])
197
198 AM_GLIB_GNU_GETTEXT
199
200 GETTEXT_PACKAGE=evolution-data-server-$BASE_VERSION
201 AC_SUBST(GETTEXT_PACKAGE)
202 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext])
203
204 localedir='$(prefix)/$(DATADIRNAME)/locale'
205 AC_SUBST(localedir)
206
207 dnl Initialize libtool
208 AM_DISABLE_STATIC
209 AC_LIBTOOL_WIN32_DLL
210 AM_PROG_LIBTOOL
211 DOLT
212
213 PKG_PROG_PKG_CONFIG
214
215 dnl ******************************
216 dnl Check for Win32
217 dnl ******************************
218
219 AC_MSG_CHECKING([for Win32])
220 case "$host" in
221 *-mingw*)
222     os_win32=yes
223     NO_UNDEFINED='-no-undefined'
224     SOCKET_LIBS='-lws2_32 -ldnsapi'
225     DL_LIB=''
226     SOFTOKN3_LIB=''
227     LIBEXECDIR_IN_SERVER_FILE='../../../libexec'
228     AC_CACHE_VAL(ac_cv_have_addrinfo, [ac_cv_have_addrinfo=yes])
229     AC_DEFINE(_WIN32_WINNT, 0x501, [To get getaddrinfo etc declarations])
230     ;;
231 *)  os_win32=no
232     NO_UNDEFINED=''
233     SOCKET_LIBS=''
234     DL_LIB='-ldl'
235     SOFTOKN3_LIB='-lsoftokn3'
236     LIBEXECDIR_IN_SERVER_FILE="$libexecdir"
237     ;;
238 esac
239 AC_MSG_RESULT([$os_win32])
240 AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])
241 AC_SUBST(NO_UNDEFINED)
242 AC_SUBST(SOCKET_LIBS)
243 AC_SUBST(LIBEXECDIR_IN_SERVER_FILE)
244
245 AC_CHECK_HEADERS(pthread.h semaphore.h sys/wait.h)
246 AC_CHECK_FUNCS(fsync strptime strtok_r)
247
248 dnl alloca()
249 AC_CHECK_HEADERS(alloca.h)
250
251 # Check for base dependencies early.
252 PKG_CHECK_MODULES(GNOME_PLATFORM,
253         [glib-2.0 >= glib_minimum_version
254          gtk+-2.0 >= gtk_minimum_version
255          ORBit-2.0 >= ORBit_minimum_version
256          libbonobo-2.0 >= libbonobo_minimum_version
257          gconf-2.0 >= gconf_minimum_version
258          libglade-2.0 >= libglade_minimum_version
259          libxml-2.0 >= libxml_minimum_version
260          libsoup-2.4 >= libsoup_minimum_version])
261
262 LIBICAL_REQUIRED=libical_minimum_version
263 AC_SUBST(LIBICAL_REQUIRED)
264
265 dnl **************************************************
266 dnl * regex checking
267 dnl **************************************************
268 AC_CHECK_FUNCS(regexec,,[AC_CHECK_LIB(regex,regexec,
269                                       [REGEX_LIBS=-lregex
270                                        AC_DEFINE(HAVE_REGEXEC,1,[Define to 1 if you have the regexec function.])],
271                                       [AC_MSG_ERROR([No regex library found])])])
272 AC_SUBST(REGEX_LIBS)
273
274 dnl **************************************************
275 dnl * libdb checking
276 dnl **************************************************
277
278 AC_ARG_WITH(libdb,
279   AC_HELP_STRING( [--with-libdb],
280                   [Prefix where libdb is installed]),
281   dynamic_libdb=yes, dynamic_libdb=no)
282
283 if test "x${dynamic_libdb}" = "xyes"; then
284         DB_CFLAGS="-I$withval/include"
285         DB_LIBS="-L$withval/lib -ldb"
286
287         AC_MSG_CHECKING([Berkeley DB])
288         save_cflags=$CFLAGS; CFLAGS=$DB_CFLAGS
289         save_libs=$LIBS; LIBS="$DB_LIBS"
290         AC_LINK_IFELSE(
291                 [AC_LANG_PROGRAM([[#include <db.h>]],
292                                  [db_create(NULL, NULL, 0)])],
293                 AC_MSG_RESULT(yes),
294                 AC_MSG_ERROR(cannot find libdb))
295         CFLAGS=$save_cflags
296         LIBS=$save_libs
297
298         msg_libdb="dynamically linked"
299 else
300         DB_CFLAGS="-I\$(top_builddir)/libdb/dist"
301         DB_LIBS="\$(top_builddir)/libdb/dist/libdb-4.1.la"
302         if test $os_win32 = yes; then
303                 # Don't pointlessly auto-export the global symbols
304                 # from the static libdb
305                 DB_LIBS="$DB_LIBS -Wl,--exclude-libs=libdb-4.1.a"
306         fi
307         AC_MSG_NOTICE(Using local libdb)
308         msg_libdb="statically linked to local copy"
309 fi
310 AM_CONDITIONAL(WITH_LIBDB, test "x$dynamic_libdb" != "xno")
311 AC_SUBST(DB_CFLAGS)
312 AC_SUBST(DB_LIBS)
313
314
315 dnl ******************************
316 dnl iconv checking
317 dnl ******************************
318 have_iconv=no
319 AC_ARG_WITH(libiconv,
320   AC_HELP_STRING( [--with-libiconv],
321                   [Prefix where libiconv is installed]))
322 if test -d $withval; then
323     ICONV_CFLAGS="-I$withval/include"
324     ICONV_LIBS="-L$withval/lib"
325 fi
326
327 save_CFLAGS="$CFLAGS"
328 save_LIBS="$LIBS"
329 CFLAGS="$CFLAGS $ICONV_CFLAGS"
330 LIBS="$LIBS $ICONV_LIBS -liconv"
331 AC_CACHE_CHECK(for iconv in -liconv, ac_cv_libiconv, AC_TRY_LINK([
332 #include <iconv.h>
333 #include <stdlib.h>],[
334
335 int main (int argc, char **argv)
336 {
337         iconv_t cd;
338         cd = iconv_open ("UTF-8", "ISO-8859-1");
339         exit (0);
340 }
341 ], ac_cv_libiconv=yes, ac_cv_libiconv=no))
342 if test $ac_cv_libiconv = yes; then
343         ICONV_LIBS="$ICONV_LIBS -liconv"
344         if test $os_win32 = yes; then
345                 # Don't pointlessly auto-export the global symbols
346                 # from a potentially static libiconv.a
347                 ICONV_LIBS="$ICONV_LIBS -Wl,--exclude-libs=libiconv.a"
348         fi
349         have_iconv=yes
350 else
351         CFLAGS="$save_CFLAGS"
352         LIBS="$save_LIBS"
353         AC_CHECK_FUNC(iconv, have_iconv=yes, have_iconv=no)
354 fi
355
356 if test $have_iconv = yes; then
357         if test $ac_cv_libiconv = no; then
358                 AC_CHECK_FUNCS(gnu_get_libc_version)
359         fi
360         AC_CACHE_CHECK([if iconv() handles UTF-8], ac_cv_libiconv_utf8, AC_TRY_RUN([
361 #include <iconv.h>
362 #include <stdlib.h>
363 #include <string.h>
364 #ifdef HAVE_GNU_GET_LIBC_VERSION
365 #include <gnu/libc-version.h>
366 #endif
367
368 int main (int argc, char **argv)
369 {
370         char *from = "Some Text \xA4";
371         char *utf8 = "Some Text \xC2\xA4";
372         char *transbuf = malloc (20), *trans = transbuf;
373         iconv_t cd;
374         size_t from_len = strlen (from), utf8_len = 20;
375         size_t utf8_real_len = strlen (utf8);
376
377 #ifdef HAVE_GNU_GET_LIBC_VERSION
378         /* glibc 2.1.2's iconv is broken in hard to test ways. */
379         if (!strcmp (gnu_get_libc_version (), "2.1.2"))
380                 exit (1);
381 #endif
382
383         cd = iconv_open ("UTF-8", "ISO-8859-1");
384         if (cd == (iconv_t) -1)
385                 exit (1);
386         if (iconv (cd, &from, &from_len, &trans, &utf8_len) == -1 || from_len != 0)
387                 exit (1);
388         if (memcmp (utf8, transbuf, utf8_real_len) != 0)
389                 exit (1);
390
391         exit (0);
392 }], ac_cv_libiconv_utf8=yes, [ac_cv_libiconv_utf8=no; have_iconv=no], ac_cv_libiconv_utf8=HOPEFULLY))
393 fi
394
395 if test "$have_iconv" = no; then
396         AC_MSG_ERROR([You need to install a working iconv implementation, such as ftp://ftp.gnu.org/pub/gnu/libiconv])
397 fi
398 AC_SUBST(ICONV_CFLAGS)
399 AC_SUBST(ICONV_LIBS)
400
401 CFLAGS="$CFLAGS -I$srcdir"
402
403 AC_MSG_CHECKING(preferred charset formats for system iconv)
404 AC_TRY_RUN([
405 #define CONFIGURE_IN
406 #include "iconv-detect.c"
407 ],[
408         AC_MSG_RESULT(found)
409 ],[
410         AC_MSG_RESULT(not found)
411         AC_WARN([
412         *** The iconv-detect program was unable to determine the
413         *** preferred charset formats recognized by your system
414         *** iconv library. It is suggested that you install a
415         *** working iconv library such as the one found at
416         *** ftp://ftp.gnu.org/pub/gnu/libiconv
417 ])
418 ],[
419   if test x$os_win32 = xyes; then
420     AC_MSG_RESULT(using cached win32 result)
421     echo "/* This is an auto-generated header, DO NOT EDIT! */" > iconv-detect.h
422     echo "" >>iconv-detect.h
423     echo "#define ICONV_ISO_D_FORMAT \"iso-%d-%d\"" >>iconv-detect.h
424     echo "#define ICONV_ISO_S_FORMAT \"iso-%d-%s\"" >>iconv-detect.h
425     echo "#define ICONV_10646 \"UCS-4BE\"" >>iconv-detect.h
426   else
427         AC_MSG_RESULT(unknown)
428         AC_WARN([
429         *** The iconv-detect program was unable to determine the
430         *** preferred charset formats recognized by your system
431         *** iconv library. You are crosscompiling and supposed
432         *** to know what you are doing. (:-)
433     ])
434   fi
435 ])
436
437 CFLAGS="$save_CFLAGS"
438 LIBS="$save_LIBS"
439
440 dnl Check for nl_langinfo and CODESET
441 AC_MSG_CHECKING([for nl_langinfo (CODESET)])
442 AC_TRY_COMPILE([#include <langinfo.h>],
443         [char *codeset = nl_langinfo (CODESET);],
444         [ac_cv_langinfo_codeset=yes],
445         [ac_cv_langinfo_codeset=no])
446 if test x$ac_cv_langinfo_codeset = xyes; then
447         AC_DEFINE(HAVE_CODESET, 1, [Have nl_langinfo (CODESET)])
448 fi
449 AC_MSG_RESULT($ac_cv_langinfo_codeset)
450
451 dnl Check to see if strftime supports the use of %l and %k
452
453 AC_MSG_CHECKING(for %l and %k support in strftime)
454 AC_TRY_RUN([
455 #include <stdlib.h>
456 #include <string.h>
457 #include <time.h>
458
459 int main(int argc, char **argv)
460 {
461         char buf[10];
462         time_t rawtime;
463         struct tm *timeinfo;
464
465         time(&rawtime);
466         timeinfo=localtime(&rawtime);
467         buf[0] = '\0';
468         strftime(buf, 10, "%lx%k", timeinfo);
469
470         if (buf[0] == '\0' || buf[0] == 'x' || strstr(buf, "l") || strstr(buf, "k"))
471                 exit(1);
472         else
473                 exit(0);
474 }],[
475 AC_DEFINE(HAVE_LKSTRFTIME, 1, [strftime supports use of l and k])
476 ac_cv_lkstrftime=yes
477 ],ac_cv_lkstrftime=no,ac_cv_lkstrftime=no,[
478 AC_DEFINE(HAVE_LKSTRFTIME, 1, [strftime supports use of l and k])
479 ac_cv_lkstrftime=yes
480 ])
481 AC_MSG_RESULT($ac_cv_lkstrftime)
482
483 dnl ********************************************************************************
484 dnl security extension support (SSL and S/MIME)
485 dnl
486 dnl The following voodoo does detection of mozilla libraries (nspr and nss)
487 dnl needed by Camel (SSL and S/MIME).
488 dnl
489 dnl The Evolution security extensions are only built if these libraries are found
490 dnl ********************************************************************************
491 msg_ssl="no"
492 msg_smime="no"
493
494 dnl these 2 enable's are inverses of each other
495 AC_ARG_ENABLE(nss,
496   AC_HELP_STRING( [--enable-nss=@<:@yes/no/static@:>@],
497                   [Attempt to use Mozilla libnss for SSL support.]),
498   enable_nss="$enableval", enable_nss="yes")
499
500 AC_ARG_ENABLE(smime,
501   AC_HELP_STRING( [--enable-smime=@<:@yes/no@:>@],
502                   [Attempt to use Mozilla libnss for SMIME support (this requires --enable-nss)]),
503   enable_smime="$enableval", enable_smime="yes")
504
505 AC_ARG_ENABLE(gnome-keyring,
506   AC_HELP_STRING( [--enable-gnome-keyring=@<:@yes/no@:>@],
507                   [Attempt to use Gnome Keyring for storing passwords]),
508   enable_gnome_keyring="$enableval", enable_gnome_keyring="no")
509
510 AC_ARG_WITH(nspr-includes,
511   AC_HELP_STRING( [--with-nspr-includes=PREFIX],
512                   [Location of Mozilla nspr4 includes.]),
513   with_nspr_includes="$withval")
514
515 AC_ARG_WITH(nspr-libs,
516   AC_HELP_STRING( [--with-nspr-libs=PREFIX],
517                   [Location of Mozilla nspr4 libs.]),
518   with_nspr_libs="$withval")
519
520 AC_ARG_WITH(nss-includes,
521   AC_HELP_STRING( [--with-nss-includes=PREFIX],
522                   [Location of Mozilla nss3 includes.]),
523   with_nss_includes="$withval")
524
525 AC_ARG_WITH(nss-libs,
526   AC_HELP_STRING( [--with-nss-libs=PREFIX],
527                   [Location of Mozilla nss3 libs.]),
528   with_nss_libs="$withval")
529
530 if test "x${enable_gnome_keyring}" = "xyes"; then
531         PKG_CHECK_MODULES(GNOME_KEYRING, gnome-keyring-1 >= gnome_keyring_minimum_version, with_gnome_keyring="yes", with_gnome_keyring="no");
532         if test "x$with_gnome_keyring" = "xyes"; then
533                 AC_DEFINE(WITH_GNOME_KEYRING, 1, [Gnome Keyring available])
534                 GNOME_KEYRING_REQUIREMENT="gnome-keyring-1"
535         else
536                 GNOME_KEYRING_REQUIREMENT=""
537         fi
538 fi
539
540 if test "x${enable_nss}" = "xyes" || test "x${enable_nss}" = "xstatic"; then
541         if test -n "${with_nspr_includes}" || test -n "${with_nspr_libs}" || test -n "${with_nss_includes}" || test -n "${with_nss_libs}" || test "x${enable_nss}" = "xstatic"; then
542                 check_manually="yes"
543         else
544                 check_manually="no"
545         fi
546
547         if test "x${check_manually}" = "xno"; then
548                 AC_MSG_CHECKING(Mozilla NSPR pkg-config module name)
549                 mozilla_nspr_pcs="nspr mozilla-nspr firefox-nspr xulrunner-nspr seamonkey-nspr"
550                 for pc in $mozilla_nspr_pcs; do
551                         if $PKG_CONFIG --exists $pc; then
552                                 AC_MSG_RESULT($pc)
553                                 mozilla_nspr=$pc
554                                 break;
555                         fi
556                 done
557
558                 AC_MSG_CHECKING(Mozilla NSS pkg-config module name)
559                 mozilla_nss_pcs="nss mozilla-nss firefox-nss xulrunner-nss seamonkey-nss"
560                 for pc in $mozilla_nss_pcs; do
561                         if $PKG_CONFIG --exists $pc; then
562                                 AC_MSG_RESULT($pc)
563                                 mozilla_nss=$pc
564                                 break;
565                         fi
566                 done
567
568                 if test -n "$mozilla_nspr" -a -n "$mozilla_nss"; then
569                         msg_ssl="yes (Mozilla NSS)"
570                         if test "x$enable_smime" = "xyes"; then
571                                 AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled])
572                                 msg_smime="yes (Mozilla NSS)"
573                         fi
574                         AC_DEFINE(HAVE_NSS,1,[Define if you have NSS])
575                         AC_DEFINE(HAVE_SSL,1,[Define if you have a supported SSL library])
576                         MANUAL_NSPR_CFLAGS=""
577                         MANUAL_NSPR_LIBS=""
578                         MANUAL_NSS_CFLAGS=""
579                         MANUAL_NSS_LIBS=""
580                 else
581                         check_manually="yes"
582                         mozilla_nspr=""
583                         mozilla_nss=""
584                 fi
585         fi
586
587         if test "x${check_manually}" = "xyes"; then
588                 have_nspr_includes="no"
589                 if test "x${with_nspr_includes}" != "xno"; then
590                         CPPFLAGS_save="$CPPFLAGS"
591
592                         AC_MSG_CHECKING(for Mozilla nspr4 includes in $with_nspr_includes)
593                         AC_MSG_RESULT("")
594
595                         CPPFLAGS="$CPPFLAGS -I$with_nspr_includes"
596                         AC_CHECK_HEADERS(nspr.h prio.h, [ moz_nspr_includes="yes" ])
597                         CPPFLAGS="$CPPFLAGS_save"
598
599                         if test "x{$moz_nspr_includes}" != "xno" -a "x{$moz_nspr_includes}" != "x" ; then
600                                 have_nspr_includes="yes"
601                                 MANUAL_NSPR_CFLAGS="-I$with_nspr_includes"
602                         fi
603                 else
604                         AC_MSG_CHECKING(for Mozilla nspr4 includes)
605                         AC_MSG_RESULT(no)
606                 fi
607
608                 have_nspr_libs="no"
609                 if test "x${with_nspr_libs}" != "xno" -a "x${have_nspr_includes}" != "xno"; then
610                         CFLAGS_save="$CFLAGS"
611                         LDFLAGS_save="$LDFLAGS"
612
613                         if test "$enable_nss" = "static"; then
614                                 if test -z "${with_nspr_libs}"; then
615                                         AC_MSG_ERROR([Static linkage requested, but path to nspr libraries not set.]
616 [Please specify the path to libnspr4.a]
617 [Example: --with-nspr-libs=/usr/lib])
618                                 else
619                                         nsprlibs="$DL_LIB $with_nspr_libs/libplc4.a $with_nspr_libs/libplds4.a $with_nspr_libs/libnspr4.a $PTHREAD_LIB"
620                                 fi
621                         else
622                                 nsprlibs="$DL_LIB -lplc4 -lplds4 -lnspr4 $PTHREAD_LIB"
623                         fi
624
625                         AC_CACHE_CHECK([for Mozilla nspr libraries], ac_cv_moz_nspr_libs,
626                         [
627                                 LIBS_save="$LIBS"
628                                 CFLAGS="$CFLAGS $MANUAL_NSPR_CFLAGS"
629
630                                 if test "x${with_nspr_libs}" != "x"; then
631                                         LIBS="$nsprlibs"
632                                         LDFLAGS="$LDFLAGS -L$with_nspr_libs"
633                                 else
634                                         LIBS="$nsprlibs"
635                                         LDFLAGS="$LDFLAGS"
636                                 fi
637
638                                 AC_TRY_LINK_FUNC(PR_Init, ac_cv_moz_nspr_libs="yes", ac_cv_moz_nspr_libs="no")
639                                 CFLAGS="$CFLAGS_save"
640                                 LDFLAGS="$LDFLAGS_save"
641                                 LIBS="$LIBS_save"
642                         ])
643                         if test "x$ac_cv_moz_nspr_libs" != "xno"; then
644                                 have_nspr_libs="yes"
645                                 MANUAL_NSPR_LIBS="-L$with_nspr_libs $nsprlibs"
646                         else
647                                 MANUAL_NSPR_CLFAGS=""
648                         fi
649                 else
650                         AC_MSG_CHECKING(for Mozilla nspr4 libraries)
651                         AC_MSG_RESULT(no)
652                 fi
653
654                 if test "x${with_nss_includes}" != "xno" -a "x${have_nspr_libs}" != "xno"; then
655                         CPPFLAGS_save="$CPPFLAGS"
656
657                         AC_MSG_CHECKING(for Mozilla nss3 includes in $with_nss_includes)
658                         AC_MSG_RESULT("")
659
660                         if test "x${with_nspr_includes}" != "x"; then
661                                 CPPFLAGS="$CPPFLAGS -I$with_nspr_includes -I$with_nss_includes"
662                         else
663                                 CPPFLAGS="$CPPFLAGS -I$with_nss_includes"
664                         fi
665
666                         AC_CHECK_HEADERS(nss.h ssl.h smime.h,
667                                 [ have_nss_includes="yes" ],
668                                 [ have_nss_includes="no" ])
669
670                         CPPFLAGS="$CPPFLAGS_save"
671
672                         if test "x${have_nss_includes}" = "xyes"; then
673                                 have_nss_includes="yes"
674                                 MANUAL_NSS_CFLAGS="-I$with_nss_includes"
675                         else
676                                 MANUAL_NSPR_CFLAGS=""
677                                 MANUAL_NSPR_LIBS=""
678                         fi
679                 else
680                         AC_MSG_CHECKING(for Mozilla nss3 includes)
681                         AC_MSG_RESULT(no)
682                 fi
683
684                 if test "x${with_nss_libs}" != "xno" -a "x${have_nss_includes}" != "xno"; then
685                         LDFLAGS_save="$LDFLAGS"
686
687                         if test "$enable_nss" = "static"; then
688                                 if test -z "${with_nss_libs}"; then
689                                         AC_MSG_ERROR([Static linkage requested, but path to nss libraries not set.]
690 [Please specify the path to libnss3.a]
691 [Example: --with-nspr-libs=/usr/lib/mozilla])
692                                 else
693                                         nsslibs="-ldb1 $with_nss_libs/libnssckfw.a $with_nss_libs/libasn1.a $with_nss_libs/libcrmf.a $with_nss_libs/libswfci.a $with_nss_libs/libjar.a $with_nss_libs/libpkcs12.a $with_nss_libs/libpkcs7.a $with_nss_libs/libpki1.a $with_nss_libs/libsmime.a $with_nss_libs/libssl.a $with_nss_libs/libnss.a $with_nss_libs/libpk11wrap.a $with_nss_libs/libsoftokn.a $with_nss_libs/libfreebl.a $with_nss_libs/libnsspki.a $with_nss_libs/libnssdev.a $with_nss_libs/libcryptohi.a $with_nss_libs/libcerthi.a $with_nss_libs/libcertdb.a $with_nss_libs/libsecutil.a $with_nss_libs/libnssb.a"
694                                         case "$host" in
695                                                 *solaris*)
696                                                 nsslibs="$nsslibs $with_nss_libs/libfreebl.a"
697                                         ;;
698                                         esac
699                                 fi
700                         else
701                                 nsslibs="-lssl3 -lsmime3 -lnss3"
702                         fi
703
704                         AC_CACHE_CHECK([for Mozilla nss libraries], ac_cv_moz_nss_libs,
705                         [
706                                 LIBS_save="$LIBS"
707                                 LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs -L$with_nss_libs $nsslibs"
708                                 LIBS="$nsslibs $nsprlibs"
709                                 AC_TRY_LINK_FUNC(NSS_Init, ac_cv_moz_nss_libs="yes", ac_cv_moz_nss_libs="no")
710                                 if test "$ac_cv_moz_nss_libs" = no; then
711                                         nsslibs="-lssl3 -lsmime3 -lnss3"
712                                         LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs -L$with_nss_libs $nsslibs"
713                                         AC_TRY_LINK_FUNC(NSS_Init, ac_cv_moz_nss_libs="yes", ac_cv_moz_nss_libs="no")
714                                 fi
715                                 LDFLAGS="$LDFLAGS_save"
716                                 LIBS="$LIBS_save"
717                         ])
718                         if test "$ac_cv_moz_nss_libs" != no; then
719                                 AC_DEFINE(HAVE_NSS)
720                                 AC_DEFINE(HAVE_SSL)
721                                 if test "$enable_nss" = "static"; then
722                                         msg_ssl="yes (Mozilla NSS:static)"
723                                 else
724                                         msg_ssl="yes (Mozilla NSS)"
725                                 fi # static_nss
726                                 if test "$enable_smime" = "yes"; then
727                                         AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled])
728                                         msg_smime="yes (Mozilla NSS)"
729                                 fi
730                                 MANUAL_NSS_LIBS="-L$with_nss_libs $nsslibs"
731                         else
732                                 MANUAL_NSS_CFLAGS=""
733                                 MANUAL_NSPR_CFLAGS=""
734                                 MANUAL_NSPR_LIBS=""
735                         fi
736                 else
737                         AC_MSG_CHECKING(for Mozilla nss libraries)
738                         AC_MSG_RESULT(no)
739                 fi
740
741                 MANUAL_NSS_CFLAGS="$MANUAL_NSPR_CFLAGS $MANUAL_NSS_CFLAGS"
742                 MANUAL_NSS_LIBS="$MANUAL_NSPR_LIBS $MANUAL_NSS_LIBS"
743         fi
744 fi
745
746 AM_CONDITIONAL(ENABLE_SMIME, test "x$msg_smime" != "xno")
747
748 AC_SUBST(MANUAL_NSPR_CFLAGS)
749 AC_SUBST(MANUAL_NSPR_LIBS)
750 AC_SUBST(MANUAL_NSS_CFLAGS)
751 AC_SUBST(MANUAL_NSS_LIBS)
752
753 if test $os_win32 != yes; then
754
755 dnl check for socklen_t (in Unix98)
756 AC_MSG_CHECKING(for socklen_t)
757 AC_TRY_COMPILE([#include <sys/types.h>
758 #include <sys/socket.h>
759 socklen_t x;
760 ],[],[AC_MSG_RESULT(yes)],[
761 AC_TRY_COMPILE([#include <sys/types.h>
762 #include <sys/socket.h>
763 int accept (int, struct sockaddr *, size_t *);
764 ],[],[
765 AC_MSG_RESULT(size_t)
766 AC_DEFINE(socklen_t,size_t,[Define to appropriate type if socklen_t is not defined])], [
767 AC_MSG_RESULT(int)
768 AC_DEFINE(socklen_t,int)])])
769
770 fi
771
772 dnl
773 dnl system mail stuff
774 dnl
775 AC_PATH_PROG(SENDMAIL, sendmail, /usr/sbin/sendmail, /usr/sbin:/usr/lib)
776 AC_DEFINE_UNQUOTED(SENDMAIL_PATH, "$SENDMAIL", [Path to a sendmail binary, or equivalent])
777
778 AC_MSG_CHECKING(system mail directory)
779 if test -d /var/mail -a '!' -h /var/mail ; then
780         system_mail_dir=/var/mail
781 else
782         system_mail_dir=/var/spool/mail
783 fi
784 AC_DEFINE_UNQUOTED(SYSTEM_MAIL_DIR, "$system_mail_dir", [Directory local mail is delivered to])
785
786 case `ls -ld $system_mail_dir 2>&1 | awk '{print $1;}'` in
787 d??????rw?)
788         CAMEL_LOCK_HELPER_USER=""
789         CAMEL_LOCK_HELPER_GROUP=""
790         system_mail_perm="world writable"
791         ;;
792
793 d???rw????)
794         CAMEL_LOCK_HELPER_USER=""
795         CAMEL_LOCK_HELPER_GROUP=`ls -ld $system_mail_dir 2>&1 | awk '{print $4;}'`
796         system_mail_perm="writable by group $CAMEL_LOCK_HELPER_GROUP"
797         ;;
798
799 drw???????)
800         CAMEL_LOCK_HELPER_USER=`ls -ld $system_mail_dir 2>&1 | awk '{print $3;}'`
801         CAMEL_LOCK_HELPER_GROUP=""
802         system_mail_perm="writable by user $CAMEL_LOCK_HELPER_USER"
803         ;;
804
805 *)
806         CAMEL_LOCK_HELPER_USER=""
807         CAMEL_LOCK_HELPER_GROUP=""
808         system_mail_perm="???"
809         ;;
810 esac
811
812 AC_MSG_RESULT([$system_mail_dir, $system_mail_perm])
813 AC_SUBST(CAMEL_LOCK_HELPER_USER)
814 AC_SUBST(CAMEL_LOCK_HELPER_GROUP)
815
816
817 dnl ***************
818 dnl Timezone checks
819 dnl ***************
820 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
821         AC_TRY_COMPILE([
822                 #include <time.h>
823                 ], [
824                 struct tm tm;
825                 tm.tm_gmtoff = 1;
826                 ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
827 if test $ac_cv_struct_tm_gmtoff = yes; then
828         AC_DEFINE(HAVE_TM_GMTOFF, 1, [Define if struct tm has a tm_gmtoff member])
829 else
830         AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
831                 AC_TRY_COMPILE([
832                         #include <time.h>
833                 ], [
834                         timezone = 1;
835                 ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
836         if test $ac_cv_var_timezone = yes; then
837                 AC_DEFINE(HAVE_TIMEZONE, 1, [Define if libc defines a timezone variable])
838                 AC_CACHE_CHECK(for altzone variable, ac_cv_var_altzone,
839                         AC_TRY_COMPILE([
840                                 #include <time.h>
841                         ], [
842                                 altzone = 1;
843                         ], ac_cv_var_altzone=yes, ac_cv_var_altzone=no))
844                 if test $ac_cv_var_altzone = yes; then
845                         AC_DEFINE(HAVE_ALTZONE, 1, [Define if libc defines an altzone variable])
846                 fi
847         else
848                 AC_ERROR(unable to find a way to determine timezone)
849         fi
850 fi
851
852
853 dnl **************************************************
854 dnl ctime_r prototype
855 dnl **************************************************
856
857 AC_CACHE_CHECK([if ctime_r wants three arguments], ac_cv_ctime_r_three_args,
858 [
859         AC_TRY_COMPILE([
860                 #include <time.h>
861         ],[
862                 char *buf;
863                 time_t date;
864                 ctime_r (&date, buf, 100);
865         ],[
866                 ac_cv_ctime_r_three_args=yes
867         ],[
868                 ac_cv_ctime_r_three_args=no
869         ])
870 ])
871
872 if test x"$ac_cv_ctime_r_three_args" = xyes ; then
873         AC_DEFINE(CTIME_R_THREE_ARGS, 1, [Solaris-style ctime_r])
874 fi
875
876 dnl **************************************************
877 dnl gethostbyname_r prototype
878 dnl **************************************************
879
880 AC_CHECK_FUNCS(gethostbyname_r,[
881 AC_CACHE_CHECK([if gethostbyname_r wants five arguments], ac_cv_gethostbyname_r_five_args,
882 [
883         AC_TRY_COMPILE([
884                 #include "confdefs.h"
885                 #include <sys/types.h>
886                 #include <sys/socket.h>
887                 #include <netinet/in.h>
888                 #include <netdb.h>
889
890                 #define BUFSIZE (sizeof(struct hostent)+10)
891         ],[
892                 struct hostent hent;
893                 char buffer[BUFSIZE];
894                 int bufsize=BUFSIZE;
895                 int h_errno;
896
897                 (void)gethostbyname_r ("www.ximian.com", &hent, buffer, bufsize, &h_errno);
898         ],[
899                 ac_cv_gethostbyname_r_five_args=yes
900         ],[
901                 ac_cv_gethostbyname_r_five_args=no
902         ])
903 ])])
904
905 if test "x$ac_cv_gethostbyname_r_five_args" = "xyes" ; then
906         AC_DEFINE(GETHOSTBYNAME_R_FIVE_ARGS, 1, [Solaris-style gethostbyname_r])
907 fi
908
909 dnl **************************************************
910 dnl gethostbyaddr_r prototype
911 dnl **************************************************
912
913 AC_CHECK_FUNCS(gethostbyaddr_r,[
914 AC_CACHE_CHECK([if gethostbyaddr_r wants seven arguments], ac_cv_gethostbyaddr_r_seven_args,
915 [
916         AC_TRY_COMPILE([
917                 #include "confdefs.h"
918                 #include <sys/types.h>
919                 #include <sys/socket.h>
920                 #include <netinet/in.h>
921                 #include <netdb.h>
922
923                 #define BUFSIZE (sizeof(struct hostent)+10)
924         ],[
925                 struct hostent hent;
926                 char buffer[BUFSIZE];
927                 int bufsize=BUFSIZE;
928                 int h_errno;
929
930                 (void)gethostbyaddr_r ("www.ximian.com", 14, AF_INET, &hent, buffer, bufsize, &h_errno);
931         ],[
932                 ac_cv_gethostbyaddr_r_seven_args=yes
933         ],[
934                 ac_cv_gethostbyaddr_r_seven_args=no
935         ])
936 ])])
937
938 if test "x$ac_cv_gethostbyaddr_r_seven_args" = "xyes" ; then
939         AC_DEFINE(GETHOSTBYADDR_R_SEVEN_ARGS, 1, [Solaris-style gethostbyaddr_r])
940 fi
941
942 dnl **************************************************
943 dnl stat(v)fs location/type
944 dnl **************************************************
945
946 AC_CHECK_HEADERS(sys/statvfs.h)
947 AC_CHECK_FUNCS(statvfs)
948 AC_CHECK_HEADERS(sys/param.h)
949 AC_CHECK_HEADERS(sys/mount.h)
950 AC_CHECK_FUNCS(statfs)
951
952 dnl **************************************************
953 dnl * IPv6 support and getaddrinfo calls
954 dnl **************************************************
955 AC_CACHE_CHECK([if system supports getaddrinfo and getnameinfo], ac_cv_have_addrinfo,
956 [
957         AC_TRY_COMPILE([
958                 #include "confdefs.h"
959                 #include <sys/types.h>
960                 #include <sys/socket.h>
961                 #include <netinet/in.h>
962                 #include <netdb.h>
963                 #include <stddef.h>
964
965         ],[
966                 #ifndef NI_MAXHOST
967                 #define NI_MAXHOST      1025
968                 #endif
969
970                 #ifndef NI_MAXSERV
971                 #define NI_MAXSERV      32
972                 #endif
973
974                 struct addrinfo hints, *res;
975                 struct sockaddr_in6 sin6;
976                 int af = AF_INET6;
977                 char host[NI_MAXHOST];
978                 char serv[NI_MAXSERV];
979
980                 getaddrinfo ("www.ximian.com", NULL, &hints, &res);
981                 freeaddrinfo (res);
982                 getnameinfo((struct sockaddr *)&sin6, sizeof(sin6), host, sizeof(host), serv, sizeof(serv), 0);
983         ],[
984                 ac_cv_have_addrinfo=yes
985         ],[
986                 ac_cv_have_addrinfo=no
987         ])
988 ])
989
990 if test x"$ac_cv_have_addrinfo" = "xno" ; then
991    AC_DEFINE(NEED_ADDRINFO,1,[Enable getaddrinfo emulation])
992    if test x"$enable_ipv6" = "xyes" ; then
993       AC_ERROR(system doesn't support necessary interfaces for ipv6 support)
994    fi
995    msg_ipv6=no
996 else
997    AC_ARG_ENABLE(ipv6,
998      AC_HELP_STRING( [--enable-ipv6=@<:@no/yes@:>@],
999                      [Enable support for resolving IPv6 addresses.]),
1000      ,enable_ipv6=yes)
1001    if test x"$enable_ipv6" = "xyes"; then
1002         msg_ipv6=yes
1003         AC_DEFINE(ENABLE_IPv6,1,[Enable IPv6 support])
1004         AC_TRY_COMPILE([
1005                 #include "confdefs.h"
1006                 #include <sys/types.h>
1007                 #include <sys/socket.h>
1008                 #include <netinet/in.h>
1009                 #include <netdb.h>
1010
1011         ],[
1012                 struct addrinfo hints;
1013
1014                 hints.ai_flags = AI_ADDRCONFIG;
1015         ],[
1016                 AC_DEFINE(HAVE_AI_ADDRCONFIG,1,[Define if the system defines the AI_ADDRCONFIG flag for getaddrinfo])
1017         ])
1018    else
1019         msg_ipv6=no
1020    fi
1021 fi
1022
1023 AM_CONDITIONAL(ENABLE_IPv6, test "x$enable_ipv6" = "xyes")
1024
1025 dnl **************************************************
1026 dnl Calendar support
1027 dnl **************************************************
1028 AC_MSG_CHECKING(if we should build the calendar)
1029 AC_ARG_ENABLE(calendar,
1030   AC_HELP_STRING( [--enable-calendar=@<:@yes/no@:>@],
1031                   [Enable the calendar components (default yes)]),
1032   enable_calendar="$enableval", enable_calendar="yes")
1033
1034 if test "x${enable_calendar}" != "xno"; then
1035         AC_DEFINE(ENABLE_CALENDAR, 1, [Define if Calendar should be built])
1036 fi
1037 AM_CONDITIONAL(ENABLE_CALENDAR, test x$enable_calendar = xyes)
1038 AC_MSG_RESULT($enable_calendar)
1039 msg_calendar=$enable_calendar
1040
1041 dnl **************************************************
1042 dnl Weather calendar backend support
1043 dnl **************************************************
1044 AC_MSG_CHECKING(if we should build the weather calendar backend)
1045 AC_ARG_WITH([weather],
1046   [AC_HELP_STRING([--with-weather], [Build the weather calendar backend (default=yes)])],
1047   [use_gweather=$withval],
1048   [use_gweather=yes])
1049 if test $enable_calendar = no; then
1050         use_gweather="no (calendar support is disabled)"
1051 fi
1052 AC_MSG_RESULT($use_gweather)
1053
1054 if test $use_gweather = yes; then
1055         PKG_CHECK_MODULES([LIBGWEATHER],
1056            [gweather >= gweather_minimum_version],
1057            [],
1058            [AC_MSG_ERROR([The weather calendar backend requires GWeather >= gweather_minimum_version. Alternatively, you may specify --without-weather as a configure option to avoid building the backend.])])
1059 fi
1060
1061 AM_CONDITIONAL(ENABLE_WEATHER, test $use_gweather = yes)
1062
1063 dnl **************************************************
1064 dnl NNTP support.
1065 dnl **************************************************
1066 AC_ARG_ENABLE(nntp,
1067   AC_HELP_STRING( [--enable-nntp=@<:@no/yes@:>@],
1068                   [Build Usenet news (NNTP) backend]),
1069   ,enable_nntp=yes)
1070
1071 if test "x$enable_nntp" = "xyes"; then
1072         AC_DEFINE(ENABLE_NNTP,1,[Build NNTP backend])
1073         msg_nntp=yes
1074 else
1075         msg_nntp=no
1076 fi
1077 AM_CONDITIONAL(ENABLE_NNTP, test x$enable_nntp = xyes)
1078
1079 dnl **************************************************
1080 dnl New IMAP code support.
1081 dnl **************************************************
1082 AC_ARG_ENABLE(imapp,
1083   AC_HELP_STRING( [--enable-imapp=@<:@no/yes@:>@],
1084                   [Attempt to compile alternative, incomplete, very unsupported IMAPv4r1 code]),
1085   ,enable_imapp=no)
1086
1087 if test "x$enable_imapp" = "xyes"; then
1088         AC_DEFINE(ENABLE_IMAPP,1,[Really don't try this at home])
1089         msg_imapp=yes
1090 else
1091         msg_imapp=no
1092 fi
1093 AM_CONDITIONAL(ENABLE_IMAPP, test x$enable_imapp = xyes)
1094
1095 dnl **************************************************
1096 dnl IMAP4rev1 code support.
1097 dnl **************************************************
1098 AC_ARG_ENABLE(imap4,
1099   AC_HELP_STRING( [--enable-imap4=@<:@no/yes@:>@],
1100                   [Attempt to compile yet another, incomplete, very unsupported IMAPv4r1 implementation]),
1101   ,enable_imap4=no)
1102
1103 if test "x$enable_imap4" = "xyes"; then
1104          AC_DEFINE(ENABLE_IMAP4,1,[Really don't try this at home])
1105          msg_imap4=yes
1106 else
1107          msg_imap4=no
1108 fi
1109 AM_CONDITIONAL(ENABLE_IMAP4, test x$enable_imap4 = xyes)
1110
1111 dnl **************************************************
1112 dnl Hula support
1113 dnl **************************************************
1114 AC_ARG_ENABLE(hula,
1115   AC_HELP_STRING( [--enable-hula=@<:@no/yes@:>@],
1116                   [Enable support for the now-defunct Hula project]),
1117   ,enable_hula=no)
1118
1119 if test "x$enable_hula" = "xyes"; then
1120         AC_DEFINE(ENABLE_HULA,1,[Build Hula backend])
1121         msg_hula=yes
1122 else
1123         msg_hula=no
1124 fi
1125 AM_CONDITIONAL(ENABLE_HULA, test x$enable_hula = xyes)
1126
1127 dnl **************************************************
1128 dnl * File locking
1129 dnl **************************************************
1130
1131 AC_ARG_ENABLE(dot-locking,
1132   AC_HELP_STRING( [--enable-dot-locking=@<:@yes/no@:>@],
1133                   [Enable support for locking mail files with dot locking]),
1134   ,enable_dot_locking=yes)
1135
1136 if test $os_win32 != yes -a "x$enable_dot_locking" = "xyes"; then
1137   AC_DEFINE(USE_DOT,1,[Define to use dot locking for mbox files])
1138   msg_dot=yes
1139 else
1140   msg_dot=no
1141 fi
1142
1143 AC_ARG_ENABLE(file-locking,
1144   AC_HELP_STRING( [--enable-file-locking=@<:@fcntl/flock/no@:>@],
1145                   [Enable support for locking mail files with file locking]),
1146   ,enable_file_locking=fcntl)
1147
1148 if test $os_win32 != yes -a "x$enable_file_locking" = "xfcntl"; then
1149   AC_DEFINE(USE_FCNTL,1,[Define to use fcntl locking for mbox files])
1150   msg_file=fcntl
1151 else
1152   if test $os_win32 != yes -a "x$enable_file_locking" = "xflock"; then
1153     AC_DEFINE(USE_FLOCK,1,[Define to use flock locking for mbox files])
1154     msg_file=flock
1155   else
1156     msg_file=no
1157   fi
1158 fi
1159
1160 dnl **************************************************
1161 dnl * sendmail operation
1162 dnl **************************************************
1163
1164 AC_MSG_CHECKING(for SunOS broken spool format)
1165 if test "x$host_os" = "xsunos" ; then
1166    with_broken_spool="yes"
1167 fi
1168
1169 AC_ARG_WITH(broken-spool,
1170   AC_HELP_STRING( [--with-broken-spool=@<:@yes/no@:>@],
1171                   [Using SunOS/Solaris sendmail which has a broken spool format]),
1172   ,with_broken_spool=${with_broken_spool:=no})
1173
1174 if test "x$with_broken_spool" = "xyes"; then
1175   AC_DEFINE(HAVE_BROKEN_SPOOL,1,[Define if mail delivered to the system mail directory is in broken Content-Length format])
1176 fi
1177
1178 AC_MSG_RESULT($with_broken_spool)
1179
1180 dnl ********
1181 dnl Kerberos
1182 dnl ********
1183 AC_ARG_WITH(krb5,
1184   AC_HELP_STRING( [--with-krb5=DIR],
1185                   [Location of Kerberos 5 install dir]),
1186   with_krb5="$withval", with_krb5="no")
1187
1188 AC_ARG_WITH(krb5-libs,
1189   AC_HELP_STRING( [--with-krb5-libs=DIR],
1190                   [Location of Kerberos 5 libraries]),
1191   with_krb5_libs="$withval", with_krb5_libs="$with_krb5/lib")
1192
1193 AC_ARG_WITH(krb5-includes,
1194   AC_HELP_STRING( [--with-krb5-includes=DIR],
1195                   [Location of Kerberos 5 headers]),
1196   with_krb5_includes="$withval", with_krb5_includes="")
1197
1198 AC_ARG_WITH(krb4,
1199   AC_HELP_STRING( [--with-krb4=DIR],
1200                   [Location of Kerberos 4 install dir]),
1201   with_krb4="$withval", with_krb4="no")
1202
1203 AC_ARG_WITH(krb4-libs,
1204   AC_HELP_STRING( [--with-krb4-libs=DIR],
1205                   [Location of Kerberos 4 libraries]),
1206   with_krb4_libs="$withval", with_krb4_libs="$with_krb4/lib")
1207
1208 AC_ARG_WITH(krb4-includes,
1209   AC_HELP_STRING( [--with-krb4-includes=DIR],
1210                   [Location of Kerberos 4 headers]),
1211   with_krb4_includes="$withval", with_krb4_includes="")
1212
1213 msg_krb5="no"
1214 if test "x${with_krb5}" != "xno"; then
1215         LIBS_save="$LIBS"
1216
1217         mitlibs="-lkrb5 -lk5crypto -lcom_err -lgssapi_krb5"
1218         heimlibs="-lkrb5 -lcrypto -lasn1 -lcom_err -lroken -lgssapi"
1219         sunlibs="-lkrb5 -lgss"
1220         AC_CACHE_CHECK([for Kerberos 5], ac_cv_lib_kerberos5,
1221         [
1222                 LIBS="$LIBS -L$with_krb5_libs $mitlibs"
1223                 AC_TRY_LINK([#include <krb5.h>],krb5_init_context, ac_cv_lib_kerberos5="$mitlibs",
1224                 [
1225                         LIBS="$LIBS_save -L$with_krb5_libs $heimlibs"
1226                         AC_TRY_LINK_FUNC(krb5_init_context, ac_cv_lib_kerberos5="$heimlibs",
1227                         [
1228                                 LIBS="$LIBS_save -L$with_krb5_libs $sunlibs"
1229                                 AC_TRY_LINK_FUNC(krb5_init_context, ac_cv_lib_kerberos5="$sunlibs", ac_cv_lib_kerberos5="no")
1230                         ])
1231                 ])
1232                 LIBS="$LIBS_save"
1233         ])
1234         if test "$ac_cv_lib_kerberos5" != "no"; then
1235                 AC_DEFINE(HAVE_KRB5,1,[Define if you have Krb5])
1236                 if test "$ac_cv_lib_kerberos5" = "$mitlibs"; then
1237                         AC_DEFINE(HAVE_MIT_KRB5,1,[Define if you have MIT Krb5])
1238                         if test -z "$with_krb5_includes"; then
1239                                 KRB5_CFLAGS="-I$with_krb5/include"
1240                         else
1241                                 KRB5_CFLAGS="-I$with_krb5_includes"
1242                         fi
1243                         msg_krb5="yes (MIT)"
1244                 else
1245                         if test "$ac_cv_lib_kerberos5" = "$heimlibs"; then
1246                                 AC_DEFINE(HAVE_HEIMDAL_KRB5,1,[Define if you have Heimdal])
1247                                 if test -z "$with_krb5_includes"; then
1248                                         KRB5_CFLAGS="-I$with_krb5/include/heimdal"
1249                                 else
1250                                         KRB5_CFLAGS="-I$with_krb5_includes"
1251                                 fi
1252                                 msg_krb5="yes (Heimdal)"
1253                         else
1254                                 AC_DEFINE(HAVE_SUN_KRB5,1,[Define if you have Sun Kerberosv5])
1255                                 if test -z "$with_krb5_includes"; then
1256                                         KRB5_CFLAGS="-I$with_krb5/include/kerberosv5"
1257                                 else
1258                                         KRB5_CFLAGS="-I$with_krb5_includes"
1259                                 fi
1260                                 msg_krb5="yes (Sun)"
1261                         fi
1262                 fi
1263                 KRB5_LDFLAGS="-L$with_krb5_libs $ac_cv_lib_kerberos5"
1264                 AC_MSG_RESULT(msg_krb5)
1265         else
1266                 dnl AC_MSG_CHECKING([for Kerberos 5])
1267                 AC_MSG_RESULT([no])
1268                 AC_MSG_ERROR([You specified with krb5, but it was not found.])
1269         fi
1270 else
1271         AC_MSG_WARN([krb5 support disabled])
1272 fi
1273
1274 AM_CONDITIONAL(ENABLE_KRB5, test x$with_krb5 != xno)
1275
1276 AC_CHECK_HEADER([et/com_err.h],[AC_DEFINE([HAVE_ET_COM_ERR_H], 1, [Have et/comm_err.h])])
1277 AC_CHECK_HEADER([com_err.h],[AC_DEFINE([HAVE_COM_ERR_H], 1, [Have comm_err.h])])
1278
1279 msg_krb4="no"
1280 if test "x${with_krb4}" != "xno"; then
1281         LDFLAGS_save="$LDFLAGS"
1282         AC_CACHE_CHECK(for Kerberos 4, ac_cv_lib_kerberos4,
1283         [
1284                 ac_cv_lib_kerberos4="no"
1285
1286                 mitcompatlibs="-lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"
1287                 # Look for MIT krb5 compat krb4
1288                 LDFLAGS="$LDFLAGS -L$with_krb4_libs $mitcompatlibs"
1289                 AC_TRY_LINK_FUNC(krb_mk_req, ac_cv_lib_kerberos4="$mitcompatlibs")
1290
1291                 if test "$ac_cv_lib_kerberos4" = "no"; then
1292                         # Look for KTH krb4
1293                         LDFLAGS="$LDFLAGS_save -L$with_krb4_libs -lkrb -lcrypto -lcom_err -lroken"
1294                         AC_TRY_LINK_FUNC(krb_mk_req, ac_cv_lib_kerberos4="-lkrb -lcrypto -lcom_err -lroken")
1295                 fi
1296                 if test "$ac_cv_lib_kerberos4" = "no"; then
1297                         # Look for old MIT krb4
1298                         LDFLAGS="$LDFLAGS_save -L$with_krb4_libs -lkrb"
1299                         AC_TRY_LINK_FUNC(krb_mk_req, ac_cv_lib_kerberos4="-lkrb",
1300                         [
1301                                 LDFLAGS="$LDFLAGS -ldes"
1302                                 AC_TRY_LINK_FUNC(krb_mk_req, ac_cv_lib_kerberos4="-lkrb -ldes")
1303                         ])
1304                 fi
1305         ])
1306         LDFLAGS="$LDFLAGS_save"
1307         if test "$ac_cv_lib_kerberos4" != "no"; then
1308                 AC_DEFINE(HAVE_KRB4,1,[Define if you have Krb4])
1309                 msg_krb4="yes"
1310
1311                 if test -z "$with_krb4_includes"; then
1312                         if test -f "$with_krb4/include/krb.h" -o -f "$with_krb4/include/port-sockets.h"; then
1313                                 KRB4_CFLAGS="-I$with_krb4/include"
1314                         fi
1315                         if test -d "$with_krb4/include/kerberosIV"; then
1316                                 KRB4_CFLAGS="$KRB4_CFLAGS -I$with_krb4/include/kerberosIV"
1317                         fi
1318                 else
1319                         KRB4_CFLAGS="-I$with_krb4_includes"
1320                 fi
1321                 KRB4_LDFLAGS="-L$with_krb4_libs $ac_cv_lib_kerberos4"
1322
1323                 CFLAGS_save="$CFLAGS"
1324                 CFLAGS="$CFLAGS $KRB4_CFLAGS"
1325                 AC_TRY_COMPILE([#include "krb.h"
1326                 int krb_sendauth;
1327                 ],[return 0],[AC_DEFINE(NEED_KRB_SENDAUTH_PROTO,1,[Need krb_sendauth proto])],)
1328                 CFLAGS="$CFLAGS_save"
1329         fi
1330 else
1331         AC_MSG_CHECKING(for Kerberos 4)
1332         AC_MSG_RESULT(${with_krb4})
1333 fi
1334
1335 AC_SUBST(KRB5_CFLAGS)
1336 AC_SUBST(KRB5_LDFLAGS)
1337 AC_SUBST(KRB4_CFLAGS)
1338 AC_SUBST(KRB4_LDFLAGS)
1339
1340 dnl
1341 dnl Purify support
1342 dnl
1343 EVO_PURIFY_SUPPORT
1344
1345 dnl **************************************************
1346 dnl Exchange debug
1347 dnl **************************************************
1348 AC_ARG_WITH(e2k-debug,
1349   AC_HELP_STRING( [--with-e2k-debug],
1350                   [Allow debugging]))
1351 case $withval in
1352 no)
1353         ;;
1354 *)
1355         AC_DEFINE(E2K_DEBUG, 1, [Define if you want E2K_DEBUG to be available])
1356         ;;
1357 esac
1358
1359 dnl **************************************************
1360 dnl LDAP support.
1361 dnl **************************************************
1362 if test "$os_win32" != yes; then
1363 EVO_LDAP_CHECK(no)
1364 case $with_openldap in
1365 no)
1366         msg_ldap=no
1367         ;;
1368 *)
1369         case $with_static_ldap in
1370         yes)
1371                 msg_ldap="$with_openldap (static)"
1372                 ;;
1373         *)
1374                 msg_ldap="$with_openldap (dynamic)"
1375                 ;;
1376         esac
1377 esac
1378
1379 dnl **************************************************
1380 dnl SunLDAP support, but if OpenLDAP support, skip check SunLDAP.
1381 dnl **************************************************
1382 if test "$with_openldap" = no ; then
1383         EVO_SUNLDAP_CHECK(no)
1384         case $with_sunldap in
1385         no)
1386                 msg_ldap=no
1387                 ;;
1388         *)
1389                 case $with_static_sunldap in
1390                 yes)
1391                         msg_ldap="$with_sunldap (static)"
1392                         ;;
1393                 *)
1394                         msg_ldap="$with_sunldap (dynamic)"
1395                         ;;
1396                 esac
1397         esac
1398 else
1399         with_sunldap=no
1400 fi
1401 AM_CONDITIONAL(SUNLDAP, test "$with_sunldap" != no)
1402
1403 SAVE_CFLAGS="$CFLAGS"
1404 SAVE_LIBS="$LIBS"
1405 LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_DEPRECATED"
1406 CFLAGS="$CFLAGS $LDAP_CFLAGS"
1407 LIBS="$LIBS $LDAP_LIBS"
1408 AC_CHECK_FUNCS(ldap_ntlm_bind)
1409 CFLAGS="$SAVE_CFLAGS"
1410 LIBS="$SAVE_LIBS"
1411 dnl You need to enable LDAP and Kerberos to enable Exchange support in e-d-s
1412 msg_no_ntlm="no"
1413 msg_exchange="no"
1414 if test "$msg_ldap" != "no" ; then
1415         if test "$ac_cv_func_ldap_ntlm_bind" != no ; then
1416                 msg_exchange="yes"
1417         else
1418 dnl The user wanted to build with openldap, but his openldap did not have NTLM
1419 dnl support. Make him aware of this with a warning message at the end.
1420                 msg_no_ntlm="yes"
1421         fi
1422 fi
1423 else # Win32
1424 LDAP_CFLAGS="-DLDAP_DEPRECATED"
1425 LDAP_LIBS="-lwldap32"
1426 AC_SUBST(LDAP_CFLAGS)
1427 AC_SUBST(LDAP_LIBS)
1428 AC_DEFINE(HAVE_LDAP,1,[Define if you have LDAP support])
1429 AM_CONDITIONAL(ENABLE_LDAP, true)
1430 AM_CONDITIONAL(SUNLDAP, false)
1431 msg_ldap="yes"
1432 msg_no_ntlm="no"
1433 msg_exchange="yes"
1434 fi # Win32
1435
1436 LIBBONOBO_REQUIRED=libbonobo_minimum_version
1437 AC_SUBST(LIBBONOBO_REQUIRED)
1438
1439 ORBIT_REQUIRED=ORBit_minimum_version
1440 AC_SUBST(ORBIT_REQUIRED)
1441
1442 dnl *******************
1443 dnl GObject marshalling
1444 dnl *******************
1445 AM_PATH_GLIB_2_0
1446
1447 dnl We use AC_SUBST_FILE because AC_SUBST won't deal with newlines
1448 EVO_MARSHAL_RULE=$srcdir/marshal.mk
1449 AC_SUBST_FILE(EVO_MARSHAL_RULE)
1450
1451 dnl **************************************************
1452 dnl * Posix thread support
1453 dnl **************************************************
1454
1455 dnl GLIB_CONFIG=${GLIB_CONFIG-glib-config}
1456 dnl GNOME_PTHREAD_CHECK
1457
1458 dnl if test "x$PTHREAD_LIB" = "x" ; then
1459 dnl     AC_MSG_ERROR([POSIX threads are currently required for Evolution])
1460 dnl fi
1461
1462 dnl
1463 dnl Notice that this is a hack, and we wont be able to use this forever, but
1464 dnl at least for some time
1465 dnl
1466
1467 EVO_PTHREAD_CHECK
1468
1469 THREADS_LIBS="$PTHREAD_LIB"
1470 THREADS_CFLAGS="$PTHREAD_CFLAGS"
1471
1472 AC_SUBST(THREADS_LIBS)
1473 AC_SUBST(THREADS_CFLAGS)
1474 AC_DEFINE(ENABLE_THREADS,1,[Required])
1475
1476 PKG_CHECK_MODULES(ORBIT, ORBit-2.0 >= ORBit_minimum_version)
1477 test x$ORBIT_IDL = x && ORBIT_IDL=`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`
1478 AC_SUBST(ORBIT_CFLAGS)
1479 AC_SUBST(ORBIT_LIBS)
1480 AC_SUBST(ORBIT_IDL)
1481
1482 AC_MSG_CHECKING(for CORBA include paths)
1483 IDL_INCLUDES="-I"`pkg-config --variable=idldir libbonobo-2.0`" -I"`pkg-config --variable=idldir bonobo-activation-2.0`
1484 AC_MSG_RESULT($IDL_INCLUDES)
1485 AC_SUBST(IDL_INCLUDES)
1486
1487 dnl Utility macro to set compiler flags for a specific lib.
1488 dnl  EVO_SET_COMPILE_FLAGS(VAR-PREFIX, DEPS, EXTRA-CFLAGS, EXTRA-LIBS)
1489 AC_DEFUN([EVO_SET_COMPILE_FLAGS], [
1490         PKG_CHECK_MODULES([$1], [$2])
1491         $1_CFLAGS="[$]$1_CFLAGS $3 "
1492         $1_LIBS="[$]$1_LIBS $4 "
1493 ])
1494
1495 dnl ****************************************
1496 dnl Flags for the various libraries we build
1497 dnl ****************************************
1498
1499 dnl --- libedataserver, libedataserverui, libebackend flags
1500
1501 E_DATA_SERVER_DEPS="libxml-2.0 libbonobo-2.0 libsoup-2.4 gconf-2.0 $mozilla_nspr"
1502
1503 EVO_SET_COMPILE_FLAGS(E_DATA_SERVER, $E_DATA_SERVER_DEPS, $THREADS_CFLAGS $MANUAL_NSPR_CFLAGS, $THREADS_LIBS $MANUAL_NSPR_LIBS)
1504 AC_SUBST(E_DATA_SERVER_CFLAGS)
1505 AC_SUBST(E_DATA_SERVER_LIBS)
1506
1507 E_DATA_SERVER_UI_DEPS="gtk+-2.0 libglade-2.0 gobject-2.0 gthread-2.0 gconf-2.0 $GNOME_KEYRING_REQUIREMENT"
1508
1509 EVO_SET_COMPILE_FLAGS(E_DATA_SERVER_UI, $E_DATA_SERVER_UI_DEPS, $THREADS_CFLAGS, $THREADS_LIBS)
1510 AC_SUBST(E_DATA_SERVER_UI_CFLAGS)
1511 AC_SUBST(E_DATA_SERVER_UI_LIBS)
1512
1513 E_BACKEND_DEPS="gobject-2.0 libxml-2.0 gmodule-2.0"
1514
1515 EVO_SET_COMPILE_FLAGS(E_BACKEND, $E_BACKEND_DEPS)
1516 AC_SUBST(E_BACKEND_CFLAGS)
1517 AC_SUBST(E_BACKEND_LIBS)
1518
1519 dnl --- evolution-addressbook flags
1520
1521 EVOLUTION_ADDRESSBOOK_DEPS="libxml-2.0 libbonobo-2.0 gobject-2.0 gthread-2.0 gconf-2.0"
1522
1523 EVO_SET_COMPILE_FLAGS(EVOLUTION_ADDRESSBOOK, $EVOLUTION_ADDRESSBOOK_DEPS)
1524 AC_SUBST(EVOLUTION_ADDRESSBOOK_CFLAGS)
1525 AC_SUBST(EVOLUTION_ADDRESSBOOK_LIBS)
1526
1527 dnl --- evolution-calendar flags
1528 if test "x${enable_calendar}" = "xyes"; then
1529         EVOLUTION_CALENDAR_DEPS="libical >= libical_minimum_version libxml-2.0 libbonobo-2.0 gio-2.0 gobject-2.0 gthread-2.0 gconf-2.0"
1530
1531 dnl *****
1532 dnl libical.pc from libical-0.43 has a bug in it's CFlags.
1533 dnl It wants apps to include <libical/ical*.h> but it's CFlags make it difficult
1534 dnl to differentiate between <libical/ical.h> and <ical.h>
1535 dnl We have fixed all our instances to use <libical/ical.h>. Until the .pc from
1536 dnl libical is fixed, we have to work-around the buggy CFlags.
1537 dnl *****
1538 LIBICAL_EXTRA_CFLAGS=" -I`$PKG_CONFIG --variable=includedir libical` "
1539 LIBICAL_EXTRA_LIBS=""
1540 AC_SUBST(LIBICAL_EXTRA_CFLAGS)
1541 AC_SUBST(LIBICAL_EXTRA_LIBS)
1542
1543         EVO_SET_COMPILE_FLAGS(EVOLUTION_CALENDAR, $EVOLUTION_CALENDAR_DEPS, $LIBICAL_EXTRA_CFLAGS, $LIBICAL_EXTRA_LIBS)
1544         AC_SUBST(EVOLUTION_CALENDAR_CFLAGS)
1545         AC_SUBST(EVOLUTION_CALENDAR_LIBS)
1546 fi
1547
1548 dnl --- factory flags
1549
1550 E_FACTORY_DEPS="$mozilla_nspr"
1551 if test "x${enable_calendar}" = "xyes"; then
1552    E_FACTORY_DEPS="$E_FACTORY_DEPS libical"
1553 fi
1554 EVO_SET_COMPILE_FLAGS(E_FACTORY, $E_FACTORY_DEPS, $THREADS_CFLAGS $MANUAL_NSPR_CFLAGS $LIBICAL_EXTRA_CFLAGS, $THREADS_LIBS $MANUAL_NSPR_LIBS $LIBICAL_EXTRA_LIBS)
1555 AC_SUBST(E_FACTORY_CFLAGS)
1556 AC_SUBST(E_FACTORY_LIBS)
1557
1558 dnl --- Google flags
1559 GDATA_DEPS="libsoup-2.4 libxml-2.0"
1560 EVO_SET_COMPILE_FLAGS(GDATA, $GDATA_DEPS)
1561 AC_SUBST(GDATA_CFLAGS)
1562 AC_SUBST(GDATA_LIBS)
1563
1564 dnl --- Groupwise flags
1565 LIBSOUP_REQUIRED=libsoup_minimum_version
1566 AC_SUBST(LIBSOUP_REQUIRED)
1567
1568 EVO_SET_COMPILE_FLAGS(SOUP, libsoup-2.4)
1569 AC_SUBST(SOUP_CFLAGS)
1570 AC_SUBST(SOUP_LIBS)
1571
1572 dnl --- Camel flags
1573 SQLITE_REQUIRED=sqlite_minimum_version
1574 AC_SUBST(SQLITE_REQUIRED)
1575
1576 zlib_found=false
1577 dnl deflateInit is a #define, use deflateEnd instead
1578 AC_CHECK_LIB(z, deflateEnd,
1579     [ AC_CHECK_HEADER(zlib.h, zlib_found=true) ])
1580 if test "x$zlib_found" = "xfalse"; then
1581     AC_MSG_ERROR([*** zlib is required])
1582 fi
1583
1584 dnl *************************************
1585 dnl *** Checks for large file support ***
1586 dnl *************************************
1587 AC_ARG_ENABLE(largefile,
1588               AC_HELP_STRING([--enable-largefile],
1589               [enable support for large files [[default=no]]]),,
1590               enable_largefile="no")
1591 if test "x$enable_largefile" != "xno"; then
1592     AC_SYS_LARGEFILE
1593     AC_CACHE_CHECK([for _LARGEFILE64_SOURCE value needed for large files], ac_cv_largefile64_source,
1594     [
1595         AC_TRY_COMPILE([
1596                 #include <sys/types.h>
1597                 #include <sys/stat.h>
1598                 #include <fcntl.h>
1599         ],[
1600                 int fd = open ("__o_largefile", O_CREAT | O_RDWR | O_LARGEFILE, 0644);
1601         ],[
1602                 ac_cv_largefile64_source="no"
1603         ],[
1604                 AC_TRY_COMPILE([
1605                         #define _LARGEFILE64_SOURCE
1606                         #include <sys/types.h>
1607                         #include <sys/stat.h>
1608                         #include <fcntl.h>
1609                 ],[
1610                         int fd = open ("__o_largefile", O_CREAT | O_RDWR | O_LARGEFILE, 0644);
1611                 ],[
1612                         ac_cv_largefile64_source="yes"
1613                 ],[
1614                         ac_cv_largefile64_source="unknown"
1615                 ])
1616         ])
1617     ])
1618
1619     enable_largefile="no"
1620
1621     if test "x$ac_cv_largefile64_source" = "xyes"; then
1622         LARGEFILE_CFLAGS="-D_LARGEFILE64_SOURCE"
1623         enable_largefile="yes"
1624     elif test "x$ac_cv_largefile64_source" = "xunknown"; then
1625         AC_DEFINE(O_LARGEFILE, 0, [Define to 0 if your system does not have the O_LARGEFILE flag])
1626     fi
1627
1628     if test -n "$ac_cv_sys_large_files" -a "x$ac_cv_sys_large_files" != "xno"; then
1629         LARGEFILE_CFLAGS="$LARGEFILE_CFLAGS -D_LARGE_FILES"
1630         enable_largefile="yes"
1631     fi
1632
1633     if test "x$ac_cv_sys_file_offset_bits" != "xno"; then
1634         LARGEFILE_CFLAGS="$LARGEFILE_CFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
1635         enable_largefile="yes"
1636     fi
1637 else
1638     AC_DEFINE(O_LARGEFILE, 0, [Define to 0 if your system does not have the O_LARGEFILE flag])
1639     LARGEFILE_CFLAGS=""
1640 fi
1641
1642 AM_CONDITIONAL(ENABLE_LARGEFILE, test "x$enable_largefile" = "xyes")
1643
1644 EVO_SET_COMPILE_FLAGS(CAMEL, $mozilla_nss gio-2.0 sqlite3 >= sqlite_minimum_version gthread-2.0,
1645                       $THREADS_CFLAGS $KRB4_CFLAGS $KRB5_CFLAGS $MANUAL_NSS_CFLAGS $LARGEFILE_CFLAGS,
1646                       -lz $THREADS_LIBS $KRB4_LDFLAGS $KRB5_LDFLAGS $MANUAL_NSS_LIBS)
1647 AC_SUBST(CAMEL_CFLAGS)
1648 AC_SUBST(CAMEL_LIBS)
1649 AC_SUBST(CAMEL_GROUPWISE_CFLAGS)
1650 AC_SUBST(CAMEL_GROUPWISE_LIBS)
1651
1652 dnl *******************
1653 dnl Special directories
1654 dnl *******************
1655
1656 dnl --- If you add something here, consider whether or not you also
1657 dnl --- need to add it to one or more .pc.in files (for Connector,
1658 dnl --- etc)
1659
1660 privdatadir='${datadir}'/evolution-data-server-$BASE_VERSION
1661 AC_SUBST(privdatadir)
1662
1663 privincludedir='${includedir}'/evolution-data-server-$BASE_VERSION
1664 AC_SUBST(privincludedir)
1665
1666 privlibdir='${libdir}'/evolution-data-server-$BASE_VERSION
1667 AC_SUBST(privlibdir)
1668
1669 idldir='${datadir}'/idl/evolution-data-server-$API_VERSION
1670 AC_SUBST(idldir)
1671
1672 imagesdir='${datadir}'/pixmaps/evolution-data-server
1673 AC_SUBST(imagesdir)
1674
1675 serverdir="$libdir/bonobo/servers"
1676 AC_SUBST(serverdir)
1677
1678 extensiondir='${libdir}'/evolution-data-server-$API_VERSION/extensions
1679 AC_SUBST(extensiondir)
1680
1681 gladedir="$privdatadir/glade"
1682 AC_SUBST(gladedir)
1683
1684 if test $use_gweather = yes; then
1685         weatherdatadir="$privdatadir/weather"
1686         AC_SUBST(weatherdatadir)
1687 fi
1688
1689 dnl separate camel from e-d-s?  or should it be under the same spot?  same for now.
1690 camel_providerdir='${libdir}'/evolution-data-server-$API_VERSION/camel-providers
1691 AC_SUBST(camel_providerdir)
1692
1693 dnl ************************
1694 dnl IDL/Component Versioning
1695 dnl ************************
1696
1697 INTERFACE_VERSION="$BASE_VERSION"
1698 AC_SUBST(INTERFACE_VERSION)
1699 AC_DEFINE_UNQUOTED(INTERFACE_VERSION, "$INTERFACE_VERSION", [IDL interface version (Major.Minor)])
1700
1701 EVO_SUBST_SERVER_RULE='%.server.in: %.server.in.in ; sed -e "s|\@BINDIR\@|$(bindir)|" -e "s|\@LIBEXECDIR_IN_SERVER_FILE\@|$(LIBEXECDIR_IN_SERVER_FILE)|" -e "s|\@COMPONENTDIR\@|$(componentdir)|" -e "s|\@IMPORTERSDIR\@|$(importersdir)|" -e "s|\@EXEEXT\@|$(EXEEXT)|" -e "s|\@VERSION\@|$(BASE_VERSION)|" -e "s|\@API_VERSION\@|$(API_VERSION)|" -e "s|\@INTERFACE_VERSION\@|$(INTERFACE_VERSION)|" $< > $@'
1702 EVO_NAME_SERVER_RULE='%_$(API_VERSION).server: %.server ; mv $< $@'
1703 AC_SUBST(EVO_SUBST_SERVER_RULE)
1704 AC_SUBST(EVO_NAME_SERVER_RULE)
1705
1706 dnl ***********
1707 dnl GConf stuff
1708 dnl ***********
1709 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
1710 AM_GCONF_SOURCE_2
1711
1712 dnl *************
1713 dnl Gtk Doc stuff
1714 dnl *************
1715 GTK_DOC_CHECK(1.9)
1716
1717 dnl ******************************
1718 dnl Makefiles
1719 dnl ******************************
1720
1721 export privlibdir
1722 export privincludedir
1723 export privdatadir
1724
1725 if test $dynamic_libdb = no; then
1726         AC_CONFIG_SUBDIRS(libdb/dist)
1727 fi
1728 AC_OUTPUT([
1729 Makefile
1730 evolution-data-server-zip
1731 evolution-data-server.pc
1732 addressbook/Makefile
1733 addressbook/idl/Makefile
1734 addressbook/libebook/Makefile
1735 addressbook/libebook/libebook.pc
1736 addressbook/libedata-book/Makefile
1737 addressbook/libedata-book/libedata-book.pc
1738 addressbook/backends/Makefile
1739 addressbook/backends/file/Makefile
1740 addressbook/backends/vcf/Makefile
1741 addressbook/backends/ldap/Makefile
1742 addressbook/backends/google/Makefile
1743 addressbook/backends/groupwise/Makefile
1744 addressbook/backends/webdav/Makefile
1745 addressbook/tests/Makefile
1746 addressbook/tests/ebook/Makefile
1747 addressbook/tests/vcard/Makefile
1748 art/Makefile
1749 calendar/Makefile
1750 calendar/idl/Makefile
1751 calendar/libecal/Makefile
1752 calendar/libecal/libecal.pc
1753 calendar/libedata-cal/Makefile
1754 calendar/libedata-cal/libedata-cal.pc
1755 calendar/backends/Makefile
1756 calendar/backends/caldav/Makefile
1757 calendar/backends/file/Makefile
1758 calendar/backends/groupwise/Makefile
1759 calendar/backends/http/Makefile
1760 calendar/backends/contacts/Makefile
1761 calendar/backends/weather/Makefile
1762 calendar/backends/google/Makefile
1763 calendar/tests/Makefile
1764 calendar/tests/ecal/Makefile
1765 camel/Makefile
1766 camel/providers/Makefile
1767 camel/providers/groupwise/Makefile
1768 camel/providers/hula/Makefile
1769 camel/providers/imap/Makefile
1770 camel/providers/imapp/Makefile
1771 camel/providers/imap4/Makefile
1772 camel/providers/local/Makefile
1773 camel/providers/nntp/Makefile
1774 camel/providers/pop3/Makefile
1775 camel/providers/sendmail/Makefile
1776 camel/providers/smtp/Makefile
1777 camel/tests/Makefile
1778 camel/tests/folder/Makefile
1779 camel/tests/lib/Makefile
1780 camel/tests/message/Makefile
1781 camel/tests/mime-filter/Makefile
1782 camel/tests/misc/Makefile
1783 camel/tests/smime/Makefile
1784 camel/tests/stream/Makefile
1785 camel/camel.pc
1786 camel/camel-provider.pc
1787 libdb/Makefile
1788 libebackend/Makefile
1789 libebackend/libebackend.pc
1790 libedataserver/Makefile
1791 libedataserver/eds-version.h
1792 libedataserver/libedataserver.pc
1793 libedataserverui/Makefile
1794 libedataserverui/libedataserverui.pc
1795 servers/Makefile
1796 servers/groupwise/Makefile
1797 servers/groupwise/libegroupwise.pc
1798 servers/exchange/Makefile
1799 servers/exchange/xntlm/Makefile
1800 servers/exchange/lib/Makefile
1801 servers/exchange/storage/Makefile
1802 servers/exchange/storage/libexchange-storage.pc
1803 servers/google/Makefile
1804 servers/google/libgdata/Makefile
1805 servers/google/libgdata/libgdata.pc
1806 servers/google/libgdata-google/Makefile
1807 servers/google/libgdata-google/libgdata-google.pc
1808 src/Makefile
1809 win32/Makefile
1810 docs/Makefile
1811 docs/reference/Makefile
1812 docs/reference/addressbook/Makefile
1813 docs/reference/addressbook/libebook/Makefile
1814 docs/reference/addressbook/libedata-book/Makefile
1815 docs/reference/calendar/Makefile
1816 docs/reference/calendar/libecal/Makefile
1817 docs/reference/calendar/libedata-cal/Makefile
1818 docs/reference/camel/Makefile
1819 docs/reference/libedataserver/Makefile
1820 docs/reference/libedataserverui/Makefile
1821 docs/reference/libebackend/Makefile
1822 po/Makefile.in
1823 ])
1824
1825 case $host in
1826 *-mingw*)
1827         # Override the old libtool in libdb/dist with the one from here
1828         cp libtool libdb/dist
1829         ;;
1830 esac
1831
1832 echo "
1833         evolution-data-server has been configured as follows:
1834         Calendar:         $msg_calendar
1835         Weather calendar: $use_gweather
1836         Mail Directory:   $system_mail_dir, $system_mail_perm
1837         LDAP support:     $msg_ldap"
1838 if test "$msg_nntp" = "yes"; then
1839 echo "\
1840         NNTP support:     $msg_nntp"
1841 fi
1842 if test "$msg_hula" = "yes"; then
1843 echo "\
1844         Hula support:     $msg_hula"
1845 fi
1846 echo "\
1847         Kerberos 4/5:     $msg_krb4/$msg_krb5
1848         Gnome Keyring:    $enable_gnome_keyring/$with_gnome_keyring
1849         SSL support:      $msg_ssl
1850         SMIME support:    $msg_smime
1851         IPv6 support:     $msg_ipv6
1852         Berkeley DB:      $msg_libdb
1853         Exchange support: $msg_exchange
1854         Dot Locking:      $msg_dot
1855         File Locking:     $msg_file
1856         Large files:      $largefile_support
1857         Gtk Doc:          $enable_gtk_doc
1858 "
1859 if test "$msg_no_ntlm" != "no" ; then
1860         echo ""
1861         AC_MSG_WARN([
1862 No NTLM support in OpenLDAP; Plaintext password authentication will be
1863 used when connecting to the Exchange Global Catalog server. Consider
1864 installing the evo-openldap package, or building OpenLDAP with the
1865 patch in servers/exchange/docs/openldap-ntlm.diff
1866 ])
1867 fi