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