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