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