Remove unnecessary definitions and calls
[claws.git] / configure.ac
1
2 AC_PREREQ([2.69])
3
4 m4_define([claws_VERSION],
5     m4_esyscmd([./get-git-version]))
6
7 AC_INIT([claws-mail],
8     m4_defn([claws_VERSION]))
9 AC_CONFIG_SRCDIR([src/main.c])
10 AC_CONFIG_AUX_DIR([config])
11 AC_CONFIG_MACRO_DIR([m4])
12 AC_CANONICAL_TARGET
13 AM_INIT_AUTOMAKE([no-define])
14
15 PACKAGE=claws-mail
16
17 dnl version number
18 INTERFACE_AGE=0
19 BINARY_AGE=0
20 EXTRA_RELEASE=
21 EXTRA_GTK3_VERSION=
22
23 GIT_VERSION=m4_defn([claws_VERSION])
24
25 if test \( -z "$GIT_VERSION" \); then
26         AC_MSG_ERROR([*** could not determine program version])
27 fi
28
29 MAJOR_VERSION=${GIT_VERSION%%.*}
30 MINOR_VERSION=${GIT_VERSION#*.}
31 MINOR_VERSION=${MINOR_VERSION%%.*}
32 MICRO_VERSION=${GIT_VERSION##*.}
33 MICRO_VERSION=${MICRO_VERSION%%-*}
34 EXTRA_VERSION=${GIT_VERSION#*-}
35 EXTRA_VERSION=${EXTRA_VERSION%%-*}
36
37 if test \( "x$EXTRA_VERSION" != "x" -a `echo -n $EXTRA_VERSION | wc -c` -lt 5 \); then
38     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}git${EXTRA_VERSION}
39 else
40     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}
41     EXTRA_VERSION=0
42 fi
43
44 if test \( "x$EXTRA_RELEASE" != "x" \); then
45     VERSION=${VERSION}${EXTRA_RELEASE}${EXTRA_GTK3_VERSION}
46 fi
47
48 dnl AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
49 dnl AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
50 AC_SUBST(PACKAGE)
51 AC_SUBST(VERSION)
52 AC_SUBST(MAJOR_VERSION)
53 AC_SUBST(MINOR_VERSION)
54 AC_SUBST(MICRO_VERSION)
55 AC_SUBST(EXTRA_VERSION)
56 AC_SUBST(GIT_VERSION)
57
58 AC_CHECK_PROG(HAVE_GTK_ICON_CACHE, gtk-update-icon-cache, yes, no)
59 AM_CONDITIONAL(UPDATE_GTK_ICON_CACHE, test x"$HAVE_GTK_ICON_CACHE" = xyes)
60
61 dnl Require pkg-config
62 m4_ifndef([PKG_PROG_PKG_CONFIG],
63     [m4_fatal([Could not locate the pkg-config autoconf macros. These
64 are usually located in /usr/share/aclocal/pkg.m4. If your macros
65 are in a different location, try setting the environment variable
66 ACLOCAL_FLAGS before running ./autogen.sh or autoreconf again. E.g.:
67 export ACLOCAL_FLAGS="-I/other/macro/dir"])
68 ])
69 PKG_PROG_PKG_CONFIG
70
71 dnl libtool versioning
72 LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
73 LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
74 LT_REVISION=$INTERFACE_AGE
75 LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
76 AC_SUBST(LT_RELEASE)
77 AC_SUBST(LT_CURRENT)
78 AC_SUBST(LT_REVISION)
79 AC_SUBST(LT_AGE)
80
81 dnl Specify a header configuration file
82 AC_CONFIG_HEADERS(config.h)
83 AC_CONFIG_HEADERS(claws-features.h)
84
85 AM_MAINTAINER_MODE
86 AC_USE_SYSTEM_EXTENSIONS
87
88 dnl Checks for programs.
89 dnl AC_ARG_PROGRAM
90 AC_PROG_CC
91 AC_SEARCH_LIBS([strerror],[cposix])
92 AC_PROG_INSTALL
93 AC_PROG_LN_S
94 AC_PROG_MAKE_SET
95 AC_PROG_CPP
96 dnl AC_PROG_RANLIB
97 AC_PROG_LEX(noyywrap)
98 AC_PROG_YACC
99 AC_LIB_PREFIX
100 AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
101 [AC_REQUIRE(AC_CANONICAL_HOST)_LT_SET_OPTION([LT_INIT],[win32-dll])
102 m4_warn([obsolete],[AC_LIBTOOL_WIN32_DLL: Remove this warning and the call to _LT_SET_OPTION when you
103 put the 'win32-dll' option into LT_INIT's first parameter.])
104 ])
105
106 LT_INIT
107 LT_PROG_RC
108 LT_LANG([Windows Resource])
109 LT_INIT
110 AC_PROG_AWK
111
112 dnl AC_PROG_CXX will set CXX=g++ even if it finds no useable C++
113 dnl compiler, so we have to check whether the program named by
114 dnl CXX exists.
115 AC_PROG_CXX
116 AC_PATH_PROG(REAL_CXX, $CXX)
117 HAVE_CXX=no
118 if test -n "$REAL_CXX"; then
119         HAVE_CXX=yes
120 fi
121
122 AC_SYS_LARGEFILE
123
124 dnl ******************************
125 dnl Checks for host
126 dnl Not needed anymore because we
127 dnl do AC_CANONICAL_TARGET above
128 dnl ******************************
129 dnl AC_CANONICAL_HOST
130
131 dnl Copied from the official gtk+-2 configure.in
132 AC_MSG_CHECKING([for host platform])
133 case "$host" in
134   *-*-mingw*|*-*-cygwin*)
135     platform_win32=yes
136     LDFLAGS="$LDFLAGS -mwindows -Wl,--export-all-symbols"
137     ;;
138         *-apple-*)
139                 platform_osx=yes
140                 LDFLAGS="$LDFLAGS -Wl,-export_dynamic"
141                 ;;
142   *)
143     platform_win32=no
144                 platform_osx=no
145                 LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
146     ;;
147 esac
148 AM_CONDITIONAL(PLATFORM_WIN32, test x"$platform_win32" = x"yes")
149 AM_CONDITIONAL(PLATFORM_OSX, test x"$platform_osx" = x"yes")
150 AC_MSG_RESULT([$host])
151
152 AC_MSG_CHECKING([for native Win32])
153 case "$host" in
154   *-*-mingw*)
155     os_win32=yes
156     ;;
157   *)
158     os_win32=no
159     ;;
160 esac
161 AC_MSG_RESULT([$os_win32])
162 AM_CONDITIONAL(OS_WIN32, test x"$os_win32" = x"yes")
163
164 AC_MSG_CHECKING([for Cygwin])
165 case "$host" in
166   *-*-cygwin*)
167     env_cygwin=yes
168     ;;
169   *)
170     env_cygwin=no
171     ;;
172 esac
173 AC_MSG_RESULT([$env_cygwin])
174 AM_CONDITIONAL(CYGWIN, test x"$env_cygwin" = x"yes")
175
176 AC_MSG_CHECKING([for time_t format specifier])
177 _gcc_cflags_save=$CFLAGS
178 CFLAGS="-Wformat -Werror"
179 AC_COMPILE_IFELSE([
180         AC_LANG_PROGRAM([[
181                 #include <stdio.h>
182                 #include <time.h>
183                 ]],[[printf("%lld", time(NULL));]])],
184         [time_t_long_long=yes],
185         [time_t_long_long=no])
186 CFLAGS=$_gcc_cflags_save
187
188 if test x"$time_t_long_long" = xyes; then
189         time_t_fmt=lld
190 else
191         time_t_fmt=ld
192 fi
193 AC_MSG_RESULT([$time_t_fmt])
194 AC_DEFINE_UNQUOTED([CM_TIME_FORMAT], ["$time_t_fmt"],
195         [Define printf format specifier for time_t])
196
197 AM_CFLAGS="-Wall"
198 if test $USE_MAINTAINER_MODE = yes; then
199         AM_CFLAGS="$AM_CFLAGS -g"
200 fi
201
202 AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
203 _gcc_cflags_save=$CFLAGS
204 CFLAGS="-Wno-pointer-sign"
205 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],_gcc_psign=yes,_gcc_psign=no)
206 AC_MSG_RESULT($_gcc_psign)
207 CFLAGS=$_gcc_cflags_save;
208 if test x"$_gcc_psign" = xyes ; then
209         AM_CFLAGS="$AM_CFLAGS -Wno-pointer-sign"
210 fi
211
212 pthread_name=
213 case "$target" in
214 *-darwin*)
215         AM_CFLAGS="$AM_CFLAGS -no-cpp-precomp -fno-common"
216         ;;
217 *-*-mingw*)
218         # Note that we need to link to pthread in all cases. This
219         # is because some locking is used even when pthread support is
220         # disabled.
221         pthread_name=pthread
222         AM_CFLAGS="$AM_CFLAGS -mms-bitfields"
223         LIBS="$LIBS -l${pthread_name} -lws2_32 -lregex"
224         ;;
225 *-*-solaris*)
226         AM_CFLAGS="$AM_CFLAGS -std=gnu99"
227         AC_DEFINE([SOLARIS], [], [Target is Solaris])
228         ;;
229 esac
230
231 AC_SUBST(AM_CFLAGS)
232
233 dnl Checks for iconv
234 AM_ICONV
235
236 dnl floor and ceil are  in -lm
237 LIBS="$LIBS -lm"
238
239 dnl
240 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
241 dnl
242 syl_save_LIBS=$LIBS
243 LIBS="$LIBS $GTK_LIBS"
244 AC_CHECK_FUNCS(bind_textdomain_codeset)
245 LIBS=$syl_save_LIBS
246
247 dnl for gettext
248 ALL_LINGUAS="ca cs da de el_GR en_GB es fi fr hu id_ID it ja nb nl pl pt_BR ro ru sk sv tr zh_TW"
249 GETTEXT_PACKAGE=claws-mail
250 AC_SUBST(GETTEXT_PACKAGE)
251 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define text domain.])
252
253 AM_GNU_GETTEXT_VERSION([0.18])
254 AM_GNU_GETTEXT([external])
255
256 AC_ARG_ENABLE(manual,
257                 [  --disable-manual                Do not build user manual],
258                 [enable_manual=$enableval], [enable_manual=yes])
259
260 AC_ARG_ENABLE(libsm,
261                 [  --disable-libsm                 Do not build libSM support for session management],
262                 [enable_libsm=$enableval], [enable_libsm=yes])
263
264 AC_ARG_ENABLE(ipv6,
265                 [  --disable-ipv6                  Do not build IPv6 support],
266                 [enable_ipv6=$enableval], [enable_ipv6=yes])
267
268 AC_ARG_ENABLE(gnutls,
269                 [  --disable-gnutls                Do not build GnuTLS support for TLS],
270                     [enable_gnutls=$enableval], [enable_gnutls=yes])
271
272 AC_ARG_ENABLE(oauth2,
273                 [  --disable-oauth2                Do not build OAuth2 support],
274                     [enable_oauth2=$enableval], [enable_oauth2=yes])
275
276 AC_ARG_ENABLE(enchant,
277                 [  --disable-enchant               Do not build Enchant support for spell-checking],
278                 [enable_enchant=$enableval], [enable_enchant=yes])
279
280 AC_ARG_ENABLE(crash-dialog,
281                 [  --enable-crash-dialog           Build crash dialog],
282                 [enable_crash_dialog=$enableval], [enable_crash_dialog=no])
283
284 AC_ARG_ENABLE(generic-umpc,
285                 [  --enable-generic-umpc           Build generic UMPC code],
286                 [enable_generic_umpc=$enableval], [enable_generic_umpc=no])
287
288 AC_ARG_ENABLE(compface,
289                 [  --disable-compface              Do not build compface support for X-Face],
290                 [enable_compface=$enableval], [enable_compface=yes])
291
292 AC_ARG_ENABLE(pthread,
293                 [  --disable-pthread               Do not build pthread support],
294                 [enable_pthread=$enableval], [enable_pthread=yes])
295
296 AC_ARG_ENABLE(startup-notification,
297                 [  --disable-startup-notification  Do not startup notification support],
298                 [enable_startup_notification=$enableval], [enable_startup_notification=yes])
299
300 AC_ARG_ENABLE(dbus,
301                 [  --disable-dbus                  Do not build DBUS support],
302                 [enable_dbus=$enableval], [enable_dbus=yes])
303
304 AC_ARG_ENABLE(ldap,
305                 [  --disable-ldap                  Do not build LDAP support],
306                 [enable_ldap=$enableval], [enable_ldap=yes])
307
308 AC_ARG_ENABLE(jpilot,
309                 [  --disable-jpilot                Do not build JPilot support],
310                 [enable_jpilot=$enableval], [enable_jpilot=yes])
311
312 AC_ARG_ENABLE(networkmanager,
313                 [  --disable-networkmanager        Do not build NetworkManager support],
314                 [enable_networkmanager=$enableval], [enable_networkmanager=yes])
315
316 AC_ARG_ENABLE(libetpan,
317                 [  --disable-libetpan              Do not build libetpan support for IMAP4/NNTP],
318                 [enable_libetpan=$enableval], [enable_libetpan=yes])
319
320 AC_ARG_ENABLE(valgrind,
321                 [  --disable-valgrind              Do not build valgrind support for debugging],
322                 [enable_valgrind=$enableval], [enable_valgrind=yes])
323
324 AC_ARG_ENABLE(alternate-addressbook,
325                 [  --enable-alternate-addressbook  Build alternate external address book support],
326                 [enable_alternate_addressbook=$enableval], [enable_alternate_addressbook=no])
327
328 AC_ARG_ENABLE(svg,
329         [  --disable-svg                   Do not build SVG support],
330         [enable_svg=$enableval], [enable_svg=yes])
331
332 AC_ARG_ENABLE(tests,
333                                 [  --enable-tests                   Build unit tests],
334                                 [enable_tests=$enableval], [enable_tests=no])
335
336 AC_ARG_ENABLE(addressbook-debug,
337         [  --enable-addressbook-debug      Build with addressbook debug calls],
338         [enable_addressbook_debug=$enableval], [enable_addressbook_debug=no])
339
340 manualdir='${docdir}/manual'
341 AC_ARG_WITH(manualdir,
342         [  --with-manualdir=DIR    Manual directory],
343         [manualdir="$withval"])
344 AC_SUBST(manualdir)
345
346 dnl ******************************
347 dnl ** Check for required tools **
348 dnl ** to build manuals         **
349 dnl ******************************
350
351 AC_PATH_PROG(DOCBOOK2HTML, docbook2html)
352 AC_PATH_PROG(DOCBOOK2TXT, docbook2txt)
353 AC_PATH_PROG(DOCBOOK2PS, docbook2ps)
354 AC_PATH_PROG(DOCBOOK2PDF, docbook2pdf)
355
356 AM_CONDITIONAL(MANUAL_HTML, test -n "$DOCBOOK2HTML")
357 AM_CONDITIONAL(MANUAL_TXT, test -n "$DOCBOOK2TXT")
358 AM_CONDITIONAL(MANUAL_PDF, test -n "$DOCBOOK2PDF")
359 AM_CONDITIONAL(MANUAL_PS, test -n "$DOCBOOK2PS")
360
361 if test x"$enable_manual" = x"yes"; then
362     if test -n "$DOCBOOK2TXT" -o -n "$DOCBOOK2HTML" \
363         -o -n "$DOCBOOK2PS" -o -n "$DOCBOOK2PDF"; then
364             enable_manual=yes
365         else
366             enable_manual=no
367     fi
368 fi
369
370 AM_CONDITIONAL(BUILD_MANUAL, test x"$enable_manual" = xyes)
371
372 dnl Set PACKAGE_DATA_DIR in config.h.
373 if test "x${datarootdir}" = 'x${prefix}/share'; then
374         if test "x${prefix}" = "xNONE"; then
375                 AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}",[PACKAGE_DATA_DIR])
376         else
377                 AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/share/${PACKAGE}",[PACKAGE_DATA_DIR])
378         fi
379 else
380         AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${datarootdir}/${PACKAGE}",[PACKAGE_DATA_DIR])
381 fi
382
383 AC_CHECK_LIB(xpg4, setlocale)
384
385 SM_LIBS=""
386 dnl Check for LibSM
387 AC_MSG_CHECKING([whether to use LibSM])
388 if test x"$enable_libsm" = xyes; then
389         AC_MSG_RESULT(yes)
390         AC_CHECK_LIB(SM, SmcSaveYourselfDone,
391                 [SM_LIBS="$X_LIBS -lSM -lICE"],enable_libsm=no,
392                 $X_LIBS -lICE)
393         AC_CHECK_HEADERS(X11/SM/SMlib.h,,enable_libsm=no)
394         if test x"$enable_libsm" = xyes; then
395                 AC_DEFINE(HAVE_LIBSM, 1, [Define to 1 if you have libSM installed])
396         else
397                 AC_MSG_RESULT(not found)
398                 AC_MSG_WARN([*** LibSM will not be supported ***])
399         fi
400 else
401         AC_MSG_RESULT(no)
402 fi
403 AC_SUBST(SM_LIBS)
404
405 dnl Check for __VA_OPT__ macro
406 AC_CACHE_CHECK([for __VA_OPT__],
407         [ac_cv_va_opt],
408         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[#define va_opt_printf(format, ...) fprintf(stderr, format __VA_OPT__(,) __VA_ARGS__)
409                 va_opt_printf("success\n");]])],[ac_cv_va_opt=yes],[ac_cv_va_opt=no])]
410 )
411 if test "$ac_cv_va_opt" = yes; then
412         AC_DEFINE([HAVE_VA_OPT], [1], [Define if __VA_OPT__ macro works])
413 fi
414
415 dnl Check for d_type member in struct dirent
416 AC_MSG_CHECKING([whether struct dirent has d_type member])
417 AC_CACHE_VAL(ac_cv_dirent_d_type,[
418         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <dirent.h>]], [[struct dirent d; d.d_type = DT_REG;]])],[ac_cv_dirent_d_type=yes],[ac_cv_dirent_d_type=no])
419 ])
420 AC_MSG_RESULT($ac_cv_dirent_d_type)
421 if test $ac_cv_dirent_d_type = yes; then
422         AC_DEFINE(HAVE_DIRENT_D_TYPE, 1,
423                   Define if `struct dirent' has `d_type' member.)
424 fi
425
426 # Check whether mkdir does not take the permission argument.
427 AX_FUNC_MKDIR
428
429 dnl Checks for header files.
430 AC_HEADER_DIRENT
431
432 AC_HEADER_SYS_WAIT
433 AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h \
434                  sys/param.h sys/utsname.h sys/select.h \
435                  wchar.h wctype.h locale.h netdb.h)
436 AC_CHECK_HEADER([execinfo.h], [AC_DEFINE(HAVE_BACKTRACE,1,[Has backtrace*() needed for retrieving stack traces])])
437 AC_SEARCH_LIBS(backtrace_symbols, [execinfo])
438
439 dnl Checks for typedefs, structures, and compiler characteristics.
440 AC_C_CONST
441 AC_TYPE_OFF_T
442 AC_TYPE_PID_T
443 AC_TYPE_SIZE_T
444 AC_STRUCT_TM
445
446 AC_CHECK_SIZEOF(unsigned short, 2)
447 AC_CHECK_SIZEOF(unsigned int, 4)
448 AC_CHECK_SIZEOF(unsigned long, 4)
449
450 dnl Checks for library functions.
451 AC_FUNC_ALLOCA
452 AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr strchr strcasestr \
453                uname flock lockf inet_aton inet_addr \
454                fchmod mkstemp truncate getuid regcomp)
455
456 AC_CHECK_FUNCS(fgets_unlocked fgetc_unlocked fputs_unlocked fputc_unlocked fread_unlocked fwrite_unlocked feof_unlocked ferror_unlocked fmemopen)
457
458 dnl *****************
459 dnl ** common code **
460 dnl *****************
461
462 dnl check for glib
463 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.50 gmodule-2.0 >= 2.50 gobject-2.0 >= 2.50 gthread-2.0 >= 2.50])
464
465 GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
466 AC_SUBST(GLIB_GENMARSHAL)
467
468 AC_SUBST(GLIB_CFLAGS)
469 AC_SUBST(GLIB_LIBS)
470
471 PKG_CHECK_MODULES(GDK_PIXBUF, [gdk-pixbuf-2.0 >= 2.26])
472
473 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
474 syl_save_LIBS=$LIBS
475 LIBS="$LIBS $GTK_LIBS"
476 AC_CHECK_FUNCS(bind_textdomain_codeset)
477 LIBS=$syl_save_LIBS
478
479 dnl check for IPv6 option
480 dnl automated checks for IPv6 support.
481 AC_MSG_CHECKING([whether to use IPv6])
482 if test x"$enable_ipv6" = xyes; then
483         AC_MSG_RESULT(yes)
484         AC_MSG_CHECKING([for IPv6 support])
485         if test x"$platform_win32" = xyes; then
486                 AC_CACHE_VAL(ac_cv_ipv6,[
487                         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
488                                         #include <ws2tcpip.h>
489                                 ]], [[struct in6_addr a;]])],[ac_cv_ipv6=yes],[ac_cv_ipv6=no])
490                 ])
491         else
492                 AC_CACHE_VAL(ac_cv_ipv6,[
493                         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
494                                         #define INET6
495                                         #include <sys/types.h>
496                                         #include <netinet/in.h>
497                                 ]], [[int x = IPPROTO_IPV6; struct in6_addr a;]])],[ac_cv_ipv6=yes],[ac_cv_ipv6=no])
498                 ])
499         fi
500         AC_MSG_RESULT($ac_cv_ipv6)
501         if test $ac_cv_ipv6 = yes; then
502                 AC_DEFINE(INET6, 1, Define if you want IPv6 support.)
503         else
504                 AC_MSG_WARN(*** IPv6 will not be supported ***)
505                 enable_ipv6=no
506         fi
507 else
508         AC_MSG_RESULT(no)
509 fi
510
511 dnl GNUTLS
512 AC_MSG_CHECKING([whether to use GnuTLS])
513 AC_MSG_RESULT($enable_gnutls)
514 if test "x$enable_gnutls" != "xno"; then
515         PKG_CHECK_MODULES(GNUTLS, gnutls >= 2.2,
516         [
517                 AC_DEFINE(USE_GNUTLS, 1, gnutls)
518                 echo "Building with GnuTLS"
519                 PKG_CHECK_MODULES(GNUTLS, gnutls >= 2.11,
520                 [
521                         dnl No linking against libgcrypt needed
522                 ],
523                 [
524                         dnl linking against libgcrypt *is* needed
525                         GNUTLS_LIBS="$GNUTLS_LIBS -lgcrypt"
526                 ])
527         ],
528         [
529                 echo "Building without GnuTLS"
530                 AC_MSG_RESULT([*** GnuTLS support is recommended ])
531                 AC_MSG_RESULT([*** You can use --disable-gnutls if you don't need it.])
532                 AC_MSG_ERROR([GnuTLS not found])
533         ])
534         AC_SUBST(GNUTLS_LIBS)
535         AC_SUBST(GNUTLS_CFLAGS)
536 fi
537
538 PKG_CHECK_MODULES(NETTLE, nettle)
539 AC_SUBST(NETTLE_LIBS)
540
541 AC_ARG_WITH(passcrypt-key, [  --with-passcrypt-key=KEY     Key used to encode passwords (8 byte string)],
542             with_passcrypt_key="$withval", with_passcrypt_key="passkey0")
543 AC_SUBST(PASSCRYPT_KEY, $with_passcrypt_key)
544
545 dnl RC dir (will be default at a certain point in time)
546 AC_ARG_WITH(config-dir,    [  --with-config-dir=RCDIR      Local configuration dir (default: .claws-mail)],
547               ac_cv_with_config_dir="$withval", ac_cv_with_config_dir="")
548
549 dnl Set correct default value based on platform
550 if test x"$ac_cv_with_config_dir" = x""; then
551         if test x"$platform_win32" = xyes; then
552                 ac_cv_with_config_dir="Claws-mail"
553         else
554                 ac_cv_with_config_dir=".claws-mail"
555         fi
556 fi
557 AC_DEFINE_UNQUOTED(CFG_RC_DIR, "$ac_cv_with_config_dir", Configuration directory)
558
559 AC_ARG_WITH(password-encryption, [  --with-password-encryption=PROVIDER    Which cryptographic library to use for encrypting stored passwords (gnutls, old, default)],
560                                                 pwd_crypto="$withval", pwd_crypto="default")
561
562 if test x"$pwd_crypto" = xdefault; then
563         if test x"$enable_gnutls" = xyes; then
564                 if `$PKG_CONFIG --atleast-version=3.0 gnutls`; then
565                         pwd_crypto="gnutls"
566                 fi
567         fi
568 fi
569 if test x"$pwd_crypto" = xdefault; then
570         pwd_crypto="old"
571 fi
572
573 case $pwd_crypto in
574         gnutls)
575                 if test x"$enable_gnutls" = xno; then
576                         AC_MSG_ERROR([GnuTLS password encryption requested but GnuTLS is not available.])
577                 fi
578                 if ! `$PKG_CONFIG --atleast-version=3.0 gnutls`; then
579                         AC_MSG_ERROR([GnuTLS version at least 3.0 is required for password encryption.])
580                 fi
581                 AC_DEFINE(PASSWORD_CRYPTO_GNUTLS, 1, Use GnuTLS for stored password encryption)
582                 ;;
583         old)
584                 AC_DEFINE(PASSWORD_CRYPTO_OLD, 1, Use old insecure method for stored password encryption)
585                 ;;
586         *)
587                 AC_MSG_ERROR([Unknown password encryption provider requested.])
588                 ;;
589 esac
590
591 AC_MSG_CHECKING([whether GnuTLS support is present for OAuth2])
592 if test x"$enable_gnutls" = xyes; then
593         AC_MSG_RESULT([yes])
594         AC_MSG_CHECKING([whether to build OAuth2 support])
595         if test x"$enable_oauth2" = xyes; then
596                 AC_MSG_RESULT([yes])
597                 AC_DEFINE(USE_OAUTH2, 1, [Define if OAuth2 is to be activated.])
598         else
599                 AC_MSG_RESULT([no])
600                 enable_oauth2=no
601         fi
602 else
603         AC_MSG_RESULT([no])
604         enable_oauth2=no
605 fi
606
607 dnl ************************
608 dnl ** GTK user interface **
609 dnl ************************
610
611 dnl Checks for GTK
612 PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.20 cairo)
613
614 AC_ARG_ENABLE(deprecated,
615                 [  --disable-deprecated            Disable deprecated GTK functions],
616                 gtkdeprecated=$enableval)
617 AC_MSG_CHECKING([whether to use deprecated GTK functions])
618 if test x"$gtkdeprecated" != xno; then
619         AC_MSG_RESULT(yes)
620 else
621         GTK_CFLAGS="$GTK_CFLAGS -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
622         AC_MSG_RESULT(no)
623 fi
624
625 dnl Make sure the code does not regress to using deprecated GTK stuff...
626 GTK_CFLAGS="$GTK_CFLAGS -DGTK_DISABLE_SINGLE_INCLUDES -DGSEAL_ENABLE"
627
628 AC_SUBST(GTK_CFLAGS)
629 AC_SUBST(GTK_LIBS)
630
631 dnl enchant is used for spell checking
632 AC_MSG_CHECKING([whether to use enchant])
633 AC_MSG_RESULT($enable_enchant)
634 if test $enable_enchant = yes; then
635         PKG_CHECK_MODULES(ENCHANT, enchant >= 1.4.0,
636         [
637                 AC_DEFINE(USE_ENCHANT, 1, enchant)
638                 echo "Building with enchant"
639                 enable_enchant=yes
640         ],
641         [
642                 PKG_CHECK_MODULES(ENCHANT, enchant-2 >= 2.0.0,
643                 [
644                         AC_DEFINE(USE_ENCHANT, 1, enchant-2)
645                         echo "Building with enchant-2"
646                         enable_enchant=yes
647                 ],
648                 [
649                         echo "Building without enchant-notification"
650                         enable_enchant=no
651                 ])
652         ])
653         AC_SUBST(ENCHANT_CFLAGS)
654         AC_SUBST(ENCHANT_LIBS)
655 fi
656
657 dnl want crash dialog
658 if test $enable_crash_dialog = yes; then
659 dnl check if GDB is somewhere
660         AC_CHECK_PROG(enable_crash_dialog, gdb, yes, no)
661         AC_MSG_CHECKING([whether to use crash dialog])
662         if test $enable_crash_dialog = yes; then
663                 AC_DEFINE(CRASH_DIALOG, 1, Pop up crash dialog)
664         fi
665         AC_MSG_RESULT($enable_crash_dialog)
666 fi
667
668 dnl generic umpc
669 if test $enable_generic_umpc = yes; then
670         AC_DEFINE(GENERIC_UMPC, 1, Generic UMPC code)
671         AC_MSG_RESULT($enable_generic_umpc)
672 fi
673
674 dnl Check for X-Face support
675 AC_MSG_CHECKING([whether to use compface])
676 if test x"$enable_compface" = xyes; then
677         AC_MSG_RESULT(yes)
678         AC_CHECK_LIB(compface, uncompface,
679                 [AC_DEFINE(HAVE_LIBCOMPFACE, 1, Define if you want compface support.)],
680                 [enable_compface=no])
681         if test x"$enable_compface" = xyes; then
682                 COMPFACE_LIBS="-lcompface"
683         else
684                 COMPFACE_LIBS=""
685         fi
686         AC_SUBST(COMPFACE_LIBS)
687 else
688         AC_MSG_RESULT(no)
689 fi
690
691 dnl check for pthread support
692 AC_MSG_CHECKING([whether to use pthread])
693 if test x$enable_pthread = xno; then
694         AC_MSG_RESULT(no)
695 else
696         AC_MSG_RESULT(yes)
697
698         # For W32 we need to use a special ptrhead lib. In this case we can't
699         # use AC_CHECK_LIB because it has no means of checking for a
700         # library installed under a different name.  Checking for the
701         # header is okay.
702         if test -n "${pthread_name}" ; then
703            enable_pthread=yes
704         else
705         AC_CHECK_LIB(pthread, pthread_create, :, enable_pthread=no)
706         fi
707         AC_CHECK_HEADERS(pthread.h, :, enable_pthread=no)
708
709         if test x$enable_pthread = xyes; then
710                 AC_DEFINE(USE_PTHREAD, 1, Define if you have pthread)
711                 if test -z "${pthread_name}" ; then
712                 PTHREAD_LIBS="-lpthread"
713         fi
714         fi
715
716 fi
717 AC_SUBST(PTHREAD_LIBS)
718
719 dnl
720 dnl Check whether we need to pass -lresolv
721 dnl We know that we don't need it for W32.
722 dnl
723 if test x$os_win32 = xno; then
724   t_oldLibs="$LIBS"
725   LIBS="$LIBS"
726   ac_cv_var__res_options=no
727   AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
728              #include <sys/socket.h>
729              #include <netinet/in.h>
730              #include <arpa/nameser.h>
731              #include <resolv.h>]], [[_res.options = RES_INIT;]])],[ac_cv_var__res_options=yes],[]);
732   if test "$ac_cv_var__res_options" != "yes"; then
733         LIBRESOLV="-lresolv"
734   fi
735   LIBS="$t_oldLibs"
736
737   if test "x$LIBRESOLV" = "x"; then
738         AC_CHECK_LIB(resolv, res_query, [LIBRESOLV=-lresolv])
739         LIBS="$t_oldLibs"
740   fi
741 fi
742 AC_SUBST(LIBRESOLV)
743
744 LIBS="$LIBS $LIBRESOLV"
745
746 dnl #######################################################################
747 dnl # Check for startup notification
748 dnl #######################################################################
749 if test "x$enable_startup_notification" = "xyes"; then
750         PKG_CHECK_MODULES(STARTUP_NOTIFICATION, libstartup-notification-1.0 >= 0.5,
751         [
752                 AC_DEFINE(HAVE_STARTUP_NOTIFICATION, 1, [Define if we're using libstartup-notification.])
753                 echo "Building with libstartup-notification"
754                 enable_startup_notification=yes
755         ],
756         [
757                 echo "Building without libstartup-notification"
758                 enable_startup_notification=no
759         ])
760
761         AC_SUBST(STARTUP_NOTIFICATION_CFLAGS)
762         AC_SUBST(STARTUP_NOTIFICATION_LIBS)
763 fi
764
765 dnl #######################################################################
766 dnl # Check for D-Bus support
767 dnl #######################################################################
768 if test "x$enable_dbus" = "xyes"; then
769         PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.60, dbus-glib-1 >= 0.60],
770         [
771                 AC_DEFINE(HAVE_DBUS_GLIB, 1, [Define if glib bindings of D-Bus are available])
772                 enable_dbus=yes
773         ],
774         [
775                 echo "D-Bus requirements not met. D-Bus support not activated."
776                 enable_dbus=no
777         ])
778         AC_SUBST(DBUS_CFLAGS)
779         AC_SUBST(DBUS_LIBS)
780 fi
781
782 dnl #######################################################################
783 dnl # Configure address book support
784 dnl #######################################################################
785
786 dnl #######################################################################
787 dnl # Check for alternate address book support
788 dnl #######################################################################
789 AC_MSG_CHECKING([whether DBUS support for alternate address book is present])
790 if test x"$enable_dbus" = xyes; then
791         AC_MSG_RESULT([yes])
792         AC_MSG_CHECKING([whether to enable alternate address book])
793         if test x"$enable_alternate_addressbook" = xyes; then
794                 AC_MSG_RESULT([yes])
795                 PKG_CHECK_MODULES(CONTACTS, [claws-contacts],
796                 [
797                         AC_DEFINE(USE_ALT_ADDRBOOK, 1, [Define if alternate address book is to be activated.])
798                         enable_alternate_addressbook=yes
799                         AC_SUBST(CONTACTS_CFLAGS)
800                         AC_SUBST(CONTACTS_LIBS)
801                 ],
802                 [
803                         enable_alternate_addressbook=no
804                 ])
805         else
806                 AC_MSG_RESULT([no])
807                 enable_alternate_addressbook=no
808         fi
809 else
810         AC_MSG_RESULT([no])
811         enable_alternate_addressbook=no
812 fi
813
814 dnl #######################################################################
815 dnl # Check for old address book support
816 dnl #######################################################################
817 if test x"$enable_alternate_addressbook" = xno; then
818         dnl for LDAP support in addressbook
819         dnl no check for libraries; dynamically loaded
820         AC_MSG_CHECKING([whether to use LDAP])
821         if test x"$enable_ldap" = xno; then
822                 AC_MSG_RESULT(no)
823         elif test x"$enable_ldap" = xyes -a x"$enable_pthread" = xno; then
824                 AC_MSG_RESULT(no - LDAP support needs pthread support)
825
826                 enable_ldap=no
827         elif test x"$platform_win32" = xyes; then
828                 AC_MSG_RESULT(yes)
829                 AC_DEFINE(USE_LDAP, 1, Define if you want LDAP support in addressbook.)
830                 LDAP_LIBS="-lwldap32"
831                 AC_SUBST(LDAP_LIBS)
832         else
833                 AC_MSG_RESULT(yes)
834
835                 dnl check for available libraries, and pull them in
836                 AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="$LDAP_LIBS -lresolv")
837                 AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket")
838                 AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
839                 AC_CHECK_LIB(lber, ber_get_tag, LDAP_LIBS="$LDAP_LIBS -llber",,
840                                  $LDAP_LIBS)
841
842                 AC_CHECK_HEADERS(ldap.h lber.h,
843                                  [ enable_ldap=yes ],
844                                  [ enable_ldap=no ])
845
846                 if test "$enable_ldap" = yes; then
847                         AC_CHECK_LIB(ldap, ldap_open,
848                                          [ enable_ldap=yes ],
849                                          [ enable_ldap=no ],
850                                          $LDAP_LIBS)
851
852                         AC_CHECK_LIB(ldap, ldap_start_tls_s,
853                                              [ ac_cv_have_tls=yes ],
854                                              [ ac_cv_have_tls=no ])
855
856                 fi
857
858                 AC_MSG_CHECKING([whether ldap library is available])
859                 AC_MSG_RESULT($enable_ldap)
860
861                 AC_MSG_CHECKING([whether TLS library is available])
862                 AC_MSG_RESULT($ac_cv_have_tls)
863
864                 if test "$enable_ldap" = yes; then
865                         AC_DEFINE(USE_LDAP, 1, Define if you want LDAP support in addressbook.)
866                         LDAP_LIBS="$LDAP_LIBS -lldap"
867                         AC_SUBST(LDAP_LIBS)
868                         if test "$ac_cv_have_tls" = yes; then
869                                 AC_DEFINE(USE_LDAP_TLS, 1, Define if you want LDAP TLS support in addressbook.)
870                         fi
871                         dnl As of OpenLDAP API version 3000 a number of functions has
872                         dnl been deprecated. As Claws-mail compiles and runs on many
873                         dnl platforms and many versions of OpenLDAP we need to be able
874                         dnl to switch between the old and new API because new API has
875                         dnl added new functions replacing old ones and at the same time
876                         dnl old functions has been changed.
877                         dnl If cross-compiling defaults to enable deprecated features
878                         dnl for maximum portability
879                         AC_MSG_CHECKING([The API version of OpenLDAP])
880                         AC_RUN_IFELSE(
881                                 [AC_LANG_PROGRAM(
882                                  [#include <ldap.h>],
883                                  [if (LDAP_API_VERSION >= 3000)
884                                                 return 1
885                                 ])],
886                                 [AC_MSG_RESULT([version < 3000])
887                                  AC_DEFINE(OPEN_LDAP_API_AT_LEAST_3000, 0, Define if OpenLDAP API is at least version 3000.)],
888                                 [AC_MSG_RESULT([version >= 3000])
889                                  AC_DEFINE(OPEN_LDAP_API_AT_LEAST_3000, 1, Define if OpenLDAP API is at least version 3000.)],
890                                 [AC_MSG_RESULT([Enabling deprecated features in OpenLDAP])
891                                  AC_DEFINE(OPEN_LDAP_API_AT_LEAST_3000, 0, Define if OpenLDAP API is at least version 3000.)
892                                  AC_DEFINE(LDAP_DEPRECATED, 1, Define to activate deprecated features in OpenLDAP)]
893                         )
894                 fi
895         fi
896
897         dnl for JPilot support in addressbook
898         dnl no check for libraries; these are dynamically loaded
899         AC_MSG_CHECKING([whether to use JPilot])
900         if test "$enable_jpilot" = yes; then
901                 AC_MSG_RESULT(yes)
902                 AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h pi-version.h,
903                                  [ AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ],
904                                  [ enable_jpilot=no ])
905                 if test "$enable_jpilot" = no; then
906                         AC_CHECK_HEADERS(libpisock/pi-args.h libpisock/pi-appinfo.h libpisock/pi-address.h libpisock/pi-version.h,
907                                          [ enable_jpilot=yes
908                                            AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ])
909                 fi
910
911                 AC_CHECK_LIB(pisock, unpack_Address, [JPILOT_LIBS="-lpisock"], [JPILOT_LIBS="" enable_jpilot="no"])
912                 if test x"$enable_jpilot" = xyes; then
913                         AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.)
914                 else
915                         AC_MSG_NOTICE([JPilot support not available])
916                 fi
917                 AC_SUBST(JPILOT_LIBS)
918         else
919                 AC_MSG_RESULT(no)
920         fi
921 fi
922
923 AM_CONDITIONAL(BUILD_ALTADDRBOOK, test x"$enable_alternate_addressbook" = x"yes")
924
925 dnl #######################################################################
926 dnl # Check for NetworkManager support
927 dnl #######################################################################
928 if test x"$enable_dbus" = xyes; then
929         if test x"$enable_networkmanager" = xyes; then
930                 PKG_CHECK_MODULES(NETWORKMANAGER_SUPPORT, libnm,
931                 [
932                         AC_DEFINE(HAVE_NETWORKMANAGER_SUPPORT, 1, [Define if NetworkManager support is to be included.])
933                         echo "Building with NetworkManager support"
934                         enable_networkmanager=yes
935                 ],
936                 [
937                         echo "NetworkManager not found."
938                         enable_networkmanager=no
939                 ])
940                 AC_SUBST(NETWORKMANAGER_SUPPORT_CFLAGS)
941         fi
942 else
943         echo "NetworkManager support deactivated as D-Bus requirements were not met."
944         enable_networkmanager=no
945 fi
946
947 dnl Libetpan
948 AC_MSG_CHECKING([whether to use libetpan])
949 if test x"$enable_libetpan" = xyes; then
950     AC_MSG_RESULT(yes)
951
952     libetpan_config=no
953     libetpan_result=no
954     libetpan_versiontype=0
955
956     # since 1.9.4, libetpan uses pkg-config
957     PKG_CHECK_MODULES([LIBETPAN], [libetpan >= 1.9.4],
958     [
959         LIBETPAN_VERSION=`pkg-config --modversion libetpan | $AWK -F. '{printf "%d", ($1 * 10000) + ($2 * 100) + $3}'`
960         libetpan_config=yes
961     ],
962     [
963         # before 1.9.4, libetpan uses its own libetpan-config script
964         AC_PATH_PROG(libetpanconfig, [libetpan-config])
965         if test "x$libetpanconfig" != "x"; then
966             LIBETPAN_CFLAGS="`$libetpanconfig --cflags`"
967             LIBETPAN_LIBS="`$libetpanconfig --libs`"
968             # support libetpan version like x.x and x.x.x
969             libetpan_versiontype=`$libetpanconfig --version | tr -dc . | wc -c`
970             if test $libetpan_versiontype -eq 1; then
971                 LIBETPAN_VERSION=`$libetpanconfig --version | $AWK -F. '{printf "%d", ($1 * 100) + $2}'`
972             else
973                 LIBETPAN_VERSION=`$libetpanconfig --version | $AWK -F. '{printf "%d", ($1 * 10000) + ($2 * 100) + $3}'`
974             fi
975             libetpan_config=yes
976         fi
977     ])
978     if test "x$libetpan_config" = "xyes"; then
979         libetpan_save_CPPFLAGS=$CPPFLAGS
980         CPPFLAGS="$CPPFLAGS $LIBETPAN_CFLAGS"
981         AC_CHECK_HEADER(libetpan/libetpan.h, [libetpan_result=yes])
982         if test "x$libetpan_result" = "xyes"; then
983             AC_MSG_CHECKING([whether libetpan-config hints compiles and links fine])
984             libetpan_save_LIBS=$LIBS
985             LIBS="$LIBS $LIBETPAN_LIBS"
986             AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <libetpan/dbstorage.h>]], [[db_mailstorage_init(NULL, NULL);]])],[libetpan_result=yes],[libetpan_result=no])
987             LIBS=$libetpan_save_LIBS
988             AC_MSG_RESULT([$libetpan_result])
989         fi
990         CPPFLAGS=$libetpan_save_CPPFLAGS
991     fi
992     if test "x$libetpan_result" = "xyes"; then
993         if test $libetpan_versiontype -eq 1; then
994             if test "$LIBETPAN_VERSION" -lt "57"; then
995                 AC_MSG_RESULT([*** Claws Mail requires libetpan 0.57 or newer. See http://www.etpan.org/])
996                 AC_MSG_RESULT([*** You can use --disable-libetpan if you don't need IMAP4 and/or NNTP support.])
997                 AC_MSG_ERROR([libetpan 0.57 not found])
998             fi
999         fi
1000         AC_SUBST(LIBETPAN_CFLAGS)
1001         AC_SUBST(LIBETPAN_LIBS)
1002         AC_DEFINE(HAVE_LIBETPAN, 1, Define if you want IMAP and/or NNTP support.)
1003     else
1004         AC_MSG_RESULT([*** Claws Mail requires libetpan 0.57 or newer. See http://www.etpan.org/ ])
1005         AC_MSG_RESULT([*** You can use --disable-libetpan if you don't need IMAP4 and/or NNTP support.])
1006         AC_MSG_ERROR([libetpan 0.57 not found])
1007     fi
1008 else
1009     AC_MSG_RESULT(no)
1010 fi
1011 AM_CONDITIONAL(CLAWS_LIBETPAN, test "x$libetpan_result" = "xyes")
1012
1013 dnl librsvg
1014 AC_MSG_CHECKING([whether to use librsvg])
1015 if test x"$enable_svg" = xyes; then
1016         AC_MSG_RESULT(yes)
1017     PKG_CHECK_MODULES([SVG], [librsvg-2.0 >= 2.39.0 cairo >= 1.0.0],
1018     [
1019         AC_SUBST(SVG_CFLAGS)
1020         AC_SUBST(SVG_LIBS)
1021                 AC_DEFINE(HAVE_SVG, 1, [Define if librsvg2 is available for SVG support])
1022                 enable_svg=yes
1023         ],
1024         [
1025                 AC_MSG_NOTICE([SVG support deactivated as librsvg2 >= 2.39.0 was not found])
1026                 enable_svg=no
1027         ])
1028 else
1029         AC_MSG_RESULT(no)
1030 fi
1031
1032 AC_MSG_CHECKING([whether to use valgrind])
1033 if test x$enable_valgrind = xyes; then
1034         AC_MSG_RESULT(yes)
1035         PKG_CHECK_MODULES([VALGRIND], [valgrind >= 2.4.0],
1036         [
1037                 AC_DEFINE(HAVE_VALGRIND, 1, Define if you want valgrind support)
1038                 enable_valgrind=yes
1039         ],
1040         [
1041                 AC_MSG_NOTICE([valgrind support deactivated as valgrind >= 2.4.0 was not found])
1042                 enable_valgrind=no
1043         ])
1044 else
1045         AC_MSG_RESULT(no)
1046 fi
1047 AM_CONDITIONAL(CLAWS_VALGRIND, test x"$enable_valgrind" = x"yes")
1048
1049 AC_MSG_CHECKING([whether to build unit tests])
1050 if test x$enable_tests = xyes; then
1051         AC_MSG_RESULT(yes)
1052 else
1053         AC_MSG_RESULT(no)
1054 fi
1055 AM_CONDITIONAL(BUILD_TESTS, test "x$enable_tests" = "xyes")
1056
1057 AC_MSG_CHECKING([whether to build addressbook debug calls])
1058 if test x$enable_addressbook_debug = xyes; then
1059         AC_MSG_RESULT(yes)
1060         AC_DEFINE(DEBUG_ADDRBOOK, 1, [Define if you want addressbook debug calls])
1061 else
1062         AC_MSG_RESULT(no)
1063 fi
1064
1065 dnl *************************
1066 dnl ** section for plugins **
1067 dnl *************************
1068
1069 PLUGINS=""
1070 DISABLED_PLUGINS=""
1071 MISSING_DEPS_PLUGINS=""
1072
1073 dnl First we set the enabled status - either enabled (yes), auto-enabled (auto)
1074 dnl or (auto-)disabled (no for both)
1075 dnl
1076 dnl All plugins are auto-enabled except for Demo which is just there to help
1077 dnl potential plugins writers.
1078
1079 AC_ARG_ENABLE(acpi_notifier-plugin,
1080                 [  --disable-acpi_notifier-plugin  Do not build acpi_notifier plugin],
1081                 [enable_acpi_notifier_plugin=$enableval], [enable_acpi_notifier_plugin=auto])
1082
1083 AC_ARG_ENABLE(address_keeper-plugin,
1084                 [  --disable-address_keeper-plugin Do not build address_keeper plugin],
1085                 [enable_address_keeper_plugin=$enableval], [enable_address_keeper_plugin=auto])
1086
1087 AC_ARG_ENABLE(archive-plugin,
1088                 [  --disable-archive-plugin        Do not build archive plugin],
1089                 [enable_archive_plugin=$enableval], [enable_archive_plugin=auto])
1090
1091 AC_ARG_ENABLE(att_remover-plugin,
1092                 [  --disable-att_remover-plugin    Do not build att_remover plugin],
1093                 [enable_att_remover_plugin=$enableval], [enable_att_remover_plugin=auto])
1094
1095 AC_ARG_ENABLE(attachwarner-plugin,
1096                 [  --disable-attachwarner-plugin   Do not build attachwarner plugin],
1097                 [enable_attachwarner_plugin=$enableval], [enable_attachwarner_plugin=auto])
1098
1099 AC_ARG_ENABLE(bogofilter-plugin,
1100                 [  --disable-bogofilter-plugin     Do not build bogofilter plugin],
1101                 [enable_bogofilter_plugin=$enableval], [enable_bogofilter_plugin=auto])
1102
1103 AC_ARG_ENABLE(bsfilter-plugin,
1104                 [  --disable-bsfilter-plugin       Do not build bsfilter plugin],
1105                 [enable_bsfilter_plugin=$enableval], [enable_bsfilter_plugin=auto])
1106
1107 AC_ARG_ENABLE(clamd-plugin,
1108                 [  --disable-clamd-plugin          Do not build clamd plugin],
1109                 [enable_clamd_plugin=$enableval], [enable_clamd_plugin=auto])
1110
1111 AC_ARG_ENABLE(dillo-plugin,
1112                 [  --disable-dillo-plugin          Do not build dillo plugin],
1113                 [enable_dillo_plugin=$enableval], [enable_dillo_plugin=auto])
1114
1115 AC_ARG_ENABLE(fancy-plugin,
1116                 [  --disable-fancy-plugin          Do not build fancy plugin],
1117                 [enable_fancy_plugin=$enableval], [enable_fancy_plugin=auto])
1118
1119 AC_ARG_ENABLE(fetchinfo-plugin,
1120                 [  --disable-fetchinfo-plugin      Do not build fetchinfo plugin],
1121                 [enable_fetchinfo_plugin=$enableval], [enable_fetchinfo_plugin=auto])
1122
1123 AC_ARG_ENABLE(gdata-plugin,
1124                 [  --disable-gdata-plugin          Do not build gdata plugin],
1125                 [enable_gdata_plugin=$enableval], [enable_gdata_plugin=auto])
1126
1127 AC_ARG_ENABLE(keyword_warner-plugin,
1128                 [  --disable-keyword_warner-plugin   Do not build keyword_warner plugin],
1129                 [enable_keyword_warner_plugin=$enableval], [enable_keyword_warner_plugin=auto])
1130
1131 AC_ARG_ENABLE(libravatar-plugin,
1132                 [  --disable-libravatar-plugin     Do not build libravatar  plugin],
1133                 [enable_libravatar_plugin=$enableval], [enable_libravatar_plugin=auto])
1134
1135 AC_ARG_ENABLE(litehtml_viewer-plugin,
1136                 [  --disable-litehtml_viewer-plugin       Do not build litehtml_viewer plugin],
1137                 [enable_litehtml_viewer_plugin=$enableval], [enable_litehtml_viewer_plugin=auto])
1138
1139 AC_ARG_ENABLE(mailmbox-plugin,
1140                 [  --disable-mailmbox-plugin       Do not build mailmbox plugin],
1141                 [enable_mailmbox_plugin=$enableval], [enable_mailmbox_plugin=auto])
1142
1143 AC_ARG_ENABLE(managesieve-plugin,
1144                 [  --disable-managesieve-plugin    Do not build managesieve plugin],
1145                 [enable_managesieve_plugin=$enableval], [enable_managesieve_plugin=auto])
1146
1147 AC_ARG_ENABLE(newmail-plugin,
1148                 [  --disable-newmail-plugin        Do not build newmail plugin],
1149                 [enable_newmail_plugin=$enableval], [enable_newmail_plugin=auto])
1150
1151 AC_ARG_ENABLE(notification-plugin,
1152                 [  --disable-notification-plugin   Do not build notification plugin],
1153                 [enable_notification_plugin=$enableval], [enable_notification_plugin=auto])
1154
1155 AC_ARG_ENABLE(pdf_viewer-plugin,
1156                 [  --disable-pdf_viewer-plugin     Do not build pdf_viewer plugin],
1157                 [enable_pdf_viewer_plugin=$enableval], [enable_pdf_viewer_plugin=auto])
1158
1159 AC_ARG_ENABLE(perl-plugin,
1160                 [  --disable-perl-plugin           Do not build perl plugin],
1161                 [enable_perl_plugin=$enableval], [enable_perl_plugin=auto])
1162
1163 AC_ARG_ENABLE(python-plugin,
1164                 [  --disable-python-plugin         Do not build python plugin],
1165                 [enable_python_plugin=$enableval], [enable_python_plugin=auto])
1166
1167 AC_ARG_ENABLE(pgpcore-plugin,
1168                 [  --disable-pgpcore-plugin        Do not build pgpcore plugin],
1169                 [enable_pgpcore_plugin=$enableval], [enable_pgpcore_plugin=auto])
1170
1171 AC_ARG_ENABLE(pgpmime-plugin,
1172                 [  --disable-pgpmime-plugin        Do not build pgpmime plugin],
1173                 [enable_pgpmime_plugin=$enableval], [enable_pgpmime_plugin=auto])
1174
1175 AC_ARG_ENABLE(pgpinline-plugin,
1176                 [  --disable-pgpinline-plugin      Do not build pgpinline plugin],
1177                 [enable_pgpinline_plugin=$enableval], [enable_pgpinline_plugin=auto])
1178
1179 AC_ARG_ENABLE(rssyl-plugin,
1180                 [  --disable-rssyl-plugin          Do not build rssyl plugin],
1181                 [enable_rssyl_plugin=$enableval], [enable_rssyl_plugin=auto])
1182
1183 AC_ARG_ENABLE(smime-plugin,
1184                 [  --disable-smime-plugin          Do not build smime plugin],
1185                 [enable_smime_plugin=$enableval], [enable_smime_plugin=auto])
1186
1187 AC_ARG_ENABLE(spamassassin-plugin,
1188                 [  --disable-spamassassin-plugin   Do not build spamassassin plugin],
1189                 [enable_spamassassin_plugin=$enableval], [enable_spamassassin_plugin=auto])
1190
1191 AC_ARG_ENABLE(spam_report-plugin,
1192                 [  --disable-spam_report-plugin    Do not build spam_report plugin],
1193                 [enable_spam_report_plugin=$enableval], [enable_spam_report_plugin=auto])
1194
1195 AC_ARG_ENABLE(tnef_parse-plugin,
1196                 [  --disable-tnef_parse-plugin     Do not build tnef_parse plugin],
1197                 [enable_tnef_parse_plugin=$enableval], [enable_tnef_parse_plugin=auto])
1198
1199 AC_ARG_ENABLE(vcalendar-plugin,
1200                 [  --disable-vcalendar-plugin      Do not build vcalendar plugin],
1201                 [enable_vcalendar_plugin=$enableval], [enable_vcalendar_plugin=auto])
1202
1203 dnl disabled by default
1204 AC_ARG_ENABLE(demo-plugin,
1205                 [  --enable-demo-plugin            Build demo plugin],
1206                 [enable_demo_plugin=$enableval], [enable_demo_plugin=no])
1207
1208
1209 dnl Then we check (unconditionnaly) for plugins dependencies
1210 dnl Some dependencies are optional, some mandatory. This is taken care of
1211 dnl later.
1212 dnl
1213 dnl During this dependancy check we do the checks themselves, define HAVE_X to
1214 dnl either yes or no, and do the AC_SUBST calls.
1215
1216 dnl Archive:            libarchive
1217 dnl Fancy:              Webkit, curl, optionally libsoup-gnome
1218 dnl Gdata:              libgdata
1219 dnl Litehtml            a C++ compiler, >=glib-2.36, cairo, fontconfig, gumbo, curl
1220 dnl Libravatar:         libcurl
1221 dnl Notification:       optionally libnotify  unity/messaging-menu
1222 dnl                                libcanberra_gtk3 hotkey
1223 dnl Pdf-Viewer:         libpoppler
1224 dnl Perl:               sed perl
1225 dnl PGP/Core:           libgpgme
1226 dnl PGP/Mime:           pgpcore libgpgme
1227 dnl PGP/Inline:         pgpcore libgpgme
1228 dnl S/Mime:             pgpcore libgpgme
1229 dnl Python:             Python
1230 dnl RSSyl:              expat libcurl
1231 dnl SpamReport:         libcurl
1232 dnl vCalendar:          libcurl, libical
1233 dnl tnef_parse:         libytnef
1234
1235 dnl libcurl ********************************************************************
1236 PKG_CHECK_MODULES(CURL, libcurl, HAVE_CURL=yes, HAVE_CURL=no)
1237 AC_SUBST(CURL_LIBS)
1238 AC_SUBST(CURL_CFLAGS)
1239
1240 dnl expat **********************************************************************
1241 PKG_CHECK_MODULES(EXPAT, expat, HAVE_EXPAT=yes, HAVE_EXPAT=no)
1242
1243 if test x"$HAVE_EXPAT" = xno; then
1244         AC_CHECK_HEADER(expat.h, [expat_header=yes], [expat_header=no])
1245         AC_CHECK_LIB(expat, XML_ParserCreate, [expat_lib=yes], [expat_lib=no])
1246         if test x"$expat_header" = xyes -a x"$expat_lib"=xyes; then
1247                 HAVE_EXPAT=yes
1248                 EXPAT_CFLAGS=""
1249                 EXPAT_LIBS="-lexpat"
1250         fi
1251 fi
1252
1253 AC_SUBST(EXPAT_CFLAGS)
1254 AC_SUBST(EXPAT_LIBS)
1255
1256 dnl webkit *********************************************************************
1257 PKG_CHECK_MODULES(WEBKIT, webkit2gtk-4.0 >= 2.18.0, HAVE_WEBKIT=yes, HAVE_WEBKIT=no)
1258 AC_SUBST(WEBKIT_LIBS)
1259 AC_SUBST(WEBKIT_CFLAGS)
1260
1261 dnl libsoup ********************************************************************
1262 PKG_CHECK_MODULES(LIBSOUP, libsoup-2.4, HAVE_LIBSOUP=yes, HAVE_LIBSOUP=no)
1263 if test x"$HAVE_LIBSOUP" = xyes; then
1264         AC_DEFINE(HAVE_LIBSOUP, 1, [Define if libsoup is available])
1265 fi
1266 AC_SUBST(LIBSOUP_CFLAGS)
1267 AC_SUBST(LIBSOUP_LIBS)
1268
1269 dnl libsoup-gnome **************************************************************
1270 PKG_CHECK_MODULES(LIBSOUP_GNOME, libsoup-gnome-2.4 >= 2.26, HAVE_LIBSOUP_GNOME=yes, HAVE_LIBSOUP_GNOME=no)
1271 if test x"$HAVE_LIBSOUP_GNOME" = xyes; then
1272         AC_DEFINE(HAVE_LIBSOUP_GNOME, 1, [Define if libsoup_gnome is available])
1273 fi
1274 AC_SUBST(LIBSOUP_GNOME_CFLAGS)
1275 AC_SUBST(LIBSOUP_GNOME_LIBS)
1276
1277 dnl libarchive *****************************************************************
1278 PKG_CHECK_MODULES(LIBARCHIVE, libarchive, HAVE_ARCHIVE=yes, HAVE_ARCHIVE=no)
1279 AC_SUBST(ARCHIVE_LIBS)
1280 AC_SUBST(ARCHIVE_CFLAGS)
1281 AC_CHECK_LIB([archive], [archive_read_new],
1282                        ARCHIVE_LIBS=-larchive
1283                        HAVE_ARCHIVE=yes
1284                        AC_SUBST(ARCHIVE_LIBS,$ARCHIVE_CFLAGS),
1285                        HAVE_ARCHIVE=no
1286                        )
1287
1288 dnl libgdata *******************************************************************
1289 PKG_CHECK_MODULES(GDATA, libgdata >= 0.17.2, HAVE_GDATA=yes, HAVE_GDATA=no)
1290 AC_SUBST(GDATA_CFLAGS)
1291 AC_SUBST(GDATA_LIBS)
1292
1293 dnl cairo **********************************************************************
1294 PKG_CHECK_MODULES(CAIRO, cairo >= 1.12.0, HAVE_CAIRO=yes, HAVE_CAIRO=no)
1295 AC_SUBST(CAIRO_CFLAGS)
1296 AC_SUBST(CAIRO_LIBS)
1297
1298 dnl fontconfig *****************************************************************
1299 PKG_CHECK_MODULES(FONTCONFIG, fontconfig, HAVE_FONTCONFIG=yes, HAVE_FONTCONFIG=no)
1300 AC_SUBST(FONTCONFIG_CFLAGS)
1301 AC_SUBST(FONTCONFIG_LIBS)
1302
1303 dnl gumbo **********************************************************************
1304 PKG_CHECK_MODULES(LIBGUMBO, gumbo >= 0.10, HAVE_LIBGUMBO=yes, HAVE_LIBGUMBO=no)
1305 AC_SUBST(LIBGUMBO_CFLAGS)
1306 AC_SUBST(LIBGUMBO_LIBS)
1307
1308 dnl libical ********************************************************************
1309 PKG_CHECK_MODULES(LIBICAL, libical >= 2.0, HAVE_LIBICAL=yes, HAVE_LIBICAL=no)
1310 AC_SUBST(LIBICAL_CFLAGS)
1311 AC_SUBST(LIBICAL_LIBS)
1312
1313 dnl Poppler ********************************************************************
1314 PKG_CHECK_MODULES(POPPLER, poppler-glib >= 0.12.0, HAVE_POPPLER=yes, HAVE_POPPLER=no)
1315 AC_SUBST(POPPLER_LIBS)
1316 AC_SUBST(POPPLER_CFLAGS)
1317
1318 dnl check for Poppler extra features that we conditionally support
1319 if test x"$HAVE_POPPLER" = xyes; then
1320         OLD_CFLAGS=$CFLAGS
1321         CFLAGS="$POPPLER_CFLAGS $GTK_CFLAGS $GLIB_CFLAGS"
1322         AC_CHECK_DECL(POPPLER_DEST_NAMED,
1323                 [AC_DEFINE([HAVE_POPPLER_DEST_NAMED], [], [Description])],
1324                 ,[#include <poppler-action.h>])
1325         AC_CHECK_DECL(POPPLER_DEST_XYZ,
1326                 [AC_DEFINE([HAVE_POPPLER_DEST_XYZ], [], [Description])],
1327                 ,[#include <poppler-action.h>])
1328         CFLAGS=$OLD_CFLAGS
1329 fi
1330
1331 dnl perl ***********************************************************************
1332 AC_CHECK_PROG(HAVE_PERL, perl, yes, no)
1333 if test x"$HAVE_PERL" = xyes; then
1334         AC_MSG_CHECKING(for perl >= 5.8.0)
1335         PERL_VER=`perl -e 'print $] > 5.0079999?"yes":"no"'`
1336         if test "$PERL_VER" = "yes"; then
1337                 AC_MSG_RESULT(yes)
1338         else
1339                 AC_MSG_RESULT(no)
1340                 HAVE_PERL=no
1341         fi
1342 fi
1343 if test x"$HAVE_PERL" = xyes; then
1344         AC_MSG_CHECKING(for perl module ExtUtils::Embed)
1345         PERL_MOD_EXT_UTILS_EMBED=no
1346         if perl -MExtUtils::Embed; then
1347                 AC_MSG_RESULT(ok)
1348                 PERL_MOD_EXT_UTILS_EMBED=yes
1349         else
1350                 AC_MSG_RESULT(no)
1351         fi
1352
1353         if test x"$PERL_MOD_EXT_UTILS_EMBED" = xyes; then
1354                 AC_MSG_CHECKING(for Perl compile flags)
1355                 PERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
1356                 PERL_CFLAGS=`echo $PERL_CFLAGS | sed 's/-D_FILE_OFFSET_BITS=[[0-9]]*//'`
1357                 PERL_LDFLAGS=`perl -MExtUtils::Embed -e ldopts |sed 's/-lgdbm\>//'`
1358                 PERL_LDFLAGS=`echo $PERL_LDFLAGS |sed 's/-ldb\>//'`
1359                 PERL_LDFLAGS=`echo $PERL_LDFLAGS |sed 's/-lndbm\>//'`
1360                 PERL_LDFLAGS=`echo $PERL_LDFLAGS |sed 's/-lc\>//'`
1361                 AC_MSG_RESULT(ok)
1362                 AC_MSG_NOTICE([Adding perl LIBS ${PERL_CFLAGS}])
1363         fi
1364
1365         if test x"$HAVE_PERL" = xyes; then
1366                 AC_CHECK_LIB(perl,perl_alloc,[AC_DEFINE(HAVE_LIBPERL, 1, Check for libperl.)], 
1367                                              [ HAVE_LIBPERL=no ])
1368         fi
1369
1370         if test x"$HAVE_LIBPERL" = xno; then
1371                 if test x"$PERL_MOD_EXT_UTILS_EMBED" = xyes; then
1372                         LIBPERL_PREFIX=`perl -MExtUtils::Embed -e perl_inc`
1373                         LIBPERL_PREFIX=`echo $LIBPERL_PREFIX |sed 's/-I//'`
1374                         AC_MSG_CHECKING([for libperl.so])
1375                         if test -f "$LIBPERL_PREFIX/libperl.so"; then
1376                                 AC_MSG_RESULT(yes)
1377                                 HAVE_LIBPERL=yes
1378                         else
1379                                 AC_MSG_RESULT(no)
1380                         fi
1381                 fi
1382         fi
1383         PERL="perl"
1384         AC_SUBST(PERL)
1385         AC_SUBST(PERL_CFLAGS)
1386         AC_SUBST(PERL_LDFLAGS)
1387 fi
1388
1389 dnl Gpgme **********************************************************************
1390 PKG_CHECK_MODULES(GPGME, [gpgme >= 1.1.1], HAVE_GPGME_PKGCONFIG=yes, HAVE_GPGME_PKGCONFIG=no)
1391 if test x"$HAVE_GPGME_PKGCONFIG" = xyes; then
1392     PKG_CHECK_MODULES(LIBGPG_ERROR, [gpg-error])
1393 else
1394     AM_PATH_GPGME(1.1.1, HAVE_GPGME_CONFIG=yes, HAVE_GPGME_CONFIG=no)
1395 fi
1396
1397 if test x"$HAVE_GPGME_PKGCONFIG" = xyes -o x"$HAVE_GPGME_CONFIG" = xyes; then
1398         AC_DEFINE(USE_GPGME, 1, Define if you use GPGME to support OpenPGP.)
1399         HAVE_GPGME=yes
1400 else
1401         HAVE_GPGME=no
1402 fi
1403
1404 dnl Python *********************************************************************
1405 PKG_CHECK_MODULES(PYTHON, python3, HAVE_PYTHON=yes, HAVE_PYTHON=no)
1406 PKG_CHECK_MODULES(PYTHONEMBED, python3-embed, HAVE_PYTHONEMBED=yes, HAVE_PYTHONEMBED=no)
1407 PKG_CHECK_MODULES(PYGOBJECT, pygobject-3.0, HAVE_PYGOBJ=yes, HAVE_PYGOBJ=no)
1408
1409 AC_SUBST(PYTHON_SHARED_LIB)
1410 AC_SUBST(PYTHON_CFLAGS)
1411 AC_SUBST(PYTHON_LIBS)
1412 AC_SUBST(PYTHONEMBED_SHARED_LIB)
1413 AC_SUBST(PYTHONEMBED_CFLAGS)
1414 AC_SUBST(PYTHONEMBED_LIBS)
1415 AC_SUBST(PYGOBJECT_CFLAGS)
1416 AC_SUBST(PYGOBJECT_LIBS)
1417
1418 dnl libnotify ******************************************************************
1419 PKG_CHECK_MODULES(libnotify, libnotify >= 0.4.3, HAVE_LIBNOTIFY=yes, HAVE_LIBNOTIFY=no)
1420 if test x"$HAVE_LIBNOTIFY" = xyes; then
1421         AC_DEFINE(HAVE_LIBNOTIFY, 1, [Define if libnotify support is enabled])
1422 fi
1423 AC_SUBST(libnotify_CFLAGS)
1424 AC_SUBST(libnotify_LIBS)
1425
1426 dnl libcanberra-gtk3 ************************************************************
1427 PKG_CHECK_MODULES(libcanberra_gtk3, libcanberra-gtk3, HAVE_LIBCANBERRA_GTK=yes, HAVE_LIBCANBERRA_GTK=no)
1428 if test x"$HAVE_LIBCANBERRA_GTK" = xyes; then
1429         AC_DEFINE(HAVE_LIBCANBERRA_GTK, 1, [Define if libcanberra-gtk3 support is enabled])
1430 fi
1431 AC_SUBST(libcanberra_gtk3_CFLAGS)
1432 AC_SUBST(libcanberra_gtk3_LIBS)
1433
1434 dnl unity/messaging-menu *******************************************************
1435 PKG_CHECK_MODULES(unity, unity messaging-menu, HAVE_UNITY=yes, HAVE_UNITY=no)
1436 if test x"$HAVE_UNITY" = xyes; then
1437         AC_DEFINE(NOTIFICATION_INDICATOR, 1, [Activate support for unity and messaging-menu])
1438 fi
1439 AC_SUBST(unity_CFLAGS)
1440 AC_SUBST(unity_LIBS)
1441
1442 dnl hotkeys ********************************************************************
1443 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)
1444 if test x"$HAVE_HOTKEYS" = xyes; then
1445         AC_DEFINE(NOTIFICATION_HOTKEYS, 1, Activate support for global hotkeys)
1446 fi
1447 AC_SUBST(CM_NP_HOTKEY_CFLAGS)
1448 AC_SUBST(CM_NP_HOTKEY_LIBS)
1449
1450 dnl libytnef *******************************************************************
1451 YTNEF_CFLAGS=""
1452 YTNEF_LIBS=""
1453 have_ytnef=0
1454 # Check both ytnef.h and libytnef/ytnef.h, and adjust YTNEF_CFLAGS
1455 # accordingly
1456 AC_CHECK_HEADER(ytnef.h, [have_ytnef=1], [have_ytnef=0])
1457 if test $have_ytnef -eq 0; then
1458         AC_CHECK_HEADER(libytnef/ytnef.h,
1459                                                                         [have_ytnef=1;
1460                                                                          YTNEF_CFLAGS="${YTNEF_CFLAGS} -DYTNEF_H_SUBDIR"],
1461                                                                         [have_ytnef=0])
1462 fi
1463 if test $have_ytnef -eq 1; then
1464         AC_MSG_CHECKING([how libytnef's SwapDDWord() should be called])
1465         # Now we have to figure out which libytnef version we're using,
1466         # based on whether SwapDDWord takes one argument or two.
1467         if test "x${YTNEF_CFLAGS}" = "x"; then
1468                 ytnef_include="#include <ytnef.h>"
1469         else
1470                 ytnef_include="#include <libytnef/ytnef.h>"
1471         fi
1472         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
1473                                                                         ${ytnef_include}]], [[SwapDDWord(0, 0);]])],[have_ytnef=1],[have_ytnef=0])
1474         if test $have_ytnef -eq 0; then
1475                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
1476                                                                                 ${ytnef_include}]], [[SwapDDWord(0);]])],[have_ytnef=1;
1477                                                                                  YTNEF_CFLAGS="${YTNEF_CFLAGS} -DYTNEF_OLD_SWAPDDWORD"],[have_ytnef=0])
1478         fi
1479         if test $have_ytnef -eq 1; then
1480                 YTNEF_LIBS="-lytnef"
1481                 AC_MSG_RESULT(ok)
1482         else
1483                 AC_MSG_RESULT(no idea, unsupported libytnef version?)
1484         fi
1485 fi
1486 AC_SUBST(YTNEF_CFLAGS)
1487 AC_SUBST(YTNEF_LIBS)
1488
1489 dnl Third, we now cross the requested plugins and the available dependencies
1490 dnl If some dependencies are missing and the plugin was explicitely enabled,
1491 dnl we error out, else we only inform.
1492
1493 AC_MSG_CHECKING([whether to build acpi_notifier plugin])
1494 if test x"$enable_acpi_notifier_plugin" != xno; then
1495         PLUGINS="$PLUGINS acpi_notifier"
1496         AC_MSG_RESULT(yes)
1497 else
1498         DISABLED_PLUGINS="$DISABLED_PLUGINS acpi_notifier"
1499         AC_MSG_RESULT(no)
1500 fi
1501
1502 AC_MSG_CHECKING([whether to build address_keeper plugin])
1503 if test x"$enable_address_keeper_plugin" != xno; then
1504         PLUGINS="$PLUGINS address_keeper"
1505         AC_MSG_RESULT(yes)
1506 else
1507         DISABLED_PLUGINS="$DISABLED_PLUGINS address_keeper"
1508         AC_MSG_RESULT(no)
1509 fi
1510
1511 AC_MSG_CHECKING([whether to build archive plugin])
1512 if test x"$enable_archive_plugin" != xno; then
1513         dependencies_missing=""
1514
1515         if test x"$HAVE_ARCHIVE" = xno; then
1516                 dependencies_missing="libarchive $dependencies_missing"
1517         fi
1518
1519         if test x"$dependencies_missing" = x; then
1520                 PLUGINS="$PLUGINS archive"
1521                 AC_MSG_RESULT(yes)
1522         elif test x"$enable_archive_plugin" = xauto; then
1523                 AC_MSG_RESULT(no)
1524                 AC_MSG_WARN("Plugin archive will not be built; missing $dependencies_missing")
1525                 enable_archive_plugin=no
1526                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS archive"
1527         else
1528                 AC_MSG_RESULT(no)
1529                 AC_MSG_ERROR("Plugin archive cannot be built; missing $dependencies_missing")
1530         fi
1531 else
1532         DISABLED_PLUGINS="$DISABLED_PLUGINS archive"
1533         AC_MSG_RESULT(no)
1534 fi
1535
1536 AC_MSG_CHECKING([whether to build att_remover plugin])
1537 if test x"$enable_att_remover_plugin" != xno; then
1538         PLUGINS="$PLUGINS att_remover"
1539         AC_MSG_RESULT(yes)
1540 else
1541         DISABLED_PLUGINS="$DISABLED_PLUGINS att_remover"
1542         AC_MSG_RESULT(no)
1543 fi
1544
1545 AC_MSG_CHECKING([whether to build attachwarner plugin])
1546 if test x"$enable_attachwarner_plugin" != xno; then
1547         PLUGINS="$PLUGINS attachwarner"
1548         AC_MSG_RESULT(yes)
1549 else
1550         DISABLED_PLUGINS="$DISABLED_PLUGINS attachwarner"
1551         AC_MSG_RESULT(no)
1552 fi
1553
1554 AC_MSG_CHECKING([whether to build bogofilter plugin])
1555 if test x"$enable_bogofilter_plugin" != xno; then
1556         PLUGINS="$PLUGINS bogofilter"
1557         AC_MSG_RESULT(yes)
1558 else
1559         DISABLED_PLUGINS="$DISABLED_PLUGINS bogofilter"
1560         AC_MSG_RESULT(no)
1561 fi
1562
1563 AC_MSG_CHECKING([whether to build bsfilter plugin])
1564 if test x"$enable_bsfilter_plugin" != xno; then
1565         PLUGINS="$PLUGINS bsfilter"
1566         AC_MSG_RESULT(yes)
1567 else
1568         DISABLED_PLUGINS="$DISABLED_PLUGINS bsfilter"
1569         AC_MSG_RESULT(no)
1570 fi
1571
1572 AC_MSG_CHECKING([whether to build clamd plugin])
1573 if test x"$enable_clamd_plugin" != xno; then
1574         PLUGINS="$PLUGINS clamd"
1575         AC_MSG_RESULT(yes)
1576 else
1577         DISABLED_PLUGINS="$DISABLED_PLUGINS clamd"
1578         AC_MSG_RESULT(no)
1579 fi
1580
1581 AC_MSG_CHECKING([whether to build demo plugin])
1582 if test x"$enable_demo_plugin" != xno; then
1583         PLUGINS="$PLUGINS demo"
1584         AC_MSG_RESULT(yes)
1585 else
1586         DISABLED_PLUGINS="$DISABLED_PLUGINS demo"
1587         AC_MSG_RESULT(no)
1588 fi
1589
1590 AC_MSG_CHECKING([whether to build Dillo plugin])
1591 if test x"$enable_dillo_plugin" != xno; then
1592         PLUGINS="$PLUGINS dillo"
1593         AC_MSG_RESULT(yes)
1594 else
1595         DISABLED_PLUGINS="$DISABLED_PLUGINS dillo"
1596         AC_MSG_RESULT(no)
1597 fi
1598
1599 AC_MSG_CHECKING([whether to build fancy plugin])
1600 if test x"$enable_fancy_plugin" != xno; then
1601         dependencies_missing=""
1602
1603         if test x"$HAVE_WEBKIT" = xno; then
1604                 dependencies_missing="libwebkit2gtk-4.0 $dependencies_missing"
1605         fi
1606         if test x"$HAVE_CURL" = xno; then
1607                 dependencies_missing="libcurl $dependencies_missing"
1608         fi
1609
1610         if test x"$dependencies_missing" = x; then
1611                 PLUGINS="$PLUGINS fancy"
1612                 AC_MSG_RESULT(yes)
1613         elif test x"$enable_fancy_plugin" = xauto; then
1614                 AC_MSG_RESULT(no)
1615                 AC_MSG_WARN("Plugin fancy will not be built; missing $dependencies_missing")
1616                 enable_fancy_plugin=no
1617                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS fancy"
1618         else
1619                 AC_MSG_RESULT(no)
1620                 AC_MSG_ERROR("Plugin fancy cannot be built; missing $dependencies_missing")
1621         fi
1622 else
1623         DISABLED_PLUGINS="$DISABLED_PLUGINS fancy"
1624         AC_MSG_RESULT(no)
1625 fi
1626
1627 AC_MSG_CHECKING([whether to build fetchinfo plugin])
1628 if test x"$enable_fetchinfo_plugin" != xno; then
1629         PLUGINS="$PLUGINS fetchinfo"
1630         AC_MSG_RESULT(yes)
1631 else
1632         DISABLED_PLUGINS="$DISABLED_PLUGINS fetchinfo"
1633         AC_MSG_RESULT(no)
1634 fi
1635
1636 AC_MSG_CHECKING([whether to build gdata plugin])
1637 if test x"$enable_gdata_plugin" != xno; then
1638         dependencies_missing=""
1639
1640         if test x"$HAVE_GDATA" = xno; then
1641                 dependencies_missing="libgdata $dependencies_missing"
1642         fi
1643
1644         if test x"$dependencies_missing" = x; then
1645                 PLUGINS="$PLUGINS gdata"
1646                 AC_MSG_RESULT(yes)
1647         elif test x"$enable_gdata_plugin" = xauto; then
1648                 AC_MSG_RESULT(no)
1649                 AC_MSG_WARN("Plugin gdata will not be built; missing $dependencies_missing")
1650                 enable_gdata_plugin=no
1651                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS gdata"
1652         else
1653                 AC_MSG_RESULT(no)
1654                 AC_MSG_ERROR("Plugin gdata cannot be built; missing $dependencies_missing")
1655         fi
1656 else
1657         DISABLED_PLUGINS="$DISABLED_PLUGINS gdata"
1658         AC_MSG_RESULT(no)
1659 fi
1660
1661 AC_MSG_CHECKING([whether to build keyword_warner plugin])
1662 if test x"$enable_keyword_warner_plugin" != xno; then
1663         PLUGINS="$PLUGINS keyword_warner"
1664         AC_MSG_RESULT(yes)
1665 else
1666         DISABLED_PLUGINS="$DISABLED_PLUGINS keyword_warner"
1667         AC_MSG_RESULT(no)
1668 fi
1669
1670 AC_MSG_CHECKING([whether to build libravatar plugin])
1671 if test x"$enable_libravatar_plugin" != xno; then
1672         dependencies_missing=""
1673
1674         if test x"$HAVE_CURL" = xno; then
1675                 dependencies_missing="libcurl $dependencies_missing"
1676         fi
1677
1678         if test x"$dependencies_missing" = x; then
1679                 PLUGINS="$PLUGINS libravatar"
1680                 AC_MSG_RESULT(yes)
1681         elif test x"$enable_libravatar_plugin" = xauto; then
1682                 AC_MSG_RESULT(no)
1683                 AC_MSG_WARN("Plugin libravatar will not be built; missing $dependencies_missing")
1684                 enable_libravatar_plugin=no
1685                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS libravatar"
1686         else
1687                 AC_MSG_RESULT(no)
1688                 AC_MSG_ERROR("Plugin libravatar cannot be built; missing $dependencies_missing")
1689         fi
1690 else
1691         DISABLED_PLUGINS="$DISABLED_PLUGINS libravatar"
1692         AC_MSG_RESULT(no)
1693 fi
1694
1695 AC_MSG_CHECKING([whether to build litehtml_viewer plugin])
1696 if test x"$enable_litehtml_viewer_plugin" != xno; then
1697         dependencies_missing=""
1698
1699         if test x"$HAVE_CXX" = xno; then
1700                 dependencies_missing="C++ compiler $dependencies_missing"
1701         fi
1702         PKG_CHECK_EXISTS([glib-2.0 >= 2.36], [],
1703                 [dependencies_missing="glib-2.0 >= 2.36 $dependencies_missing"])
1704         if test x"$HAVE_CAIRO" = xno; then
1705                 dependencies_missing="cairo $dependencies_missing"
1706         fi
1707         if test x"$HAVE_FONTCONFIG" = xno; then
1708                 dependencies_missing="fontconfig $dependencies_missing"
1709         fi
1710         if test x"$HAVE_LIBGUMBO" = xno; then
1711                 dependencies_missing="libgumbo $dependencies_missing"
1712         fi
1713         if test x"$HAVE_CURL" = xno; then
1714                 dependencies_missing="libcurl $dependencies_missing"
1715         fi
1716
1717
1718         if test x"$dependencies_missing" = x; then
1719                 PLUGINS="$PLUGINS litehtml_viewer"
1720                 AC_MSG_RESULT(yes)
1721         elif test x"$enable_litehtml_viewer_plugin" = xauto; then
1722                 AC_MSG_RESULT(no)
1723                 AC_MSG_WARN("Plugin litehtml_viewer will not be built; missing $dependencies_missing")
1724                 enable_litehtml_viewer_plugin=no
1725                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS litehtml_viewer"
1726         else
1727                 AC_MSG_RESULT(no)
1728                 AC_MSG_ERROR("Plugin litehtml_viewer cannot be built; missing $dependencies_missing")
1729         fi
1730 else
1731         DISABLED_PLUGINS="$DISABLED_PLUGINS litehtml_viewer"
1732         AC_MSG_RESULT(no)
1733 fi
1734
1735 AC_MSG_CHECKING([whether to build mailmbox plugin])
1736 if test x"$enable_mailmbox_plugin" != xno; then
1737         PLUGINS="$PLUGINS mailmbox"
1738         AC_MSG_RESULT(yes)
1739 else
1740         DISABLED_PLUGINS="$DISABLED_PLUGINS mailmbox"
1741         AC_MSG_RESULT(no)
1742 fi
1743
1744 AC_MSG_CHECKING([whether to build managesieve plugin])
1745 if test x"$enable_managesieve_plugin" != xno; then
1746         PLUGINS="$PLUGINS managesieve"
1747         AC_MSG_RESULT(yes)
1748 else
1749         DISABLED_PLUGINS="$DISABLED_PLUGINS managesieve"
1750         AC_MSG_RESULT(no)
1751 fi
1752
1753 AC_MSG_CHECKING([whether to build newmail plugin])
1754 if test x"$enable_newmail_plugin" != xno; then
1755         PLUGINS="$PLUGINS newmail"
1756         AC_MSG_RESULT(yes)
1757 else
1758         DISABLED_PLUGINS="$DISABLED_PLUGINS newmail"
1759         AC_MSG_RESULT(no)
1760 fi
1761
1762 AC_MSG_CHECKING([whether to build notification plugin])
1763 if test x"$enable_notification_plugin" != xno; then
1764         PLUGINS="$PLUGINS notification"
1765         AC_MSG_RESULT(yes)
1766
1767         AC_DEFINE(NOTIFICATION_POPUP, 1, Activate notification popup)
1768         AC_DEFINE(NOTIFICATION_BANNER, 1, Activate notification banner)
1769         AC_DEFINE(NOTIFICATION_COMMAND, 1, Activate notification shell command)
1770         AC_DEFINE(NOTIFICATION_TRAYICON, 1, Activate notification trayicon)
1771         if test x"$platform_win32" = xno; then
1772                 AC_DEFINE(NOTIFICATION_LCDPROC, 1, Activate lcdproc support)
1773         fi
1774
1775         notification_features="banner command"
1776         notification_missing_dependencies=""
1777         if test x"$HAVE_HOTKEYS" = xyes; then
1778                 notification_features="$notification_features hotkeys"
1779         else
1780                 notification_missing_dependencies="$notification_missing_dependencies hotkeys"
1781         fi
1782         notification_features="$notification_features lcdproc"
1783         if test x"$HAVE_UNITY" = xyes; then
1784                 notification_features="$notification_features unity/messaging-menu"
1785         else
1786                 notification_missing_dependencies="$notification_missing_dependencies unity/messaging-menu"
1787         fi
1788         if test x"$HAVE_LIBNOTIFY" = xyes; then
1789                 notification_features="$notification_features libnotify"
1790         else
1791                 notification_missing_dependencies="$notification_missing_dependencies libnotify"
1792         fi
1793         if test x"$HAVE_LIBCANBERRA_GTK" = xyes; then
1794                 notification_features="$notification_features libcanberra-gtk3"
1795         else
1796                 notification_missing_dependencies="$notification_missing_dependencies libcanberra-gtk3"
1797         fi
1798         notification_features="$notification_features popup trayicon"
1799 else
1800         DISABLED_PLUGINS="$DISABLED_PLUGINS notification"
1801         AC_MSG_RESULT(no)
1802 fi
1803
1804 AC_MSG_CHECKING([whether to build pdf_viewer plugin])
1805 if test x"$enable_pdf_viewer_plugin" != xno; then
1806         dependencies_missing=""
1807
1808         if test x"$HAVE_POPPLER" = xno; then
1809                 dependencies_missing="libpoppler-glib $dependencies_missing"
1810         fi
1811
1812         if test x"$dependencies_missing" = x; then
1813                 PLUGINS="$PLUGINS pdf_viewer"
1814                 AC_MSG_RESULT(yes)
1815         elif test x"$enable_pdf_viewer_plugin" = xauto; then
1816                 AC_MSG_RESULT(no)
1817                 AC_MSG_WARN("Plugin pdf_viewer will not be built; missing $dependencies_missing")
1818                 enable_pdf_viewer_plugin=no
1819                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS pdf_viewer"
1820         else
1821                 AC_MSG_RESULT(no)
1822                 AC_MSG_ERROR("Plugin pdf_viewer cannot be built; missing $dependencies_missing")
1823         fi
1824 else
1825         DISABLED_PLUGINS="$DISABLED_PLUGINS pdf_viewer"
1826         AC_MSG_RESULT(no)
1827 fi
1828
1829 AC_MSG_CHECKING([whether to build perl plugin])
1830 if test x"$enable_perl_plugin" != xno; then
1831         dependencies_missing=""
1832
1833         if test x"$HAVE_LIBPERL" = xno; then
1834                 dependencies_missing="libperl $dependencies_missing"
1835         fi
1836         if test x"$PERL_MOD_EXT_UTILS_EMBED" = xno; then
1837                 dependencies_missing="ExtUtils::Embed $dependencies_missing"
1838         fi
1839
1840         if test x"$dependencies_missing" = x; then
1841                 PLUGINS="$PLUGINS perl"
1842                 AC_MSG_RESULT(yes)
1843         elif test x"$enable_perl_plugin" = xauto; then
1844                 AC_MSG_RESULT(no)
1845                 AC_MSG_WARN("Plugin perl will not be built; missing $dependencies_missing")
1846                 enable_perl_plugin=no
1847                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS perl"
1848         else
1849                 AC_MSG_RESULT(no)
1850                 AC_MSG_ERROR("Plugin perl cannot be built; missing $dependencies_missing")
1851         fi
1852 else
1853         DISABLED_PLUGINS="$DISABLED_PLUGINS perl"
1854         AC_MSG_RESULT(no)
1855 fi
1856
1857 AC_MSG_CHECKING([whether to build python plugin])
1858 if test x"$enable_python_plugin" != xno; then
1859         dependencies_missing=""
1860
1861         if test x"$HAVE_PYTHON" = xno; then
1862                 dependencies_missing="python3 $dependencies_missing"
1863         fi
1864         if test x"$HAVE_PYGOBJ" = xno; then
1865                 dependencies_missing="pygobject-3.0 $dependencies_missing"
1866         fi
1867
1868         if test x"$dependencies_missing" = x; then
1869                 PLUGINS="$PLUGINS python"
1870                 AC_MSG_RESULT(yes)
1871         elif test x"$enable_python_plugin" = xauto; then
1872                 AC_MSG_RESULT(no)
1873                 AC_MSG_WARN("Plugin python will not be built; missing $dependencies_missing")
1874                 enable_python_plugin=no
1875                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS python"
1876         else
1877                 AC_MSG_RESULT(no)
1878                 AC_MSG_ERROR("Plugin python cannot be built; missing $dependencies_missing")
1879         fi
1880 else
1881         DISABLED_PLUGINS="$DISABLED_PLUGINS python"
1882         AC_MSG_RESULT(no)
1883 fi
1884
1885 AC_MSG_CHECKING([whether to build pgpcore plugin])
1886 if test x"$enable_pgpcore_plugin" != xno; then
1887         dependencies_missing=""
1888
1889         if test x"$HAVE_GPGME" = xno; then
1890                 dependencies_missing="libgpgme $dependencies_missing"
1891         fi
1892
1893         if test x"$dependencies_missing" = x; then
1894                 PLUGINS="$PLUGINS pgpcore"
1895                 AC_MSG_RESULT(yes)
1896         elif test x"$enable_pgpcore_plugin" = xauto; then
1897                 AC_MSG_RESULT(no)
1898                 AC_MSG_WARN("Plugin pgpcore will not be built; missing $dependencies_missing")
1899                 enable_pgpcore_plugin=no
1900                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS pgpcore"
1901         else
1902                 AC_MSG_RESULT(no)
1903                 AC_MSG_ERROR("Plugin pgpcore cannot be built; missing $dependencies_missing")
1904         fi
1905 else
1906         DISABLED_PLUGINS="$DISABLED_PLUGINS pgpcore"
1907         AC_MSG_RESULT(no)
1908 fi
1909
1910 AC_MSG_CHECKING([whether to build pgpmime plugin])
1911 if test x"$enable_pgpmime_plugin" != xno; then
1912         dependencies_missing=""
1913
1914         if test x"$HAVE_GPGME" = xno; then
1915                 dependencies_missing="libgpgme $dependencies_missing"
1916         fi
1917         if test x"$enable_pgpcore_plugin" = xno; then
1918                 dependencies_missing="pgpcore plugin $dependencies_missing"
1919         fi
1920
1921         if test x"$dependencies_missing" = x; then
1922                 PLUGINS="$PLUGINS pgpmime"
1923                 AC_MSG_RESULT(yes)
1924         elif test x"$enable_pgpmime_plugin" = xauto; then
1925                 AC_MSG_RESULT(no)
1926                 AC_MSG_WARN("Plugin pgpmime will not be built; missing $dependencies_missing")
1927                 enable_pgpmime_plugin=no
1928                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS pgpmime"
1929         else
1930                 AC_MSG_RESULT(no)
1931                 AC_MSG_ERROR("Plugin pgpmime cannot be built; missing $dependencies_missing")
1932         fi
1933 else
1934         DISABLED_PLUGINS="$DISABLED_PLUGINS pgpmime"
1935         AC_MSG_RESULT(no)
1936 fi
1937
1938 AC_MSG_CHECKING([whether to build pgpinline plugin])
1939 if test x"$enable_pgpinline_plugin" != xno; then
1940         dependencies_missing=""
1941
1942         if test x"$HAVE_GPGME" = xno; then
1943                 dependencies_missing="libgpgme $dependencies_missing"
1944         fi
1945         if test x"$enable_pgpcore_plugin" = xno; then
1946                 dependencies_missing="pgpcore plugin $dependencies_missing"
1947         fi
1948
1949         if test x"$dependencies_missing" = x; then
1950                 PLUGINS="$PLUGINS pgpinline"
1951                 AC_MSG_RESULT(yes)
1952         elif test x"$enable_pgpinline_plugin" = xauto; then
1953                 AC_MSG_RESULT(no)
1954                 AC_MSG_WARN("Plugin pgpinline will not be built; missing $dependencies_missing")
1955                 enable_pgpinline_plugin=no
1956                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS pgpinline"
1957         else
1958                 AC_MSG_RESULT(no)
1959                 AC_MSG_ERROR("Plugin pgpinline cannot be built; missing $dependencies_missing")
1960         fi
1961 else
1962         DISABLED_PLUGINS="$DISABLED_PLUGINS pgpinline"
1963         AC_MSG_RESULT(no)
1964 fi
1965
1966 AC_MSG_CHECKING([whether to build rssyl plugin])
1967 if test x"$enable_rssyl_plugin" != xno; then
1968         dependencies_missing=""
1969
1970         if test x"$HAVE_EXPAT" = xno; then
1971                 dependencies_missing="expat $dependencies_missing"
1972         fi
1973         if test x"$HAVE_CURL" = xno; then
1974                 dependencies_missing="libcurl $dependencies_missing"
1975         fi
1976
1977         if test x"$dependencies_missing" = x; then
1978                 PLUGINS="$PLUGINS rssyl"
1979                 AC_MSG_RESULT(yes)
1980         elif test x"$enable_rssyl_plugin" = xauto; then
1981                 AC_MSG_RESULT(no)
1982                 AC_MSG_WARN("Plugin rssyl will not be built; missing $dependencies_missing")
1983                 enable_rssyl_plugin=no
1984                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS rssyl"
1985         else
1986                 AC_MSG_RESULT(no)
1987                 AC_MSG_ERROR("Plugin rssyl cannot be built; missing $dependencies_missing")
1988         fi
1989 else
1990         DISABLED_PLUGINS="$DISABLED_PLUGINS rssyl"
1991         AC_MSG_RESULT(no)
1992 fi
1993
1994 AC_MSG_CHECKING([whether to build spamassassin plugin])
1995 if test x"$enable_spamassassin_plugin" != xno; then
1996         PLUGINS="$PLUGINS spamassassin"
1997         AC_MSG_RESULT(yes)
1998         AC_SPAMASSASSIN
1999
2000         dnl check for zlib (optional)
2001         spamassassin_zlib=0
2002         SPAMASSASSIN_CFLAGS=""
2003         SPAMASSASSIN_LIBS=""
2004         AC_CHECK_HEADER([zlib.h],
2005                         [AC_DEFINE(HAVE_ZLIB_H,1,[optional zlib support for spamassassin plugin])]
2006                         [spamassassin_zlib=1],
2007                         [spamassassin_zlib=0])
2008         if test $spamassassin_zlib -eq 1; then
2009                 AC_CHECK_LIB(z, deflate, [spamassassin_zlib=1], [spamassassin_zlib=0])
2010                 AC_MSG_CHECKING([whether to build spamassassin plugin with zlib support])
2011                 if test $spamassassin_zlib -eq 1; then
2012                         AC_MSG_RESULT(yes)
2013                         SPAMASSASSIN_CFLAGS="-DHAVE_LIBZ"
2014                         SPAMASSASSIN_LIBS="-lz"
2015                 else
2016                         AC_MSG_RESULT(no)
2017                 fi
2018         fi
2019         AC_SUBST(SPAMASSASSIN_CFLAGS)
2020         AC_SUBST(SPAMASSASSIN_LIBS)
2021 else
2022         DISABLED_PLUGINS="$DISABLED_PLUGINS spamassassin"
2023         AC_MSG_RESULT(no)
2024 fi
2025
2026 AC_MSG_CHECKING([whether to build smime plugin])
2027 if test x"$enable_smime_plugin" != xno; then
2028         dependencies_missing=""
2029
2030         if test x"$HAVE_GPGME" = xno; then
2031                 dependencies_missing="libgpgme $dependencies_missing"
2032         fi
2033         if test x"$enable_pgpcore_plugin" = xno; then
2034                 dependencies_missing="pgpcore plugin $dependencies_missing"
2035         fi
2036
2037         if test x"$dependencies_missing" = x; then
2038                 PLUGINS="$PLUGINS smime"
2039                 AC_MSG_RESULT(yes)
2040         elif test x"$enable_smime_plugin" = xauto; then
2041                 AC_MSG_RESULT(no)
2042                 AC_MSG_WARN("Plugin smime will not be built; missing $dependencies_missing")
2043                 enable_smime_plugin=no
2044                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS smime"
2045         else
2046                 AC_MSG_RESULT(no)
2047                 AC_MSG_ERROR("Plugin smime cannot be built; missing $dependencies_missing")
2048         fi
2049 else
2050         DISABLED_PLUGINS="$DISABLED_PLUGINS smime"
2051         AC_MSG_RESULT(no)
2052 fi
2053
2054 AC_MSG_CHECKING([whether to build spam_report plugin])
2055 if test x"$enable_spam_report_plugin" != xno; then
2056         dependencies_missing=""
2057
2058         if test x"$HAVE_CURL" = xno; then
2059                 dependencies_missing="libcurl $dependencies_missing"
2060         fi
2061
2062         if test x"$dependencies_missing" = x; then
2063                 PLUGINS="$PLUGINS spam_report"
2064                 AC_MSG_RESULT(yes)
2065         elif test x"$enable_spam_report_plugin" = xauto; then
2066                 AC_MSG_RESULT(no)
2067                 AC_MSG_WARN("Plugin spam_report will not be built; missing $dependencies_missing")
2068                 enable_spam_report_plugin=no
2069                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS spam_report"
2070         else
2071                 AC_MSG_RESULT(no)
2072                 AC_MSG_ERROR("Plugin spam_report cannot be built; missing $dependencies_missing")
2073         fi
2074 else
2075         DISABLED_PLUGINS="$DISABLED_PLUGINS spam_report"
2076         AC_MSG_RESULT(no)
2077 fi
2078
2079 AC_MSG_CHECKING([whether to build tnef_parse plugin])
2080 if test x"$enable_tnef_parse_plugin" != xno; then
2081         dependencies_missing=""
2082
2083         if test $have_ytnef -eq 0; then
2084                 dependencies_missing="libytnef"
2085         fi
2086
2087         if test x"$dependencies_missing" = x; then
2088                 PLUGINS="$PLUGINS tnef_parse"
2089                 AC_MSG_RESULT(yes)
2090         elif test x"$enable_tnef_parse_plugin" = xauto; then
2091                 AC_MSG_RESULT(no)
2092                 AC_MSG_WARN(Plugin tnef_parse will not be built; missing $dependencies_missing")
2093                 enable_tnef_parse_plugin=no
2094                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS tnef_parse"
2095         else
2096                 AC_MSG_RESULT(no)
2097                 AC_MSG_ERROR(Plugin tnef_parse will not be built; missing $dependencies_missing")
2098         fi
2099 else
2100         DISABLED_PLUGINS="$DISABLED_PLUGINS tnef_parse"
2101         AC_MSG_RESULT(no)
2102 fi
2103
2104
2105 AC_MSG_CHECKING([whether to build vcalendar plugin])
2106 if test x"$enable_vcalendar_plugin" != xno; then
2107         dependencies_missing=""
2108
2109         if test x"$HAVE_CURL" = xno; then
2110                 dependencies_missing="libcurl $dependencies_missing"
2111         fi
2112
2113   if test x"$HAVE_LIBICAL" = xno; then
2114     dependencies_missing="libical $dependencies_missing"
2115   fi
2116
2117         if test x"$HAVE_PERL" = xno; then
2118                 dependencies_missing="perl $dependencies_missing"
2119         fi
2120
2121         if test x"$dependencies_missing" = x; then
2122                 PLUGINS="$PLUGINS vcalendar"
2123                 AC_MSG_RESULT(yes)
2124         elif test x"$enable_vcalendar_plugin" = xauto; then
2125                 AC_MSG_RESULT(no)
2126                 AC_MSG_WARN("Plugin vcalendar will not be built; missing $dependencies_missing")
2127                 enable_vcalendar_plugin=no
2128                 MISSING_DEPS_PLUGINS="$MISSING_DEPS_PLUGINS vcalendar"
2129         else
2130                 AC_MSG_RESULT(no)
2131                 AC_MSG_ERROR("Plugin vcalendar cannot be built; missing $dependencies_missing")
2132         fi
2133 else
2134         DISABLED_PLUGINS="$DISABLED_PLUGINS vcalendar"
2135         AC_MSG_RESULT(no)
2136 fi
2137
2138 dnl And finally the automake conditionals.
2139
2140 AM_CONDITIONAL(BUILD_ACPI_NOTIFIER_PLUGIN,      test x"$enable_acpi_notifier_plugin" != xno)
2141 AM_CONDITIONAL(BUILD_ADDRESS_KEEPER_PLUGIN,     test x"$enable_address_keeper_plugin" != xno)
2142 AM_CONDITIONAL(BUILD_ARCHIVE_PLUGIN,            test x"$enable_archive_plugin" != xno)
2143 AM_CONDITIONAL(BUILD_ATT_REMOVER_PLUGIN,        test x"$enable_att_remover_plugin" != xno)
2144 AM_CONDITIONAL(BUILD_ATTACHWARNER_PLUGIN,       test x"$enable_attachwarner_plugin" != xno)
2145 AM_CONDITIONAL(BUILD_BOGOFILTER_PLUGIN,         test x"$enable_bogofilter_plugin" != xno)
2146 AM_CONDITIONAL(BUILD_BSFILTER_PLUGIN,           test x"$enable_bsfilter_plugin" != xno)
2147 AM_CONDITIONAL(BUILD_CLAMD_PLUGIN,              test x"$enable_clamd_plugin" != xno)
2148 AM_CONDITIONAL(BUILD_DEMO_PLUGIN,               test x"$enable_demo_plugin" != xno)
2149 AM_CONDITIONAL(BUILD_DILLO_PLUGIN,              test x"$enable_dillo_plugin" != xno)
2150 AM_CONDITIONAL(BUILD_FANCY_PLUGIN,              test x"$enable_fancy_plugin" != xno)
2151 AM_CONDITIONAL(BUILD_FETCHINFO_PLUGIN,          test x"$enable_fetchinfo_plugin" != xno)
2152 AM_CONDITIONAL(BUILD_GDATA_PLUGIN,              test x"$enable_gdata_plugin" != xno)
2153 AM_CONDITIONAL(BUILD_KEYWORD_WARNER_PLUGIN,     test x"$enable_keyword_warner_plugin" != xno)
2154 AM_CONDITIONAL(BUILD_LIBRAVATAR_PLUGIN,         test x"$enable_libravatar_plugin" != xno)
2155 AM_CONDITIONAL(BUILD_LITEHTML_VIEWER_PLUGIN,    test x"$enable_litehtml_viewer_plugin" != xno)
2156 AM_CONDITIONAL(BUILD_MAILMBOX_PLUGIN,           test x"$enable_mailmbox_plugin" != xno)
2157 AM_CONDITIONAL(BUILD_MANAGESIEVE_PLUGIN,        test x"$enable_managesieve_plugin" != xno)
2158 AM_CONDITIONAL(BUILD_NEWMAIL_PLUGIN,            test x"$enable_newmail_plugin" != xno)
2159 AM_CONDITIONAL(BUILD_NOTIFICATION_PLUGIN,       test x"$enable_notification_plugin" != xno)
2160 AM_CONDITIONAL(BUILD_HOTKEYS,                   test x"$enable_notification_plugin" != xno -a x"$HAVE_HOTKEYS" = xyes)
2161 AM_CONDITIONAL(BUILD_PDF_VIEWER_PLUGIN,         test x"$enable_pdf_viewer_plugin" != xno)
2162 AM_CONDITIONAL(BUILD_PERL_PLUGIN,               test x"$enable_perl_plugin" != xno)
2163 AM_CONDITIONAL(BUILD_PYTHON_PLUGIN,             test x"$enable_python_plugin" != xno)
2164 AM_CONDITIONAL(BUILD_PGPCORE_PLUGIN,            test x"$enable_pgpcore_plugin" != xno)
2165 AM_CONDITIONAL(BUILD_PGPMIME_PLUGIN,            test x"$enable_pgpmime_plugin" != xno)
2166 AM_CONDITIONAL(BUILD_PGPINLINE_PLUGIN,          test x"$enable_pgpinline_plugin" != xno)
2167 AM_CONDITIONAL(BUILD_RSSYL_PLUGIN,              test x"$enable_rssyl_plugin" != xno)
2168 AM_CONDITIONAL(BUILD_SMIME_PLUGIN,              test x"$enable_smime_plugin" != xno)
2169 AM_CONDITIONAL(BUILD_SPAMASSASSIN_PLUGIN,       test x"$enable_spamassassin_plugin" != xno)
2170 AM_CONDITIONAL(BUILD_SPAM_REPORT_PLUGIN,        test x"$enable_spam_report_plugin" != xno)
2171 AM_CONDITIONAL(BUILD_TNEF_PARSE_PLUGIN,         test x"$enable_tnef_parse_plugin" != xno)
2172 AM_CONDITIONAL(BUILD_VCALENDAR_PLUGIN,          test x"$enable_vcalendar_plugin" != xno)
2173
2174
2175 dnl ****************************
2176 dnl ** Final configure output **
2177 dnl ****************************
2178
2179 AC_CONFIG_FILES([
2180 Makefile
2181 po/Makefile.in
2182 src/common/version.h
2183 src/Makefile
2184 src/w32-resource.rc
2185 src/common/Makefile
2186 src/common/passcrypt.h
2187 src/common/tests/Makefile
2188 src/gtk/Makefile
2189 src/etpan/Makefile
2190 src/plugins/Makefile
2191 src/plugins/acpi_notifier/Makefile
2192 src/plugins/address_keeper/Makefile
2193 src/plugins/address_keeper/version.rc
2194 src/plugins/archive/Makefile
2195 src/plugins/att_remover/Makefile
2196 src/plugins/att_remover/version.rc
2197 src/plugins/attachwarner/Makefile
2198 src/plugins/attachwarner/version.rc
2199 src/plugins/bogofilter/Makefile
2200 src/plugins/bsfilter/Makefile
2201 src/plugins/bsfilter/version.rc
2202 src/plugins/clamd/Makefile
2203 src/plugins/clamd/libclamd/Makefile
2204 src/plugins/demo/Makefile
2205 src/plugins/dillo/Makefile
2206 src/plugins/fancy/Makefile
2207 src/plugins/fancy/version.rc
2208 src/plugins/fetchinfo/Makefile
2209 src/plugins/fetchinfo/version.rc
2210 src/plugins/gdata/Makefile
2211 src/plugins/keyword_warner/Makefile
2212 src/plugins/keyword_warner/version.rc
2213 src/plugins/litehtml_viewer/Makefile
2214 src/plugins/litehtml_viewer/version.rc
2215 src/plugins/litehtml_viewer/litehtml/Makefile
2216 src/plugins/libravatar/Makefile
2217 src/plugins/libravatar/version.rc
2218 src/plugins/mailmbox/Makefile
2219 src/plugins/mailmbox/version.rc
2220 src/plugins/managesieve/Makefile
2221 src/plugins/managesieve/version.rc
2222 src/plugins/newmail/Makefile
2223 src/plugins/notification/Makefile
2224 src/plugins/notification/version.rc
2225 src/plugins/notification/gtkhotkey/Makefile
2226 src/plugins/pdf_viewer/Makefile
2227 src/plugins/pdf_viewer/version.rc
2228 src/plugins/perl/Makefile
2229 src/plugins/perl/tools/Makefile
2230 src/plugins/python/Makefile
2231 src/plugins/python/examples/Makefile
2232 src/plugins/pgpcore/Makefile
2233 src/plugins/pgpcore/version.rc
2234 src/plugins/pgpmime/Makefile
2235 src/plugins/pgpmime/version.rc
2236 src/plugins/pgpinline/Makefile
2237 src/plugins/pgpinline/version.rc
2238 src/plugins/rssyl/Makefile
2239 src/plugins/rssyl/version.rc
2240 src/plugins/rssyl/tests/Makefile
2241 src/plugins/rssyl/libfeed/Makefile
2242 src/plugins/rssyl/libfeed/tests/Makefile
2243 src/plugins/smime/Makefile
2244 src/plugins/smime/version.rc
2245 src/plugins/spamassassin/Makefile
2246 src/plugins/spam_report/Makefile
2247 src/plugins/spam_report/version.rc
2248 src/plugins/tnef_parse/Makefile
2249 src/plugins/tnef_parse/version.rc
2250 src/plugins/vcalendar/Makefile
2251 src/plugins/vcalendar/version.rc
2252 src/tests/Makefile
2253 doc/Makefile
2254 doc/man/Makefile
2255 tools/Makefile
2256 config/Makefile
2257 manual/Makefile
2258 claws-mail.pc
2259 ])
2260 AC_OUTPUT
2261
2262 dnl Output the configuration summary
2263 echo ""
2264 echo "$PACKAGE $VERSION"
2265 echo ""
2266 if test x"$enable_alternate_addressbook" = xyes; then
2267         echo "Using Address Book : Alternate experimental interface"
2268 else
2269         echo "Using Address Book : Original stable interface"
2270         echo "JPilot             : $enable_jpilot"
2271         echo "LDAP               : $enable_ldap"
2272 fi
2273 echo "gnuTLS             : $enable_gnutls"
2274 echo "OAuth2             : $enable_oauth2"
2275 echo "iconv              : $am_cv_func_iconv"
2276 echo "compface           : $enable_compface"
2277 echo "IPv6               : $enable_ipv6"
2278 echo "enchant            : $enable_enchant"
2279 echo "IMAP4              : $enable_libetpan"
2280 echo "NNTP               : $enable_libetpan"
2281 echo "Crash dialog       : $enable_crash_dialog"
2282 echo "LibSM              : $enable_libsm"
2283 echo "DBUS               : $enable_dbus"
2284 echo "NetworkManager     : $enable_networkmanager"
2285 echo "Manual             : $enable_manual"
2286 echo "Generic UMPC code  : $enable_generic_umpc"
2287 echo "SVG support        : $enable_svg"
2288 echo "Config dir         : $ac_cv_with_config_dir"
2289 echo "Password crypto    : $pwd_crypto"
2290 echo "Unit tests         : $enable_tests"
2291
2292 echo "Plugins"
2293 echo "   Built:"
2294 for plugin in $PLUGINS; do
2295 echo "            - $plugin"
2296 if test x"$plugin" = xnotification; then
2297         echo "                Features:"
2298         for notif_feature in $notification_features; do
2299                 echo "                    $notif_feature"
2300         done;
2301         if test "x$notification_missing_dependencies" != x; then
2302                 echo "                Disabled due to missing dependencies:"
2303                 for notif_miss_dep in $notification_missing_dependencies; do
2304                         echo "                    $notif_miss_dep"
2305                 done;
2306         fi
2307 fi
2308 done;
2309 if test "x$DISABLED_PLUGINS" != x; then
2310 echo "   Disabled:"
2311 for plugin in $DISABLED_PLUGINS; do
2312 echo "            - $plugin"
2313 done;
2314 fi
2315
2316 if test "x$MISSING_DEPS_PLUGINS" != x; then
2317 echo "   Disabled due to missing dependencies:"
2318 for plugin in $MISSING_DEPS_PLUGINS; do
2319 echo "            - $plugin"
2320 done;
2321 fi
2322 echo ""
2323 echo "The binary will be installed in $prefix/bin"
2324 echo ""
2325 echo "Configure finished, type 'make' to build."