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