Bug 596834 - Fix misquoting in libdb configuration
[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 IMAPX code support.
1069 dnl ******************************
1070 AC_ARG_ENABLE(imapx,
1071         AS_HELP_STRING([--enable-imapx=no/yes],
1072         [Attempt to compile yet another, incomplete, very unsupported IMAPv4r1 implementation]),
1073         [],[enable_imapx=no])
1074
1075 if test "x$enable_imapx" = "xyes"; then
1076         AC_DEFINE(ENABLE_IMAPX,1,[Really don't try this at home])
1077         AC_PATH_PROG(GPERF, gperf)
1078         if test -z "$GPERF" ; then
1079                 AC_MSG_ERROR([You need gperf to compile imapx provider])
1080         fi
1081         msg_imapx=yes
1082 else
1083         msg_imapx=no
1084 fi
1085 AM_CONDITIONAL(ENABLE_IMAPX, [test x$enable_imapx = 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         LIBS_save="$LIBS"
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                 LIBS="$LIBS -L$with_krb5_libs $mitlibs"
1200                 AC_LINK_IFELSE([AC_LANG_CALL([], [krb5_init_context])],
1201                 [ac_cv_lib_kerberos5="$mitlibs"],
1202                 [
1203                         LIBS="$LIBS_save -L$with_krb5_libs $heimlibs"
1204                         AC_LINK_IFELSE([AC_LANG_CALL([], [krb5_init_context])],
1205                         [ac_cv_lib_kerberos5="$heimlibs"],
1206                         [
1207                                 LIBS="$LIBS_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                 LIBS="$LIBS_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_LIBS="-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         LIBS_save="$LIBS"
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                 LIBS="$LIBS_save -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                         LIBS="$LIBS_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                         LIBS="$LIBS_save -L$with_krb4_libs -lkrb"
1294                         AC_LINK_IFELSE([AC_LANG_CALL([], [krb_mk_req])],
1295                         [ac_cv_lib_kerberos4="-lkrb"],
1296                         [
1297                                 LIBS="$LIBS -ldes"
1298                                 AC_LINK_IFELSE([AC_LANG_CALL([], [krb_mk_req])],
1299                                 [ac_cv_lib_kerberos4="-lkrb -ldes"])
1300                         ])
1301                 fi
1302         ])
1303         LIBS="$LIBS_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_LIBS="-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_LIBS)
1337 AC_SUBST(KRB4_CFLAGS)
1338 AC_SUBST(KRB4_LIBS)
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 DBUS_GLIB_REQUIRED=dbus_glib_minimum_version
1440 AC_SUBST(DBUS_GLIB_REQUIRED)
1441
1442 dnl ******************************
1443 dnl GObject marshalling
1444 dnl ******************************
1445 AM_PATH_GLIB_2_0
1446
1447 dnl We use AC_SUBST_FILE because AC_SUBST won't deal with newlines
1448 EVO_MARSHAL_RULE=$srcdir/marshal.mk
1449 AC_SUBST_FILE(EVO_MARSHAL_RULE)
1450
1451 dnl ******************************
1452 dnl Posix thread support
1453 dnl ******************************
1454
1455 dnl GLIB_CONFIG=${GLIB_CONFIG-glib-config}
1456 dnl GNOME_PTHREAD_CHECK
1457
1458 dnl if test "x$PTHREAD_LIB" = "x" ; then
1459 dnl     AC_MSG_ERROR([POSIX threads are currently required for Evolution])
1460 dnl fi
1461
1462 dnl Notice that this is a hack, and we wont be able to use this forever, but
1463 dnl at least for some time
1464
1465 EVO_PTHREAD_CHECK
1466
1467 THREADS_LIBS="$PTHREAD_LIB"
1468 THREADS_CFLAGS="$PTHREAD_CFLAGS"
1469
1470 AC_SUBST(THREADS_LIBS)
1471 AC_SUBST(THREADS_CFLAGS)
1472 AC_DEFINE(ENABLE_THREADS,1,[Required])
1473
1474 dnl ******************************
1475 dnl Orbit \ Bonobo stuff
1476 dnl ******************************
1477 PKG_CHECK_MODULES([ORBIT], [ORBit-2.0 >= ORBit_minimum_version])
1478 test x$ORBIT_IDL = x && ORBIT_IDL=`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`
1479 AC_SUBST(ORBIT_CFLAGS)
1480 AC_SUBST(ORBIT_LIBS)
1481 AC_SUBST(ORBIT_IDL)
1482
1483 AC_MSG_CHECKING(for CORBA include paths)
1484 IDL_INCLUDES="-I"`${PKG_CONFIG} --variable=idldir libbonobo-2.0`" -I"`${PKG_CONFIG} --variable=idldir bonobo-activation-2.0`
1485 AC_MSG_RESULT($IDL_INCLUDES)
1486 AC_SUBST(IDL_INCLUDES)
1487
1488 PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 >= dbus_glib_minimum_version)
1489 AC_SUBST(DBUS_GLIB_CFLAGS)
1490 AC_SUBST(DBUS_GLIB_LIBS)
1491
1492 dnl ******************************
1493 dnl Utility macro to set compiler flags for a specific lib.
1494 dnl EVO_SET_COMPILE_FLAGS(VAR-PREFIX, DEPS, EXTRA-CFLAGS, EXTRA-LIBS)
1495 dnl ******************************
1496 AC_DEFUN([EVO_SET_COMPILE_FLAGS], [
1497         PKG_CHECK_MODULES([$1], [$2])
1498         $1_CFLAGS="[$]$1_CFLAGS $3 "
1499         $1_LIBS="[$]$1_LIBS $4 "
1500 ])
1501
1502 dnl ******************************
1503 dnl libedataserver flags
1504 dnl ******************************
1505 E_DATA_SERVER_DEPS="libxml-2.0 libbonobo-2.0 libsoup-2.4 gconf-2.0 $mozilla_nspr"
1506
1507 EVO_SET_COMPILE_FLAGS(E_DATA_SERVER, $E_DATA_SERVER_DEPS, $THREADS_CFLAGS $MANUAL_NSPR_CFLAGS, $THREADS_LIBS $MANUAL_NSPR_LIBS)
1508 AC_SUBST(E_DATA_SERVER_CFLAGS)
1509 AC_SUBST(E_DATA_SERVER_LIBS)
1510
1511 dnl ******************************
1512 dnl libedataserverui
1513 dnl ******************************
1514 E_DATA_SERVER_UI_DEPS="gtk+-2.0 libxml-2.0 gobject-2.0 gthread-2.0 gconf-2.0 $GNOME_KEYRING_REQUIREMENT"
1515
1516 EVO_SET_COMPILE_FLAGS(E_DATA_SERVER_UI, $E_DATA_SERVER_UI_DEPS, $THREADS_CFLAGS, $THREADS_LIBS)
1517 AC_SUBST(E_DATA_SERVER_UI_CFLAGS)
1518 AC_SUBST(E_DATA_SERVER_UI_LIBS)
1519
1520 E_BACKEND_DEPS="gobject-2.0 libxml-2.0 gmodule-2.0"
1521
1522 dnl ******************************
1523 dnl libebackend flags
1524 dnl ******************************
1525 EVO_SET_COMPILE_FLAGS(E_BACKEND, $E_BACKEND_DEPS)
1526 AC_SUBST(E_BACKEND_CFLAGS)
1527 AC_SUBST(E_BACKEND_LIBS)
1528
1529 dnl ******************************
1530 dnl evolution-addressbook flags
1531 dnl ******************************
1532 EVOLUTION_ADDRESSBOOK_DEPS="libxml-2.0 dbus-glib-1 gobject-2.0 gthread-2.0 gconf-2.0"
1533
1534 EVO_SET_COMPILE_FLAGS(EVOLUTION_ADDRESSBOOK, $EVOLUTION_ADDRESSBOOK_DEPS)
1535 AC_SUBST(EVOLUTION_ADDRESSBOOK_CFLAGS)
1536 AC_SUBST(EVOLUTION_ADDRESSBOOK_LIBS)
1537
1538 dnl ******************************
1539 dnl evolution-calendar flags
1540 dnl ******************************
1541 if test "x${enable_calendar}" = "xyes"; then
1542         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"
1543
1544 dnl *****
1545 dnl libical.pc from libical-0.43 has a bug in it's CFlags.
1546 dnl It wants apps to include <libical/ical*.h> but it's CFlags make it difficult
1547 dnl to differentiate between <libical/ical.h> and <ical.h>
1548 dnl We have fixed all our instances to use <libical/ical.h>. Until the .pc from
1549 dnl libical is fixed, we have to work-around the buggy CFlags.
1550 dnl *****
1551         LIBICAL_EXTRA_CFLAGS=" -I`$PKG_CONFIG --variable=includedir libical` "
1552         LIBICAL_EXTRA_LIBS=""
1553         AC_SUBST(LIBICAL_EXTRA_CFLAGS)
1554         AC_SUBST(LIBICAL_EXTRA_LIBS)
1555
1556         EVO_SET_COMPILE_FLAGS(EVOLUTION_CALENDAR, $EVOLUTION_CALENDAR_DEPS, $LIBICAL_EXTRA_CFLAGS, $LIBICAL_EXTRA_LIBS)
1557         AC_SUBST(EVOLUTION_CALENDAR_CFLAGS)
1558         AC_SUBST(EVOLUTION_CALENDAR_LIBS)
1559 fi
1560
1561 dnl ******************************
1562 dnl factory flags
1563 dnl ******************************
1564 E_FACTORY_DEPS="$mozilla_nspr"
1565 if test "x${enable_calendar}" = "xyes"; then
1566         E_FACTORY_DEPS="$E_FACTORY_DEPS libical"
1567 fi
1568 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)
1569 AC_SUBST(E_FACTORY_CFLAGS)
1570 AC_SUBST(E_FACTORY_LIBS)
1571
1572 dnl ******************************
1573 dnl Google flags
1574 dnl ******************************
1575 GDATA_DEPS="libsoup-2.4 libxml-2.0"
1576 EVO_SET_COMPILE_FLAGS(GDATA, $GDATA_DEPS)
1577 AC_SUBST(GDATA_CFLAGS)
1578 AC_SUBST(GDATA_LIBS)
1579
1580 dnl ******************************
1581 dnl Groupwise flags
1582 dnl ******************************
1583 LIBSOUP_REQUIRED=libsoup_minimum_version
1584 AC_SUBST(LIBSOUP_REQUIRED)
1585
1586 EVO_SET_COMPILE_FLAGS(SOUP, libsoup-2.4)
1587 AC_SUBST(SOUP_CFLAGS)
1588 AC_SUBST(SOUP_LIBS)
1589
1590 dnl ******************************
1591 dnl Camel flags
1592 dnl ******************************
1593 SQLITE_REQUIRED=sqlite_minimum_version
1594 AC_SUBST(SQLITE_REQUIRED)
1595
1596 zlib_found=false
1597 dnl deflateInit is a #define, use deflateEnd instead
1598 AC_CHECK_LIB(z, deflateEnd,
1599         [AC_CHECK_HEADER(zlib.h, zlib_found=true)])
1600 if test "x$zlib_found" = "xfalse"; then
1601         AC_MSG_ERROR([*** zlib is required])
1602 fi
1603
1604 dnl ******************************
1605 dnl Checks for large file support
1606 dnl ******************************
1607 AC_ARG_ENABLE([largefile],
1608         AS_HELP_STRING([--enable-largefile],
1609         [enable support for large files [[default=no]]]),
1610         [],[enable_largefile="no"])
1611
1612 if test "x$enable_largefile" != "xno"; then
1613         AC_SYS_LARGEFILE
1614         AC_CACHE_CHECK([for _LARGEFILE64_SOURCE value needed for large files], [ac_cv_largefile64_source],
1615         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1616         [[      #include <sys/types.h>
1617                         #include <sys/stat.h>
1618                 #include <fcntl.h>
1619         ]],
1620         [[      int fd = open ("__o_largefile", O_CREAT | O_RDWR | O_LARGEFILE, 0644);  ]]
1621         )],[ac_cv_largefile64_source="no"],
1622                 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1623                 [[      #define _LARGEFILE64_SOURCE
1624                         #include <sys/types.h>
1625                         #include <sys/stat.h>
1626                         #include <fcntl.h>
1627                 ]],
1628                 [[ int fd = open ("__o_largefile", O_CREAT | O_RDWR | O_LARGEFILE, 0644); ]])],[ac_cv_largefile64_source="yes"],
1629                 [ac_cv_largefile64_source="unknown"])])
1630         ])
1631
1632         enable_largefile="no"
1633
1634         if test "x$ac_cv_largefile64_source" = "xyes"; then
1635                 LARGEFILE_CFLAGS="-D_LARGEFILE64_SOURCE"
1636                 enable_largefile="yes"
1637         elif test "x$ac_cv_largefile64_source" = "xunknown"; then
1638                 AC_DEFINE(O_LARGEFILE, 0, [Define to 0 if your system does not have the O_LARGEFILE flag])
1639         fi
1640
1641         if test -n "$ac_cv_sys_large_files" -a "x$ac_cv_sys_large_files" != "xno"; then
1642                 LARGEFILE_CFLAGS="$LARGEFILE_CFLAGS -D_LARGE_FILES"
1643                 enable_largefile="yes"
1644         fi
1645
1646         if test "x$ac_cv_sys_file_offset_bits" != "xno"; then
1647                 LARGEFILE_CFLAGS="$LARGEFILE_CFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
1648                 enable_largefile="yes"
1649         fi
1650 else
1651         AC_DEFINE(O_LARGEFILE, 0, [Define to 0 if your system does not have the O_LARGEFILE flag])
1652         LARGEFILE_CFLAGS=""
1653 fi
1654
1655 AM_CONDITIONAL(ENABLE_LARGEFILE, [test "x$enable_largefile" = "xyes"])
1656
1657 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)
1658 AC_SUBST(CAMEL_CFLAGS)
1659 AC_SUBST(CAMEL_LIBS)
1660 AC_SUBST(CAMEL_GROUPWISE_CFLAGS)
1661 AC_SUBST(CAMEL_GROUPWISE_LIBS)
1662
1663 dnl ******************************
1664 dnl Special directories
1665 dnl ******************************
1666
1667 dnl If you add something here, consider whether or not you also
1668 dnl need to add it to one or more .pc.in files (for Connector,
1669 dnl etc)
1670
1671 privdatadir='${datadir}'/evolution-data-server-$BASE_VERSION
1672 AC_SUBST(privdatadir)
1673
1674 privincludedir='${includedir}'/evolution-data-server-$BASE_VERSION
1675 AC_SUBST(privincludedir)
1676
1677 privlibdir='${libdir}'/evolution-data-server-$BASE_VERSION
1678 AC_SUBST(privlibdir)
1679
1680 idldir='${datadir}'/idl/evolution-data-server-$API_VERSION
1681 AC_SUBST(idldir)
1682
1683 imagesdir='${datadir}'/pixmaps/evolution-data-server
1684 AC_SUBST(imagesdir)
1685
1686 serverdir="$libdir/bonobo/servers"
1687 AC_SUBST(serverdir)
1688
1689 extensiondir='${libdir}'/evolution-data-server-$API_VERSION/extensions
1690 AC_SUBST(extensiondir)
1691
1692 uidir="$privdatadir/ui"
1693 AC_SUBST(uidir)
1694
1695 if test $use_gweather = yes; then
1696         weatherdatadir="$privdatadir/weather"
1697         AC_SUBST(weatherdatadir)
1698 fi
1699
1700 dnl separate camel from e-d-s? or should it be under the same spot? same for now.
1701 camel_providerdir='${libdir}'/evolution-data-server-$API_VERSION/camel-providers
1702 AC_SUBST(camel_providerdir)
1703
1704 dnl ******************************
1705 dnl IDL/Component Versioning
1706 dnl ******************************
1707 INTERFACE_VERSION="$BASE_VERSION"
1708 AC_SUBST(INTERFACE_VERSION)
1709 AC_DEFINE_UNQUOTED(INTERFACE_VERSION, "$INTERFACE_VERSION", [IDL interface version (Major.Minor)])
1710
1711 EVO_SUBST_SERVER_RULE='%.server.in: %.server.in.in ; sed -e "s|\@BINDIR\@|$(bindir)|" -e "s|\@LIBEXECDIR_IN_SERVER_FILE\@|$(LIBEXECDIR_IN_SERVER_FILE)|" -e "s|\@COMPONENTDIR\@|$(componentdir)|" -e "s|\@IMPORTERSDIR\@|$(importersdir)|" -e "s|\@EXEEXT\@|$(EXEEXT)|" -e "s|\@VERSION\@|$(BASE_VERSION)|" -e "s|\@API_VERSION\@|$(API_VERSION)|" -e "s|\@INTERFACE_VERSION\@|$(INTERFACE_VERSION)|" $< > $@'
1712 EVO_NAME_SERVER_RULE='%_$(API_VERSION).server: %.server ; mv $< $@'
1713 AC_SUBST(EVO_SUBST_SERVER_RULE)
1714 AC_SUBST(EVO_NAME_SERVER_RULE)
1715
1716 dnl *******************
1717 dnl D-BUS service stuff 
1718 dnl *******************
1719 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)|" $< > $@'
1720 AC_SUBST(EVO_SUBST_SERVICE_RULE)
1721
1722 dnl ******************************
1723 dnl GConf stuff
1724 dnl ******************************
1725 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
1726 AM_GCONF_SOURCE_2
1727
1728 dnl ******************************
1729 dnl Gtk Doc stuff
1730 dnl ******************************
1731 GTK_DOC_CHECK(1.9)
1732
1733 dnl ******************************
1734 dnl Makefiles
1735 dnl ******************************
1736 export privlibdir
1737 export privincludedir
1738 export privdatadir
1739
1740 AC_CONFIG_FILES([
1741 Makefile
1742 evolution-data-server-zip
1743 evolution-data-server.pc
1744 addressbook/Makefile
1745 addressbook/libebook/Makefile
1746 addressbook/libebook/libebook.pc
1747 addressbook/libedata-book/Makefile
1748 addressbook/libedata-book/libedata-book.pc
1749 addressbook/backends/Makefile
1750 addressbook/backends/file/Makefile
1751 addressbook/backends/vcf/Makefile
1752 addressbook/backends/ldap/Makefile
1753 addressbook/backends/google/Makefile
1754 addressbook/backends/groupwise/Makefile
1755 addressbook/backends/webdav/Makefile
1756 addressbook/tests/Makefile
1757 addressbook/tests/ebook/Makefile
1758 addressbook/tests/vcard/Makefile
1759 art/Makefile
1760 calendar/Makefile
1761 calendar/idl/Makefile
1762 calendar/libecal/Makefile
1763 calendar/libecal/libecal.pc
1764 calendar/libedata-cal/Makefile
1765 calendar/libedata-cal/libedata-cal.pc
1766 calendar/backends/Makefile
1767 calendar/backends/caldav/Makefile
1768 calendar/backends/file/Makefile
1769 calendar/backends/groupwise/Makefile
1770 calendar/backends/http/Makefile
1771 calendar/backends/contacts/Makefile
1772 calendar/backends/weather/Makefile
1773 calendar/backends/google/Makefile
1774 calendar/tests/Makefile
1775 calendar/tests/ecal/Makefile
1776 camel/Makefile
1777 camel/providers/Makefile
1778 camel/providers/groupwise/Makefile
1779 camel/providers/hula/Makefile
1780 camel/providers/imap/Makefile
1781 camel/providers/imapx/Makefile
1782 camel/providers/imapp/Makefile
1783 camel/providers/imap4/Makefile
1784 camel/providers/local/Makefile
1785 camel/providers/nntp/Makefile
1786 camel/providers/pop3/Makefile
1787 camel/providers/sendmail/Makefile
1788 camel/providers/smtp/Makefile
1789 camel/tests/Makefile
1790 camel/tests/folder/Makefile
1791 camel/tests/lib/Makefile
1792 camel/tests/message/Makefile
1793 camel/tests/mime-filter/Makefile
1794 camel/tests/misc/Makefile
1795 camel/tests/smime/Makefile
1796 camel/tests/stream/Makefile
1797 camel/camel.pc
1798 camel/camel-provider.pc
1799 libebackend/Makefile
1800 libebackend/libebackend.pc
1801 libedataserver/Makefile
1802 libedataserver/eds-version.h
1803 libedataserver/libedataserver.pc
1804 libedataserverui/Makefile
1805 libedataserverui/libedataserverui.pc
1806 servers/Makefile
1807 servers/groupwise/Makefile
1808 servers/groupwise/libegroupwise.pc
1809 servers/exchange/Makefile
1810 servers/exchange/xntlm/Makefile
1811 servers/exchange/lib/Makefile
1812 servers/exchange/storage/Makefile
1813 servers/exchange/storage/libexchange-storage.pc
1814 servers/google/Makefile
1815 servers/google/libgdata/Makefile
1816 servers/google/libgdata/libgdata.pc
1817 servers/google/libgdata-google/Makefile
1818 servers/google/libgdata-google/libgdata-google.pc
1819 src/Makefile
1820 win32/Makefile
1821 docs/Makefile
1822 docs/reference/Makefile
1823 docs/reference/addressbook/Makefile
1824 docs/reference/addressbook/libebook/Makefile
1825 docs/reference/addressbook/libedata-book/Makefile
1826 docs/reference/calendar/Makefile
1827 docs/reference/calendar/libecal/Makefile
1828 docs/reference/calendar/libedata-cal/Makefile
1829 docs/reference/camel/Makefile
1830 docs/reference/libedataserver/Makefile
1831 docs/reference/libedataserverui/Makefile
1832 docs/reference/libebackend/Makefile
1833 po/Makefile.in
1834 ])
1835 AC_OUTPUT
1836
1837 echo "
1838         evolution-data-server has been configured as follows:
1839         Calendar:               $msg_calendar
1840         Weather calendar:       $use_gweather
1841         Mail Directory:         $system_mail_dir, $system_mail_perm
1842         LDAP support:           $msg_ldap
1843         NNTP support:           $msg_nntp
1844         Kerberos 4/5:           $msg_krb4/$msg_krb5
1845         Gnome Keyring:          $enable_gnome_keyring/$with_gnome_keyring
1846         SSL support:            $msg_ssl
1847         SMIME support:          $msg_smime
1848         IPv6 support:           $msg_ipv6
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_imapx" = "yes"; then
1860         echo "
1861         IMAPX support:          $msg_imapx
1862 "
1863 fi
1864
1865 if test "$msg_no_ntlm" != "no" ; then
1866         echo ""
1867         AC_MSG_WARN([
1868 No NTLM support in OpenLDAP; Plaintext password authentication will be
1869 used when connecting to the Exchange Global Catalog server. Consider
1870 installing the evo-openldap package, or building OpenLDAP with the
1871 patch in servers/exchange/docs/openldap-ntlm.diff
1872 ])
1873 fi