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