2013-02-27 [mones] 3.9.0cvs104
[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=104
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 he 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         if test x"$platform_win32" = xno; then
1460                 AC_DEFINE(NOTIFICATION_LCDPROC, 1, Activate lcdproc support)
1461         fi
1462
1463         notification_features="banner command"
1464         notification_missing_dependencies=""
1465         if test x"$HAVE_HOTKEYS" = xyes; then
1466                 notification_features="$notification_features hotkeys"
1467         else
1468                 notification_missing_dependencies="$notification_missing_dependencies hotkeys"
1469         fi
1470         notification_features="$notification_features lcdproc"
1471         if test x"$HAVE_LIBINDICATE" = xyes; then
1472                 notification_features="$notification_features libindicate"
1473         else
1474                 notification_missing_dependencies="$notification_missing_dependencies libindicate"
1475         fi
1476         if test x"$HAVE_LIBNOTIFY" = xyes; then
1477                 notification_features="$notification_features libnotify"
1478         else
1479                 notification_missing_dependencies="$notification_missing_dependencies libnotify"
1480         fi
1481         if test x"$HAVE_LIBCANBERRA_GTK" = xyes; then
1482                 notification_features="$notification_features libcanberra-gtk"
1483         else
1484                 notification_missing_dependencies="$notification_missing_dependencies libcanberra-gtk"
1485         fi
1486         notification_features="$notification_features popup trayicon"
1487 else
1488         DISABLED_PLUGINS="$DISABLED_PLUGINS notification"
1489         AC_MSG_RESULT(no)
1490 fi
1491
1492 AC_MSG_CHECKING([whether to build pdf_viewer plugin])
1493 if test x"$enable_pdf_viewer_plugin" != xno; then
1494         dependencies_missing=""
1495
1496         if test x"$HAVE_POPPLER" = xno; then
1497                 dependencies_missing="libpoppler-glib $dependencies_missing"
1498         fi
1499
1500         if test x"$dependencies_missing" = x; then
1501                 PLUGINS="$PLUGINS pdf_viewer"
1502                 AC_MSG_RESULT(yes)
1503         elif test x"$enable_pdf_viewer_plugin" = xauto; then
1504                 AC_MSG_RESULT(no)
1505                 AC_MSG_WARN("Plugin pdf_viewer will not be built; missing $dependencies_missing")
1506                 enable_pdf_viewer_plugin=no
1507                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS pdf_viewer"
1508         else
1509                 AC_MSG_RESULT(no)
1510                 AC_MSG_ERROR("Plugin pdf_viewer cannot be built; missing $dependencies_missing")
1511         fi
1512 else
1513         DISABLED_PLUGINS="$DISABLED_PLUGINS pdf_viewer"
1514         AC_MSG_RESULT(no)
1515 fi
1516
1517 AC_MSG_CHECKING([whether to build perl plugin])
1518 if test x"$enable_perl_plugin" != xno; then
1519         dependencies_missing=""
1520
1521         if test x"$HAVE_PERL" = xno; then
1522                 dependencies_missing="perl $dependencies_missing"
1523         fi
1524
1525         if test x"$dependencies_missing" = x; then
1526                 PLUGINS="$PLUGINS perl"
1527                 AC_MSG_RESULT(yes)
1528         elif test x"$enable_perl_plugin" = xauto; then
1529                 AC_MSG_RESULT(no)
1530                 AC_MSG_WARN("Plugin perl will not be built; missing $dependencies_missing")
1531                 enable_perl_plugin=no
1532                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS perl"
1533         else
1534                 AC_MSG_RESULT(no)
1535                 AC_MSG_ERROR("Plugin perl cannot be built; missing $dependencies_missing")
1536         fi
1537 else
1538         DISABLED_PLUGINS="$DISABLED_PLUGINS perl"
1539         AC_MSG_RESULT(no)
1540 fi
1541
1542 AC_MSG_CHECKING([whether to build python plugin])
1543 if test x"$enable_python_plugin" != xno; then
1544         dependencies_missing=""
1545
1546         if test x"$HAVE_PYTHON" = xno; then
1547                 dependencies_missing="python $dependencies_missing"
1548         fi
1549
1550         if test x"$dependencies_missing" = x; then
1551                 PLUGINS="$PLUGINS python"
1552                 AC_MSG_RESULT(yes)
1553         elif test x"$enable_python_plugin" = xauto; then
1554                 AC_MSG_RESULT(no)
1555                 AC_MSG_WARN("Plugin python will not be built; missing $dependencies_missing")
1556                 enable_python_plugin=no
1557                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS python"
1558         else
1559                 AC_MSG_RESULT(no)
1560                 AC_MSG_ERROR("Plugin python cannot be built; missing $dependencies_missing")
1561         fi
1562 else
1563         DISABLED_PLUGINS="$DISABLED_PLUGINS python"
1564         AC_MSG_RESULT(no)
1565 fi
1566
1567 AC_MSG_CHECKING([whether to build pgpcore plugin])
1568 if test x"$enable_pgpcore_plugin" != xno; then
1569         dependencies_missing=""
1570
1571         if test x"$HAVE_GPGME" = xno; then
1572                 dependencies_missing="libgpgme $dependencies_missing"
1573         fi
1574
1575         if test x"$dependencies_missing" = x; then
1576                 PLUGINS="$PLUGINS pgpcore"
1577                 AC_MSG_RESULT(yes)
1578         elif test x"$enable_pgpcore_plugin" = xauto; then
1579                 AC_MSG_RESULT(no)
1580                 AC_MSG_WARN("Plugin pgpcore will not be built; missing $dependencies_missing")
1581                 enable_pgpcore_plugin=no
1582                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS pgpcore"
1583         else
1584                 AC_MSG_RESULT(no)
1585                 AC_MSG_ERROR("Plugin pgpcore cannot be built; missing $dependencies_missing")
1586         fi
1587 else
1588         DISABLED_PLUGINS="$DISABLED_PLUGINS pgpcore"
1589         AC_MSG_RESULT(no)
1590 fi
1591
1592 AC_MSG_CHECKING([whether to build pgpmime plugin])
1593 if test x"$enable_pgpmime_plugin" != xno; then
1594         dependencies_missing=""
1595
1596         if test x"$HAVE_GPGME" = xno; then
1597                 dependencies_missing="libgpgme $dependencies_missing"
1598         fi
1599         if test x"$enable_pgpcore_plugin" = xno; then
1600                 dependencies_missing="pgpcore plugin $dependencies_missing"
1601         fi
1602
1603         if test x"$dependencies_missing" = x; then
1604                 PLUGINS="$PLUGINS pgpmime"
1605                 AC_MSG_RESULT(yes)
1606         elif test x"$enable_pgpmime_plugin" = xauto; then
1607                 AC_MSG_RESULT(no)
1608                 AC_MSG_WARN("Plugin pgpmime will not be built; missing $dependencies_missing")
1609                 enable_pgpmime_plugin=no
1610                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS pgpmime"
1611         else
1612                 AC_MSG_RESULT(no)
1613                 AC_MSG_ERROR("Plugin pgpmime cannot be built; missing $dependencies_missing")
1614         fi
1615 else
1616         DISABLED_PLUGINS="$DISABLED_PLUGINS pgpmime"
1617         AC_MSG_RESULT(no)
1618 fi
1619
1620 AC_MSG_CHECKING([whether to build pgpinline plugin])
1621 if test x"$enable_pgpinline_plugin" != xno; then
1622         dependencies_missing=""
1623
1624         if test x"$HAVE_GPGME" = xno; then
1625                 dependencies_missing="libgpgme $dependencies_missing"
1626         fi
1627         if test x"$enable_pgpcore_plugin" = xno; then
1628                 dependencies_missing="pgpcore plugin $dependencies_missing"
1629         fi
1630
1631         if test x"$dependencies_missing" = x; then
1632                 PLUGINS="$PLUGINS pgpinline"
1633                 AC_MSG_RESULT(yes)
1634         elif test x"$enable_pgpinline_plugin" = xauto; then
1635                 AC_MSG_RESULT(no)
1636                 AC_MSG_WARN("Plugin pgpinline will not be built; missing $dependencies_missing")
1637                 enable_pgpinline_plugin=no
1638                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS pgpinline"
1639         else
1640                 AC_MSG_RESULT(no)
1641                 AC_MSG_ERROR("Plugin pgpinline cannot be built; missing $dependencies_missing")
1642         fi
1643 else
1644         DISABLED_PLUGINS="$DISABLED_PLUGINS pgpinline"
1645         AC_MSG_RESULT(no)
1646 fi
1647
1648 AC_MSG_CHECKING([whether to build rssyl plugin])
1649 if test x"$enable_rssyl_plugin" != xno; then
1650         dependencies_missing=""
1651
1652         if test x"$HAVE_LIBXML" = xno; then
1653                 dependencies_missing="libxml2 $dependencies_missing"
1654         fi
1655         if test x"$HAVE_CURL" = xno; then
1656                 dependencies_missing="libcurl $dependencies_missing"
1657         fi
1658
1659         if test x"$dependencies_missing" = x; then
1660                 PLUGINS="$PLUGINS rssyl"
1661                 AC_MSG_RESULT(yes)
1662         elif test x"$enable_rssyl_plugin" = xauto; then
1663                 AC_MSG_RESULT(no)
1664                 AC_MSG_WARN("Plugin rssyl will not be built; missing $dependencies_missing")
1665                 enable_rssyl_plugin=no
1666                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS rssyl"
1667         else
1668                 AC_MSG_RESULT(no)
1669                 AC_MSG_ERROR("Plugin rssyl cannot be built; missing $dependencies_missing")
1670         fi
1671 else
1672         DISABLED_PLUGINS="$DISABLED_PLUGINS rssyl"
1673         AC_MSG_RESULT(no)
1674 fi
1675
1676 AC_MSG_CHECKING([whether to build spamassassin plugin])
1677 if test x"$enable_spamassassin_plugin" != xno; then
1678         PLUGINS="$PLUGINS spamassassin"
1679         AC_MSG_RESULT(yes)
1680         AC_SPAMASSASSIN
1681 else
1682         DISABLED_PLUGINS="$DISABLED_PLUGINS spamassassin"
1683         AC_MSG_RESULT(no)
1684 fi
1685
1686 AC_MSG_CHECKING([whether to build smime plugin])
1687 if test x"$enable_smime_plugin" != xno; then
1688         dependencies_missing=""
1689
1690         if test x"$HAVE_GPGME" = xno; then
1691                 dependencies_missing="libgpgme $dependencies_missing"
1692         fi
1693         if test x"$enable_pgpcore_plugin" = xno; then
1694                 dependencies_missing="pgpcore plugin $dependencies_missing"
1695         fi
1696
1697         if test x"$dependencies_missing" = x; then
1698                 PLUGINS="$PLUGINS smime"
1699                 AC_MSG_RESULT(yes)
1700         elif test x"$enable_smime_plugin" = xauto; then
1701                 AC_MSG_RESULT(no)
1702                 AC_MSG_WARN("Plugin smime will not be built; missing $dependencies_missing")
1703                 enable_smime_plugin=no
1704                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS smime"
1705         else
1706                 AC_MSG_RESULT(no)
1707                 AC_MSG_ERROR("Plugin smime cannot be built; missing $dependencies_missing")
1708         fi
1709 else
1710         DISABLED_PLUGINS="$DISABLED_PLUGINS smime"
1711         AC_MSG_RESULT(no)
1712 fi
1713
1714 AC_MSG_CHECKING([whether to build spam_report plugin])
1715 if test x"$enable_spam_report_plugin" != xno; then
1716         dependencies_missing=""
1717
1718         if test x"$HAVE_CURL" = xno; then
1719                 dependencies_missing="libcurl $dependencies_missing"
1720         fi
1721
1722         if test x"$dependencies_missing" = x; then
1723                 PLUGINS="$PLUGINS spam_report"
1724                 AC_MSG_RESULT(yes)
1725         elif test x"$enable_spam_report_plugin" = xauto; then
1726                 AC_MSG_RESULT(no)
1727                 AC_MSG_WARN("Plugin spam_report will not be built; missing $dependencies_missing")
1728                 enable_spam_report_plugin=no
1729                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS spam_report"
1730         else
1731                 AC_MSG_RESULT(no)
1732                 AC_MSG_ERROR("Plugin spam_report cannot be built; missing $dependencies_missing")
1733         fi
1734 else
1735         DISABLED_PLUGINS="$DISABLED_PLUGINS spam_report"
1736         AC_MSG_RESULT(no)
1737 fi
1738
1739 AC_MSG_CHECKING([whether to build tnef_parse plugin])
1740 if test x"$enable_tnef_parse_plugin" != xno; then
1741         PLUGINS="$PLUGINS tnef_parse"
1742         AC_MSG_RESULT(yes)
1743 else
1744         DISABLED_PLUGINS="$DISABLED_PLUGINS tnef_parse"
1745         AC_MSG_RESULT(no)
1746 fi
1747
1748 AC_MSG_CHECKING([whether to build vcalendar plugin])
1749 if test x"$enable_vcalendar_plugin" != xno; then
1750         dependencies_missing=""
1751
1752         if test x"$HAVE_CURL" = xno; then
1753                 dependencies_missing="libcurl $dependencies_missing"
1754         fi
1755
1756         if test x"$HAVE_PERL" = xno; then
1757                 dependencies_missing="perl $dependencies_missing"
1758         fi
1759
1760         if test x"$dependencies_missing" = x; then
1761                 PLUGINS="$PLUGINS vcalendar"
1762                 AC_MSG_RESULT(yes)
1763         elif test x"$enable_vcalendar_plugin" = xauto; then
1764                 AC_MSG_RESULT(no)
1765                 AC_MSG_WARN("Plugin vcalendar will not be built; missing $dependencies_missing")
1766                 enable_vcalendar_plugin=no
1767                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS vcalendar"
1768         else
1769                 AC_MSG_RESULT(no)
1770                 AC_MSG_ERROR("Plugin vcalendar cannot be built; missing $dependencies_missing")
1771         fi
1772 else
1773         DISABLED_PLUGINS="$DISABLED_PLUGINS vcalendar"
1774         AC_MSG_RESULT(no)
1775 fi
1776
1777 dnl And finally the automake conditionals.
1778
1779 AM_CONDITIONAL(BUILD_ACPI_NOTIFIER_PLUGIN,      test x"$enable_acpi_notifier_plugin" != xno)
1780 AM_CONDITIONAL(BUILD_ADDRESS_KEEPER_PLUGIN,     test x"$enable_address_keeper_plugin" != xno)
1781 AM_CONDITIONAL(BUILD_ARCHIVE_PLUGIN,            test x"$enable_archive_plugin" != xno)
1782 AM_CONDITIONAL(BUILD_ATT_REMOVER_PLUGIN,        test x"$enable_att_remover_plugin" != xno)
1783 AM_CONDITIONAL(BUILD_ATTACHWARNER_PLUGIN,       test x"$enable_attachwarner_plugin" != xno)
1784 AM_CONDITIONAL(BUILD_BOGOFILTER_PLUGIN,         test x"$enable_bogofilter_plugin" != xno)
1785 AM_CONDITIONAL(BUILD_BSFILTER_PLUGIN,           test x"$enable_bsfilter_plugin" != xno)
1786 AM_CONDITIONAL(BUILD_CLAMD_PLUGIN,              test x"$enable_clamd_plugin" != xno)
1787 AM_CONDITIONAL(BUILD_DEMO_PLUGIN,               test x"$enable_demo_plugin" != xno)
1788 AM_CONDITIONAL(BUILD_FANCY_PLUGIN,              test x"$enable_fancy_plugin" != xno)
1789 AM_CONDITIONAL(BUILD_FETCHINFO_PLUGIN,          test x"$enable_fetchinfo_plugin" != xno)
1790 AM_CONDITIONAL(BUILD_GDATA_PLUGIN,              test x"$enable_gdata_plugin" != xno)
1791 AM_CONDITIONAL(BUILD_MAILMBOX_PLUGIN,           test x"$enable_mailmbox_plugin" != xno)
1792 AM_CONDITIONAL(BUILD_NEWMAIL_PLUGIN,            test x"$enable_newmail_plugin" != xno)
1793 AM_CONDITIONAL(BUILD_NOTIFICATION_PLUGIN,       test x"$enable_notification_plugin" != xno)
1794 AM_CONDITIONAL(BUILD_HOTKEYS,                   test x"$enable_notification_plugin" != xno -a x"$HAVE_HOTKEYS" = xyes)
1795 AM_CONDITIONAL(BUILD_PDF_VIEWER_PLUGIN,         test x"$enable_pdf_viewer_plugin" != xno)
1796 AM_CONDITIONAL(BUILD_PERL_PLUGIN,               test x"$enable_perl_plugin" != xno)
1797 AM_CONDITIONAL(BUILD_PYTHON_PLUGIN,             test x"$enable_python_plugin" != xno)
1798 AM_CONDITIONAL(BUILD_PGPCORE_PLUGIN,            test x"$enable_pgpcore_plugin" != xno)
1799 AM_CONDITIONAL(BUILD_PGPMIME_PLUGIN,            test x"$enable_pgpmime_plugin" != xno)
1800 AM_CONDITIONAL(BUILD_PGPINLINE_PLUGIN,          test x"$enable_pgpinline_plugin" != xno)
1801 AM_CONDITIONAL(BUILD_RSSYL_PLUGIN,              test x"$enable_rssyl_plugin" != xno)
1802 AM_CONDITIONAL(BUILD_SMIME_PLUGIN,              test x"$enable_smime_plugin" != xno)
1803 AM_CONDITIONAL(BUILD_SPAMASSASSIN_PLUGIN,       test x"$enable_spamassassin_plugin" != xno)
1804 AM_CONDITIONAL(BUILD_SPAM_REPORT_PLUGIN,        test x"$enable_spam_report_plugin" != xno)
1805 AM_CONDITIONAL(BUILD_TNEF_PARSE_PLUGIN,         test x"$enable_tnef_parse_plugin" != xno)
1806 AM_CONDITIONAL(BUILD_VCALENDAR_PLUGIN,          test x"$enable_vcalendar_plugin" != xno)
1807
1808
1809 dnl ****************************
1810 dnl ** Final configure output **
1811 dnl ****************************
1812
1813 AC_OUTPUT([
1814 Makefile
1815 m4/Makefile
1816 po/Makefile.in
1817 src/common/version.h
1818 src/Makefile
1819 src/common/Makefile
1820 src/common/passcrypt.h
1821 src/gtk/Makefile
1822 src/etpan/Makefile
1823 src/plugins/Makefile
1824 src/plugins/acpi_notifier/Makefile
1825 src/plugins/address_keeper/Makefile
1826 src/plugins/archive/Makefile
1827 src/plugins/att_remover/Makefile
1828 src/plugins/attachwarner/Makefile
1829 src/plugins/bogofilter/Makefile
1830 src/plugins/bsfilter/Makefile
1831 src/plugins/clamd/Makefile
1832 src/plugins/clamd/libclamd/Makefile
1833 src/plugins/demo/Makefile
1834 src/plugins/fancy/Makefile
1835 src/plugins/fetchinfo/Makefile
1836 src/plugins/gdata/Makefile
1837 src/plugins/mailmbox/Makefile
1838 src/plugins/newmail/Makefile
1839 src/plugins/notification/Makefile
1840 src/plugins/notification/gtkhotkey/Makefile
1841 src/plugins/pdf_viewer/Makefile
1842 src/plugins/perl/Makefile
1843 src/plugins/python/Makefile
1844 src/plugins/pgpcore/Makefile
1845 src/plugins/pgpmime/Makefile
1846 src/plugins/pgpinline/Makefile
1847 src/plugins/rssyl/Makefile
1848 src/plugins/smime/Makefile
1849 src/plugins/spamassassin/Makefile
1850 src/plugins/spam_report/Makefile
1851 src/plugins/tnef_parse/Makefile
1852 src/plugins/vcalendar/Makefile
1853 src/plugins/vcalendar/libical/Makefile
1854 src/plugins/vcalendar/libical/libical/icalversion.h
1855 src/plugins/vcalendar/libical/libical/Makefile
1856 src/plugins/vcalendar/libical/design-data/Makefile
1857 src/plugins/vcalendar/libical/scripts/Makefile
1858 doc/Makefile
1859 doc/man/Makefile
1860 tools/Makefile
1861 config/Makefile
1862 manual/Makefile
1863 manual/dtd/Makefile
1864 manual/dist/Makefile
1865 manual/dist/pdf/Makefile
1866 manual/dist/ps/Makefile
1867 manual/dist/html/Makefile
1868 manual/dist/txt/Makefile
1869 manual/fr/Makefile
1870 manual/fr/dist/Makefile
1871 manual/fr/dist/pdf/Makefile
1872 manual/fr/dist/ps/Makefile
1873 manual/fr/dist/html/Makefile
1874 manual/fr/dist/txt/Makefile
1875 manual/pl/Makefile
1876 manual/pl/dist/Makefile
1877 manual/pl/dist/pdf/Makefile
1878 manual/pl/dist/ps/Makefile
1879 manual/pl/dist/html/Makefile
1880 manual/pl/dist/txt/Makefile
1881 manual/es/Makefile
1882 manual/es/dist/Makefile
1883 manual/es/dist/pdf/Makefile
1884 manual/es/dist/ps/Makefile
1885 manual/es/dist/html/Makefile
1886 manual/es/dist/txt/Makefile
1887 manual/de/Makefile
1888 manual/de/dist/Makefile
1889 manual/de/dist/pdf/Makefile
1890 manual/de/dist/ps/Makefile
1891 manual/de/dist/html/Makefile
1892 manual/de/dist/txt/Makefile
1893 claws-mail.pc
1894 ])
1895
1896 dnl Output the configuration summary
1897 echo ""
1898 echo "$PACKAGE $VERSION"
1899 echo ""
1900 if test x"$enable_new_addrbook" = xyes; then
1901         echo "Using Address Book : New experimental interface"
1902 else
1903         echo "Using Address Book : Old stable interface"
1904         echo "JPilot             : $enable_jpilot"
1905         echo "LDAP               : $enable_ldap"
1906 fi
1907 echo "gnuTLS             : $enable_gnutls"
1908 echo "iconv              : $am_cv_func_iconv"
1909 echo "compface           : $enable_compface"
1910 echo "IPv6               : $enable_ipv6"
1911 echo "enchant            : $enable_enchant"
1912 echo "IMAP4              : $enable_libetpan"
1913 echo "NNTP               : $enable_libetpan"
1914 echo "Crash dialog       : $enable_crash_dialog"
1915 echo "LibSM              : $enable_libsm"
1916 echo "DBUS               : $enable_dbus"
1917 echo "NetworkManager     : $enable_networkmanager"
1918 echo "Manual             : $enable_manual"
1919 echo "Generic UMPC code  : $enable_generic_umpc"
1920 echo "Maemo build        : $enable_maemo"
1921 echo "Config dir         : $with_config_dir"
1922
1923 echo "Plugins"
1924 echo "   Built:"
1925 for plugin in $PLUGINS; do
1926 echo "            - $plugin"
1927 if test x"$plugin" = xnotification; then
1928         echo "                Features:"
1929         for notif_feature in $notification_features; do
1930                 echo "                    $notif_feature"
1931         done;
1932         if test "x$notification_missing_dependencies" != x; then
1933                 echo "                Disabled due to missing dependencies:"
1934                 for notif_miss_dep in $notification_missing_dependencies; do
1935                         echo "                    $notif_miss_dep"
1936                 done;
1937         fi
1938 fi
1939 done;
1940 if test "x$DISABLED_PLUGINS" != x; then
1941 echo "   Disabled:"
1942 for plugin in $DISABLED_PLUGINS; do
1943 echo "            - $plugin"
1944 done;
1945 fi
1946
1947 if test "x$MISSING_DEPS_PLUGINS" != x; then
1948 echo "   Disabled due to missing dependencies:"
1949 for plugin in $MISSING_DEPS_PLUGINS; do
1950 echo "            - $plugin"
1951 done;
1952 fi
1953 echo ""
1954 echo "The binary will be installed in $prefix/bin"
1955 echo ""
1956 echo "Configure finished, type 'make' to build."