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