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