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