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