Fix bug #3559 more correctly
[claws.git] / configure.ac
1
2 AC_PREREQ(2.59)
3 AC_INIT(src/main.c)
4 AC_CONFIG_AUX_DIR(config)
5 AC_CONFIG_MACRO_DIR([m4])
6
7 PACKAGE=claws-mail
8
9 dnl version number
10 INTERFACE_AGE=0
11 BINARY_AGE=0
12 EXTRA_RELEASE=
13 EXTRA_GTK2_VERSION=
14
15 if test \( -d .git \); then
16     AC_CHECK_PROG([GIT], [git], [yes], [no], [$PATH])
17     if test \( "$GIT" = "no" \); then
18         AC_MSG_ERROR([*** git not found. See http://git-scm.com/])
19     else
20         GIT_VERSION=`git describe --abbrev=6 --dirty --always`
21         echo "echo ${GIT_VERSION}" > ./version
22     fi
23 else
24     GIT_VERSION=`sh -c ". ./$srcdir/version"`
25 fi
26 MAJOR_VERSION=${GIT_VERSION%%.*}
27 MINOR_VERSION=${GIT_VERSION#*.}
28 MINOR_VERSION=${MINOR_VERSION%%.*}
29 MICRO_VERSION=${GIT_VERSION##*.}
30 MICRO_VERSION=${MICRO_VERSION%%-*}
31 EXTRA_VERSION=${GIT_VERSION#*-}
32 EXTRA_VERSION=${EXTRA_VERSION%%-*}
33
34 if test \( "x$EXTRA_VERSION" != "x" -a `echo -n $EXTRA_VERSION | wc -c` -lt 5 \); then
35     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}git${EXTRA_VERSION}
36 else
37     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}
38     EXTRA_VERSION=0
39 fi
40
41 if test \( "x$EXTRA_RELEASE" != "x" \); then
42     VERSION=${VERSION}${EXTRA_RELEASE}${EXTRA_GTK2_VERSION}
43 fi
44
45 dnl set $target
46 AC_CANONICAL_SYSTEM
47
48 dnl
49 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
50 dnl AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
51 dnl AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
52 AC_SUBST(PACKAGE)
53 AC_SUBST(VERSION)
54 AC_SUBST(MAJOR_VERSION)
55 AC_SUBST(MINOR_VERSION)
56 AC_SUBST(MICRO_VERSION)
57 AC_SUBST(EXTRA_VERSION)
58 AC_SUBST(GIT_VERSION)
59
60 AC_CHECK_PROG(HAVE_GTK_ICON_CACHE, gtk-update-icon-cache, yes, no)
61 AM_CONDITIONAL(UPDATE_GTK_ICON_CACHE, test x"$HAVE_GTK_ICON_CACHE" = xyes)
62
63 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
64 if test x$PKG_CONFIG = xno ; then
65   AC_MSG_ERROR([*** pkg-config not found. See http://www.freedesktop.org/software/pkgconfig/])
66 fi
67
68 dnl libtool versioning
69 LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
70 LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
71 LT_REVISION=$INTERFACE_AGE
72 LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
73 AC_SUBST(LT_RELEASE)
74 AC_SUBST(LT_CURRENT)
75 AC_SUBST(LT_REVISION)
76 AC_SUBST(LT_AGE)
77
78 dnl Specify a header configuration file
79 AC_CONFIG_HEADERS(config.h)
80 AC_CONFIG_HEADERS(claws-features.h)
81
82 AM_MAINTAINER_MODE
83
84 dnl Checks for programs.
85 dnl AC_ARG_PROGRAM
86 AC_PROG_CC
87 AC_ISC_POSIX
88 AC_PROG_INSTALL
89 AC_PROG_LN_S
90 AC_PROG_MAKE_SET
91 AC_PROG_CPP
92 dnl AC_PROG_RANLIB
93 AM_PROG_LEX
94 AC_PROG_YACC
95 AC_LIB_PREFIX
96 AC_LIBTOOL_WIN32_DLL
97 LT_INIT
98 LT_AC_PROG_RC
99 AC_LIBTOOL_RC
100 AC_PROG_LIBTOOL
101 AC_PROG_AWK
102
103 AC_SYS_LARGEFILE
104
105 dnl ******************************
106 dnl Checks for host
107 dnl Not needed anymore because we
108 dnl do AC_CANONICAL_SYSTEM above
109 dnl ******************************
110 dnl AC_CANONICAL_HOST
111
112 dnl Copied from the official gtk+-2 configure.in
113 AC_MSG_CHECKING([for some Win32 platform])
114 case "$host" in
115   *-*-mingw*|*-*-cygwin*)
116     platform_win32=yes
117     LDFLAGS="$LDFLAGS -mwindows"
118     ;;
119   *)
120     platform_win32=no
121     ;;
122 esac
123 AC_MSG_RESULT([$platform_win32])
124 AM_CONDITIONAL(PLATFORM_WIN32, test x"$platform_win32" = x"yes")
125
126 AC_MSG_CHECKING([for native Win32])
127 case "$host" in
128   *-*-mingw*)
129     os_win32=yes
130     ;;
131   *)
132     os_win32=no
133     ;;
134 esac
135 AC_MSG_RESULT([$os_win32])
136 AM_CONDITIONAL(OS_WIN32, test x"$os_win32" = x"yes")
137
138 AC_MSG_CHECKING([for Cygwin])
139 case "$host" in
140   *-*-cygwin*)
141     env_cygwin=yes
142     ;;
143   *)
144     env_cygwin=no
145     ;;
146 esac
147 AC_MSG_RESULT([$env_cygwin])
148 AM_CONDITIONAL(CYGWIN, test x"$env_cygwin" = x"yes")
149
150 if test "$GCC" = "yes"
151 then
152         CFLAGS="$CFLAGS -Wno-unused-function"
153         #CFLAGS="-g -Wall -Wno-unused-function"
154 fi
155
156 AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
157 _gcc_cflags_save=$CFLAGS
158 CFLAGS="-Wno-pointer-sign"
159 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],_gcc_psign=yes,_gcc_psign=no)
160 AC_MSG_RESULT($_gcc_psign)
161 CFLAGS=$_gcc_cflags_save;
162 if test x"$_gcc_psign" = xyes ; then
163         CFLAGS="$CFLAGS -Wno-pointer-sign"
164 fi
165
166 CFLAGS="$CFLAGS -Wall"
167
168 if test $USE_MAINTAINER_MODE = yes; then
169         CFLAGS="-g -Wall -Wno-pointer-sign -DUSE_MAINTAINER_MODE"
170 fi
171
172 pthread_name=
173 case "$target" in
174 *-darwin*)
175         CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
176         ;;
177 *-*-mingw*)
178         # Note that we need to link to pthread in all cases. This
179         # is because some locking is used even when pthread support is
180         # disabled.
181         pthread_name=pthread
182         CFLAGS="$CFLAGS -mms-bitfields"
183         LIBS="$LIBS -l${pthread_name} -lws2_32 -lregex"
184         ;;
185 *-*-solaris*)
186         CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
187         CFLAGS="$CFLAGS -std=gnu99 -DSOLARIS"
188         ;;
189 esac
190
191 dnl Checks for iconv
192 AM_ICONV
193
194 dnl floor and ceil are  in -lm
195 LIBS="$LIBS -lm"
196
197 dnl
198 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
199 dnl
200 syl_save_LIBS=$LIBS
201 LIBS="$LIBS $GTK_LIBS"
202 AC_CHECK_FUNCS(bind_textdomain_codeset)
203 LIBS=$syl_save_LIBS
204
205 dnl for gettext
206 ALL_LINGUAS="bg ca cs de en_GB eo es fi fr he hu it lt nb nl pt_BR sk sv zh_TW"
207 GETTEXT_PACKAGE=claws-mail
208 AC_SUBST(GETTEXT_PACKAGE)
209 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define text domain.])
210
211 AM_GNU_GETTEXT_VERSION([0.18])
212 AM_GNU_GETTEXT([external])
213
214 AC_ARG_ENABLE(manual,
215                 [  --disable-manual                Do not build user manual],
216                 [enable_manual=$enableval], [enable_manual=yes])
217
218 AC_ARG_ENABLE(libsm,
219                 [  --disable-libsm                 Do not build libSM support for session management],
220                 [enable_libsm=$enableval], [enable_libsm=yes])
221
222 AC_ARG_ENABLE(ipv6,
223                 [  --disable-ipv6                  Do not build IPv6 support],
224                 [enable_ipv6=$enableval], [enable_ipv6=yes])
225
226 AC_ARG_ENABLE(gnutls,
227                 [  --disable-gnutls                Do not build GnuTLS support for SSL/TLS],
228                     [enable_gnutls=$enableval], [enable_gnutls=yes])
229
230 AC_ARG_ENABLE(enchant,
231                 [  --disable-enchant               Do not build Enchant support for spell-checking],
232                 [enable_enchant=$enableval], [enable_enchant=yes])
233
234 AC_ARG_ENABLE(crash-dialog,
235                 [  --enable-crash-dialog           Build crash dialog],
236                 [enable_crash_dialog=$enableval], [enable_crash_dialog=no])
237
238 AC_ARG_ENABLE(generic-umpc,
239                 [  --enable-generic-umpc           Build generic UMPC code],
240                 [enable_generic_umpc=$enableval], [enable_generic_umpc=no])
241
242 AC_ARG_ENABLE(compface,
243                 [  --disable-compface              Do not build compface support for X-Face],
244                 [enable_compface=$enableval], [enable_compface=yes])
245
246 AC_ARG_ENABLE(pthread,
247                 [  --disable-pthread               Do not build pthread support],
248                 [enable_pthread=$enableval], [enable_pthread=yes])
249
250 AC_ARG_ENABLE(startup-notification,
251                 [  --disable-startup-notification  Do not startup notification support],
252                 [enable_startup_notification=$enableval], [enable_startup_notification=yes])
253
254 AC_ARG_ENABLE(dbus,
255                 [  --disable-dbus                  Do not build DBUS support],
256                 [enable_dbus=$enableval], [enable_dbus=yes])
257
258 AC_ARG_ENABLE(ldap,
259                 [  --disable-ldap                  Do not build LDAP support],
260                 [enable_ldap=$enableval], [enable_ldap=yes])
261
262 AC_ARG_ENABLE(jpilot,
263                 [  --disable-jpilot                Do not build JPilot support],
264                 [enable_jpilot=$enableval], [enable_jpilot=yes])
265
266 AC_ARG_ENABLE(networkmanager,
267                 [  --disable-networkmanager        Do not build NetworkManager support],
268                 [enable_networkmanager=$enableval], [enable_networkmanager=yes])
269
270 AC_ARG_ENABLE(libetpan,
271                 [  --disable-libetpan              Do not build libetpan support for IMAP4/NNTP],
272                 [enable_libetpan=$enableval], [enable_libetpan=yes])
273
274 AC_ARG_ENABLE(valgrind,
275                 [  --disable-valgrind              Do not build valgrind support for debugging],
276                 [enable_valgrind=$enableval], [enable_valgrind=yes])
277
278 AC_ARG_ENABLE(new-addrbook,
279                 [  --enable-new-addrbook           Build new external address book support],
280                 [enable_new_addrbook=$enableval], [enable_new_addrbook=no])
281
282 AC_ARG_ENABLE(gtk3,
283                 [  --enable-gtk3                   Build GTK3 support],
284                 [enable_gtk3=$enableval], [enable_gtk3=no])
285
286 AC_ARG_ENABLE(deprecated,
287                 [  --disable-deprecated            Disable deprecated GTK functions],
288                 [GTK_CFLAGS="$GTK_CFLAGS -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"], [])
289
290 manualdir='${docdir}/manual'
291 AC_ARG_WITH(manualdir,
292         [  --with-manualdir=DIR    Manual directory],
293         [manualdir="$withval"])
294 AC_SUBST(manualdir)
295
296 dnl ******************************
297 dnl ** Check for required tools **
298 dnl ** to build manuals         **
299 dnl ******************************
300
301 AC_PATH_PROG(DOCBOOK2HTML, docbook2html)
302 AC_PATH_PROG(DOCBOOK2TXT, docbook2txt)
303 AC_PATH_PROG(DOCBOOK2PS, docbook2ps)
304 AC_PATH_PROG(DOCBOOK2PDF, docbook2pdf)
305
306 AM_CONDITIONAL(MANUAL_HTML, test -n "$DOCBOOK2HTML")
307 AM_CONDITIONAL(MANUAL_TXT, test -n "$DOCBOOK2TXT")
308 AM_CONDITIONAL(MANUAL_PDF, test -n "$DOCBOOK2PDF")
309 AM_CONDITIONAL(MANUAL_PS, test -n "$DOCBOOK2PS")
310
311 if test x"$enable_manual" = x"yes"; then
312     if test -n "$DOCBOOK2TXT" -o -n "$DOCBOOK2HTML" \
313         -o -n "$DOCBOOK2PS" -o -n "$DOCBOOK2PDF"; then
314             enable_manual=yes
315         else
316             enable_manual=no
317     fi
318 fi
319
320 AM_CONDITIONAL(BUILD_MANUAL, test x"$enable_manual" = xyes)
321
322 dnl Set PACKAGE_DATA_DIR in config.h.
323 if test "x${datarootdir}" = 'x${prefix}/share'; then
324         if test "x${prefix}" = "xNONE"; then
325                 AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}",[PACKAGE_DATA_DIR])
326         else
327                 AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/share/${PACKAGE}",[PACKAGE_DATA_DIR])
328         fi
329 else
330         AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${datarootdir}/${PACKAGE}",[PACKAGE_DATA_DIR])
331 fi
332
333 AC_CHECK_LIB(xpg4, setlocale)
334
335 SM_LIBS=""
336 dnl Check for LibSM
337 AC_MSG_CHECKING([whether to use LibSM])
338 if test x"$enable_libsm" = xyes; then
339         AC_MSG_RESULT(yes)
340         AC_CHECK_LIB(SM, SmcSaveYourselfDone,
341                 [SM_LIBS="$X_LIBS -lSM -lICE"],enable_libsm=no,
342                 $X_LIBS -lICE)
343         AC_CHECK_HEADERS(X11/SM/SMlib.h,,enable_libsm=no)
344         if test x"$enable_libsm" = xyes; then
345                 AC_DEFINE(HAVE_LIBSM, 1, [Define to 1 if you have libSM installed])
346         else
347                 AC_MSG_RESULT(not found)
348                 AC_MSG_WARN([*** LibSM will not be supported ***])
349         fi
350 else
351         AC_MSG_RESULT(no)
352 fi
353 AC_SUBST(SM_LIBS)
354
355 dnl Check for d_type member in struct dirent
356 AC_MSG_CHECKING([whether struct dirent has d_type member])
357 AC_CACHE_VAL(ac_cv_dirent_d_type,[
358         AC_TRY_COMPILE([#include <dirent.h>],
359                        [struct dirent d; d.d_type = DT_REG;],
360                        ac_cv_dirent_d_type=yes, ac_cv_dirent_d_type=no)
361 ])
362 AC_MSG_RESULT($ac_cv_dirent_d_type)
363 if test $ac_cv_dirent_d_type = yes; then
364         AC_DEFINE(HAVE_DIRENT_D_TYPE, 1,
365                   Define if `struct dirent' has `d_type' member.)
366 fi
367
368 # Check whether mkdir does not take the permission argument.
369 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
370
371 dnl Checks for header files.
372 AC_HEADER_DIRENT
373 AC_HEADER_STDC
374 AC_HEADER_SYS_WAIT
375 AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h \
376                  sys/param.h sys/utsname.h sys/select.h \
377                  wchar.h wctype.h locale.h netdb.h)
378 AC_CHECK_HEADER([execinfo.h], [AC_DEFINE(HAVE_BACKTRACE,1,[Has backtrace*() needed for retrieving stack traces])])
379 AC_SEARCH_LIBS(backtrace_symbols, [execinfo])
380
381 dnl alf - Check for apache installation f*ck up. apache may also install an
382 dnl fnmatch, which includes their own regex stuff if USE_HSREGEX is defined
383 AC_TRY_COMPILE([#include <stdlib.h>
384                 #include <fnmatch.h>],
385         [int x = USE_HSREGEX;],
386         ac_cv_have_apache_fnmatch=yes, ac_cv_have_apache_fnmatch=no)
387 if test $ac_cv_have_apache_fnmatch = yes; then
388         AC_DEFINE(HAVE_APACHE_FNMATCH, 1, Define if you need to work around apache regex/fnmatch !KLUDGE!)
389 fi
390 AC_MSG_CHECKING([whether to use Apache regex header kludge])
391 AC_MSG_RESULT($ac_cv_have_apache_fnmatch)
392
393 dnl Checks for typedefs, structures, and compiler characteristics.
394 AC_C_CONST
395 AC_TYPE_OFF_T
396 AC_TYPE_PID_T
397 AC_TYPE_SIZE_T
398 AC_STRUCT_TM
399
400 dnl AC_CHECK_TYPE(wint_t, unsigned int) does not work because wint_t
401 dnl may be defined only in wchar.h (this happens with gcc-2.96).
402 dnl So we need to use this extended macro.
403 CLAWS_CHECK_TYPE(wint_t, unsigned int,
404 [
405 #if HAVE_WCHAR_H
406 #include <wchar.h>
407 #endif
408 ], Define to `unsigned int' if <stddef.h> or <wchar.h> doesn't define.)
409
410 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF, Used to test for a u32 typedef)
411 AC_CHECK_SIZEOF(unsigned short, 2)
412 AC_CHECK_SIZEOF(unsigned int, 4)
413 AC_CHECK_SIZEOF(unsigned long, 4)
414
415 dnl Checks for library functions.
416 AC_FUNC_ALLOCA
417 AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr strchr \
418                uname flock lockf inet_aton inet_addr \
419                fchmod mkstemp truncate getuid regcomp)
420
421 AC_CHECK_FUNCS(fgets_unlocked fwrite_unlocked)
422
423 dnl *****************
424 dnl ** common code **
425 dnl *****************
426
427 dnl check for glib
428 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.20 gmodule-2.0 >= 2.20 gobject-2.0 >= 2.20 gthread-2.0 >= 2.20)
429
430 GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
431 AC_SUBST(GLIB_GENMARSHAL)
432
433 AC_SUBST(GLIB_CFLAGS)
434 AC_SUBST(GLIB_LIBS)
435
436 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
437 syl_save_LIBS=$LIBS
438 LIBS="$LIBS $GTK_LIBS"
439 AC_CHECK_FUNCS(bind_textdomain_codeset)
440 LIBS=$syl_save_LIBS
441
442 dnl check for IPv6 option
443 dnl automated checks for IPv6 support.
444 AC_MSG_CHECKING([whether to use IPv6])
445 if test x"$enable_ipv6" = xyes; then
446         AC_MSG_RESULT(yes)
447         AC_MSG_CHECKING([for IPv6 support])
448         if test x"$platform_win32" = xyes; then
449                 AC_CACHE_VAL(ac_cv_ipv6,[
450                         AC_TRY_COMPILE([
451                                         #include <ws2tcpip.h>
452                                 ], [struct in6_addr a;],
453                                 ac_cv_ipv6=yes, ac_cv_ipv6=no)
454                 ])
455         else
456                 AC_CACHE_VAL(ac_cv_ipv6,[
457                         AC_TRY_COMPILE([
458                                         #define INET6
459                                         #include <sys/types.h>
460                                         #include <netinet/in.h>
461                                 ], [int x = IPPROTO_IPV6; struct in6_addr a;],
462                                 ac_cv_ipv6=yes, ac_cv_ipv6=no)
463                 ])
464         fi
465         AC_MSG_RESULT($ac_cv_ipv6)
466         if test $ac_cv_ipv6 = yes; then
467                 AC_DEFINE(INET6, 1, Define if you want IPv6 support.)
468         else
469                 AC_MSG_WARN(*** IPv6 will not be supported ***)
470                 enable_ipv6=no
471         fi
472 else
473         AC_MSG_RESULT(no)
474 fi
475
476 dnl GNUTLS
477 AC_MSG_CHECKING([whether to use GnuTLS])
478 AC_MSG_RESULT($enable_gnutls)
479 if test "x$enable_gnutls" != "xno"; then
480         PKG_CHECK_MODULES(GNUTLS, gnutls >= 2.2,
481         [
482                 AC_DEFINE(USE_GNUTLS, 1, gnutls)
483                 echo "Building with GnuTLS"
484                 PKG_CHECK_MODULES(GNUTLS, gnutls >= 2.11,
485                 [
486                         dnl No linking against libgcrypt needed
487                 ],
488                 [
489                         dnl linking against libgcrypt *is* needed
490                         GNUTLS_LIBS="$GNUTLS_LIBS -lgcrypt"
491                 ])
492         ],
493         [
494                 echo "Building without gnutls"
495                 enable_gnutls=no
496         ])
497         AC_SUBST(GNUTLS_LIBS)
498         AC_SUBST(GNUTLS_CFLAGS)
499 fi
500
501 dnl password encryption
502 OLDLIBS=$LIBS
503 LIBS=
504 case $host_os in
505         *dragonfly*)
506                 AC_SEARCH_LIBS(encrypt, cipher, [], AC_MSG_ERROR(['encrypt'-function not found.]))
507         ;;
508         *)
509                 AC_SEARCH_LIBS(encrypt, crypt, [], AC_MSG_ERROR(['encrypt'-function not found.]))
510         ;;
511 esac
512 CRYPT_LIBS=$LIBS
513 AC_SUBST(CRYPT_LIBS)
514 LIBS=$OLDLIBS
515
516 AC_ARG_WITH(passcrypt-key, [  --with-passcrypt-key=KEY     Key used to encode passwords (8 byte string)],
517             with_passcrypt_key="$withval", with_passcrypt_key="passkey0")
518 AC_SUBST(PASSCRYPT_KEY, $with_passcrypt_key)
519
520 dnl RC dir (will be default at a certain point in time)
521 AC_ARG_WITH(config-dir,    [  --with-config-dir=RCDIR      Local configuration dir (default: .claws-mail)],
522               ac_cv_with_config_dir="$withval", ac_cv_with_config_dir=".claws-mail")
523 if test x"$ac_cv_with_config_dir" = x""; then
524         ac_cv_with_config_dir=".claws-mail"
525 fi
526 AC_DEFINE_UNQUOTED(CFG_RC_DIR, "$ac_cv_with_config_dir", Configuration directory)
527
528 dnl ************************
529 dnl ** GTK user interface **
530 dnl ************************
531
532 dnl Checks for GTK
533 AM_CONDITIONAL(GTK3, false)
534 AM_CONDITIONAL(GTK2, true)
535 if test x"$enable_gtk3" = x"yes"; then
536         PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.0 cairo)
537         AM_CONDITIONAL(GTK3, true)
538         AM_CONDITIONAL(GTK2, false)
539 else
540         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.16)
541 fi
542 AC_SUBST(GTK_CFLAGS)
543 AC_SUBST(GTK_LIBS)
544
545 dnl enchant is used for spell checking
546 AC_MSG_CHECKING([whether to use enchant])
547 AC_MSG_RESULT($enable_enchant)
548 if test $enable_enchant = yes; then
549         PKG_CHECK_MODULES(ENCHANT, enchant >= 1.0.0,
550         [
551                 AC_DEFINE(USE_ENCHANT, 1, enchant)
552                 echo "Building with enchant"
553                 enable_enchant=yes
554                 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags enchant`"
555         ],
556         [
557                 echo "Building without enchant-notification"
558                 enable_enchant=no
559         ])
560         AC_SUBST(ENCHANT_CFLAGS)
561         AC_SUBST(ENCHANT_LIBS)
562 fi
563
564 dnl want crash dialog
565 if test $enable_crash_dialog = yes; then
566 dnl check if GDB is somewhere
567         AC_CHECK_PROG(enable_crash_dialog, gdb, yes, no)
568         AC_MSG_CHECKING([whether to use crash dialog])
569         if test $enable_crash_dialog = yes; then
570                 AC_DEFINE(CRASH_DIALOG, 1, Pop up crash dialog)
571         fi
572         AC_MSG_RESULT($enable_crash_dialog)
573 fi
574
575 dnl generic umpc
576 if test $enable_generic_umpc = yes; then
577         AC_DEFINE(GENERIC_UMPC, 1, Generic UMPC code)
578         AC_MSG_RESULT($enable_generic_umpc)
579 fi
580
581 dnl Check for X-Face support
582 AC_MSG_CHECKING([whether to use compface])
583 if test x"$enable_compface" = xyes; then
584         AC_MSG_RESULT(yes)
585         AC_CHECK_LIB(compface, uncompface,
586                 [AC_DEFINE(HAVE_LIBCOMPFACE, 1, Define if you want compface support.)],
587                 [enable_compface=no])
588         if test x"$enable_compface" = xyes; then
589                 COMPFACE_LIBS="-lcompface"
590         else
591                 COMPFACE_LIBS=""
592         fi
593         AC_SUBST(COMPFACE_LIBS)
594 else
595         AC_MSG_RESULT(no)
596 fi
597
598 dnl check for pthread support
599 AC_MSG_CHECKING([whether to use pthread])
600 if test x$enable_pthread = xno; then
601         AC_MSG_RESULT(no)
602 else
603         AC_MSG_RESULT(yes)
604
605         # For W32 we need to use a special ptrhead lib. In this case we can't
606         # use AC_CHECK_LIB because it has no means of checking for a
607         # library installed under a different name.  Checking for the
608         # header is okay.
609         if test -n "${pthread_name}" ; then
610            enable_pthread=yes
611         else
612         AC_CHECK_LIB(pthread, pthread_create, :, enable_pthread=no)
613         fi
614         AC_CHECK_HEADERS(pthread.h, :, enable_pthread=no)
615
616         if test x$enable_pthread = xyes; then
617                 AC_DEFINE(USE_PTHREAD, 1, Define if you have pthread)
618                 if test -z "${pthread_name}" ; then
619                 PTHREAD_LIBS="-lpthread"
620         fi
621         fi
622
623 fi
624 AC_SUBST(PTHREAD_LIBS)
625
626 dnl
627 dnl Check whether we need to pass -lresolv
628 dnl We know that we don't need it for W32.
629 dnl
630 if test x$os_win32 = xno; then
631   t_oldLibs="$LIBS"
632   LIBS="$LIBS"
633   ac_cv_var__res_options=no
634   AC_TRY_LINK([#include <sys/types.h>
635              #include <sys/socket.h>
636              #include <netinet/in.h>
637              #include <arpa/nameser.h>
638              #include <resolv.h>],
639                 [_res.options = RES_INIT;],
640                 ac_cv_var__res_options=yes);
641   if test "$ac_cv_var__res_options" != "yes"; then
642         LIBRESOLV="-lresolv"
643   fi
644   LIBS="$t_oldLibs"
645
646   if test "x$LIBRESOLV" = "x"; then
647         AC_CHECK_LIB(resolv, res_query, [LIBRESOLV=-lresolv])
648         LIBS="$t_oldLibs"
649   fi
650 fi
651 AC_SUBST(LIBRESOLV)
652
653 LIBS="$LIBS $LIBRESOLV"
654
655 dnl #######################################################################
656 dnl # Check for startup notification
657 dnl #######################################################################
658 if test "x$enable_startup_notification" = "xyes"; then
659         PKG_CHECK_MODULES(STARTUP_NOTIFICATION, libstartup-notification-1.0 >= 0.5,
660         [
661                 AC_DEFINE(HAVE_STARTUP_NOTIFICATION, 1, [Define if we're using libstartup-notification.])
662                 echo "Building with libstartup-notification"
663                 enable_startup_notification=yes
664         ],
665         [
666                 echo "Building without libstartup-notification"
667                 enable_startup_notification=no
668         ])
669
670         AC_SUBST(STARTUP_NOTIFICATION_CFLAGS)
671         AC_SUBST(STARTUP_NOTIFICATION_LIBS)
672 fi
673
674 dnl #######################################################################
675 dnl # Check for D-Bus support
676 dnl #######################################################################
677 if test "x$enable_dbus" = "xyes"; then
678         PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.60, dbus-glib-1 >= 0.60],
679         [
680                 AC_DEFINE(HAVE_DBUS_GLIB, 1, [Define if glib bindings of D-Bus are available])
681                 enable_dbus_glib=yes
682         ],
683         [
684                 echo "D-Bus requirements not met. D-Bus support not activated."
685                 enable_dbus_glib=no
686         ])
687         AC_SUBST(DBUS_CFLAGS)
688         AC_SUBST(DBUS_LIBS)
689 fi
690
691 dnl #######################################################################
692 dnl # Configure address book support
693 dnl #######################################################################
694
695 dnl #######################################################################
696 dnl # Check for new address book support
697 dnl #######################################################################
698 AC_MSG_CHECKING([whether DBUS support for new address book is present])
699 if test x"$enable_dbus_glib" = xyes; then
700         AC_MSG_RESULT([yes])
701         AC_MSG_CHECKING([whether to enable new address book])
702         if test x"$enable_new_addrbook" = xyes; then
703                 AC_MSG_RESULT([yes])
704                 PKG_CHECK_MODULES(CONTACTS, [claws-contacts],
705                 [
706                         AC_DEFINE(USE_NEW_ADDRBOOK, 1, [Define if new address book is to be activated.])
707                         enable_new_addrbook=yes
708                         AC_SUBST(CONTACTS_CFLAGS)
709                         AC_SUBST(CONTACTS_LIBS)
710                 ],
711                 [
712                         enable_new_addrbook=no
713                 ])
714         else
715                 AC_MSG_RESULT([no])
716                 enable_new_addrbook=no
717         fi
718 else
719         AC_MSG_RESULT([no])
720         enable_new_addrbook=no
721 fi
722
723 dnl #######################################################################
724 dnl # Check for old address book support
725 dnl #######################################################################
726 if test x"$enable_new_addrbook" = xno; then
727         dnl for LDAP support in addressbook
728         dnl no check for libraries; dynamically loaded
729         AC_MSG_CHECKING([whether to use LDAP])
730         if test x"$enable_ldap" = xno; then
731                 AC_MSG_RESULT(no)
732         elif test x"$enable_ldap" = xyes -a x"$enable_pthread" = xno; then
733                 AC_MSG_RESULT(no - LDAP support needs pthread support)
734
735                 enable_ldap=no
736         elif test x"$platform_win32" = xyes; then
737                 AC_MSG_RESULT(yes)
738                 AC_DEFINE(USE_LDAP, 1, Define if you want LDAP support in addressbook.)
739                 LDAP_LIBS="-lwldap32"
740                 AC_SUBST(LDAP_LIBS)
741         else
742                 AC_MSG_RESULT(yes)
743
744                 dnl check for available libraries, and pull them in
745                 AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="$LDAP_LIBS -lresolv")
746                 AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket")
747                 AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
748                 AC_CHECK_LIB(lber, ber_get_tag, LDAP_LIBS="$LDAP_LIBS -llber",,
749                                  $LDAP_LIBS)
750
751                 AC_CHECK_HEADERS(ldap.h lber.h,
752                                  [ enable_ldap=yes ],
753                                  [ enable_ldap=no ])
754
755                 if test "$enable_ldap" = yes; then
756                         AC_CHECK_LIB(ldap, ldap_open,
757                                          [ enable_ldap=yes ],
758                                          [ enable_ldap=no ],
759                                          $LDAP_LIBS)
760
761                         AC_CHECK_LIB(ldap, ldap_start_tls_s,
762                                              [ ac_cv_have_tls=yes ],
763                                              [ ac_cv_have_tls=no ])
764
765                 fi
766
767                 AC_MSG_CHECKING([whether ldap library is available])
768                 AC_MSG_RESULT($enable_ldap)
769
770                 AC_MSG_CHECKING([whether TLS library is available])
771                 AC_MSG_RESULT($ac_cv_have_tls)
772
773                 if test "$enable_ldap" = yes; then
774                         AC_DEFINE(USE_LDAP, 1, Define if you want LDAP support in addressbook.)
775                         LDAP_LIBS="$LDAP_LIBS -lldap"
776                         AC_SUBST(LDAP_LIBS)
777                         if test "$ac_cv_have_tls" = yes; then
778                                 AC_DEFINE(USE_LDAP_TLS, 1, Define if you want LDAP TLS support in addressbook.)
779                         fi
780                         dnl As of OpenLDAP API version 3000 a number of functions has
781                         dnl been deprecated. As Claws-mail compiles and runs on many
782                         dnl platforms and many versions of OpenLDAP we need to be able
783                         dnl to switch between the old and new API because new API has
784                         dnl added new functions replacing old ones and at the same time
785                         dnl old functions has been changed.
786                         dnl If cross-compiling defaults to enable deprecated features
787                         dnl for maximum portability
788                         AC_MSG_CHECKING([The API version of OpenLDAP])
789                         AC_RUN_IFELSE(
790                                 [AC_LANG_PROGRAM(
791                                  [#include <ldap.h>],
792                                  [if (LDAP_API_VERSION >= 3000)
793                                                 return 1
794                                 ])],
795                                 [AC_MSG_RESULT([version < 3000])
796                                  AC_DEFINE(OPEN_LDAP_API_AT_LEAST_3000, 0, Define if OpenLDAP API is at least version 3000.)],
797                                 [AC_MSG_RESULT([version >= 3000])
798                                  AC_DEFINE(OPEN_LDAP_API_AT_LEAST_3000, 1, Define if OpenLDAP API is at least version 3000.)],
799                                 [AC_MSG_RESULT([Enabling deprecated features in OpenLDAP])
800                                  AC_DEFINE(OPEN_LDAP_API_AT_LEAST_3000, 0, Define if OpenLDAP API is at least version 3000.)
801                                  AC_DEFINE(LDAP_DEPRECATED, 1, Define to activate deprecated features in OpenLDAP)]
802                         )
803                 fi
804         fi
805
806         dnl for JPilot support in addressbook
807         dnl no check for libraries; these are dynamically loaded
808         AC_MSG_CHECKING([whether to use JPilot])
809         if test "$enable_jpilot" = yes; then
810                 AC_MSG_RESULT(yes)
811                 AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h pi-version.h,
812                                  [ AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ],
813                                  [ enable_jpilot=no ])
814                 if test "$enable_jpilot" = no; then
815                         AC_CHECK_HEADERS(libpisock/pi-args.h libpisock/pi-appinfo.h libpisock/pi-address.h libpisock/pi-version.h,
816                                          [ enable_jpilot=yes
817                                            AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ])
818                 fi
819
820                 AC_CHECK_LIB(pisock, unpack_Address, [JPILOT_LIBS="-lpisock"], [JPILOT_LIBS="" enable_jpilot="no"])
821                 if test x"$enable_jpilot" = xyes; then
822                         AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.)
823                 else
824                         AC_MSG_NOTICE([JPilot support not available])
825                 fi
826                 AC_SUBST(JPILOT_LIBS)
827         else
828                 AC_MSG_RESULT(no)
829         fi
830 fi
831
832 AM_CONDITIONAL(BUILD_NEWADDRBOOK, test x"$enable_new_addrbook" = x"yes")
833
834 dnl #######################################################################
835 dnl # Check for NetworkManager support
836 dnl #######################################################################
837 if test x"$enable_dbus_glib" = xyes; then
838         if test x"$enable_networkmanager" = xyes; then
839                 PKG_CHECK_MODULES(NETWORKMANAGER_SUPPORT, NetworkManager >= 0.6.2,
840                 [
841                         AC_DEFINE(HAVE_NETWORKMANAGER_SUPPORT, 1, [Define if NetworkManager support is to be included.])
842                         echo "Building with NetworkManager support"
843                         enable_networkmanager=yes
844                 ],
845                 [
846                         echo "NetworkManager not found."
847                         enable_networkmanager=no
848                 ])
849                 AC_SUBST(NETWORKMANAGER_SUPPORT_CFLAGS)
850         fi
851 else
852         echo "NetworkManager support deactivated as D-Bus requirements were not met."
853         enable_networkmanager=no
854 fi
855
856 dnl Libetpan
857 AC_MSG_CHECKING([whether to use libetpan])
858 if test x"$enable_libetpan" = xyes; then
859         AC_MSG_RESULT(yes)
860         libetpan_result=no
861         AC_PATH_PROG(libetpanconfig, [libetpan-config])
862         if test "x$libetpanconfig" != "x"; then
863           CPPFLAGS="$CPPFLAGS `$libetpanconfig --cflags 2>/dev/null`"
864           AC_CHECK_HEADER(libetpan/libetpan.h, [libetpan_result=yes])
865           if test "x$libetpan_result" = "xyes"; then
866             AC_MSG_CHECKING([whether libetpan-config hints compiles and links fine])
867             LIBS="$LIBS `$libetpanconfig --libs 2>/dev/null`"
868             AC_TRY_LINK([#include <libetpan/dbstorage.h>], [db_mailstorage_init(NULL, NULL);], [libetpan_result=yes], [libetpan_result=no])
869             AC_MSG_RESULT([$libetpan_result])
870           fi
871         fi
872         if test "x$libetpan_result" = "xyes"; then
873            LIBETPAN_CPPFLAGS="`$libetpanconfig --cflags`"
874            LIBETPAN_LIBS="`$libetpanconfig --libs`"
875            LIBETPAN_VERSION=`$libetpanconfig --version | $AWK -F. '{printf "%d", ($1 * 100) + $2}'`
876            if test "$LIBETPAN_VERSION" -lt "57"; then
877                 AC_MSG_RESULT([*** Claws Mail requires libetpan 0.57 or newer. See http://www.etpan.org/])
878                 AC_MSG_RESULT([*** You can use --disable-libetpan if you don't need IMAP4 and/or NNTP support.])
879                 AC_MSG_ERROR([libetpan 0.57 not found])
880            fi
881            AC_SUBST(LIBETPAN_FLAGS)
882            AC_SUBST(LIBETPAN_LIBS)
883            AC_DEFINE(HAVE_LIBETPAN, 1, Define if you want IMAP and/or NNTP support.)
884         else
885            AC_MSG_RESULT([*** Claws Mail requires libetpan 0.57 or newer. See http://www.etpan.org/ ])
886            AC_MSG_RESULT([*** You can use --disable-libetpan if you don't need IMAP4 and/or NNTP support.])
887            AC_MSG_ERROR([libetpan 0.57 not found])
888         fi
889 else
890         AC_MSG_RESULT(no)
891 fi
892 AM_CONDITIONAL(CLAWS_LIBETPAN, test "x$libetpan_result" = "xyes")
893
894 AC_MSG_CHECKING([whether to use valgrind])
895 if test x$enable_valgrind = xyes; then
896         AC_MSG_RESULT(yes)
897         PKG_CHECK_MODULES(VALGRIND, valgrind >= 2.4.0,
898                           enable_valgrind=yes, enable_valgrind=no)
899         if test x"$enable_valgrind" = xyes; then
900                 AC_DEFINE(HAVE_VALGRIND, 1, Define if you want valgrind support)
901         else
902                 AC_MSG_RESULT(not found)
903         fi
904 else
905         AC_MSG_RESULT(no)
906 fi
907 AM_CONDITIONAL(CLAWS_VALGRIND, test x"$enable_valgrind" = x"yes")
908
909 dnl *************************
910 dnl ** section for plugins **
911 dnl *************************
912
913 PLUGINS=""
914 DISABLED_PLUGINS=""
915 MISSING_DEPS_PLUGINS=""
916
917 dnl First we set the enabled status - either enabled (yes), auto-enabled (auto)
918 dnl or (auto-)disabled (no for both)
919 dnl
920 dnl All plugins are auto-enabled except for Demo which is just there to help
921 dnl potential plugins writers.
922
923 AC_ARG_ENABLE(acpi_notifier-plugin,
924                 [  --disable-acpi_notifier-plugin  Do not build acpi_notifier plugin],
925                 [enable_acpi_notifier_plugin=$enableval], [enable_acpi_notifier_plugin=auto])
926
927 AC_ARG_ENABLE(address_keeper-plugin,
928                 [  --disable-address_keeper-plugin Do not build address_keeper plugin],
929                 [enable_address_keeper_plugin=$enableval], [enable_address_keeper_plugin=auto])
930
931 AC_ARG_ENABLE(archive-plugin,
932                 [  --disable-archive-plugin        Do not build archive plugin],
933                 [enable_archive_plugin=$enableval], [enable_archive_plugin=auto])
934
935 AC_ARG_ENABLE(att_remover-plugin,
936                 [  --disable-att_remover-plugin    Do not build att_remover plugin],
937                 [enable_att_remover_plugin=$enableval], [enable_att_remover_plugin=auto])
938
939 AC_ARG_ENABLE(attachwarner-plugin,
940                 [  --disable-attachwarner-plugin   Do not build attachwarner plugin],
941                 [enable_attachwarner_plugin=$enableval], [enable_attachwarner_plugin=auto])
942
943 AC_ARG_ENABLE(bogofilter-plugin,
944                 [  --disable-bogofilter-plugin     Do not build bogofilter plugin],
945                 [enable_bogofilter_plugin=$enableval], [enable_bogofilter_plugin=auto])
946
947 AC_ARG_ENABLE(bsfilter-plugin,
948                 [  --disable-bsfilter-plugin       Do not build bsfilter plugin],
949                 [enable_bsfilter_plugin=$enableval], [enable_bsfilter_plugin=auto])
950
951 AC_ARG_ENABLE(clamd-plugin,
952                 [  --disable-clamd-plugin          Do not build clamd plugin],
953                 [enable_clamd_plugin=$enableval], [enable_clamd_plugin=auto])
954
955 AC_ARG_ENABLE(fancy-plugin,
956                 [  --disable-fancy-plugin          Do not build fancy plugin],
957                 [enable_fancy_plugin=$enableval], [enable_fancy_plugin=auto])
958
959 AC_ARG_ENABLE(fetchinfo-plugin,
960                 [  --disable-fetchinfo-plugin      Do not build fetchinfo plugin],
961                 [enable_fetchinfo_plugin=$enableval], [enable_fetchinfo_plugin=auto])
962
963 AC_ARG_ENABLE(gdata-plugin,
964                 [  --disable-gdata-plugin          Do not build gdata plugin],
965                 [enable_gdata_plugin=$enableval], [enable_gdata_plugin=auto])
966
967 AC_ARG_ENABLE(libravatar-plugin,
968                 [  --disable-libravatar-plugin     Do not build libravatar  plugin],
969                 [enable_libravatar_plugin=$enableval], [enable_libravatar_plugin=auto])
970
971 AC_ARG_ENABLE(mailmbox-plugin,
972                 [  --disable-mailmbox-plugin       Do not build mailmbox plugin],
973                 [enable_mailmbox_plugin=$enableval], [enable_mailmbox_plugin=auto])
974
975 AC_ARG_ENABLE(managesieve-plugin,
976                 [  --disable-managesieve-plugin       Do not build managesieve plugin],
977                 [enable_managesieve_plugin=$enableval], [enable_managesieve_plugin=auto])
978
979 AC_ARG_ENABLE(newmail-plugin,
980                 [  --disable-newmail-plugin        Do not build newmail plugin],
981                 [enable_newmail_plugin=$enableval], [enable_newmail_plugin=auto])
982
983 AC_ARG_ENABLE(notification-plugin,
984                 [  --disable-notification-plugin   Do not build notification plugin],
985                 [enable_notification_plugin=$enableval], [enable_notification_plugin=auto])
986
987 AC_ARG_ENABLE(pdf_viewer-plugin,
988                 [  --disable-pdf_viewer-plugin     Do not build pdf_viewer plugin],
989                 [enable_pdf_viewer_plugin=$enableval], [enable_pdf_viewer_plugin=auto])
990
991 AC_ARG_ENABLE(perl-plugin,
992                 [  --disable-perl-plugin           Do not build perl plugin],
993                 [enable_perl_plugin=$enableval], [enable_perl_plugin=auto])
994
995 AC_ARG_ENABLE(python-plugin,
996                 [  --disable-python-plugin         Do not build python plugin],
997                 [enable_python_plugin=$enableval], [enable_python_plugin=auto])
998
999 AC_ARG_ENABLE(pgpcore-plugin,
1000                 [  --disable-pgpcore-plugin        Do not build pgpcore plugin],
1001                 [enable_pgpcore_plugin=$enableval], [enable_pgpcore_plugin=auto])
1002
1003 AC_ARG_ENABLE(pgpmime-plugin,
1004                 [  --disable-pgpmime-plugin        Do not build pgpmime plugin],
1005                 [enable_pgpmime_plugin=$enableval], [enable_pgpmime_plugin=auto])
1006
1007 AC_ARG_ENABLE(pgpinline-plugin,
1008                 [  --disable-pgpinline-plugin      Do not build pgpinline plugin],
1009                 [enable_pgpinline_plugin=$enableval], [enable_pgpinline_plugin=auto])
1010
1011 AC_ARG_ENABLE(rssyl-plugin,
1012                 [  --disable-rssyl-plugin          Do not build rssyl plugin],
1013                 [enable_rssyl_plugin=$enableval], [enable_rssyl_plugin=auto])
1014
1015 AC_ARG_ENABLE(smime-plugin,
1016                 [  --disable-smime-plugin          Do not build smime plugin],
1017                 [enable_smime_plugin=$enableval], [enable_smime_plugin=auto])
1018
1019 AC_ARG_ENABLE(spamassassin-plugin,
1020                 [  --disable-spamassassin-plugin   Do not build spamassassin plugin],
1021                 [enable_spamassassin_plugin=$enableval], [enable_spamassassin_plugin=auto])
1022
1023 AC_ARG_ENABLE(spam_report-plugin,
1024                 [  --disable-spam_report-plugin    Do not build spam_report plugin],
1025                 [enable_spam_report_plugin=$enableval], [enable_spam_report_plugin=auto])
1026
1027 AC_ARG_ENABLE(tnef_parse-plugin,
1028                 [  --disable-tnef_parse-plugin     Do not build tnef_parse plugin],
1029                 [enable_tnef_parse_plugin=$enableval], [enable_tnef_parse_plugin=auto])
1030
1031 AC_ARG_ENABLE(vcalendar-plugin,
1032                 [  --disable-vcalendar-plugin      Do not build vcalendar plugin],
1033                 [enable_vcalendar_plugin=$enableval], [enable_vcalendar_plugin=auto])
1034
1035 dnl disabled by default
1036 AC_ARG_ENABLE(demo-plugin,
1037                 [  --enable-demo-plugin         Build demo plugin],
1038                 [enable_demo_plugin=$enableval], [enable_demo_plugin=no])
1039
1040
1041 dnl Then we check (unconditionnaly) for plugins dependencies
1042 dnl Some dependencies are optional, some mandatories. This is taken care of
1043 dnl later.
1044 dnl
1045 dnl During this dependancy check we do the checks themselves, define HAVE_X to
1046 dnl either yes or no, and do the AC_SUBST calls.
1047
1048 dnl Archive:            libarchive
1049 dnl Fancy:              Webkit, curl, optionally libsoup-gnome
1050 dnl Gdata:              libgdata
1051 dnl Libravatar:         libcurl
1052 dnl Notification:       optionally libnotify libindicate libcanberra_gtk hotkey
1053 dnl Pdf-Viewer:         libpoppler
1054 dnl Perl:               sed perl
1055 dnl PGP/Core:           libgpgme
1056 dnl PGP/Mime:           pgpcore libgpgme
1057 dnl PGP/Inline:         pgpcore libgpgme
1058 dnl S/Mime:             pgpcore libgpgme
1059 dnl Python:             Python
1060 dnl RSSyl:              expat libcurl
1061 dnl SpamReport:         libcurl
1062 dnl vCalendar:          libcurl
1063
1064 dnl libcurl ********************************************************************
1065 PKG_CHECK_MODULES(CURL, libcurl, HAVE_CURL=yes, HAVE_CURL=no)
1066 AC_SUBST(CURL_LIBS)
1067 AC_SUBST(CURL_CFLAGS)
1068
1069 dnl expat **********************************************************************
1070 PKG_CHECK_MODULES(EXPAT, expat, HAVE_EXPAT=yes, HAVE_EXPAT=no)
1071
1072 if test x"$HAVE_EXPAT" = xno; then
1073         AC_CHECK_HEADER(expat.h, [expat_header=yes], [expat_header=no])
1074         AC_CHECK_LIB(expat, XML_ParserCreate, [expat_lib=yes], [expat_lib=no])
1075         if test x"$expat_header" = xyes -a x"$expat_lib"=xyes; then
1076                 HAVE_EXPAT=yes
1077                 EXPAT_CFLAGS=""
1078                 EXPAT_LIBS="-lexpat"
1079         fi
1080 fi
1081
1082 AC_SUBST(EXPAT_CFLAGS)
1083 AC_SUBST(EXPAT_LIBS)
1084
1085 dnl webkit *********************************************************************
1086 PKG_CHECK_MODULES(WEBKIT, webkit-1.0 >= 1.1.14, HAVE_WEBKIT=yes, HAVE_WEBKIT=no)
1087 AC_SUBST(WEBKIT_LIBS)
1088 AC_SUBST(WEBKIT_CFLAGS)
1089
1090 dnl libsoup ********************************************************************
1091 PKG_CHECK_MODULES(LIBSOUP, libsoup-2.4, HAVE_LIBSOUP=yes, HAVE_LIBSOUP=no)
1092 if test x"$HAVE_LIBSOUP" = xyes; then
1093         AC_DEFINE(HAVE_LIBSOUP, 1, [Define if libsoup is available])
1094 fi
1095 AC_SUBST(LIBSOUP_CFLAGS)
1096 AC_SUBST(LIBSOUP_LIBS)
1097
1098 dnl libsoup-gnome **************************************************************
1099 PKG_CHECK_MODULES(LIBSOUP_GNOME, libsoup-gnome-2.4 >= 2.26, HAVE_LIBSOUP_GNOME=yes, HAVE_LIBSOUP_GNOME=no)
1100 if test x"$HAVE_LIBSOUP_GNOME" = xyes; then
1101         AC_DEFINE(HAVE_LIBSOUP_GNOME, 1, [Define if libsoup_gnome is available])
1102 fi
1103 AC_SUBST(LIBSOUP_GNOME_CFLAGS)
1104 AC_SUBST(LIBSOUP_GNOME_LIBS)
1105
1106 dnl libarchive *****************************************************************
1107 AC_CHECK_LIB([archive], [archive_read_new],
1108                        ARCHIVE_LIBS=-larchive
1109                        HAVE_ARCHIVE=yes
1110                        AC_SUBST(ARCHIVE_LIBS),
1111                        HAVE_ARCHIVE=no
1112                        )
1113
1114 dnl libgdata *******************************************************************
1115 PKG_CHECK_MODULES(GDATA, libgdata >= 0.17.1, HAVE_GDATA=yes, HAVE_GDATA=no)
1116 AC_SUBST(GDATA_CFLAGS)
1117 AC_SUBST(GDATA_LIBS)
1118
1119 dnl Poppler ********************************************************************
1120 PKG_CHECK_MODULES(POPPLER, poppler-glib >= 0.12.0, HAVE_POPPLER=yes, HAVE_POPPLER=no)
1121 AC_SUBST(POPPLER_LIBS)
1122 AC_SUBST(POPPLER_CFLAGS)
1123
1124 dnl check for Poppler extra features that we conditionally support
1125 if test x"$HAVE_POPPLER" = xyes; then
1126         OLD_CFLAGS=$CFLAGS
1127         CFLAGS="$POPPLER_CFLAGS $GTK_CFLAGS $GLIB_CFLAGS"
1128         AC_CHECK_DECL(POPPLER_DEST_NAMED,
1129                 [AC_DEFINE([HAVE_POPPLER_DEST_NAMED], [], [Description])],
1130                 ,[#include <poppler-action.h>])
1131         AC_CHECK_DECL(POPPLER_DEST_XYZ,
1132                 [AC_DEFINE([HAVE_POPPLER_DEST_XYZ], [], [Description])],
1133                 ,[#include <poppler-action.h>])
1134         CFLAGS=$OLD_CFLAGS
1135 fi
1136
1137 dnl perl ***********************************************************************
1138 AC_CHECK_PROG(HAVE_PERL, perl, yes, no)
1139 if test x"$HAVE_PERL" = xyes; then
1140         AC_MSG_CHECKING(for perl >= 5.8.0)
1141         PERL_VER=`perl -e 'print $] > 5.0079999?"yes":"no"'`
1142         if test "$PERL_VER" = "yes"; then
1143                 AC_MSG_RESULT(yes)
1144         else
1145                 AC_MSG_RESULT(no)
1146                 HAVE_PERL=no
1147         fi
1148 fi
1149 if test x"$HAVE_PERL" = xyes; then
1150         AC_MSG_CHECKING(for Perl compile flags)
1151         PERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
1152         PERL_CFLAGS=`echo $PERL_CFLAGS | sed 's/-D_FILE_OFFSET_BITS=[[0-9]]*//'`
1153         PERL_LDFLAGS=`perl -MExtUtils::Embed -e ldopts |sed 's/-lgdbm//'`
1154         PERL_LDFLAGS=`echo $PERL_LDFLAGS |sed 's/-ldb//'`
1155         PERL_LDFLAGS=`echo $PERL_LDFLAGS |sed 's/-lndbm//'`
1156         PERL_LDFLAGS=`echo $PERL_LDFLAGS |sed 's/-lc//'`
1157         AC_MSG_RESULT(ok)
1158         AC_MSG_NOTICE([Adding perl LIBS ${PERL_CFLAGS}])
1159         
1160         if test x"$HAVE_PERL" = xyes; then
1161                 AC_CHECK_LIB(perl,perl_alloc,[AC_DEFINE(HAVE_LIBPERL, 1, Check for libperl.)], 
1162                                              [ HAVE_LIBPERL=no ])
1163         fi
1164         if test x"$HAVE_LIBPERL" = xno; then
1165                 LIBPERL_PREFIX=`perl -MExtUtils::Embed -e perl_inc`
1166                 LIBPERL_PREFIX=`echo $LIBPERL_PREFIX |sed 's/-I//'`
1167                 AC_MSG_CHECKING([for libperl.so])
1168                 if test -f "$LIBPERL_PREFIX/libperl.so"; then
1169                         AC_MSG_RESULT(yes)
1170                         HAVE_LIBPERL=yes
1171                 else
1172                         AC_MSG_RESULT(no)
1173                 fi      
1174         fi
1175         PERL="perl"
1176         AC_SUBST(PERL)
1177         AC_SUBST(PERL_CFLAGS)
1178         AC_SUBST(PERL_LDFLAGS)
1179 fi
1180
1181 dnl Gpgme **********************************************************************
1182 AM_PATH_GPGME(1.0.0, HAVE_GPGME=yes, HAVE_GPGME=no)
1183 if test x"$HAVE_GPGME" = xyes; then
1184         AC_DEFINE(USE_GPGME, 1, Define if you use GPGME to support OpenPGP.)
1185         AM_PATH_GPGME(1.1.1, AC_DEFINE(HAVE_GPGME_PKA_TRUST, 1, [Define if GPGME supports PKA.]))
1186 fi
1187
1188 dnl Python *********************************************************************
1189 AM_PATH_PYTHON([2.5], [
1190         AC_PATH_PROG(PYTHON_CONFIG, python$PYTHON_VERSION-config)
1191         if test x"$PYTHON_CONFIG" = x"" ; then
1192                 AC_PATH_PROG(PYTHON_CONFIG, python-config)
1193         fi
1194         if test x"$PYTHON_CONFIG" != x""; then
1195                 PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
1196                 PYTHON_LIBS=`$PYTHON_CONFIG --libs`
1197                 PYTHON_PREFIX=`$PYTHON_CONFIG --prefix`
1198                 HAVE_PYTHON=yes
1199         else
1200                 AC_MSG_WARN(python-config not found. Maybe you need to install development packages for Python.)
1201                 HAVE_PYTHON=no
1202         fi
1203
1204         if test x"$HAVE_PYTHON" = xyes; then
1205                 _save_libs="$LIBS"
1206                 if test x"$platform_win32" = xno; then
1207                         # libpython.so
1208                         PYTHON_SHARED_LIB="libpython${PYTHON_VERSION}.so"
1209                         LIBS="-ldl"
1210                         AC_MSG_CHECKING([whether to dlopen $PYTHON_SHARED_LIB works])
1211                         AC_RUN_IFELSE(
1212                                 [AC_LANG_PROGRAM(
1213                                         [#include <dlfcn.h>
1214                                          #define PYTHON_SO_FILE "${PYTHON_SHARED_LIB}"
1215                                         ],
1216                                         [if (!dlopen(PYTHON_SO_FILE, RTLD_NOW | RTLD_GLOBAL)) return 1; return 0;])
1217                                 ],
1218                                 [found_libpython_so="yes"],
1219                                 [found_libpython_so="no"],
1220                                 [AC_MSG_FAILURE([cross-compiling not supported])])
1221                 fi
1222                 if test x"$found_libpython_so" != x"yes"; then
1223                         AC_MSG_RESULT(no)
1224                         AC_MSG_WARN(Could not find Python shared libary: ${PYTHON_SHARED_LIB}. Maybe you need to install development packages for Python.)
1225                         HAVE_PYTHON=no
1226                 else
1227                         AC_MSG_RESULT(yes)
1228                 fi
1229                 LIBS="$_save_libs";
1230         fi
1231         if test x"$HAVE_PYTHON" = xyes; then
1232                 PKG_CHECK_MODULES(PYGTK, pygtk-2.0 >= 2.10.3, [AC_DEFINE(ENABLE_PYTHON, [1], [Enable Python support])], HAVE_PYTHON=no)
1233         fi
1234 ])
1235 AC_SUBST(PYTHON_SHARED_LIB)
1236 AC_SUBST(PYTHON_CFLAGS)
1237 AC_SUBST(PYTHON_LIBS)
1238 AC_SUBST(PYGTK_CFLAGS)
1239 AC_SUBST(PYGTK_LIBS)
1240
1241 dnl libnotify ******************************************************************
1242 PKG_CHECK_MODULES(libnotify, libnotify >= 0.4.3, HAVE_LIBNOTIFY=yes, HAVE_LIBNOTIFY=no)
1243 if test x"$HAVE_LIBNOTIFY" = xyes; then
1244         AC_DEFINE(HAVE_LIBNOTIFY, 1, [Define if libnotify support is enabled])
1245 fi
1246 AC_SUBST(libnotify_CFLAGS)
1247 AC_SUBST(libnotify_LIBS)
1248
1249 dnl libcanberra-gtk ************************************************************
1250 PKG_CHECK_MODULES(libcanberra_gtk, libcanberra-gtk >= 0.6, HAVE_LIBCANBERRA_GTK=yes, HAVE_LIBCANBERRA_GTK=no)
1251 if test x"$HAVE_LIBCANBERRA_GTK" = xyes; then
1252         AC_DEFINE(HAVE_LIBCANBERRA_GTK, 1, [Define if libcanberra-gtk support is enabled])
1253 fi
1254 AC_SUBST(libcanberra_gtk_CFLAGS)
1255 AC_SUBST(libcanberra_gtk_LIBS)
1256
1257 dnl libindicate ****************************************************************
1258 dnl We support either 0.3+ or 0.5+ or 0.6+ or 0.7+
1259 LIBINDICATE_MODULE=indicate
1260 LIBINDICATE_REQUIRED=0.3.0
1261
1262 PKG_CHECK_EXISTS(indicate-0.5 >= 0.5.0, LIBINDICATE_MODULE=indicate-0.5)
1263 PKG_CHECK_EXISTS(indicate-0.6 >= 0.6.0, LIBINDICATE_MODULE=indicate-0.6)
1264 PKG_CHECK_EXISTS(indicate-0.7 >= 0.7.0, LIBINDICATE_MODULE=indicate-0.7)
1265 PKG_CHECK_MODULES(libindicate, $LIBINDICATE_MODULE >= $LIBINDICATE_REQUIRED, HAVE_LIBINDICATE=yes, HAVE_LIBINDICATE=no)
1266 if test x"$HAVE_LIBINDICATE" = xyes; then
1267         AC_DEFINE(NOTIFICATION_INDICATOR, 1, [Activate support for indicators])
1268 fi
1269 AC_SUBST(libindicate_CFLAGS)
1270 AC_SUBST(libindicate_LIBS)
1271
1272 dnl hotkeys ********************************************************************
1273 PKG_CHECK_MODULES(CM_NP_HOTKEY, [gio-2.0 >= 2.15.6 gio-unix-2.0 >= 2.15.6], HAVE_HOTKEYS=yes, HAVE_HOTKEYS=no)
1274 if test x"$HAVE_HOTKEYS" = xyes; then
1275         AC_DEFINE(NOTIFICATION_HOTKEYS, 1, Activate support for global hotkeys)
1276 fi
1277 AC_SUBST(CM_NP_HOTKEY_CFLAGS)
1278 AC_SUBST(CM_NP_HOTKEY_LIBS)
1279
1280 dnl Third, we now cross the requested plugins and the available dependencies
1281 dnl If some dependencies are missing and the plugin was explicitely enabled,
1282 dnl we error out, else we only inform.
1283
1284 AC_MSG_CHECKING([whether to build acpi_notifier plugin])
1285 if test x"$enable_acpi_notifier_plugin" != xno; then
1286         PLUGINS="$PLUGINS acpi_notifier"
1287         AC_MSG_RESULT(yes)
1288 else
1289         DISABLED_PLUGINS="$DISABLED_PLUGINS acpi_notifier"
1290         AC_MSG_RESULT(no)
1291 fi
1292
1293 AC_MSG_CHECKING([whether to build address_keeper plugin])
1294 if test x"$enable_address_keeper_plugin" != xno; then
1295         PLUGINS="$PLUGINS address_keeper"
1296         AC_MSG_RESULT(yes)
1297 else
1298         DISABLED_PLUGINS="$DISABLED_PLUGINS address_keeper"
1299         AC_MSG_RESULT(no)
1300 fi
1301
1302 AC_MSG_CHECKING([whether to build archive plugin])
1303 if test x"$enable_archive_plugin" != xno; then
1304         dependencies_missing=""
1305
1306         if test x"$HAVE_ARCHIVE" = xno; then
1307                 dependencies_missing="libarchive $dependencies_missing"
1308         fi
1309
1310         if test x"$dependencies_missing" = x; then
1311                 PLUGINS="$PLUGINS archive"
1312                 AC_MSG_RESULT(yes)
1313         elif test x"$enable_archive_plugin" = xauto; then
1314                 AC_MSG_RESULT(no)
1315                 AC_MSG_WARN("Plugin archive will not be built; missing $dependencies_missing")
1316                 enable_archive_plugin=no
1317                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS archive"
1318         else
1319                 AC_MSG_RESULT(no)
1320                 AC_MSG_ERROR("Plugin archive cannot be built; missing $dependencies_missing")
1321         fi
1322 else
1323         DISABLED_PLUGINS="$DISABLED_PLUGINS archive"
1324         AC_MSG_RESULT(no)
1325 fi
1326
1327 AC_MSG_CHECKING([whether to build att_remover plugin])
1328 if test x"$enable_att_remover_plugin" != xno; then
1329         PLUGINS="$PLUGINS att_remover"
1330         AC_MSG_RESULT(yes)
1331 else
1332         DISABLED_PLUGINS="$DISABLED_PLUGINS att_remover"
1333         AC_MSG_RESULT(no)
1334 fi
1335
1336 AC_MSG_CHECKING([whether to build attachwarner plugin])
1337 if test x"$enable_attachwarner_plugin" != xno; then
1338         PLUGINS="$PLUGINS attachwarner"
1339         AC_MSG_RESULT(yes)
1340 else
1341         DISABLED_PLUGINS="$DISABLED_PLUGINS attachwarner"
1342         AC_MSG_RESULT(no)
1343 fi
1344
1345 AC_MSG_CHECKING([whether to build bogofilter plugin])
1346 if test x"$enable_bogofilter_plugin" != xno; then
1347         PLUGINS="$PLUGINS bogofilter"
1348         AC_MSG_RESULT(yes)
1349 else
1350         DISABLED_PLUGINS="$DISABLED_PLUGINS bogofilter"
1351         AC_MSG_RESULT(no)
1352 fi
1353
1354 AC_MSG_CHECKING([whether to build bsfilter plugin])
1355 if test x"$enable_bsfilter_plugin" != xno; then
1356         PLUGINS="$PLUGINS bsfilter"
1357         AC_MSG_RESULT(yes)
1358 else
1359         DISABLED_PLUGINS="$DISABLED_PLUGINS bsfilter"
1360         AC_MSG_RESULT(no)
1361 fi
1362
1363 AC_MSG_CHECKING([whether to build clamd plugin])
1364 if test x"$enable_clamd_plugin" != xno; then
1365         PLUGINS="$PLUGINS clamd"
1366         AC_MSG_RESULT(yes)
1367 else
1368         DISABLED_PLUGINS="$DISABLED_PLUGINS clamd"
1369         AC_MSG_RESULT(no)
1370 fi
1371
1372 AC_MSG_CHECKING([whether to build demo plugin])
1373 if test x"$enable_demo_plugin" != xno; then
1374         PLUGINS="$PLUGINS demo"
1375         AC_MSG_RESULT(yes)
1376 else
1377         DISABLED_PLUGINS="$DISABLED_PLUGINS demo"
1378         AC_MSG_RESULT(no)
1379 fi
1380
1381 AC_MSG_CHECKING([whether to build fancy plugin])
1382 if test x"$enable_fancy_plugin" != xno; then
1383         dependencies_missing=""
1384
1385         if test x"$HAVE_WEBKIT" = xno; then
1386                 dependencies_missing="libwebkit-1.0 $dependencies_missing"
1387         fi
1388         if test x"$HAVE_CURL" = xno; then
1389                 dependencies_missing="libcurl $dependencies_missing"
1390         fi
1391
1392         if test x"$dependencies_missing" = x; then
1393                 PLUGINS="$PLUGINS fancy"
1394                 AC_MSG_RESULT(yes)
1395         elif test x"$enable_fancy_plugin" = xauto; then
1396                 AC_MSG_RESULT(no)
1397                 AC_MSG_WARN("Plugin fancy will not be built; missing $dependencies_missing")
1398                 enable_fancy_plugin=no
1399                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS fancy"
1400         else
1401                 AC_MSG_RESULT(no)
1402                 AC_MSG_ERROR("Plugin fancy cannot be built; missing $dependencies_missing")
1403         fi
1404 else
1405         DISABLED_PLUGINS="$DISABLED_PLUGINS fancy"
1406         AC_MSG_RESULT(no)
1407 fi
1408
1409 AC_MSG_CHECKING([whether to build fetchinfo plugin])
1410 if test x"$enable_fetchinfo_plugin" != xno; then
1411         PLUGINS="$PLUGINS fetchinfo"
1412         AC_MSG_RESULT(yes)
1413 else
1414         DISABLED_PLUGINS="$DISABLED_PLUGINS fetchinfo"
1415         AC_MSG_RESULT(no)
1416 fi
1417
1418 AC_MSG_CHECKING([whether to build gdata plugin])
1419 if test x"$enable_gdata_plugin" != xno; then
1420         dependencies_missing=""
1421
1422         if test x"$HAVE_GDATA" = xno; then
1423                 dependencies_missing="libgdata $dependencies_missing"
1424         fi
1425
1426         if test x"$dependencies_missing" = x; then
1427                 PLUGINS="$PLUGINS gdata"
1428                 AC_MSG_RESULT(yes)
1429         elif test x"$enable_gdata_plugin" = xauto; then
1430                 AC_MSG_RESULT(no)
1431                 AC_MSG_WARN("Plugin gdata will not be built; missing $dependencies_missing")
1432                 enable_gdata_plugin=no
1433                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS gdata"
1434         else
1435                 AC_MSG_RESULT(no)
1436                 AC_MSG_ERROR("Plugin gdata cannot be built; missing $dependencies_missing")
1437         fi
1438 else
1439         DISABLED_PLUGINS="$DISABLED_PLUGINS gdata"
1440         AC_MSG_RESULT(no)
1441 fi
1442
1443 AC_MSG_CHECKING([whether to build libravatar plugin])
1444 if test x"$enable_libravatar_plugin" != xno; then
1445         dependencies_missing=""
1446
1447         if test x"$HAVE_CURL" = xno; then
1448                 dependencies_missing="libcurl $dependencies_missing"
1449         fi
1450
1451         if test x"$dependencies_missing" = x; then
1452                 PLUGINS="$PLUGINS libravatar"
1453                 AC_MSG_RESULT(yes)
1454         elif test x"$enable_libravatar_plugin" = xauto; then
1455                 AC_MSG_RESULT(no)
1456                 AC_MSG_WARN("Plugin libravatar will not be built; missing $dependencies_missing")
1457                 enable_libravatar_plugin=no
1458                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS libravatar"
1459         else
1460                 AC_MSG_RESULT(no)
1461                 AC_MSG_ERROR("Plugin libravatar cannot be built; missing $dependencies_missing")
1462         fi
1463 else
1464         DISABLED_PLUGINS="$DISABLED_PLUGINS libravatar"
1465         AC_MSG_RESULT(no)
1466 fi
1467
1468 AC_MSG_CHECKING([whether to build mailmbox plugin])
1469 if test x"$enable_mailmbox_plugin" != xno; then
1470         PLUGINS="$PLUGINS mailmbox"
1471         AC_MSG_RESULT(yes)
1472 else
1473         DISABLED_PLUGINS="$DISABLED_PLUGINS mailmbox"
1474         AC_MSG_RESULT(no)
1475 fi
1476
1477 AC_MSG_CHECKING([whether to build managesieve plugin])
1478 if test x"$enable_managesieve_plugin" != xno; then
1479         PLUGINS="$PLUGINS managesieve"
1480         AC_MSG_RESULT(yes)
1481 else
1482         DISABLED_PLUGINS="$DISABLED_PLUGINS managesieve"
1483         AC_MSG_RESULT(no)
1484 fi
1485
1486 AC_MSG_CHECKING([whether to build newmail plugin])
1487 if test x"$enable_newmail_plugin" != xno; then
1488         PLUGINS="$PLUGINS newmail"
1489         AC_MSG_RESULT(yes)
1490 else
1491         DISABLED_PLUGINS="$DISABLED_PLUGINS newmail"
1492         AC_MSG_RESULT(no)
1493 fi
1494
1495 AC_MSG_CHECKING([whether to build notification plugin])
1496 if test x"$enable_notification_plugin" != xno; then
1497         PLUGINS="$PLUGINS notification"
1498         AC_MSG_RESULT(yes)
1499
1500         AC_DEFINE(NOTIFICATION_POPUP, 1, Activate notification popup)
1501         AC_DEFINE(NOTIFICATION_BANNER, 1, Activate notification banner)
1502         AC_DEFINE(NOTIFICATION_COMMAND, 1, Activate notification shell command)
1503         AC_DEFINE(NOTIFICATION_TRAYICON, 1, Activate notification trayicon)
1504         if test x"$platform_win32" = xno; then
1505                 AC_DEFINE(NOTIFICATION_LCDPROC, 1, Activate lcdproc support)
1506         fi
1507
1508         notification_features="banner command"
1509         notification_missing_dependencies=""
1510         if test x"$HAVE_HOTKEYS" = xyes; then
1511                 notification_features="$notification_features hotkeys"
1512         else
1513                 notification_missing_dependencies="$notification_missing_dependencies hotkeys"
1514         fi
1515         notification_features="$notification_features lcdproc"
1516         if test x"$HAVE_LIBINDICATE" = xyes; then
1517                 notification_features="$notification_features libindicate"
1518         else
1519                 notification_missing_dependencies="$notification_missing_dependencies libindicate"
1520         fi
1521         if test x"$HAVE_LIBNOTIFY" = xyes; then
1522                 notification_features="$notification_features libnotify"
1523         else
1524                 notification_missing_dependencies="$notification_missing_dependencies libnotify"
1525         fi
1526         if test x"$HAVE_LIBCANBERRA_GTK" = xyes; then
1527                 notification_features="$notification_features libcanberra-gtk"
1528         else
1529                 notification_missing_dependencies="$notification_missing_dependencies libcanberra-gtk"
1530         fi
1531         notification_features="$notification_features popup trayicon"
1532 else
1533         DISABLED_PLUGINS="$DISABLED_PLUGINS notification"
1534         AC_MSG_RESULT(no)
1535 fi
1536
1537 AC_MSG_CHECKING([whether to build pdf_viewer plugin])
1538 if test x"$enable_pdf_viewer_plugin" != xno; then
1539         dependencies_missing=""
1540
1541         if test x"$HAVE_POPPLER" = xno; then
1542                 dependencies_missing="libpoppler-glib $dependencies_missing"
1543         fi
1544
1545         if test x"$dependencies_missing" = x; then
1546                 PLUGINS="$PLUGINS pdf_viewer"
1547                 AC_MSG_RESULT(yes)
1548         elif test x"$enable_pdf_viewer_plugin" = xauto; then
1549                 AC_MSG_RESULT(no)
1550                 AC_MSG_WARN("Plugin pdf_viewer will not be built; missing $dependencies_missing")
1551                 enable_pdf_viewer_plugin=no
1552                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS pdf_viewer"
1553         else
1554                 AC_MSG_RESULT(no)
1555                 AC_MSG_ERROR("Plugin pdf_viewer cannot be built; missing $dependencies_missing")
1556         fi
1557 else
1558         DISABLED_PLUGINS="$DISABLED_PLUGINS pdf_viewer"
1559         AC_MSG_RESULT(no)
1560 fi
1561
1562 AC_MSG_CHECKING([whether to build perl plugin])
1563 if test x"$enable_perl_plugin" != xno; then
1564         dependencies_missing=""
1565
1566         if test x"$HAVE_LIBPERL" = xno; then
1567                 dependencies_missing="libperl $dependencies_missing"
1568         fi
1569
1570         if test x"$dependencies_missing" = x; then
1571                 PLUGINS="$PLUGINS perl"
1572                 AC_MSG_RESULT(yes)
1573         elif test x"$enable_perl_plugin" = xauto; then
1574                 AC_MSG_RESULT(no)
1575                 AC_MSG_WARN("Plugin perl will not be built; missing $dependencies_missing")
1576                 enable_perl_plugin=no
1577                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS perl"
1578         else
1579                 AC_MSG_RESULT(no)
1580                 AC_MSG_ERROR("Plugin perl cannot be built; missing $dependencies_missing")
1581         fi
1582 else
1583         DISABLED_PLUGINS="$DISABLED_PLUGINS perl"
1584         AC_MSG_RESULT(no)
1585 fi
1586
1587 AC_MSG_CHECKING([whether to build python plugin])
1588 if test x"$enable_python_plugin" != xno; then
1589         dependencies_missing=""
1590
1591         if test x"$HAVE_PYTHON" = xno; then
1592                 dependencies_missing="python $dependencies_missing"
1593         fi
1594
1595         if test x"$dependencies_missing" = x; then
1596                 PLUGINS="$PLUGINS python"
1597                 AC_MSG_RESULT(yes)
1598         elif test x"$enable_python_plugin" = xauto; then
1599                 AC_MSG_RESULT(no)
1600                 AC_MSG_WARN("Plugin python will not be built; missing $dependencies_missing")
1601                 enable_python_plugin=no
1602                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS python"
1603         else
1604                 AC_MSG_RESULT(no)
1605                 AC_MSG_ERROR("Plugin python cannot be built; missing $dependencies_missing")
1606         fi
1607 else
1608         DISABLED_PLUGINS="$DISABLED_PLUGINS python"
1609         AC_MSG_RESULT(no)
1610 fi
1611
1612 AC_MSG_CHECKING([whether to build pgpcore plugin])
1613 if test x"$enable_pgpcore_plugin" != xno; then
1614         dependencies_missing=""
1615
1616         if test x"$HAVE_GPGME" = xno; then
1617                 dependencies_missing="libgpgme $dependencies_missing"
1618         fi
1619
1620         if test x"$dependencies_missing" = x; then
1621                 PLUGINS="$PLUGINS pgpcore"
1622                 AC_MSG_RESULT(yes)
1623         elif test x"$enable_pgpcore_plugin" = xauto; then
1624                 AC_MSG_RESULT(no)
1625                 AC_MSG_WARN("Plugin pgpcore will not be built; missing $dependencies_missing")
1626                 enable_pgpcore_plugin=no
1627                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS pgpcore"
1628         else
1629                 AC_MSG_RESULT(no)
1630                 AC_MSG_ERROR("Plugin pgpcore cannot be built; missing $dependencies_missing")
1631         fi
1632 else
1633         DISABLED_PLUGINS="$DISABLED_PLUGINS pgpcore"
1634         AC_MSG_RESULT(no)
1635 fi
1636
1637 AC_MSG_CHECKING([whether to build pgpmime plugin])
1638 if test x"$enable_pgpmime_plugin" != xno; then
1639         dependencies_missing=""
1640
1641         if test x"$HAVE_GPGME" = xno; then
1642                 dependencies_missing="libgpgme $dependencies_missing"
1643         fi
1644         if test x"$enable_pgpcore_plugin" = xno; then
1645                 dependencies_missing="pgpcore plugin $dependencies_missing"
1646         fi
1647
1648         if test x"$dependencies_missing" = x; then
1649                 PLUGINS="$PLUGINS pgpmime"
1650                 AC_MSG_RESULT(yes)
1651         elif test x"$enable_pgpmime_plugin" = xauto; then
1652                 AC_MSG_RESULT(no)
1653                 AC_MSG_WARN("Plugin pgpmime will not be built; missing $dependencies_missing")
1654                 enable_pgpmime_plugin=no
1655                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS pgpmime"
1656         else
1657                 AC_MSG_RESULT(no)
1658                 AC_MSG_ERROR("Plugin pgpmime cannot be built; missing $dependencies_missing")
1659         fi
1660 else
1661         DISABLED_PLUGINS="$DISABLED_PLUGINS pgpmime"
1662         AC_MSG_RESULT(no)
1663 fi
1664
1665 AC_MSG_CHECKING([whether to build pgpinline plugin])
1666 if test x"$enable_pgpinline_plugin" != xno; then
1667         dependencies_missing=""
1668
1669         if test x"$HAVE_GPGME" = xno; then
1670                 dependencies_missing="libgpgme $dependencies_missing"
1671         fi
1672         if test x"$enable_pgpcore_plugin" = xno; then
1673                 dependencies_missing="pgpcore plugin $dependencies_missing"
1674         fi
1675
1676         if test x"$dependencies_missing" = x; then
1677                 PLUGINS="$PLUGINS pgpinline"
1678                 AC_MSG_RESULT(yes)
1679         elif test x"$enable_pgpinline_plugin" = xauto; then
1680                 AC_MSG_RESULT(no)
1681                 AC_MSG_WARN("Plugin pgpinline will not be built; missing $dependencies_missing")
1682                 enable_pgpinline_plugin=no
1683                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS pgpinline"
1684         else
1685                 AC_MSG_RESULT(no)
1686                 AC_MSG_ERROR("Plugin pgpinline cannot be built; missing $dependencies_missing")
1687         fi
1688 else
1689         DISABLED_PLUGINS="$DISABLED_PLUGINS pgpinline"
1690         AC_MSG_RESULT(no)
1691 fi
1692
1693 AC_MSG_CHECKING([whether to build rssyl plugin])
1694 if test x"$enable_rssyl_plugin" != xno; then
1695         dependencies_missing=""
1696
1697         if test x"$HAVE_EXPAT" = xno; then
1698                 dependencies_missing="expat $dependencies_missing"
1699         fi
1700         if test x"$HAVE_CURL" = xno; then
1701                 dependencies_missing="libcurl $dependencies_missing"
1702         fi
1703
1704         if test x"$dependencies_missing" = x; then
1705                 PLUGINS="$PLUGINS rssyl"
1706                 AC_MSG_RESULT(yes)
1707         elif test x"$enable_rssyl_plugin" = xauto; then
1708                 AC_MSG_RESULT(no)
1709                 AC_MSG_WARN("Plugin rssyl will not be built; missing $dependencies_missing")
1710                 enable_rssyl_plugin=no
1711                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS rssyl"
1712         else
1713                 AC_MSG_RESULT(no)
1714                 AC_MSG_ERROR("Plugin rssyl cannot be built; missing $dependencies_missing")
1715         fi
1716 else
1717         DISABLED_PLUGINS="$DISABLED_PLUGINS rssyl"
1718         AC_MSG_RESULT(no)
1719 fi
1720
1721 AC_MSG_CHECKING([whether to build spamassassin plugin])
1722 if test x"$enable_spamassassin_plugin" != xno; then
1723         PLUGINS="$PLUGINS spamassassin"
1724         AC_MSG_RESULT(yes)
1725         AC_SPAMASSASSIN
1726 else
1727         DISABLED_PLUGINS="$DISABLED_PLUGINS spamassassin"
1728         AC_MSG_RESULT(no)
1729 fi
1730
1731 AC_MSG_CHECKING([whether to build smime plugin])
1732 if test x"$enable_smime_plugin" != xno; then
1733         dependencies_missing=""
1734
1735         if test x"$HAVE_GPGME" = xno; then
1736                 dependencies_missing="libgpgme $dependencies_missing"
1737         fi
1738         if test x"$enable_pgpcore_plugin" = xno; then
1739                 dependencies_missing="pgpcore plugin $dependencies_missing"
1740         fi
1741
1742         if test x"$dependencies_missing" = x; then
1743                 PLUGINS="$PLUGINS smime"
1744                 AC_MSG_RESULT(yes)
1745         elif test x"$enable_smime_plugin" = xauto; then
1746                 AC_MSG_RESULT(no)
1747                 AC_MSG_WARN("Plugin smime will not be built; missing $dependencies_missing")
1748                 enable_smime_plugin=no
1749                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS smime"
1750         else
1751                 AC_MSG_RESULT(no)
1752                 AC_MSG_ERROR("Plugin smime cannot be built; missing $dependencies_missing")
1753         fi
1754 else
1755         DISABLED_PLUGINS="$DISABLED_PLUGINS smime"
1756         AC_MSG_RESULT(no)
1757 fi
1758
1759 AC_MSG_CHECKING([whether to build spam_report plugin])
1760 if test x"$enable_spam_report_plugin" != xno; then
1761         dependencies_missing=""
1762
1763         if test x"$HAVE_CURL" = xno; then
1764                 dependencies_missing="libcurl $dependencies_missing"
1765         fi
1766
1767         if test x"$dependencies_missing" = x; then
1768                 PLUGINS="$PLUGINS spam_report"
1769                 AC_MSG_RESULT(yes)
1770         elif test x"$enable_spam_report_plugin" = xauto; then
1771                 AC_MSG_RESULT(no)
1772                 AC_MSG_WARN("Plugin spam_report will not be built; missing $dependencies_missing")
1773                 enable_spam_report_plugin=no
1774                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS spam_report"
1775         else
1776                 AC_MSG_RESULT(no)
1777                 AC_MSG_ERROR("Plugin spam_report cannot be built; missing $dependencies_missing")
1778         fi
1779 else
1780         DISABLED_PLUGINS="$DISABLED_PLUGINS spam_report"
1781         AC_MSG_RESULT(no)
1782 fi
1783
1784 AC_MSG_CHECKING([whether to build tnef_parse plugin])
1785 if test x"$enable_tnef_parse_plugin" != xno; then
1786         PLUGINS="$PLUGINS tnef_parse"
1787         AC_MSG_RESULT(yes)
1788 else
1789         DISABLED_PLUGINS="$DISABLED_PLUGINS tnef_parse"
1790         AC_MSG_RESULT(no)
1791 fi
1792
1793 AC_MSG_CHECKING([whether to build vcalendar plugin])
1794 if test x"$enable_vcalendar_plugin" != xno; then
1795         dependencies_missing=""
1796
1797         if test x"$HAVE_CURL" = xno; then
1798                 dependencies_missing="libcurl $dependencies_missing"
1799         fi
1800
1801         if test x"$HAVE_PERL" = xno; then
1802                 dependencies_missing="perl $dependencies_missing"
1803         fi
1804
1805         if test x"$dependencies_missing" = x; then
1806                 PLUGINS="$PLUGINS vcalendar"
1807                 AC_MSG_RESULT(yes)
1808         elif test x"$enable_vcalendar_plugin" = xauto; then
1809                 AC_MSG_RESULT(no)
1810                 AC_MSG_WARN("Plugin vcalendar will not be built; missing $dependencies_missing")
1811                 enable_vcalendar_plugin=no
1812                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS vcalendar"
1813         else
1814                 AC_MSG_RESULT(no)
1815                 AC_MSG_ERROR("Plugin vcalendar cannot be built; missing $dependencies_missing")
1816         fi
1817 else
1818         DISABLED_PLUGINS="$DISABLED_PLUGINS vcalendar"
1819         AC_MSG_RESULT(no)
1820 fi
1821
1822 dnl And finally the automake conditionals.
1823
1824 AM_CONDITIONAL(BUILD_ACPI_NOTIFIER_PLUGIN,      test x"$enable_acpi_notifier_plugin" != xno)
1825 AM_CONDITIONAL(BUILD_ADDRESS_KEEPER_PLUGIN,     test x"$enable_address_keeper_plugin" != xno)
1826 AM_CONDITIONAL(BUILD_ARCHIVE_PLUGIN,            test x"$enable_archive_plugin" != xno)
1827 AM_CONDITIONAL(BUILD_ATT_REMOVER_PLUGIN,        test x"$enable_att_remover_plugin" != xno)
1828 AM_CONDITIONAL(BUILD_ATTACHWARNER_PLUGIN,       test x"$enable_attachwarner_plugin" != xno)
1829 AM_CONDITIONAL(BUILD_BOGOFILTER_PLUGIN,         test x"$enable_bogofilter_plugin" != xno)
1830 AM_CONDITIONAL(BUILD_BSFILTER_PLUGIN,           test x"$enable_bsfilter_plugin" != xno)
1831 AM_CONDITIONAL(BUILD_CLAMD_PLUGIN,              test x"$enable_clamd_plugin" != xno)
1832 AM_CONDITIONAL(BUILD_DEMO_PLUGIN,               test x"$enable_demo_plugin" != xno)
1833 AM_CONDITIONAL(BUILD_FANCY_PLUGIN,              test x"$enable_fancy_plugin" != xno)
1834 AM_CONDITIONAL(BUILD_FETCHINFO_PLUGIN,          test x"$enable_fetchinfo_plugin" != xno)
1835 AM_CONDITIONAL(BUILD_GDATA_PLUGIN,              test x"$enable_gdata_plugin" != xno)
1836 AM_CONDITIONAL(BUILD_LIBRAVATAR_PLUGIN,         test x"$enable_libravatar_plugin" != xno)
1837 AM_CONDITIONAL(BUILD_MAILMBOX_PLUGIN,           test x"$enable_mailmbox_plugin" != xno)
1838 AM_CONDITIONAL(BUILD_MANAGESIEVE_PLUGIN,                test x"$enable_managesieve_plugin" != xno)
1839 AM_CONDITIONAL(BUILD_NEWMAIL_PLUGIN,            test x"$enable_newmail_plugin" != xno)
1840 AM_CONDITIONAL(BUILD_NOTIFICATION_PLUGIN,       test x"$enable_notification_plugin" != xno)
1841 AM_CONDITIONAL(BUILD_HOTKEYS,                   test x"$enable_notification_plugin" != xno -a x"$HAVE_HOTKEYS" = xyes)
1842 AM_CONDITIONAL(BUILD_PDF_VIEWER_PLUGIN,         test x"$enable_pdf_viewer_plugin" != xno)
1843 AM_CONDITIONAL(BUILD_PERL_PLUGIN,               test x"$enable_perl_plugin" != xno)
1844 AM_CONDITIONAL(BUILD_PYTHON_PLUGIN,             test x"$enable_python_plugin" != xno)
1845 AM_CONDITIONAL(BUILD_PGPCORE_PLUGIN,            test x"$enable_pgpcore_plugin" != xno)
1846 AM_CONDITIONAL(BUILD_PGPMIME_PLUGIN,            test x"$enable_pgpmime_plugin" != xno)
1847 AM_CONDITIONAL(BUILD_PGPINLINE_PLUGIN,          test x"$enable_pgpinline_plugin" != xno)
1848 AM_CONDITIONAL(BUILD_RSSYL_PLUGIN,              test x"$enable_rssyl_plugin" != xno)
1849 AM_CONDITIONAL(BUILD_SMIME_PLUGIN,              test x"$enable_smime_plugin" != xno)
1850 AM_CONDITIONAL(BUILD_SPAMASSASSIN_PLUGIN,       test x"$enable_spamassassin_plugin" != xno)
1851 AM_CONDITIONAL(BUILD_SPAM_REPORT_PLUGIN,        test x"$enable_spam_report_plugin" != xno)
1852 AM_CONDITIONAL(BUILD_TNEF_PARSE_PLUGIN,         test x"$enable_tnef_parse_plugin" != xno)
1853 AM_CONDITIONAL(BUILD_VCALENDAR_PLUGIN,          test x"$enable_vcalendar_plugin" != xno)
1854
1855
1856 dnl ****************************
1857 dnl ** Final configure output **
1858 dnl ****************************
1859
1860 AC_OUTPUT([
1861 Makefile
1862 m4/Makefile
1863 po/Makefile.in
1864 src/common/version.h
1865 src/Makefile
1866 src/common/Makefile
1867 src/common/passcrypt.h
1868 src/gtk/Makefile
1869 src/etpan/Makefile
1870 src/plugins/Makefile
1871 src/plugins/acpi_notifier/Makefile
1872 src/plugins/address_keeper/Makefile
1873 src/plugins/archive/Makefile
1874 src/plugins/att_remover/Makefile
1875 src/plugins/attachwarner/Makefile
1876 src/plugins/bogofilter/Makefile
1877 src/plugins/bsfilter/Makefile
1878 src/plugins/clamd/Makefile
1879 src/plugins/clamd/libclamd/Makefile
1880 src/plugins/demo/Makefile
1881 src/plugins/fancy/Makefile
1882 src/plugins/fetchinfo/Makefile
1883 src/plugins/gdata/Makefile
1884 src/plugins/libravatar/Makefile
1885 src/plugins/mailmbox/Makefile
1886 src/plugins/managesieve/Makefile
1887 src/plugins/newmail/Makefile
1888 src/plugins/notification/Makefile
1889 src/plugins/notification/gtkhotkey/Makefile
1890 src/plugins/pdf_viewer/Makefile
1891 src/plugins/perl/Makefile
1892 src/plugins/perl/tools/Makefile
1893 src/plugins/python/Makefile
1894 src/plugins/python/examples/Makefile
1895 src/plugins/pgpcore/Makefile
1896 src/plugins/pgpmime/Makefile
1897 src/plugins/pgpinline/Makefile
1898 src/plugins/rssyl/Makefile
1899 src/plugins/rssyl/libfeed/Makefile
1900 src/plugins/smime/Makefile
1901 src/plugins/spamassassin/Makefile
1902 src/plugins/spam_report/Makefile
1903 src/plugins/tnef_parse/Makefile
1904 src/plugins/vcalendar/Makefile
1905 src/plugins/vcalendar/libical/Makefile
1906 src/plugins/vcalendar/libical/libical/icalversion.h
1907 src/plugins/vcalendar/libical/libical/Makefile
1908 src/plugins/vcalendar/libical/design-data/Makefile
1909 src/plugins/vcalendar/libical/scripts/Makefile
1910 doc/Makefile
1911 doc/man/Makefile
1912 tools/Makefile
1913 config/Makefile
1914 manual/Makefile
1915 manual/dtd/Makefile
1916 manual/dist/Makefile
1917 manual/dist/pdf/Makefile
1918 manual/dist/ps/Makefile
1919 manual/dist/html/Makefile
1920 manual/dist/txt/Makefile
1921 manual/fr/Makefile
1922 manual/fr/dist/Makefile
1923 manual/fr/dist/pdf/Makefile
1924 manual/fr/dist/ps/Makefile
1925 manual/fr/dist/html/Makefile
1926 manual/fr/dist/txt/Makefile
1927 manual/es/Makefile
1928 manual/es/dist/Makefile
1929 manual/es/dist/pdf/Makefile
1930 manual/es/dist/ps/Makefile
1931 manual/es/dist/html/Makefile
1932 manual/es/dist/txt/Makefile
1933 claws-mail.pc
1934 ])
1935
1936 dnl Output the configuration summary
1937 echo ""
1938 echo "$PACKAGE $VERSION"
1939 echo ""
1940 if test x"$enable_new_addrbook" = xyes; then
1941         echo "Using Address Book : New experimental interface"
1942 else
1943         echo "Using Address Book : Old stable interface"
1944         echo "JPilot             : $enable_jpilot"
1945         echo "LDAP               : $enable_ldap"
1946 fi
1947 echo "gnuTLS             : $enable_gnutls"
1948 echo "iconv              : $am_cv_func_iconv"
1949 echo "compface           : $enable_compface"
1950 echo "IPv6               : $enable_ipv6"
1951 echo "enchant            : $enable_enchant"
1952 echo "IMAP4              : $enable_libetpan"
1953 echo "NNTP               : $enable_libetpan"
1954 echo "Crash dialog       : $enable_crash_dialog"
1955 echo "LibSM              : $enable_libsm"
1956 echo "DBUS               : $enable_dbus"
1957 echo "NetworkManager     : $enable_networkmanager"
1958 echo "Manual             : $enable_manual"
1959 echo "Generic UMPC code  : $enable_generic_umpc"
1960 echo "Config dir         : $ac_cv_with_config_dir"
1961
1962 echo "Plugins"
1963 echo "   Built:"
1964 for plugin in $PLUGINS; do
1965 echo "            - $plugin"
1966 if test x"$plugin" = xnotification; then
1967         echo "                Features:"
1968         for notif_feature in $notification_features; do
1969                 echo "                    $notif_feature"
1970         done;
1971         if test "x$notification_missing_dependencies" != x; then
1972                 echo "                Disabled due to missing dependencies:"
1973                 for notif_miss_dep in $notification_missing_dependencies; do
1974                         echo "                    $notif_miss_dep"
1975                 done;
1976         fi
1977 fi
1978 done;
1979 if test "x$DISABLED_PLUGINS" != x; then
1980 echo "   Disabled:"
1981 for plugin in $DISABLED_PLUGINS; do
1982 echo "            - $plugin"
1983 done;
1984 fi
1985
1986 if test "x$MISSING_DEPS_PLUGINS" != x; then
1987 echo "   Disabled due to missing dependencies:"
1988 for plugin in $MISSING_DEPS_PLUGINS; do
1989 echo "            - $plugin"
1990 done;
1991 fi
1992 echo ""
1993 echo "The binary will be installed in $prefix/bin"
1994 echo ""
1995 echo "Configure finished, type 'make' to build."