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