Remove references to nonexistent variables
[claws.git] / configure.ac
1
2 AC_PREREQ(2.59)
3 AC_INIT(src/main.c)
4 AC_CONFIG_AUX_DIR(config)
5 AC_CONFIG_MACRO_DIR([m4])
6
7 PACKAGE=claws-mail
8
9 dnl version number
10 INTERFACE_AGE=0
11 BINARY_AGE=0
12 EXTRA_RELEASE=
13 EXTRA_GTK2_VERSION=
14
15 GIT_VERSION=`git describe --abbrev=6 --dirty --always`
16 MAJOR_VERSION=`echo $GIT_VERSION | cut -f1 -d- | cut -f1 -d.`
17 MINOR_VERSION=`echo $GIT_VERSION | cut -f1 -d- | cut -f2 -d.`
18 MICRO_VERSION=`echo $GIT_VERSION | cut -f1 -d- | cut -f3 -d.`
19 EXTRA_VERSION=`echo $GIT_VERSION | cut -f2 -d-`
20
21 if test \( "x$EXTRA_VERSION" != "x" \); then
22     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}git${EXTRA_VERSION}
23 else
24     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}
25     EXTRA_VERSION=0
26 fi
27
28 if test \( "x$EXTRA_RELEASE" != "x" \); then
29     VERSION=${VERSION}${EXTRA_RELEASE}${EXTRA_GTK2_VERSION}
30 fi
31
32 dnl set $target
33 AC_CANONICAL_SYSTEM
34
35 dnl
36 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
37 dnl AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
38 dnl AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
39 AC_SUBST(PACKAGE)
40 AC_SUBST(VERSION)
41 AC_SUBST(MAJOR_VERSION)
42 AC_SUBST(MINOR_VERSION)
43 AC_SUBST(MICRO_VERSION)
44 AC_SUBST(EXTRA_VERSION)
45 AC_SUBST(GIT_VERSION)
46
47 AC_CHECK_PROG(HAVE_GTK_ICON_CACHE, gtk-update-icon-cache, yes, no)
48 AM_CONDITIONAL(UPDATE_GTK_ICON_CACHE, test x"$HAVE_GTK_ICON_CACHE" = xyes)
49
50 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
51 if test x$PKG_CONFIG = xno ; then
52   AC_MSG_ERROR([*** pkg-config not found. See http://www.freedesktop.org/software/pkgconfig/])
53 fi
54
55 dnl GNOME 2.x installed?
56 PKG_CHECK_MODULES(GNOME2, libgnome-2.0 >= 2.0, ac_enable_gnome2=yes, ac_enable_gnome2=no)
57 AM_CONDITIONAL(CLAWS_GNOME2, test x"$ac_enable_gnome2" = x"yes")
58
59 dnl libtool versioning
60 LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
61 LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
62 LT_REVISION=$INTERFACE_AGE
63 LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
64 AC_SUBST(LT_RELEASE)
65 AC_SUBST(LT_CURRENT)
66 AC_SUBST(LT_REVISION)
67 AC_SUBST(LT_AGE)
68
69 dnl Specify a header configuration file
70 AC_CONFIG_HEADERS(config.h)
71 AC_CONFIG_HEADERS(claws-features.h)
72
73 AM_MAINTAINER_MODE
74
75 dnl Checks for programs.
76 dnl AC_ARG_PROGRAM
77 AC_PROG_CC
78 AC_ISC_POSIX
79 AC_PROG_INSTALL
80 AC_PROG_LN_S
81 AC_PROG_MAKE_SET
82 AC_PROG_CPP
83 dnl AC_PROG_RANLIB
84 AM_PROG_LEX
85 AC_PROG_YACC
86 AC_LIB_PREFIX
87 AC_LIBTOOL_WIN32_DLL
88 LT_INIT
89 LT_AC_PROG_RC
90 AC_LIBTOOL_RC
91 AC_PROG_LIBTOOL
92
93 AC_SYS_LARGEFILE
94
95 dnl ******************************
96 dnl Checks for host
97 dnl Not needed anymore because we 
98 dnl do AC_CANONICAL_SYSTEM above
99 dnl ******************************
100 dnl AC_CANONICAL_HOST
101
102 dnl Copied from the official gtk+-2 configure.in
103 AC_MSG_CHECKING([for some Win32 platform])
104 case "$host" in
105   *-*-mingw*|*-*-cygwin*)
106     platform_win32=yes
107     LDFLAGS="$LDFLAGS -mwindows"
108     ;;
109   *)
110     platform_win32=no
111     ;;
112 esac
113 AC_MSG_RESULT([$platform_win32])
114 AM_CONDITIONAL(PLATFORM_WIN32, test x"$platform_win32" = x"yes")
115
116 AC_MSG_CHECKING([for native Win32])
117 case "$host" in
118   *-*-mingw*)
119     os_win32=yes
120     ;;
121   *)
122     os_win32=no
123     ;;
124 esac
125 AC_MSG_RESULT([$os_win32])
126 AM_CONDITIONAL(OS_WIN32, test x"$os_win32" = x"yes")
127
128 AC_MSG_CHECKING([for Cygwin])
129 case "$host" in
130   *-*-cygwin*)
131     env_cygwin=yes
132     ;;
133   *)
134     env_cygwin=no
135     ;;
136 esac
137 AC_MSG_RESULT([$env_cygwin])
138 AM_CONDITIONAL(CYGWIN, test x"$env_cygwin" = x"yes")
139
140 if test "$GCC" = "yes"
141 then
142         CFLAGS="$CFLAGS -Wno-unused-function"
143         #CFLAGS="-g -Wall -Wno-unused-function"
144 fi
145
146 AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
147 _gcc_cflags_save=$CFLAGS
148 CFLAGS="-Wno-pointer-sign"
149 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],_gcc_psign=yes,_gcc_psign=no)
150 AC_MSG_RESULT($_gcc_psign)
151 CFLAGS=$_gcc_cflags_save;
152 if test x"$_gcc_psign" = xyes ; then
153         CFLAGS="$CFLAGS -Wno-pointer-sign"
154 fi
155
156 CFLAGS="$CFLAGS -Wall"
157
158 if test $USE_MAINTAINER_MODE = yes; then
159         CFLAGS="-g -Wall -Wno-pointer-sign -DUSE_MAINTAINER_MODE"
160 fi
161
162 pthread_name=
163 case "$target" in
164 *-darwin*)
165         CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
166         ;;
167 *-*-mingw*)
168         # Note that we need to link to pthreadGC2 in all cases. This
169         # is because some locking is used even when pthread support is
170         # disabled.
171         pthread_name=pthreadGC2
172         CFLAGS="$CFLAGS -mms-bitfields"
173         LIBS="$LIBS -l${pthread_name} -lws2_32 -lregex"
174         ;;
175 *-*-solaris*)
176         CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
177         CFLAGS="$CFLAGS -std=gnu99 -DSOLARIS"
178         ;;
179 esac
180   
181 dnl Checks for iconv
182 AM_ICONV
183
184 dnl floor and ceil are  in -lm
185 LIBS="$LIBS -lm"
186
187 dnl
188 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
189 dnl
190 syl_save_LIBS=$LIBS
191 LIBS="$LIBS $GTK_LIBS"
192 AC_CHECK_FUNCS(bind_textdomain_codeset)
193 LIBS=$syl_save_LIBS
194
195 dnl for gettext
196 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"
197 GETTEXT_PACKAGE=claws-mail
198 AC_SUBST(GETTEXT_PACKAGE)
199 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define text domain.])
200
201 AM_GNU_GETTEXT_VERSION([0.15])
202 AM_GNU_GETTEXT([external])
203
204 AC_ARG_ENABLE(manual,
205                 [  --disable-manual                Do not build user manual],
206                 [enable_manual=$enableval], [enable_manual=yes])
207
208 AC_ARG_ENABLE(libsm,
209                 [  --disable-libsm                 Do not build libSM support for session management],
210                 [enable_libsm=$enableval], [enable_libsm=yes])
211
212 AC_ARG_ENABLE(ipv6,
213                 [  --disable-ipv6                  Do not build IPv6 support],
214                 [enable_ipv6=$enableval], [enable_ipv6=yes])
215
216 AC_ARG_ENABLE(gnutls,
217                 [  --disable-gnutls                Do not build GnuTLS support for SSL/TLS],
218                     [enable_gnutls=$enableval], [enable_gnutls=yes])
219
220 AC_ARG_ENABLE(enchant,
221                 [  --disable-enchant               Do not build Enchant support for spell-checking],
222                 [enable_enchant=$enableval], [enable_enchant=yes])
223
224 AC_ARG_ENABLE(crash-dialog,
225                 [  --enable-crash-dialog           Build crash dialog],
226                 [enable_crash_dialog=$enableval], [enable_crash_dialog=no])
227
228 AC_ARG_ENABLE(generic-umpc,
229                 [  --enable-generic-umpc           Build generic UMPC code],
230                 [enable_generic_umpc=$enableval], [enable_generic_umpc=no])
231
232 AC_ARG_ENABLE(maemo,
233                 [  --enable-maemo                  Build for the Maemo platform],
234                 [enable_maemo=$enableval], [enable_maemo=no])
235
236 AC_ARG_ENABLE(compface,
237                 [  --disable-compface              Do not build compface support for X-Face],
238                 [enable_compface=$enableval], [enable_compface=yes])
239
240 AC_ARG_ENABLE(pthread,
241                 [  --disable-pthread               Do not build pthread support],
242                 [enable_pthread=$enableval], [enable_pthread=yes])
243
244 AC_ARG_ENABLE(startup-notification,
245                 [  --disable-startup-notification  Do not startup notification support],
246                 [enable_startup_notification=$enableval], [enable_startup_notification=yes])
247
248 AC_ARG_ENABLE(dbus,
249                 [  --disable-dbus                  Do not build DBUS support],
250                 [enable_dbus=$enableval], [enable_dbus=yes])
251
252 AC_ARG_ENABLE(ldap,
253                 [  --disable-ldap                  Do not build LDAP support],
254                 [enable_ldap=$enableval], [enable_ldap=yes])
255
256 AC_ARG_ENABLE(jpilot,
257                 [  --disable-jpilot                Do not build JPilot support],
258                 [enable_jpilot=$enableval], [enable_jpilot=yes])
259
260 AC_ARG_ENABLE(networkmanager,
261                 [  --disable-networkmanager        Do not build NetworkManager support],
262                 [enable_networkmanager=$enableval], [enable_networkmanager=yes])
263
264 AC_ARG_ENABLE(libetpan,
265                 [  --disable-libetpan              Do not build libetpan support for IMAP4/NNTP],
266                 [enable_libetpan=$enableval], [enable_libetpan=yes])
267
268 AC_ARG_ENABLE(valgrind,
269                 [  --disable-valgrind              Do not build valgrind support for debugging],
270                 [enable_valgrind=$enableval], [enable_valgrind=yes])
271
272 AC_ARG_ENABLE(new-addrbook,
273                 [  --enable-new-addrbook           Build new external address book support],
274                 [enable_new_addrbook=$enableval], [enable_new_addrbook=no])
275
276 AC_ARG_ENABLE(gtk3,
277                 [  --enable-gtk3                   Build GTK3 support],
278                 [enable_gtk3=$enableval], [enable_gtk3=no])
279
280 AC_ARG_ENABLE(deprecated,
281                 [  --disable-deprecated            Disable deprecated GTK functions],
282                 [GTK_CFLAGS="$GTK_CFLAGS -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"], [])
283
284 manualdir='${docdir}/manual'
285 AC_ARG_WITH(manualdir,
286         [  --with-manualdir=DIR    Manual directory],
287         [manualdir="$withval"])
288 AC_SUBST(manualdir)
289
290 dnl ******************************
291 dnl ** Check for required tools **
292 dnl ** to build manuals         **
293 dnl ******************************
294
295 AC_PATH_PROG(DOCBOOK2HTML, docbook2html)
296 AC_PATH_PROG(DOCBOOK2TXT, docbook2txt)
297 AC_PATH_PROG(DOCBOOK2PS, docbook2ps)
298 AC_PATH_PROG(DOCBOOK2PDF, docbook2pdf)
299
300 AM_CONDITIONAL(MANUAL_HTML, test -n "$DOCBOOK2HTML")
301 AM_CONDITIONAL(MANUAL_TXT, test -n "$DOCBOOK2TXT")
302 AM_CONDITIONAL(MANUAL_PDF, test -n "$DOCBOOK2PDF")
303 AM_CONDITIONAL(MANUAL_PS, test -n "$DOCBOOK2PS")
304
305 if test x"$enable_manual" = x"yes"; then
306     if test -n "$DOCBOOK2TXT" -o -n "$DOCBOOK2HTML" \
307         -o -n "$DOCBOOK2PS" -o -n "$DOCBOOK2PDF"; then
308             enable_manual=yes
309         else
310             enable_manual=no
311     fi
312 fi
313
314 AM_CONDITIONAL(BUILD_MANUAL, test x"$enable_manual" = xyes)
315
316 dnl Set PACKAGE_DATA_DIR in config.h.
317 if test "x${datarootdir}" = 'x${prefix}/share'; then
318         if test "x${prefix}" = "xNONE"; then
319                 AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}",[PACKAGE_DATA_DIR])
320         else
321                 AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/share/${PACKAGE}",[PACKAGE_DATA_DIR])
322         fi
323 else
324         AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${datarootdir}/${PACKAGE}",[PACKAGE_DATA_DIR])
325 fi
326
327 AC_CHECK_LIB(xpg4, setlocale)
328
329 SM_LIBS=""
330 dnl Check for LibSM
331 AC_MSG_CHECKING([whether to use LibSM])
332 if test x"$enable_libsm" = xyes; then
333         AC_MSG_RESULT(yes)
334         AC_CHECK_LIB(SM, SmcSaveYourselfDone,
335                 [SM_LIBS="$X_LIBS -lSM -lICE"],enable_libsm=no,
336                 $X_LIBS -lICE)
337         AC_CHECK_HEADERS(X11/SM/SMlib.h,,enable_libsm=no)
338         if test x"$enable_libsm" = xyes; then
339                 AC_DEFINE(HAVE_LIBSM, 1, [Define to 1 if you have libSM installed])
340         else
341                 AC_MSG_RESULT(not found)
342                 AC_MSG_WARN([*** LibSM will not be supported ***])
343         fi
344 else
345         AC_MSG_RESULT(no)
346 fi
347 AC_SUBST(SM_LIBS)
348
349 dnl Check for d_type member in struct dirent
350 AC_MSG_CHECKING([whether struct dirent has d_type member])
351 AC_CACHE_VAL(ac_cv_dirent_d_type,[
352         AC_TRY_COMPILE([#include <dirent.h>],
353                        [struct dirent d; d.d_type = DT_REG;],
354                        ac_cv_dirent_d_type=yes, ac_cv_dirent_d_type=no)
355 ])
356 AC_MSG_RESULT($ac_cv_dirent_d_type)
357 if test $ac_cv_dirent_d_type = yes; then
358         AC_DEFINE(HAVE_DIRENT_D_TYPE, 1,
359                   Define if `struct dirent' has `d_type' member.)
360 fi
361
362 # Check whether mkdir does not take the permission argument.
363 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
364
365 dnl Checks for header files.
366 AC_HEADER_DIRENT
367 AC_HEADER_STDC
368 AC_HEADER_SYS_WAIT
369 AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h \
370                  sys/param.h sys/utsname.h sys/select.h \
371                  wchar.h wctype.h locale.h netdb.h)
372 AC_CHECK_HEADER([execinfo.h], [AC_DEFINE(HAVE_BACKTRACE,1,[Has backtrace*() needed for retrieving stack traces])])
373 AC_SEARCH_LIBS(backtrace_symbols, [execinfo])
374
375 dnl alf - Check for apache installation f*ck up. apache may also install an 
376 dnl fnmatch, which includes their own regex stuff if USE_HSREGEX is defined
377 AC_TRY_COMPILE([#include <stdlib.h>
378                 #include <fnmatch.h>],
379         [int x = USE_HSREGEX;],
380         ac_cv_have_apache_fnmatch=yes, ac_cv_have_apache_fnmatch=no)
381 if test $ac_cv_have_apache_fnmatch = yes; then
382         AC_DEFINE(HAVE_APACHE_FNMATCH, 1, Define if you need to work around apache regex/fnmatch !KLUDGE!)
383 fi
384 AC_MSG_CHECKING([whether to use Apache regex header kludge])
385 AC_MSG_RESULT($ac_cv_have_apache_fnmatch)
386
387 dnl Checks for typedefs, structures, and compiler characteristics.
388 AC_C_CONST
389 AC_TYPE_OFF_T
390 AC_TYPE_PID_T
391 AC_TYPE_SIZE_T
392 AC_STRUCT_TM
393
394 dnl AC_CHECK_TYPE(wint_t, unsigned int) does not work because wint_t
395 dnl may be defined only in wchar.h (this happens with gcc-2.96).
396 dnl So we need to use this extended macro.
397 CLAWS_CHECK_TYPE(wint_t, unsigned int,
398 [
399 #if HAVE_WCHAR_H
400 #include <wchar.h>
401 #endif
402 ], Define to `unsigned int' if <stddef.h> or <wchar.h> doesn't define.)
403
404 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF, Used to test for a u32 typedef)
405 AC_CHECK_SIZEOF(unsigned short, 2)
406 AC_CHECK_SIZEOF(unsigned int, 4)
407 AC_CHECK_SIZEOF(unsigned long, 4)
408
409 dnl Checks for library functions.
410 AC_FUNC_ALLOCA
411 AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr strchr \
412                uname flock lockf inet_aton inet_addr \
413                fchmod mkstemp truncate getuid regcomp)
414
415 AC_CHECK_FUNCS(fgets_unlocked fwrite_unlocked)
416
417 dnl *****************
418 dnl ** common code **
419 dnl *****************
420
421 dnl check for glib
422 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.6 gmodule-2.0 >= 2.6 gobject-2.0 >= 2.6 gthread-2.0 >= 2.6)
423       
424 GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
425 AC_SUBST(GLIB_GENMARSHAL)
426
427 AC_SUBST(GLIB_CFLAGS)
428 AC_SUBST(GLIB_LIBS)
429
430 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
431 syl_save_LIBS=$LIBS
432 LIBS="$LIBS $GTK_LIBS"
433 AC_CHECK_FUNCS(bind_textdomain_codeset)
434 LIBS=$syl_save_LIBS
435
436 dnl check for IPv6 option
437 dnl automated checks for IPv6 support.
438 AC_MSG_CHECKING([whether to use IPv6])
439 if test x"$enable_ipv6" = xyes; then
440         AC_MSG_RESULT(yes)
441         AC_MSG_CHECKING([for IPv6 support])
442         AC_CACHE_VAL(ac_cv_ipv6,[
443                 AC_TRY_COMPILE([#define INET6
444                                 #include <sys/types.h>
445                                 #include <netinet/in.h>],
446                         [int x = IPPROTO_IPV6; struct in6_addr a;],
447                         ac_cv_ipv6=yes, ac_cv_ipv6=no)
448         ])
449         AC_MSG_RESULT($ac_cv_ipv6)
450         if test $ac_cv_ipv6 = yes; then
451                 AC_DEFINE(INET6, 1, Define if you want IPv6 support.)
452         else
453                 AC_MSG_WARN(*** IPv6 will not be supported ***)
454                 enable_ipv6=no
455         fi
456 else
457         AC_MSG_RESULT(no)
458 fi
459
460 dnl GNUTLS
461 AC_MSG_CHECKING([whether to use GnuTLS])
462 AC_MSG_RESULT($enable_gnutls)
463 if test "x$enable_gnutls" != "xno"; then
464         PKG_CHECK_MODULES(GNUTLS, gnutls >= 2.2,
465         [
466                 AC_DEFINE(USE_GNUTLS, 1, gnutls)
467                 echo "Building with GnuTLS"
468         ],
469         [
470                 echo "Building without gnutls"
471         ])
472         PKG_CHECK_MODULES(GNUTLS, gnutls >= 2.11,
473         [
474                 dnl No linking against libgcrypt needed
475         ],
476         [
477                 dnl linking against libgcrypt *is* needed
478                 GNUTLS_LIBS="$GNUTLS_LIBS -lgcrypt"
479         ])
480         AC_SUBST(GNUTLS_LIBS)
481         AC_SUBST(GNUTLS_CFLAGS)
482 fi
483
484 dnl password encryption
485 OLDLIBS=$LIBS
486 LIBS=
487 case $host_os in
488         *dragonfly*)
489                 AC_SEARCH_LIBS(encrypt, cipher, [], AC_MSG_ERROR(['encrypt'-function not found.]))
490         ;;
491         *)
492                 AC_SEARCH_LIBS(encrypt, crypt, [], AC_MSG_ERROR(['encrypt'-function not found.]))
493         ;;
494 esac
495 CRYPT_LIBS=$LIBS
496 AC_SUBST(CRYPT_LIBS)
497 LIBS=$OLDLIBS
498
499 AC_ARG_WITH(passcrypt-key, [  --with-passcrypt-key=KEY     Key used to encode passwords (8 byte string)],
500             with_passcrypt_key="$withval", with_passcrypt_key="passkey0")
501 AC_SUBST(PASSCRYPT_KEY, $with_passcrypt_key)
502
503 dnl RC dir (will be default at a certain point in time)
504 AC_ARG_WITH(config-dir,    [  --with-config-dir=RCDIR      Local configuration dir (default: .claws-mail)],
505               ac_cv_with_config_dir="$withval", ac_cv_with_config_dir=".claws-mail")
506 if test x"$ac_cv_with_config_dir" = x""; then
507         ac_cv_with_config_dir=".claws-mail"
508 fi 
509 AC_DEFINE_UNQUOTED(CFG_RC_DIR, "$ac_cv_with_config_dir", Configuration directory)
510
511 dnl ************************
512 dnl ** GTK user interface **
513 dnl ************************
514
515 dnl Checks for GTK
516 AM_CONDITIONAL(GTK3, false)
517 AM_CONDITIONAL(GTK2, true)
518 if test x"$enable_gtk3" = x"yes"; then
519         PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.0 cairo)
520         AM_CONDITIONAL(GTK3, true)
521         AM_CONDITIONAL(GTK2, false)
522 else
523         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.16)
524 fi
525 AC_SUBST(GTK_CFLAGS)
526 AC_SUBST(GTK_LIBS)
527
528 dnl enchant is used for spell checking
529 AC_MSG_CHECKING([whether to use enchant])
530 AC_MSG_RESULT($enable_enchant)
531 if test $enable_enchant = yes; then
532         PKG_CHECK_MODULES(ENCHANT, enchant >= 1.0.0,
533         [
534                 AC_DEFINE(USE_ENCHANT, 1, enchant)
535                 echo "Building with enchant"
536                 enable_enchant=yes
537                 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags enchant`"
538         ],
539         [
540                 echo "Building without enchant-notification"
541                 enable_enchant=no
542         ])
543         AC_SUBST(ENCHANT_CFLAGS)
544         AC_SUBST(ENCHANT_LIBS)
545 fi
546
547 dnl want crash dialog
548 if test $enable_crash_dialog = yes; then
549 dnl check if GDB is somewhere
550         AC_CHECK_PROG(enable_crash_dialog, gdb, yes, no)
551         AC_MSG_CHECKING([whether to use crash dialog])
552         if test $enable_crash_dialog = yes; then
553                 AC_DEFINE(CRASH_DIALOG, 1, Pop up crash dialog)
554         fi
555         AC_MSG_RESULT($enable_crash_dialog)
556 fi
557
558 dnl generic umpc
559 if test $enable_generic_umpc = yes; then
560         AC_DEFINE(GENERIC_UMPC, 1, Generic UMPC code)
561         AC_MSG_RESULT($enable_generic_umpc)
562 fi
563
564 dnl Maemo platform
565 if test $enable_maemo = yes; then
566         PKG_CHECK_MODULES(MAEMO, libosso hildon-libs hildon-fm gnome-vfs-2.0, enable_maemo=yes,
567                   enable_maemo=no)
568         AC_SUBST(MAEMO_CFLAGS)
569         AC_SUBST(MAEMO_LIBS)
570         if test $enable_maemo = no; then
571                 #test for chinook
572                 PKG_CHECK_MODULES(MAEMO, libosso hildon-1 hildon-fm-2 gnome-vfs-2.0 hal, enable_maemo=yes,
573                           enable_maemo=no)
574                 AC_SUBST(MAEMO_CFLAGS)
575                 AC_SUBST(MAEMO_LIBS)
576                 if test $enable_maemo = no; then
577                         AC_MSG_ERROR(one of libosso hildon-libs hildon-fm hildon-1 hildon-fm-2 not found)
578                 else
579                         AC_DEFINE(MAEMO, 1, Build for maemo)
580                         AC_DEFINE(CHINOOK, 1, Maemo chinook)
581                         AC_DEFINE(GENERIC_UMPC, 1, Generic UMPC code)
582                         enable_generic_umpc=yes
583                 fi
584         else
585                 AC_DEFINE(MAEMO, 1, Build for maemo)
586                 AC_DEFINE(GENERIC_UMPC, 1, Generic UMPC code)
587                 enable_generic_umpc=yes
588         fi
589 fi
590
591 PKG_CHECK_MODULES(CONIC, conic, enable_conic=yes,
592           enable_conic=no)
593 AC_SUBST(CONIC_CFLAGS)
594 AC_SUBST(CONIC_LIBS)
595 if test $enable_conic = yes; then
596         AC_DEFINE(CONIC, 1, Have conic lib)
597 fi
598
599 dnl Check for X-Face support
600 AC_MSG_CHECKING([whether to use compface])
601 if test x"$enable_compface" = xyes; then
602         AC_MSG_RESULT(yes)
603         AC_CHECK_LIB(compface, uncompface, 
604                 [AC_DEFINE(HAVE_LIBCOMPFACE, 1, Define if you want compface support.)],
605                 [enable_compface=no])
606         if test x"$enable_compface" = xyes; then
607                 COMPFACE_LIBS="-lcompface"
608         else
609                 COMPFACE_LIBS=""
610         fi
611         AC_SUBST(COMPFACE_LIBS)
612 else
613         AC_MSG_RESULT(no)
614 fi
615
616 dnl check for pthread support
617 AC_MSG_CHECKING([whether to use pthread])
618 if test x$enable_pthread = xno; then
619         AC_MSG_RESULT(no)
620 else
621         AC_MSG_RESULT(yes)
622
623         # For W32 we need to use a special ptrhead lib. In this case we can't
624         # use AC_CHECK_LIB because it has no means of checking for a
625         # library installed under a different name.  Checking for the
626         # header is okay.
627         if test -n "${pthread_name}" ; then
628            enable_pthread=yes
629         else
630         AC_CHECK_LIB(pthread, pthread_create, :, enable_pthread=no)
631         fi
632         AC_CHECK_HEADERS(pthread.h, :, enable_pthread=no)
633
634         if test x$enable_pthread = xyes; then
635                 AC_DEFINE(USE_PTHREAD, 1, Define if you have pthread)
636                 if test -z "${pthread_name}" ; then
637                 PTHREAD_LIBS="-lpthread"
638         fi
639         fi
640
641 fi
642 AC_SUBST(PTHREAD_LIBS)
643
644 dnl
645 dnl Check whether we need to pass -lresolv
646 dnl We know that we don't need it for W32.
647 dnl
648 if test x$os_win32 = xno; then
649   t_oldLibs="$LIBS"
650   LIBS="$LIBS"
651   ac_cv_var__res_options=no
652   AC_TRY_LINK([#include <sys/types.h>
653              #include <sys/socket.h>
654              #include <netinet/in.h>
655              #include <arpa/nameser.h>
656              #include <resolv.h>],
657                 [_res.options = RES_INIT;],
658                 ac_cv_var__res_options=yes);
659   if test "$ac_cv_var__res_options" != "yes"; then
660         LIBRESOLV="-lresolv"
661   fi
662   LIBS="$t_oldLibs"
663
664   if test "x$LIBRESOLV" = "x"; then
665         AC_CHECK_LIB(resolv, res_query, [LIBRESOLV=-lresolv])
666         LIBS="$t_oldLibs"
667   fi
668 fi
669 AC_SUBST(LIBRESOLV)
670
671 LIBS="$LIBS $LIBRESOLV"
672
673 dnl #######################################################################
674 dnl # Check for startup notification
675 dnl #######################################################################
676 if test "x$enable_startup_notification" = "xyes"; then
677         PKG_CHECK_MODULES(STARTUP_NOTIFICATION, libstartup-notification-1.0 >= 0.5,
678         [
679                 AC_DEFINE(HAVE_STARTUP_NOTIFICATION, 1, [Define if we're using libstartup-notification.])
680                 echo "Building with libstartup-notification"
681                 enable_startup_notification=yes
682         ],
683         [
684                 echo "Building without libstartup-notification"
685                 enable_startup_notification=no
686         ])
687
688         AC_SUBST(STARTUP_NOTIFICATION_CFLAGS)
689         AC_SUBST(STARTUP_NOTIFICATION_LIBS)
690 fi
691
692 dnl #######################################################################
693 dnl # Check for D-Bus support
694 dnl #######################################################################
695 if test "x$enable_dbus" = "xyes"; then
696         PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.60, dbus-glib-1 >= 0.60],
697         [
698                 AC_DEFINE(HAVE_DBUS_GLIB, 1, [Define if glib bindings of D-Bus are available])
699                 enable_dbus_glib=yes
700         ],
701         [
702                 echo "D-Bus requirements not met. D-Bus support not activated."
703                 enable_dbus_glib=no
704         ])
705         AC_SUBST(DBUS_CFLAGS)
706         AC_SUBST(DBUS_LIBS)
707 fi
708
709 dnl #######################################################################
710 dnl # Configure address book support
711 dnl #######################################################################
712
713 dnl #######################################################################
714 dnl # Check for new address book support
715 dnl #######################################################################
716 AC_MSG_CHECKING([whether DBUS support for new address book is present])
717 if test x"$enable_dbus_glib" = xyes; then
718         AC_MSG_RESULT([yes])
719         AC_MSG_CHECKING([whether to enable new address book])
720         if test x"$enable_new_addrbook" = xyes; then
721                 AC_MSG_RESULT([yes])
722                 PKG_CHECK_MODULES(CONTACTS, [claws-contacts],
723                 [
724                         AC_DEFINE(USE_NEW_ADDRBOOK, 1, [Define if new address book is to be activated.])
725                         enable_new_addrbook=yes
726                         AC_SUBST(CONTACTS_CFLAGS)
727                         AC_SUBST(CONTACTS_LIBS)
728                 ],
729                 [
730                         enable_new_addrbook=no
731                 ])
732         else
733                 AC_MSG_RESULT([no])
734                 enable_new_addrbook=no
735         fi
736 else
737         AC_MSG_RESULT([no])
738         enable_new_addrbook=no
739 fi
740
741 dnl #######################################################################
742 dnl # Check for old address book support
743 dnl #######################################################################
744 if test x"$enable_new_addrbook" = xno; then
745         dnl for LDAP support in addressbook
746         dnl no check for libraries; dynamically loaded
747         AC_MSG_CHECKING([whether to use LDAP])
748         if test x"$enable_ldap" = xno; then
749                 AC_MSG_RESULT(no)
750         elif test x"$enable_ldap" = xyes -a x"$enable_pthread" = xno; then
751                 AC_MSG_RESULT(no - LDAP support needs pthread support)
752
753                 enable_ldap=no
754         elif test x"$platform_win32" = xyes; then
755                 AC_MSG_RESULT(yes)
756                 AC_DEFINE(USE_LDAP, 1, Define if you want LDAP support in addressbook.)
757                 LDAP_LIBS="-lwldap32"
758                 AC_SUBST(LDAP_LIBS)
759         else
760                 AC_MSG_RESULT(yes)
761
762                 dnl check for available libraries, and pull them in
763                 AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="$LDAP_LIBS -lresolv")
764                 AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket")
765                 AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
766                 AC_CHECK_LIB(lber, ber_get_tag, LDAP_LIBS="$LDAP_LIBS -llber",,
767                                  $LDAP_LIBS)
768
769                 AC_CHECK_HEADERS(ldap.h lber.h,
770                                  [ enable_ldap=yes ],
771                                  [ enable_ldap=no ])
772
773                 if test "$enable_ldap" = yes; then
774                         AC_CHECK_LIB(ldap, ldap_open,
775                                          [ enable_ldap=yes ],
776                                          [ enable_ldap=no ],
777                                          $LDAP_LIBS)
778
779                         AC_CHECK_LIB(ldap, ldap_start_tls_s,
780                                              [ ac_cv_have_tls=yes ],
781                                              [ ac_cv_have_tls=no ])
782
783                 fi
784
785                 AC_MSG_CHECKING([whether ldap library is available])
786                 AC_MSG_RESULT($enable_ldap)
787
788                 AC_MSG_CHECKING([whether TLS library is available])
789                 AC_MSG_RESULT($ac_cv_have_tls)
790
791                 if test "$enable_ldap" = yes; then
792                         AC_DEFINE(USE_LDAP, 1, Define if you want LDAP support in addressbook.)
793                         LDAP_LIBS="$LDAP_LIBS -lldap"
794                         AC_SUBST(LDAP_LIBS)
795                         if test "$ac_cv_have_tls" = yes; then
796                                 AC_DEFINE(USE_LDAP_TLS, 1, Define if you want LDAP TLS support in addressbook.)
797                         fi
798                         dnl As of OpenLDAP API version 3000 a number of functions has
799                         dnl been deprecated. As Claws-mail compiles and runs on many
800                         dnl platforms and many versions of OpenLDAP we need to be able
801                         dnl to switch between the old and new API because new API has
802                         dnl added new functions replacing old ones and at the same time
803                         dnl old functions has been changed.
804                         dnl If cross-compiling defaults to enable deprecated features
805                         dnl for maximum portability
806                         AC_MSG_CHECKING([The API version of OpenLDAP])
807                         AC_RUN_IFELSE(
808                                 [AC_LANG_PROGRAM(
809                                  [#include <ldap.h>],
810                                  [if (LDAP_API_VERSION >= 3000)
811                                                 return 1
812                                 ])],
813                                 [AC_MSG_RESULT([version < 3000])
814                                  AC_DEFINE(OPEN_LDAP_API_AT_LEAST_3000, 0, Define if OpenLDAP API is at least version 3000.)],
815                                 [AC_MSG_RESULT([version >= 3000])
816                                  AC_DEFINE(OPEN_LDAP_API_AT_LEAST_3000, 1, Define if OpenLDAP API is at least version 3000.)],
817                                 [AC_MSG_RESULT([Enabling deprecated features in OpenLDAP])
818                                  AC_DEFINE(OPEN_LDAP_API_AT_LEAST_3000, 0, Define if OpenLDAP API is at least version 3000.)
819                                  AC_DEFINE(LDAP_DEPRECATED, 1, Define to activate deprecated features in OpenLDAP)]
820                         )
821                 fi
822         fi
823
824         dnl for JPilot support in addressbook
825         dnl no check for libraries; these are dynamically loaded
826         AC_MSG_CHECKING([whether to use JPilot])
827         if test "$enable_jpilot" = yes; then
828                 AC_MSG_RESULT(yes)
829                 AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h pi-version.h,
830                                  [ AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ],
831                                  [ enable_jpilot=no ])
832                 if test "$enable_jpilot" = no; then
833                         AC_CHECK_HEADERS(libpisock/pi-args.h libpisock/pi-appinfo.h libpisock/pi-address.h libpisock/pi-version.h,
834                                          [ enable_jpilot=yes
835                                            AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ])
836                 fi
837
838                 AC_CHECK_LIB(pisock, unpack_Address, [JPILOT_LIBS="-lpisock"], [JPILOT_LIBS="" enable_jpilot="no"])
839                 if test x"$enable_jpilot" = xyes; then
840                         AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.)
841                 else
842                         AC_MSG_NOTICE([JPilot support not available])
843                 fi
844                 AC_SUBST(JPILOT_LIBS)
845         else
846                 AC_MSG_RESULT(no)
847         fi
848 fi
849
850 AM_CONDITIONAL(BUILD_NEWADDRBOOK, test x"$enable_new_addrbook" = x"yes")
851
852 dnl #######################################################################
853 dnl # Check for NetworkManager support
854 dnl #######################################################################
855 if test x"$enable_dbus_glib" = xyes; then
856         if test x"$enable_networkmanager" = xyes; then
857                 PKG_CHECK_MODULES(NETWORKMANAGER_SUPPORT, NetworkManager >= 0.6.2,
858                 [
859                         AC_DEFINE(HAVE_NETWORKMANAGER_SUPPORT, 1, [Define if NetworkManager support is to be included.])
860                         echo "Building with NetworkManager support"
861                         enable_networkmanager=yes
862                 ],
863                 [
864                         echo "NetworkManager not found."
865                         enable_networkmanager=no
866                 ])
867                 AC_SUBST(NETWORKMANAGER_SUPPORT_CFLAGS)
868         fi
869 else
870         echo "NetworkManager support deactivated as D-Bus requirements were not met."
871         enable_networkmanager=no
872 fi
873
874 dnl Libetpan
875 AC_MSG_CHECKING([whether to use libetpan])
876 if test x"$enable_libetpan" = xyes; then
877         AC_MSG_RESULT(yes)
878         libetpan_result=no
879         AC_PATH_PROG(libetpanconfig, [libetpan-config])
880         if test "x$libetpanconfig" != "x"; then
881           CPPFLAGS="$CPPFLAGS `$libetpanconfig --cflags 2>/dev/null`"
882           AC_CHECK_HEADER(libetpan/libetpan.h, [libetpan_result=yes])
883           if test "x$libetpan_result" = "xyes"; then
884             AC_MSG_CHECKING([whether libetpan-config hints compiles and links fine])
885             LIBS="$LIBS `$libetpanconfig --libs 2>/dev/null`"
886             AC_TRY_LINK([#include <libetpan/dbstorage.h>], [db_mailstorage_init(NULL, NULL);], [libetpan_result=yes], [libetpan_result=no])
887             AC_MSG_RESULT([$libetpan_result])
888           fi
889         fi
890         if test "x$libetpan_result" = "xyes"; then
891            LIBETPAN_CPPFLAGS="`$libetpanconfig --cflags`"
892            LIBETPAN_LIBS="`$libetpanconfig --libs`"
893            LIBETPAN_STABLE=`$libetpanconfig --version | grep -v ^0`
894            LIBETPAN_VERSION=`$libetpanconfig --version | sed "s/\.//g" | sed "s/-.*$//"`
895            if test x"$LIBETPAN_STABLE" != "x"; then
896                 LIBETPAN_VERSION="100"
897            fi
898            if test "$LIBETPAN_VERSION" -lt "057"; then
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            AC_SUBST(LIBETPAN_FLAGS)
904            AC_SUBST(LIBETPAN_LIBS)
905            AC_DEFINE(HAVE_LIBETPAN, 1, Define if you want IMAP and/or NNTP support.)
906         else
907            AC_MSG_RESULT([*** Claws Mail requires libetpan 0.57 or newer. See http://www.etpan.org/ ])
908            AC_MSG_RESULT([*** You can use --disable-libetpan if you don't need IMAP4 and/or NNTP support.])
909            AC_MSG_ERROR([libetpan 0.57 not found])
910         fi
911 else
912         AC_MSG_RESULT(no)
913 fi
914 AM_CONDITIONAL(CLAWS_LIBETPAN, test "x$libetpan_result" = "xyes")
915
916 AC_MSG_CHECKING([whether to use valgrind])
917 if test x$enable_valgrind = xyes; then
918         AC_MSG_RESULT(yes)
919         PKG_CHECK_MODULES(VALGRIND, valgrind >= 2.4.0,
920                           enable_valgrind=yes, enable_valgrind=no)
921         if test x"$enable_valgrind" = xyes; then
922                 AC_DEFINE(HAVE_VALGRIND, 1, Define if you want valgrind support)
923         else
924                 AC_MSG_RESULT(not found)
925         fi
926 else
927         AC_MSG_RESULT(no)
928 fi
929 AM_CONDITIONAL(CLAWS_VALGRIND, test x"$enable_valgrind" = x"yes")
930
931 dnl *************************
932 dnl ** section for plugins **
933 dnl *************************
934
935 PLUGINS=""
936 DISABLED_PLUGINS=""
937 MISSING_DEPS_PLUGINS=""
938
939 dnl First we set the enabled status - either enabled (yes), auto-enabled (auto)
940 dnl or (auto-)disabled (no for both)
941 dnl
942 dnl All plugins are auto-enabled except for Demo which is just there to help
943 dnl potential plugins writers.
944
945 AC_ARG_ENABLE(acpi_notifier-plugin,
946                 [  --disable-acpi_notifier-plugin  Do not build acpi_notifier plugin],
947                 [enable_acpi_notifier_plugin=$enableval], [enable_acpi_notifier_plugin=auto])
948
949 AC_ARG_ENABLE(address_keeper-plugin,
950                 [  --disable-address_keeper-plugin Do not build address_keeper plugin],
951                 [enable_address_keeper_plugin=$enableval], [enable_address_keeper_plugin=auto])
952
953 AC_ARG_ENABLE(archive-plugin,
954                 [  --disable-archive-plugin        Do not build archive plugin],
955                 [enable_archive_plugin=$enableval], [enable_archive_plugin=auto])
956
957 AC_ARG_ENABLE(att_remover-plugin,
958                 [  --disable-att_remover-plugin    Do not build att_remover plugin],
959                 [enable_att_remover_plugin=$enableval], [enable_att_remover_plugin=auto])
960
961 AC_ARG_ENABLE(attachwarner-plugin,
962                 [  --disable-attachwarner-plugin   Do not build attachwarner plugin],
963                 [enable_attachwarner_plugin=$enableval], [enable_attachwarner_plugin=auto])
964
965 AC_ARG_ENABLE(bogofilter-plugin,
966                 [  --disable-bogofilter-plugin     Do not build bogofilter plugin],
967                 [enable_bogofilter_plugin=$enableval], [enable_bogofilter_plugin=auto])
968
969 AC_ARG_ENABLE(bsfilter-plugin,
970                 [  --disable-bsfilter-plugin       Do not build bsfilter plugin],
971                 [enable_bsfilter_plugin=$enableval], [enable_bsfilter_plugin=auto])
972
973 AC_ARG_ENABLE(clamd-plugin,
974                 [  --disable-clamd-plugin          Do not build clamd plugin],
975                 [enable_clamd_plugin=$enableval], [enable_clamd_plugin=auto])
976
977 AC_ARG_ENABLE(fancy-plugin,
978                 [  --disable-fancy-plugin          Do not build fancy plugin],
979                 [enable_fancy_plugin=$enableval], [enable_fancy_plugin=auto])
980
981 AC_ARG_ENABLE(fetchinfo-plugin,
982                 [  --disable-fetchinfo-plugin      Do not build fetchinfo plugin],
983                 [enable_fetchinfo_plugin=$enableval], [enable_fetchinfo_plugin=auto])
984
985 AC_ARG_ENABLE(gdata-plugin,
986                 [  --disable-gdata-plugin          Do not build gdata plugin],
987                 [enable_gdata_plugin=$enableval], [enable_gdata_plugin=auto])
988
989 AC_ARG_ENABLE(mailmbox-plugin,
990                 [  --disable-mailmbox-plugin       Do not build mailmbox plugin],
991                 [enable_mailmbox_plugin=$enableval], [enable_mailmbox_plugin=auto])
992
993 AC_ARG_ENABLE(newmail-plugin,
994                 [  --disable-newmail-plugin        Do not build newmail plugin],
995                 [enable_newmail_plugin=$enableval], [enable_newmail_plugin=auto])
996
997 AC_ARG_ENABLE(notification-plugin,
998                 [  --disable-notification-plugin   Do not build notification plugin],
999                 [enable_notification_plugin=$enableval], [enable_notification_plugin=auto])
1000
1001 AC_ARG_ENABLE(pdf_viewer-plugin,
1002                 [  --disable-pdf_viewer-plugin     Do not build pdf_viewer plugin],
1003                 [enable_pdf_viewer_plugin=$enableval], [enable_pdf_viewer_plugin=auto])
1004
1005 AC_ARG_ENABLE(perl-plugin,
1006                 [  --disable-perl-plugin           Do not build perl plugin],
1007                 [enable_perl_plugin=$enableval], [enable_perl_plugin=auto])
1008
1009 AC_ARG_ENABLE(python-plugin,
1010                 [  --disable-python-plugin         Do not build python plugin],
1011                 [enable_python_plugin=$enableval], [enable_python_plugin=auto])
1012
1013 AC_ARG_ENABLE(pgpcore-plugin,
1014                 [  --disable-pgpcore-plugin        Do not build pgpcore plugin],
1015                 [enable_pgpcore_plugin=$enableval], [enable_pgpcore_plugin=auto])
1016
1017 AC_ARG_ENABLE(pgpmime-plugin,
1018                 [  --disable-pgpmime-plugin        Do not build pgpmime plugin],
1019                 [enable_pgpmime_plugin=$enableval], [enable_pgpmime_plugin=auto])
1020
1021 AC_ARG_ENABLE(pgpinline-plugin,
1022                 [  --disable-pgpinline-plugin      Do not build pgpinline plugin],
1023                 [enable_pgpinline_plugin=$enableval], [enable_pgpinline_plugin=auto])
1024
1025 AC_ARG_ENABLE(rssyl-plugin,
1026                 [  --disable-rssyl-plugin          Do not build rssyl plugin],
1027                 [enable_rssyl_plugin=$enableval], [enable_rssyl_plugin=auto])
1028
1029 AC_ARG_ENABLE(smime-plugin,
1030                 [  --disable-smime-plugin          Do not build smime plugin],
1031                 [enable_smime_plugin=$enableval], [enable_smime_plugin=auto])
1032
1033 AC_ARG_ENABLE(spamassassin-plugin,
1034                 [  --disable-spamassassin-plugin   Do not build spamassassin plugin],
1035                 [enable_spamassassin_plugin=$enableval], [enable_spamassassin_plugin=auto])
1036
1037 AC_ARG_ENABLE(spam_report-plugin,
1038                 [  --disable-spam_report-plugin    Do not build spam_report plugin],
1039                 [enable_spam_report_plugin=$enableval], [enable_spam_report_plugin=auto])
1040
1041 AC_ARG_ENABLE(tnef_parse-plugin,
1042                 [  --disable-tnef_parse-plugin     Do not build tnef_parse plugin],
1043                 [enable_tnef_parse_plugin=$enableval], [enable_tnef_parse_plugin=auto])
1044
1045 AC_ARG_ENABLE(vcalendar-plugin,
1046                 [  --disable-vcalendar-plugin      Do not build vcalendar plugin],
1047                 [enable_vcalendar_plugin=$enableval], [enable_vcalendar_plugin=auto])
1048
1049 dnl disabled by default
1050 AC_ARG_ENABLE(demo-plugin,
1051                 [  --enable-demo-plugin         Build demo plugin],
1052                 [enable_demo_plugin=$enableval], [enable_demo_plugin=no])
1053
1054
1055 dnl Then we check (unconditionnaly) for plugins dependencies
1056 dnl Some dependencies are optional, some mandatories. This is taken care of
1057 dnl later.
1058 dnl
1059 dnl During this dependancy check we do the checks themselves, define HAVE_X to
1060 dnl either yes or no, and do the AC_SUBST calls.
1061
1062 dnl Archive:            libarchive
1063 dnl Fancy:              Webkit, curl, optionally libsoup-gnome
1064 dnl Gdata:              libgdata
1065 dnl Notification:       optionally libnotify libindicate libcanberra_gtk hotkey
1066 dnl Pdf-Viewer:         libpoppler
1067 dnl Perl:               sed perl
1068 dnl PGP/Core:           libgpgme
1069 dnl PGP/Mime:           pgpcore libgpgme
1070 dnl PGP/Inline:         pgpcore libgpgme
1071 dnl S/Mime:             pgpcore libgpgme
1072 dnl Python:             Python
1073 dnl RSSyl:              libxml2 libcurl
1074 dnl SpamReport:         libcurl
1075 dnl vCalendar:          libcurl
1076
1077 dnl libcurl ********************************************************************
1078 PKG_CHECK_MODULES(CURL, libcurl, HAVE_CURL=yes, HAVE_CURL=no)
1079 AC_SUBST(CURL_LIBS)
1080 AC_SUBST(CURL_CFLAGS)
1081
1082 dnl libxml2 ********************************************************************
1083 PKG_CHECK_MODULES(LIBXML, libxml-2.0, HAVE_LIBXML=yes, HAVE_LIBXML=no)
1084 AC_SUBST(LIBXML_LIBS)
1085 AC_SUBST(LIBXML_CFLAGS)
1086
1087 dnl webkit *********************************************************************
1088 PKG_CHECK_MODULES(WEBKIT, webkit-1.0 >= 1.1.14, HAVE_WEBKIT=yes, HAVE_WEBKIT=no)
1089 AC_SUBST(WEBKIT_LIBS)
1090 AC_SUBST(WEBKIT_CFLAGS)
1091
1092 dnl libsoup-gnome **************************************************************
1093 PKG_CHECK_MODULES(LIBSOUP_GNOME, libsoup-gnome-2.4 >= 2.26, HAVE_LIBSOUP_GNOME=yes, HAVE_LIBSOUP_GNOME=no)
1094 if test x"$HAVE_LIBSOUP_GNOME" = xyes; then
1095         AC_DEFINE(HAVE_LIBSOUP_GNOME, 1, [Define if libsoup is available])
1096 fi
1097 AC_SUBST(LIBSOUP_GNOME_CFLAGS)
1098 AC_SUBST(LIBSOUP_GNOME_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/perl/tools/Makefile
1844 src/plugins/python/Makefile
1845 src/plugins/pgpcore/Makefile
1846 src/plugins/pgpmime/Makefile
1847 src/plugins/pgpinline/Makefile
1848 src/plugins/rssyl/Makefile
1849 src/plugins/smime/Makefile
1850 src/plugins/spamassassin/Makefile
1851 src/plugins/spam_report/Makefile
1852 src/plugins/tnef_parse/Makefile
1853 src/plugins/vcalendar/Makefile
1854 src/plugins/vcalendar/libical/Makefile
1855 src/plugins/vcalendar/libical/libical/icalversion.h
1856 src/plugins/vcalendar/libical/libical/Makefile
1857 src/plugins/vcalendar/libical/design-data/Makefile
1858 src/plugins/vcalendar/libical/scripts/Makefile
1859 doc/Makefile
1860 doc/man/Makefile
1861 tools/Makefile
1862 config/Makefile
1863 manual/Makefile
1864 manual/dtd/Makefile
1865 manual/dist/Makefile
1866 manual/dist/pdf/Makefile
1867 manual/dist/ps/Makefile
1868 manual/dist/html/Makefile
1869 manual/dist/txt/Makefile
1870 manual/fr/Makefile
1871 manual/fr/dist/Makefile
1872 manual/fr/dist/pdf/Makefile
1873 manual/fr/dist/ps/Makefile
1874 manual/fr/dist/html/Makefile
1875 manual/fr/dist/txt/Makefile
1876 manual/pl/Makefile
1877 manual/pl/dist/Makefile
1878 manual/pl/dist/pdf/Makefile
1879 manual/pl/dist/ps/Makefile
1880 manual/pl/dist/html/Makefile
1881 manual/pl/dist/txt/Makefile
1882 manual/es/Makefile
1883 manual/es/dist/Makefile
1884 manual/es/dist/pdf/Makefile
1885 manual/es/dist/ps/Makefile
1886 manual/es/dist/html/Makefile
1887 manual/es/dist/txt/Makefile
1888 manual/de/Makefile
1889 manual/de/dist/Makefile
1890 manual/de/dist/pdf/Makefile
1891 manual/de/dist/ps/Makefile
1892 manual/de/dist/html/Makefile
1893 manual/de/dist/txt/Makefile
1894 claws-mail.pc
1895 ])
1896
1897 dnl Output the configuration summary
1898 echo ""
1899 echo "$PACKAGE $VERSION"
1900 echo ""
1901 if test x"$enable_new_addrbook" = xyes; then
1902         echo "Using Address Book : New experimental interface"
1903 else
1904         echo "Using Address Book : Old stable interface"
1905         echo "JPilot             : $enable_jpilot"
1906         echo "LDAP               : $enable_ldap"
1907 fi
1908 echo "gnuTLS             : $enable_gnutls"
1909 echo "iconv              : $am_cv_func_iconv"
1910 echo "compface           : $enable_compface"
1911 echo "IPv6               : $enable_ipv6"
1912 echo "enchant            : $enable_enchant"
1913 echo "IMAP4              : $enable_libetpan"
1914 echo "NNTP               : $enable_libetpan"
1915 echo "Crash dialog       : $enable_crash_dialog"
1916 echo "LibSM              : $enable_libsm"
1917 echo "DBUS               : $enable_dbus"
1918 echo "NetworkManager     : $enable_networkmanager"
1919 echo "Manual             : $enable_manual"
1920 echo "Generic UMPC code  : $enable_generic_umpc"
1921 echo "Maemo build        : $enable_maemo"
1922 echo "Config dir         : $ac_cv_with_config_dir"
1923
1924 echo "Plugins"
1925 echo "   Built:"
1926 for plugin in $PLUGINS; do
1927 echo "            - $plugin"
1928 if test x"$plugin" = xnotification; then
1929         echo "                Features:"
1930         for notif_feature in $notification_features; do
1931                 echo "                    $notif_feature"
1932         done;
1933         if test "x$notification_missing_dependencies" != x; then
1934                 echo "                Disabled due to missing dependencies:"
1935                 for notif_miss_dep in $notification_missing_dependencies; do
1936                         echo "                    $notif_miss_dep"
1937                 done;
1938         fi
1939 fi
1940 done;
1941 if test "x$DISABLED_PLUGINS" != x; then
1942 echo "   Disabled:"
1943 for plugin in $DISABLED_PLUGINS; do
1944 echo "            - $plugin"
1945 done;
1946 fi
1947
1948 if test "x$MISSING_DEPS_PLUGINS" != x; then
1949 echo "   Disabled due to missing dependencies:"
1950 for plugin in $MISSING_DEPS_PLUGINS; do
1951 echo "            - $plugin"
1952 done;
1953 fi
1954 echo ""
1955 echo "The binary will be installed in $prefix/bin"
1956 echo ""
1957 echo "Configure finished, type 'make' to build."