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