9dfc299b77233959c565cd8fa293535ddce19d7d
[claws.git] / configure.ac
1
2 AC_PREREQ(2.59)
3 AC_INIT(src/main.c)
4 AC_CONFIG_AUX_DIR(config)
5 AC_CONFIG_MACRO_DIR([m4])
6
7 PACKAGE=claws-mail
8
9 dnl version number
10 MAJOR_VERSION=3
11 MINOR_VERSION=7
12 MICRO_VERSION=6
13 INTERFACE_AGE=0
14 BINARY_AGE=0
15 EXTRA_VERSION=53
16 EXTRA_RELEASE=
17 EXTRA_GTK2_VERSION=
18
19 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
20     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}${EXTRA_RELEASE}${EXTRA_GTK2_VERSION}
21 else
22     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}cvs${EXTRA_VERSION}${EXTRA_GTK2_VERSION}
23 fi
24
25 dnl set $target
26 AC_CANONICAL_SYSTEM
27
28 dnl
29 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
30 dnl AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
31 dnl AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
32 AC_SUBST(PACKAGE)
33 AC_SUBST(VERSION)
34 AC_SUBST(MAJOR_VERSION)
35 AC_SUBST(MINOR_VERSION)
36 AC_SUBST(MICRO_VERSION)
37 AC_SUBST(EXTRA_VERSION)
38
39 dnl GNOME installed?
40 AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
41 if test "$GNOME_CONFIG" != no; then
42         gnomedatadir="`gnome-config --datadir`"
43         gnomeprefix="`gnome-config --prefix`"
44         if test "${prefix}" = "NONE"; then
45                 gnomedatadir="${ac_default_prefix}/${gnomedatadir#${gnomeprefix}}"
46         else
47                 gnomedatadir="${prefix}/${gnomedatadir#${gnomeprefix}}"
48         fi
49         AC_SUBST(gnomedatadir)
50 fi
51 AM_CONDITIONAL(CLAWS_GNOME, test -n "$gnomedatadir")
52
53 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
54 if test x$PKG_CONFIG = xno ; then
55   AC_MSG_ERROR([*** pkg-config not found. See http://www.freedesktop.org/software/pkgconfig/])
56 fi
57
58 dnl GNOME 2.x installed?
59 PKG_CHECK_MODULES(GNOME2, libgnome-2.0 >= 2.0, ac_enable_gnome2=yes, ac_enable_gnome2=no)
60 AM_CONDITIONAL(CLAWS_GNOME2, test x"$ac_enable_gnome2" = x"yes")
61
62 dnl libtool versioning
63 LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
64 LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
65 LT_REVISION=$INTERFACE_AGE
66 LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
67 AC_SUBST(LT_RELEASE)
68 AC_SUBST(LT_CURRENT)
69 AC_SUBST(LT_REVISION)
70 AC_SUBST(LT_AGE)
71
72 dnl Specify a header configuration file
73 AC_CONFIG_HEADERS(config.h)
74
75 AM_MAINTAINER_MODE
76
77 dnl Checks for programs.
78 dnl AC_ARG_PROGRAM
79 AC_PROG_CC
80 AC_ISC_POSIX
81 AC_PROG_INSTALL
82 AC_PROG_LN_S
83 AC_PROG_MAKE_SET
84 AC_PROG_CPP
85 dnl AC_PROG_RANLIB
86 AM_PROG_LEX
87 AC_PROG_YACC
88 AC_LIB_PREFIX
89 AC_LIBTOOL_WIN32_DLL
90 LT_AC_PROG_RC
91 AC_LIBTOOL_RC
92 AC_PROG_LIBTOOL
93
94 AC_SYS_LARGEFILE
95
96 dnl ******************************
97 dnl Checks for host
98 dnl Not needed anymore because we 
99 dnl do AC_CANONICAL_SYSTEM above
100 dnl ******************************
101 dnl AC_CANONICAL_HOST
102
103 dnl Copied from the official gtk+-2 configure.in
104 AC_MSG_CHECKING([for some Win32 platform])
105 case "$host" in
106   *-*-mingw*|*-*-cygwin*)
107     platform_win32=yes
108     LDFLAGS="$LDFLAGS -mwindows"
109     ;;
110   *)
111     platform_win32=no
112     ;;
113 esac
114 AC_MSG_RESULT([$platform_win32])
115 AM_CONDITIONAL(PLATFORM_WIN32, test x"$platform_win32" = x"yes")
116
117 AC_MSG_CHECKING([for native Win32])
118 case "$host" in
119   *-*-mingw*)
120     os_win32=yes
121     ;;
122   *)
123     os_win32=no
124     ;;
125 esac
126 AC_MSG_RESULT([$os_win32])
127 AM_CONDITIONAL(OS_WIN32, test x"$os_win32" = x"yes")
128
129 AC_MSG_CHECKING([for Cygwin])
130 case "$host" in
131   *-*-cygwin*)
132     env_cygwin=yes
133     ;;
134   *)
135     env_cygwin=no
136     ;;
137 esac
138 AC_MSG_RESULT([$env_cygwin])
139 AM_CONDITIONAL(CYGWIN, test x"$env_cygwin" = x"yes")
140
141 if test "$GCC" = "yes"
142 then
143         CFLAGS="$CFLAGS -Wno-unused-function"
144 fi
145
146 AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
147 _gcc_cflags_save=$CFLAGS
148 CFLAGS="-Wno-pointer-sign"
149 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_psign=yes,_gcc_psign=no)
150 AC_MSG_RESULT($_gcc_psign)
151 CFLAGS=$_gcc_cflags_save;
152 if test x"$_gcc_psign" = xyes ; then
153         CFLAGS="$CFLAGS -Wno-pointer-sign"
154 fi
155
156 CFLAGS="$CFLAGS -Wall"
157
158 if test $USE_MAINTAINER_MODE = yes; then
159         CFLAGS="$CFLAGS -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES"
160 fi
161
162 pthread_name=
163 case "$target" in
164 *-darwin*)
165         CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
166         ;;
167 *-*-mingw*)
168         # Note that we need to link to pthreadGC2 in all cases. This
169         # is because some locking is used even when pthread support is
170         # disabled.
171         pthread_name=pthreadGC2
172         CFLAGS="$CFLAGS -mms-bitfields"
173         LIBS="$LIBS -l${pthread_name} -lws2_32 -lregex"
174         ;;
175 *-*-solaris*)
176         CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
177         CFLAGS="$CFLAGS -std=gnu99 -DSOLARIS"
178         ;;
179 esac
180   
181 dnl Checks for iconv
182 AM_ICONV
183
184 dnl
185 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
186 dnl
187 syl_save_LIBS=$LIBS
188 LIBS="$LIBS $GTK_LIBS"
189 AC_CHECK_FUNCS(bind_textdomain_codeset)
190 LIBS=$syl_save_LIBS
191
192 dnl for gettext
193 ALL_LINGUAS="bg ca cs de en_GB es fi fr hu id it ja nl pl pt_BR pt_PT ru sk sv uk zh_CN"
194 GETTEXT_PACKAGE=claws-mail
195 AC_SUBST(GETTEXT_PACKAGE)
196 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define text domain.])
197
198 AM_GNU_GETTEXT_VERSION([0.15])
199 AM_GNU_GETTEXT([external])
200
201 manualdir='${docdir}/manual'
202 AC_ARG_WITH(manualdir,
203         [  --with-manualdir=DIR    Manual directory],
204         [manualdir="$withval"])
205 AC_SUBST(manualdir)
206
207 AC_ARG_ENABLE(manual,
208         [  --disable-manual           do not build manual],
209         [ac_cv_enable_manual=$enableval], [ac_cv_enable_manual=yes])
210
211 dnl ******************************
212 dnl ** Check for required tools **
213 dnl ** to build manuals         **
214 dnl ******************************
215 SAXON=`which saxon 2> /dev/null`
216 if test $? -ne 0; then
217         SAXON=
218 fi
219 if test -z "$SAXON"; then
220         SAXONJAR='/usr/share/java/saxon.jar'
221         if test ! -f "$SAXONJAR"; then
222                 SAXONJAR='/usr/local/share/java/saxon.jar'
223                 if test ! -f "$SAXONJAR"; then
224                         SAXONJAR=
225                 fi
226         fi
227 fi
228 AM_CONDITIONAL(MANUAL_PDF, test -n "$SAXON" -o -n "$SAXONJAR")
229
230 DOCBOOK2TXT=`which docbook2txt 2> /dev/null`
231 if test $? -ne 0; then
232         DOCBOOK2TXT=
233 fi
234 AM_CONDITIONAL(MANUAL_TXT, test -n "$DOCBOOK2TXT")
235
236 DOCBOOK2HTML=`which docbook2html 2> /dev/null`
237 if test $? -ne 0; then
238         DOCBOOK2HTML=
239 fi
240 AM_CONDITIONAL(MANUAL_HTML, test -n "$DOCBOOK2HTML")
241
242 DOCBOOK2PS=`which docbook2ps 2> /dev/null`
243 if test $? -ne 0; then
244         DOCBOOK2PS=
245 fi
246 AM_CONDITIONAL(MANUAL_PS, test -n "$DOCBOOK2PS")
247
248 if test -n "$DOCBOOK2TXT" -o -n "$DOCBOOK2HTML" -o -n "$DOCBOOK2PS" \
249         -o -n "$SAXON" -o -n "$SAXONJAR"; then
250         ac_cv_enable_manual="yes"
251 else
252         ac_cv_enable_manual="no"
253 fi
254
255 AM_CONDITIONAL(BUILD_MANUAL, test x"$ac_cv_enable_manual" = xyes)
256
257 dnl Set PACKAGE_DATA_DIR in config.h.
258 if test "x${datarootdir}" = 'x${prefix}/share'; then
259         if test "x${prefix}" = "xNONE"; then
260                 AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}",[PACKAGE_DATA_DIR])
261         else
262                 AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/share/${PACKAGE}",[PACKAGE_DATA_DIR])
263         fi
264 else
265         AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${datarootdir}/${PACKAGE}",[PACKAGE_DATA_DIR])
266 fi
267
268 AC_CHECK_LIB(xpg4, setlocale)
269
270 SM_LIBS=""
271 dnl Check for LibSM
272 AC_ARG_ENABLE(libsm,
273         [  --disable-libsm    disable libSM support for session management.],
274         [ac_cv_enable_libsm=$enableval], [ac_cv_enable_libsm=yes])
275 AC_MSG_CHECKING([whether to use LibSM])
276 if test x"$ac_cv_enable_libsm" = xyes; then
277         AC_MSG_RESULT(yes)
278         AC_CHECK_LIB(SM, SmcSaveYourselfDone,
279                 [SM_LIBS="$X_LIBS -lSM -lICE"],ac_cv_enable_libsm=no,
280                 $X_LIBS -lICE)
281         AC_CHECK_HEADERS(X11/SM/SMlib.h,,ac_cv_enable_libsm=no)
282         if test x"$ac_cv_enable_libsm" = xyes; then
283                 AC_DEFINE(HAVE_LIBSM, 1, [Define to 1 if you have libSM installed])
284         else
285                 AC_MSG_RESULT(not found)
286                 AC_MSG_WARN([*** LibSM will not be supported ***])
287         fi
288 else
289         AC_MSG_RESULT(no)
290 fi
291 AC_SUBST(SM_LIBS)
292
293 dnl for GThread support (currently disabled)
294 dnl AC_ARG_ENABLE(threads,
295 dnl     [  --enable-threads        Enable multithread support [default=no]],
296 dnl     [use_threads=$enableval], [use_threads=no])
297
298 AC_MSG_CHECKING([whether to use threads])
299 if test x"$use_threads" = xyes ; then
300         AC_MSG_RESULT(yes)
301         if test ! -z `$GLIB_CONFIG --help 2>&1 |grep 'gthread'` ; then
302                 CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags gthread`"
303                 LIBS="$LIBS `$GLIB_CONFIG --libs gthread`"
304                 AC_DEFINE(USE_THREADS, 1, Whether to use multithread or not)
305         else
306                 AC_MSG_ERROR([Sylpheed requires GThread from GLib to use threading.])
307         fi
308 else
309         AC_MSG_RESULT(no)
310 fi
311
312 dnl Check for d_type member in struct dirent
313 AC_MSG_CHECKING([whether struct dirent has d_type member])
314 AC_CACHE_VAL(ac_cv_dirent_d_type,[
315         AC_TRY_COMPILE([#include <dirent.h>],
316                        [struct dirent d; d.d_type = DT_REG;],
317                        ac_cv_dirent_d_type=yes, ac_cv_dirent_d_type=no)
318 ])
319 AC_MSG_RESULT($ac_cv_dirent_d_type)
320 if test $ac_cv_dirent_d_type = yes; then
321         AC_DEFINE(HAVE_DIRENT_D_TYPE, 1,
322                   Define if `struct dirent' has `d_type' member.)
323 fi
324
325 # Check whether mkdir does not take the permission argument.
326 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
327
328 dnl Checks for header files.
329 AC_HEADER_DIRENT
330 AC_HEADER_STDC
331 AC_HEADER_SYS_WAIT
332 AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h \
333                  sys/param.h sys/utsname.h sys/select.h \
334                  wchar.h wctype.h locale.h netdb.h)
335 AC_CHECK_HEADER([execinfo.h], [AC_DEFINE(HAVE_BACKTRACE,1,[Has backtrace*() needed for retrieving stack traces])])
336 AC_SEARCH_LIBS(backtrace_symbols, [execinfo])
337
338 dnl alf - Check for apache installation f*ck up. apache may also install an 
339 dnl fnmatch, which includes their own regex stuff if USE_HSREGEX is defined
340 AC_TRY_COMPILE([#include <stdlib.h>
341                 #include <fnmatch.h>],
342         [int x = USE_HSREGEX;],
343         ac_cv_have_apache_fnmatch=yes, ac_cv_have_apache_fnmatch=no)
344 if test $ac_cv_have_apache_fnmatch = yes; then
345         AC_DEFINE(HAVE_APACHE_FNMATCH, 1, Define if you need to work around apache regex/fnmatch !KLUDGE!)
346 fi
347 AC_MSG_CHECKING([whether to use Apache regex header kludge])
348 AC_MSG_RESULT($ac_cv_have_apache_fnmatch)
349
350 dnl Checks for typedefs, structures, and compiler characteristics.
351 AC_C_CONST
352 AC_TYPE_OFF_T
353 AC_TYPE_PID_T
354 AC_TYPE_SIZE_T
355 AC_STRUCT_TM
356
357 dnl AC_CHECK_TYPE(wint_t, unsigned int) does not work because wint_t
358 dnl may be defined only in wchar.h (this happens with gcc-2.96).
359 dnl So we need to use this extended macro.
360 CLAWS_CHECK_TYPE(wint_t, unsigned int,
361 [
362 #if HAVE_WCHAR_H
363 #include <wchar.h>
364 #endif
365 ], Define to `unsigned int' if <stddef.h> or <wchar.h> doesn't define.)
366
367 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF, Used to test for a u32 typedef)
368 AC_CHECK_SIZEOF(unsigned short, 2)
369 AC_CHECK_SIZEOF(unsigned int, 4)
370 AC_CHECK_SIZEOF(unsigned long, 4)
371
372 dnl Checks for library functions.
373 AC_FUNC_ALLOCA
374 AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr strchr \
375                uname flock lockf inet_aton inet_addr \
376                fchmod mkstemp truncate getuid regcomp)
377
378 AC_CHECK_FUNCS(fgets_unlocked fwrite_unlocked)
379
380 dnl *****************
381 dnl ** common code **
382 dnl *****************
383
384 dnl check for glib
385 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.6 gmodule-2.0 >= 2.6 gobject-2.0 >= 2.6 gthread-2.0 >= 2.6)
386       
387 GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
388 AC_SUBST(GLIB_GENMARSHAL)
389
390 AC_SUBST(GLIB_CFLAGS)
391 AC_SUBST(GLIB_LIBS)
392
393 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
394 syl_save_LIBS=$LIBS
395 LIBS="$LIBS $GTK_LIBS"
396 AC_CHECK_FUNCS(bind_textdomain_codeset)
397 LIBS=$syl_save_LIBS
398
399 dnl check for IPv6 option
400 AC_ARG_ENABLE(ipv6,
401         [  --disable-ipv6           disable build IPv6 support],
402         [ac_cv_enable_ipv6=$enableval], [ac_cv_enable_ipv6=yes])
403
404 dnl automated checks for IPv6 support.
405 AC_MSG_CHECKING([whether to use IPv6])
406 if test x"$ac_cv_enable_ipv6" = xyes; then
407         AC_MSG_RESULT(yes)
408         AC_MSG_CHECKING([for IPv6 support])
409         AC_CACHE_VAL(ac_cv_ipv6,[
410                 AC_TRY_COMPILE([#define INET6
411                                 #include <sys/types.h>
412                                 #include <netinet/in.h>],
413                         [int x = IPPROTO_IPV6; struct in6_addr a;],
414                         ac_cv_ipv6=yes, ac_cv_ipv6=no)
415         ])
416         AC_MSG_RESULT($ac_cv_ipv6)
417         if test $ac_cv_ipv6 = yes; then
418                 AC_DEFINE(INET6, 1, Define if you want IPv6 support.)
419         else
420                 AC_MSG_WARN(*** IPv6 will not be supported ***)
421                 ac_cv_enable_ipv6=no
422         fi
423 else
424         AC_MSG_RESULT(no)
425 fi
426
427 dnl GNUTLS
428 AC_MSG_CHECKING([whether to use GnuTLS])
429 AC_ARG_ENABLE(gnutls,    [  --enable-gnutls      enable GnuTLS support],
430             [ac_cv_enable_gnutls=$enableval], [ac_cv_enable_gnutls=yes])
431
432 AC_MSG_RESULT($ac_cv_enable_gnutls)
433 if test "x$ac_cv_enable_gnutls" != "xno"; then
434   OCPPFLAGS="$CPPFLAGS"
435   OLDFLAGS="$LDFLAGS"
436   GNUTLS_LIBS=""
437   PKG_CHECK_MODULES(GNUTLS, gnutls >= 2.0.3,
438         [ac_cv_enable_gnutls=yes],
439         [ac_cv_enable_gnutls=no
440          echo "GnuTLS version >= 2.0.3 not found"])
441   if test "x$ac_cv_enable_gnutls" = "xyes"; then
442    AC_CHECK_HEADER(gpg-error.h,
443         [AC_CHECK_LIB(gpg-error, gpg_strerror,,
444                 [ac_cv_enable_gnutls=no])
445         ],[ac_cv_enable_gnutls=no])
446   fi
447   if test "x$ac_cv_enable_gnutls" = "xyes"; then
448    GCRYPT_LIBS="-lgpg-error"
449    AC_CHECK_HEADER(gcrypt.h,
450         [AC_CHECK_LIB(gcrypt, gcry_control,,
451                 [ac_cv_enable_gnutls=no])
452         ],[ac_cv_enable_gnutls=no])
453   fi
454   if test "x$ac_cv_enable_gnutls" = "xyes"; then
455         if test x"$platform_win32" = "xyes"; then
456                 GNUTLS_LIBS="-lgnutls -lgcrypt ${GCRYPT_LIBS}"
457         else
458                 GNUTLS_LIBS="-lgnutls -lgcrypt -lz ${GCRYPT_LIBS}"
459         fi
460   fi
461 else
462    CPPFLAGS="$OCPPFLAGS"
463    LDFLAGS="$OLDFLAGS"
464 fi
465
466 if test "x$ac_cv_enable_gnutls" = "xyes"; then
467   AC_DEFINE([USE_GNUTLS],1, [Define to use GnuTLS])
468 else
469   GNUTLS_LIBS=""
470 fi
471 AC_SUBST(GNUTLS_LIBS)
472
473 dnl password encryption
474 OLDLIBS=$LIBS
475 LIBS=
476 case $host_os in
477         *dragonfly*)
478                 AC_SEARCH_LIBS(encrypt, cipher, [], AC_MSG_ERROR(['encrypt'-function not found.]))
479         ;;
480         *)
481                 AC_SEARCH_LIBS(encrypt, crypt, [], AC_MSG_ERROR(['encrypt'-function not found.]))
482         ;;
483 esac
484 CRYPT_LIBS=$LIBS
485 AC_SUBST(CRYPT_LIBS)
486 LIBS=$OLDLIBS
487
488 AC_ARG_WITH(passcrypt-key, [  --with-passcrypt-key=KEY     Key used to encode passwords (8 byte string)],
489             with_passcrypt_key="$withval", with_passcrypt_key="passkey0")
490 AC_SUBST(PASSCRYPT_KEY, $with_passcrypt_key)
491
492 dnl RC dir (will be default at a certain point in time)
493 AC_ARG_WITH(config-dir,    [  --with-config-dir=RCDIR      Local configuration dir (default: .claws-mail)],
494               ac_cv_with_config_dir="$withval", ac_cv_with_config_dir=".claws-mail")
495 if test x"$ac_cv_with_config_dir" = x""; then
496         ac_cv_with_config_dir=".claws-mail"
497 fi 
498 AC_DEFINE_UNQUOTED(CFG_RC_DIR, "$ac_cv_with_config_dir", Configuration directory)
499
500 dnl ************************
501 dnl ** GTK user interface **
502 dnl ************************
503
504 dnl Checks for GTK
505 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.10)
506
507 dnl --disable-deprecated switch for GTK2 purification
508 AC_ARG_ENABLE(deprecated, [  --disable-deprecated  disable deprecated GTK functions. ],
509                           [GTK_CFLAGS="$GTK_CFLAGS -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"], [])
510
511 AC_SUBST(GTK_CFLAGS)
512 AC_SUBST(GTK_LIBS)
513
514 dnl enchant is used for spell checking
515 AC_MSG_CHECKING([whether to use enchant])
516 AC_ARG_ENABLE(enchant,
517         [  --disable-enchant         disable enchant support],
518         [ac_cv_enable_enchant=$enableval], [ac_cv_enable_enchant=yes])
519 AC_MSG_RESULT($ac_cv_enable_enchant)
520 if test $ac_cv_enable_enchant = yes; then
521         PKG_CHECK_MODULES(ENCHANT, enchant >= 1.0.0,
522         [
523                 AC_DEFINE(USE_ENCHANT, 1, enchant)
524                 echo "Building with enchant"
525                 ac_cv_enable_enchant=yes
526                 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags enchant`"
527         ],
528         [
529                 echo "Building without enchant-notification"
530                 ac_cv_enable_enchant=no
531         ])
532         AC_SUBST(ENCHANT_CFLAGS)
533         AC_SUBST(ENCHANT_LIBS)
534 fi
535
536 dnl want crash dialog
537 AC_ARG_ENABLE(crash-dialog,
538         [  --enable-crash-dialog   Enable crash dialog [default=no]],
539         [ac_cv_enable_crash_dialog=$enableval], [ac_cv_enable_crash_dialog=no])
540 if test $ac_cv_enable_crash_dialog = yes; then
541 dnl check if GDB is somewhere
542         AC_CHECK_PROG(ac_cv_enable_crash_dialog, gdb, yes, no)
543         AC_MSG_CHECKING([whether to use crash dialog])
544         if test $ac_cv_enable_crash_dialog = yes; then
545                 AC_DEFINE(CRASH_DIALOG, 1, Pop up crash dialog)
546         fi
547         AC_MSG_RESULT($ac_cv_enable_crash_dialog)
548 fi
549
550 dnl generic umpc
551 AC_ARG_ENABLE(generic-umpc,
552         [  --enable-generic-umpc   Enable generic UMPC code [default=no]],
553         [ac_cv_enable_generic_umpc=$enableval], [ac_cv_enable_generic_umpc=no])
554 if test $ac_cv_enable_generic_umpc = yes; then
555         AC_DEFINE(GENERIC_UMPC, 1, Generic UMPC code)
556         AC_MSG_RESULT($ac_cv_enable_generic_umpc)
557 fi
558
559 dnl Maemo platform
560 AC_ARG_ENABLE(maemo,
561         [  --enable-maemo   build for the Maemo platform [default=no]],
562         [ac_cv_enable_maemo=$enableval], [ac_cv_enable_maemo=no])
563 if test $ac_cv_enable_maemo = yes; then
564         PKG_CHECK_MODULES(MAEMO, libosso hildon-libs hildon-fm gnome-vfs-2.0, ac_cv_enable_maemo=yes,
565                   ac_cv_enable_maemo=no)
566         AC_SUBST(MAEMO_CFLAGS)
567         AC_SUBST(MAEMO_LIBS)
568         if test $ac_cv_enable_maemo = no; then
569                 #test for chinook
570                 PKG_CHECK_MODULES(MAEMO, libosso hildon-1 hildon-fm-2 gnome-vfs-2.0 hal, ac_cv_enable_maemo=yes,
571                           ac_cv_enable_maemo=no)
572                 AC_SUBST(MAEMO_CFLAGS)
573                 AC_SUBST(MAEMO_LIBS)
574                 if test $ac_cv_enable_maemo = no; then
575                         AC_MSG_ERROR(one of libosso hildon-libs hildon-fm hildon-1 hildon-fm-2 not found)
576                 else
577                         AC_DEFINE(MAEMO, 1, Build for maemo)
578                         AC_DEFINE(CHINOOK, 1, Maemo chinook)
579                         AC_DEFINE(GENERIC_UMPC, 1, Generic UMPC code)
580                         ac_cv_enable_generic_umpc=yes
581                 fi
582         else
583                 AC_DEFINE(MAEMO, 1, Build for maemo)
584                 AC_DEFINE(GENERIC_UMPC, 1, Generic UMPC code)
585                 ac_cv_enable_generic_umpc=yes
586         fi
587 fi
588
589 PKG_CHECK_MODULES(CONIC, conic, ac_cv_enable_conic=yes,
590           ac_cv_enable_conic=no)
591 AC_SUBST(CONIC_CFLAGS)
592 AC_SUBST(CONIC_LIBS)
593 if test $ac_cv_enable_conic = yes; then
594         AC_DEFINE(CONIC, 1, Have conic lib)
595 fi
596
597 dnl Check for X-Face support
598 AC_ARG_ENABLE(compface,
599         [  --disable-compface      disable compface (X-Face) support],
600         [ac_cv_enable_compface=$enableval], [ac_cv_enable_compface=yes])
601 AC_MSG_CHECKING([whether to use compface])
602 if test x"$ac_cv_enable_compface" = xyes; then
603         AC_MSG_RESULT(yes)
604         AC_CHECK_LIB(compface, uncompface, 
605                 [AC_DEFINE(HAVE_LIBCOMPFACE, 1, Define if you want compface support.)],
606                 [ac_cv_enable_compface=no])
607         if test x"$ac_cv_enable_compface" = xyes; then
608                 COMPFACE_LIBS="-lcompface"
609         else
610                 COMPFACE_LIBS=""
611         fi
612         AC_SUBST(COMPFACE_LIBS)
613 else
614         AC_MSG_RESULT(no)
615 fi
616
617 dnl check for pthread support
618 AC_ARG_ENABLE(pthread,
619         [  --disable-pthread           disable pthread support],
620         [ac_cv_enable_pthread=$enableval], [ac_cv_enable_pthread=yes])
621 AC_MSG_CHECKING([whether to use pthread])
622 if test x$ac_cv_enable_pthread = xno; then
623         AC_MSG_RESULT(no)
624 else
625         AC_MSG_RESULT(yes)
626
627         # For W32 we need to use a special ptrhead lib. In this case we can't
628         # use AC_CHECK_LIB because it has no means of checking for a
629         # library installed under a different name.  Checking for the
630         # header is okay.
631         if test -n "${pthread_name}" ; then
632            ac_cv_enable_pthread=yes
633         else
634         AC_CHECK_LIB(pthread, pthread_create, :, ac_cv_enable_pthread=no)
635         fi
636         AC_CHECK_HEADERS(pthread.h, :, ac_cv_enable_pthread=no)
637
638         if test x$ac_cv_enable_pthread = xyes; then
639                 AC_DEFINE(USE_PTHREAD, 1, Define if you have pthread)
640                 if test -z "${pthread_name}" ; then
641                 PTHREAD_LIBS="-lpthread"
642         fi
643         fi
644
645 fi
646 AC_SUBST(PTHREAD_LIBS)
647
648 dnl
649 dnl Check whether we need to pass -lresolv
650 dnl We know that we don't need it for W32.
651 dnl
652 if test x$os_win32 = xno; then
653   t_oldLibs="$LIBS"
654   LIBS="$LIBS"
655   ac_cv_var__res_options=no
656   AC_TRY_LINK([#include <sys/types.h>
657              #include <sys/socket.h>
658              #include <netinet/in.h>
659              #include <arpa/nameser.h>
660              #include <resolv.h>],
661                 [_res.options = RES_INIT;],
662                 ac_cv_var__res_options=yes);
663   if test "$ac_cv_var__res_options" != "yes"; then
664         LIBRESOLV="-lresolv"
665   fi
666   LIBS="$t_oldLibs"
667
668   if test "x$LIBRESOLV" = "x"; then
669         AC_CHECK_LIB(resolv, res_query, [LIBRESOLV=-lresolv])
670         LIBS="$t_oldLibs"
671   fi
672 fi
673 AC_SUBST(LIBRESOLV)
674
675 LIBS="$LIBS $LIBRESOLV"
676                  
677 dnl for LDAP support in addressbook
678 dnl no check for libraries; dynamically loaded
679 AC_ARG_ENABLE(ldap,
680         [  --disable-ldap         disable LDAP support],
681         [ac_cv_enable_ldap=$enableval], [ac_cv_enable_ldap=yes])
682 AC_MSG_CHECKING([whether to use LDAP])
683 if test x"$ac_cv_enable_ldap" = xno; then
684         AC_MSG_RESULT(no)
685 elif test x"$ac_cv_enable_ldap" = xyes -a x"$ac_cv_enable_pthread" = xno; then
686         AC_MSG_RESULT(no - LDAP support needs pthread support)
687
688         ac_cv_enable_ldap=no
689 else
690         AC_MSG_RESULT(yes)
691
692         dnl check for available libraries, and pull them in
693         AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="$LDAP_LIBS -lresolv")
694         AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket")
695         AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
696         AC_CHECK_LIB(lber, ber_get_tag, LDAP_LIBS="$LDAP_LIBS -llber",,
697                      $LDAP_LIBS)
698
699         AC_CHECK_HEADERS(ldap.h lber.h,
700                          [ ac_cv_enable_ldap=yes ],
701                          [ ac_cv_enable_ldap=no ])
702
703         if test "$ac_cv_enable_ldap" = yes; then
704                 AC_CHECK_LIB(ldap, ldap_open,
705                              [ ac_cv_enable_ldap=yes ],
706                              [ ac_cv_enable_ldap=no ],
707                              $LDAP_LIBS)
708
709                 AC_CHECK_LIB(ldap, ldap_start_tls_s,
710                              [ ac_cv_have_tls=yes ],
711                              [ ac_cv_have_tls=no ])
712
713         fi
714
715         AC_MSG_CHECKING([whether ldap library is available])
716         AC_MSG_RESULT($ac_cv_enable_ldap)
717
718         AC_MSG_CHECKING([whether TLS library is available])
719         AC_MSG_RESULT($ac_cv_have_tls)
720
721         if test "$ac_cv_enable_ldap" = yes; then
722                 AC_DEFINE(USE_LDAP, 1, Define if you want LDAP support in addressbook.)
723                 LDAP_LIBS="$LDAP_LIBS -lldap"
724                 AC_SUBST(LDAP_LIBS)
725                 if test "$ac_cv_have_tls" = yes; then
726                         AC_DEFINE(USE_LDAP_TLS, 1, Define if you want LDAP TLS support in addressbook.)
727                 fi
728                 dnl As of OpenLDAP API version 3000 a number of functions has
729                 dnl been deprecated. As Claws-mail compiles and runs on many
730                 dnl platforms and many versions of OpenLDAP we need to be able
731                 dnl to switch between the old and new API because new API has
732                 dnl added new functions replacing old ones and at the same time
733                 dnl old functions has been changed.
734                 dnl If cross-compiling defaults to enable deprecated features
735                 dnl for maximum portability
736                 AC_MSG_CHECKING([The API version of OpenLDAP])
737                 AC_RUN_IFELSE(
738                         [AC_LANG_PROGRAM(
739                          [#include <ldap.h>],
740                          [if (LDAP_API_VERSION >= 3000)
741                                         return 1
742                         ])],
743                         [AC_MSG_RESULT([version < 3000])
744                          AC_DEFINE(OPEN_LDAP_API_AT_LEAST_3000, 0, Define if OpenLDAP API is at least version 3000.)],
745                         [AC_MSG_RESULT([version >= 3000])
746                          AC_DEFINE(OPEN_LDAP_API_AT_LEAST_3000, 1, Define if OpenLDAP API is at least version 3000.)],
747                         [AC_MSG_RESULT([Enabling deprecated features in OpenLDAP])
748                          AC_DEFINE(OPEN_LDAP_API_AT_LEAST_3000, 0, Define if OpenLDAP API is at least version 3000.)
749                          AC_DEFINE(LDAP_DEPRECATED, 1, Define to activate deprecated features in OpenLDAP)]
750                 )
751         fi
752 fi
753
754 dnl for JPilot support in addressbook
755 dnl no check for libraries; these are dynamically loaded
756 AC_ARG_ENABLE(jpilot,
757         [  --disable-jpilot         disable JPilot support],
758         [ac_cv_enable_jpilot=$enableval], [ac_cv_enable_jpilot=yes])
759 AC_MSG_CHECKING([whether to use JPilot])
760 if test "$ac_cv_enable_jpilot" = yes; then
761         AC_MSG_RESULT(yes)
762         AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h pi-version.h,
763                          [ AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ],
764                          [ ac_cv_enable_jpilot=no ])
765         if test "$ac_cv_enable_jpilot" = no; then
766                 AC_CHECK_HEADERS(libpisock/pi-args.h libpisock/pi-appinfo.h libpisock/pi-address.h libpisock/pi-version.h,
767                                  [ ac_cv_enable_jpilot=yes
768                                    AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ])
769         fi
770
771         AC_CHECK_LIB(pisock, unpack_Address, [JPILOT_LIBS="-lpisock"], [JPILOT_LIBS="" ac_cv_enable_jpilot="no"])
772         if test x"$ac_cv_enable_jpilot" = xyes; then
773                 AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.)
774         else
775                 AC_MSG_NOTICE([JPilot support not available])
776         fi
777         AC_SUBST(JPILOT_LIBS)
778 else
779         AC_MSG_RESULT(no)
780 fi
781
782 dnl #######################################################################
783 dnl # Check for startup notification
784 dnl #######################################################################
785 AC_ARG_ENABLE(startup-notification, [  --disable-startup-notification    disable startup notification support],,enable_startup_notification=yes)
786
787 if test "x$enable_startup_notification" = "xyes"; then
788         PKG_CHECK_MODULES(STARTUP_NOTIFICATION, libstartup-notification-1.0 >= 0.5,
789         [
790                 AC_DEFINE(HAVE_STARTUP_NOTIFICATION, 1, [Define if we're using libstartup-notification.])
791                 echo "Building with libstartup-notification"
792                 enable_startup_notification=yes
793         ],
794         [
795                 echo "Building without libstartup-notification"
796                 enable_startup_notification=no
797         ])
798
799         AC_SUBST(STARTUP_NOTIFICATION_CFLAGS)
800         AC_SUBST(STARTUP_NOTIFICATION_LIBS)
801 fi
802
803 dnl #######################################################################
804 dnl # Check for D-Bus support
805 dnl #######################################################################
806 AC_ARG_ENABLE(dbus, [  --disable-dbus    disable dbus support],,enable_dbus=yes)
807
808 if test "x$enable_dbus" = "xyes"; then
809         PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.60, dbus-glib-1 >= 0.60],
810         [
811                 AC_DEFINE(HAVE_DBUS_GLIB, 1, [Define if glib bindings of D-Bus are available])
812                 enable_dbus_glib=yes
813         ],
814         [
815                 echo "D-Bus requirements not met. D-Bus support not activated."
816                 enable_dbus_glib=no
817         ])
818         AC_SUBST(DBUS_CFLAGS)
819         AC_SUBST(DBUS_LIBS)
820 fi
821
822 dnl #######################################################################
823 dnl # Check for NetworkManager support
824 dnl #######################################################################
825 if test x"$enable_dbus_glib" = xyes; then
826         AC_ARG_ENABLE(networkmanager-support, [  --disable-networkmanager-support  disable NetworkManager support],,enable_networkmanager_support=yes)
827         if test x"$enable_networkmanager_support" = xyes; then
828                 PKG_CHECK_MODULES(NETWORKMANAGER_SUPPORT, NetworkManager >= 0.6.2,
829                 [
830                         AC_DEFINE(HAVE_NETWORKMANAGER_SUPPORT, 1, [Define if NetworkManager support is to be included.])
831                         echo "Building with NetworkManager support"
832                         enable_networkmanager_support=yes
833                 ],
834                 [
835                         echo "NetworkManager not found."
836                         enable_networkmanager_support=no
837                 ])
838                 AC_SUBST(NETWORKMANAGER_SUPPORT_CFLAGS)
839         fi
840 else
841         echo "NetworkManager support deactivated as D-Bus requirements were not met."
842         enable_networkmanager_support=no
843 fi
844
845 dnl *************************
846 dnl ** section for plugins **
847 dnl *************************
848
849 PLUGINS=""
850
851 dnl --- Trayicon ---
852 AC_MSG_CHECKING([whether to build Trayicon plugin])
853 AC_ARG_ENABLE(trayicon-plugin,
854         [  --disable-trayicon-plugin         do not build System Tray Icon plugin],
855         [ac_cv_enable_trayicon_plugin=$enableval], [ac_cv_enable_trayicon_plugin=yes])
856 if test x"$ac_cv_enable_trayicon_plugin" = xyes; then
857         AC_MSG_RESULT(yes)
858         PLUGINS="trayicon $PLUGINS"
859 else
860         AC_MSG_RESULT(no)
861 fi
862 AM_CONDITIONAL(BUILD_TRAYICON_PLUGIN, test x"$ac_cv_enable_trayicon_plugin" = xyes)
863
864 dnl --- SpamAssassin ---
865 AC_MSG_CHECKING([whether to build SpamAssassin plugin])
866 AC_ARG_ENABLE(spamassassin-plugin,
867         [  --disable-spamassassin-plugin      do not build SpamAssassin plugin],
868         [ac_cv_enable_spamassassin_plugin=$enableval], [ac_cv_enable_spamassassin_plugin=yes])
869 if test x"$ac_cv_enable_spamassassin_plugin" = xyes; then
870         AC_MSG_RESULT(yes)
871         AC_SPAMASSASSIN
872         PLUGINS="spamassassin $PLUGINS"
873         AC_DEFINE(USE_SPAMASSASSIN_PLUGIN, 1, Define if spamassassin plugin is being built.)
874 else
875         AC_MSG_RESULT(no)
876 fi
877 AM_CONDITIONAL(BUILD_SPAMASSASSIN_PLUGIN, test x"$ac_cv_enable_spamassassin_plugin" = xyes)
878
879 dnl --- Bogofilter ---
880 AC_MSG_CHECKING([whether to build Bogofilter plugin])
881 AC_ARG_ENABLE(bogofilter-plugin,
882         [  --disable-bogofilter-plugin      do not build bogofilter plugin],
883         [ac_cv_enable_bogofilter_plugin=$enableval], [ac_cv_enable_bogofilter_plugin=yes])
884 if test x"$ac_cv_enable_bogofilter_plugin" = xyes; then
885         AC_MSG_RESULT(yes)
886         PLUGINS="bogofilter $PLUGINS"
887         AC_DEFINE(USE_BOGOFILTER_PLUGIN, 1, Define if bogofilter plugin is being built.)
888 else
889         AC_MSG_RESULT(no)
890 fi
891 AM_CONDITIONAL(BUILD_BOGOFILTER_PLUGIN, test x"$ac_cv_enable_bogofilter_plugin" = xyes)
892
893 dnl --- PGP/CORE ---
894 AC_MSG_CHECKING([whether to build PGP/CORE plugin])
895 AC_ARG_ENABLE(pgpcore-plugin,
896         [  --disable-pgpcore-plugin           do not build PGP/Core plugin],
897         [ac_cv_enable_pgpcore_plugin=$enableval], [ac_cv_enable_pgpcore_plugin=yes])
898 if test x"$ac_cv_enable_pgpcore_plugin" = xyes; then
899         AC_MSG_RESULT(yes)
900         AM_PATH_GPGME(1.0.0, AC_DEFINE(USE_GPGME, 1, Define if you use GPGME to support OpenPGP.),
901                       [ac_cv_enable_pgpcore_plugin=no])
902         if test x"$ac_cv_enable_pgpcore_plugin" = xyes; then
903                 PLUGINS="pgpcore $PLUGINS"
904                 AM_PATH_GPGME(1.1.1,
905                               AC_DEFINE(HAVE_GPGME_PKA_TRUST, 1,
906                                         [Define if GPGME supports PKA.]))
907                 #needed to get GPGME_LIBS and al correctly
908                 AM_PATH_GPGME(1.0.0, AC_DEFINE(USE_GPGME, 1, Define if you use GPGME to support OpenPGP.),
909                           [ac_cv_enable_pgpcore_plugin=no])
910         else
911                 AC_MSG_WARN([*** PGP/CORE plugin will not be built ***])
912         fi
913 else
914         AC_MSG_RESULT(no)
915 fi
916 AM_CONDITIONAL(BUILD_PGPCORE_PLUGIN, test x"$ac_cv_enable_pgpcore_plugin" = xyes)
917
918 AC_MSG_CHECKING([whether to build PGP/MIME plugin])
919 AC_ARG_ENABLE(pgpmime-plugin,
920         [  --disable-pgpmime-plugin           do not build PGP/MIME plugin],
921         [ac_cv_enable_pgpmime_plugin=$enableval], [ac_cv_enable_pgpmime_plugin=yes])
922 if test x"$ac_cv_enable_pgpmime_plugin" = xyes; then
923         AC_MSG_RESULT(yes)
924         if test x"$ac_cv_enable_pgpcore_plugin" = xyes; then
925                 PLUGINS="pgpmime $PLUGINS"
926         else
927                 AC_MSG_WARN([*** PGP/MIME plugin cannot be built ***])
928                 AC_MSG_WARN([*** without the PGP/CORE plugin     ***])
929         fi
930 else
931         AC_MSG_RESULT(no)
932 fi
933 AM_CONDITIONAL(BUILD_PGPMIME_PLUGIN, test x"$ac_cv_enable_pgpmime_plugin" = xyes)
934
935 AC_MSG_CHECKING([whether to build PGP/Inline plugin])
936 AC_ARG_ENABLE(pgpinline-plugin,
937         [  --disable-pgpinline-plugin           do not build PGP/Inline plugin],
938         [ac_cv_enable_pgpinline_plugin=$enableval], [ac_cv_enable_pgpinline_plugin=yes])
939 if test x"$ac_cv_enable_pgpinline_plugin" = xyes; then
940         AC_MSG_RESULT(yes)
941         if test x"$ac_cv_enable_pgpcore_plugin" = xyes; then
942                 PLUGINS="pgpinline $PLUGINS"
943         else
944                 AC_MSG_WARN([*** PGP/Inline plugin cannot be built ***])
945                 AC_MSG_WARN([*** without the PGP/CORE plugin     ***])
946         fi
947 else
948         AC_MSG_RESULT(no)
949 fi
950 AM_CONDITIONAL(BUILD_PGPINLINE_PLUGIN, test x"$ac_cv_enable_pgpinline_plugin" = xyes)
951
952 AC_MSG_CHECKING([whether to build S/Mime plugin])
953 AC_ARG_ENABLE(smime-plugin,
954         [  --disable-smime-plugin           do not build S/Mime plugin],
955         [ac_cv_enable_smime_plugin=$enableval], [ac_cv_enable_smime_plugin=yes])
956 if test x"$ac_cv_enable_smime_plugin" = xyes; then
957         AC_MSG_RESULT(yes)
958         if test x"$ac_cv_enable_pgpcore_plugin" = xyes; then
959                 PLUGINS="smime $PLUGINS"
960         else
961                 AC_MSG_WARN([*** S/Mime plugin cannot be built ***])
962                 AC_MSG_WARN([*** without the PGP/CORE plugin     ***])
963         fi
964 else
965         AC_MSG_RESULT(no)
966 fi
967 AM_CONDITIONAL(BUILD_SMIME_PLUGIN, test x"$ac_cv_enable_smime_plugin" = xyes)
968
969 dnl --- Dillo Viewer ---
970 AC_MSG_CHECKING([whether to build Dillo plugin])
971 AC_ARG_ENABLE(dillo-viewer-plugin,
972         [  --disable-dillo-viewer-plugin     do not build Dillo plugin for html mail rendering],
973         [ac_cv_enable_dillo_viewer_plugin=$enableval], [ac_cv_enable_dillo_viewer_plugin=yes])
974 if test x"$ac_cv_enable_dillo_viewer_plugin" = xyes; then
975         AC_MSG_RESULT(yes)
976         PLUGINS="dillo-viewer $PLUGINS"
977 else
978         AC_MSG_RESULT(no)
979 fi
980 AM_CONDITIONAL(BUILD_DILLO_VIEWER_PLUGIN, test x"$ac_cv_enable_dillo_viewer_plugin" = xyes)
981
982 dnl --- Demo ---
983 AC_ARG_ENABLE(demo-plugin,
984         [  --enable-demo-plugin              build demo plugin],
985         [ac_cv_enable_demo_plugin=$enableval], [ac_cv_enable_demo_plugin=no])
986 if test x"$ac_cv_enable_demo_plugin" = xyes; then
987         PLUGINS="demo $PLUGINS"
988 fi
989 AM_CONDITIONAL(BUILD_DEMO_PLUGIN, test x"$ac_cv_enable_demo_plugin" = xyes)
990
991 dnl Libetpan
992 AC_MSG_CHECKING([whether to use libetpan])
993 AC_ARG_ENABLE(libetpan,
994         [  --disable-libetpan           disable IMAP4/NNTP (libetpan) support],
995         [ac_cv_enable_libetpan=$enableval], [ac_cv_enable_libetpan=yes])
996 if test x"$ac_cv_enable_libetpan" = xyes; then
997         AC_MSG_RESULT(yes)
998         libetpan_result=no
999         AC_PATH_PROG(libetpanconfig, [libetpan-config])
1000         if test "x$libetpanconfig" != "x"; then
1001           CPPFLAGS="$CPPFLAGS `$libetpanconfig --cflags 2>/dev/null`"
1002           AC_CHECK_HEADER(libetpan/libetpan.h, [libetpan_result=yes])
1003           if test "x$libetpan_result" = "xyes"; then
1004             AC_MSG_CHECKING([whether libetpan-config hints compiles and links fine])
1005             LIBS="$LIBS `$libetpanconfig --libs 2>/dev/null`"
1006             AC_TRY_LINK([#include <libetpan/dbstorage.h>], [db_mailstorage_init(NULL, NULL);], [libetpan_result=yes], [libetpan_result=no])
1007             AC_MSG_RESULT([$libetpan_result])
1008           fi
1009         fi
1010         if test "x$libetpan_result" = "xyes"; then
1011            LIBETPAN_CPPFLAGS="`$libetpanconfig --cflags`"
1012            LIBETPAN_LIBS="`$libetpanconfig --libs`"
1013            LIBETPAN_STABLE=`$libetpanconfig --version | grep -v ^0`
1014            LIBETPAN_VERSION=`$libetpanconfig --version | sed "s/\.//g" | sed "s/-.*$//"`
1015            if test x"$LIBETPAN_STABLE" != "x"; then
1016                 LIBETPAN_VERSION="100"
1017            fi
1018            if test "$LIBETPAN_VERSION" -lt "057"; then
1019                 AC_MSG_RESULT([*** Claws Mail requires libetpan 0.57 or newer. See http://www.etpan.org/])
1020                 AC_MSG_RESULT([*** You can use --disable-libetpan if you don't need IMAP4 and/or NNTP support.])
1021                 AC_MSG_ERROR([libetpan 0.57 not found])
1022            fi
1023            AC_SUBST(LIBETPAN_FLAGS)
1024            AC_SUBST(LIBETPAN_LIBS)
1025            AC_DEFINE(HAVE_LIBETPAN, 1, Define if you want IMAP and/or NNTP support.)
1026         else
1027            AC_MSG_RESULT([*** Claws Mail requires libetpan 0.57 or newer. See http://www.etpan.org/ ])
1028            AC_MSG_RESULT([*** You can use --disable-libetpan if you don't need IMAP4 and/or NNTP support.])
1029            AC_MSG_ERROR([libetpan 0.57 not found])
1030         fi
1031 else
1032         AC_MSG_RESULT(no)
1033 fi
1034 AM_CONDITIONAL(CLAWS_LIBETPAN, test "x$libetpan_result" = "xyes")
1035
1036 AC_MSG_CHECKING([whether to use valgrind])
1037 AC_ARG_ENABLE(valgrind,
1038         [  --disable-valgrind           disable valgrind support for debugging],
1039         [ac_cv_enable_valgrind=$enableval], [ac_cv_enable_valgrind=yes])
1040 if test x$ac_cv_enable_valgrind = xyes; then
1041         AC_MSG_RESULT(yes)
1042         PKG_CHECK_MODULES(VALGRIND, valgrind >= 2.4.0,
1043                           ac_cv_enable_valgrind=yes, ac_cv_enable_valgrind=no)
1044         if test x"$ac_cv_enable_valgrind" = xyes; then
1045                 AC_DEFINE(HAVE_VALGRIND, 1, Define if you want valgrind support)
1046         else
1047                 AC_MSG_RESULT(not found)
1048         fi
1049 else
1050         AC_MSG_RESULT(no)
1051 fi
1052 AM_CONDITIONAL(CLAWS_VALGRIND, test x"$ac_cv_enable_valgrind" = x"yes")
1053
1054 dnl ****************************
1055 dnl ** Final configure output **
1056 dnl ****************************
1057
1058 AC_OUTPUT([
1059 Makefile
1060 m4/Makefile
1061 po/Makefile.in
1062 src/common/version.h
1063 src/Makefile
1064 src/common/Makefile
1065 src/common/passcrypt.h
1066 src/gtk/Makefile
1067 src/etpan/Makefile
1068 src/plugins/Makefile
1069 src/plugins/demo/Makefile
1070 src/plugins/bogofilter/Makefile
1071 src/plugins/spamassassin/Makefile
1072 src/plugins/dillo_viewer/Makefile
1073 src/plugins/trayicon/Makefile
1074 src/plugins/pgpcore/Makefile
1075 src/plugins/pgpmime/Makefile
1076 src/plugins/pgpinline/Makefile
1077 src/plugins/smime/Makefile
1078 doc/Makefile
1079 doc/man/Makefile
1080 tools/Makefile
1081 config/Makefile
1082 manual/Makefile
1083 manual/dtd/Makefile
1084 manual/dist/Makefile
1085 manual/dist/pdf/Makefile
1086 manual/dist/ps/Makefile
1087 manual/dist/html/Makefile
1088 manual/dist/txt/Makefile
1089 manual/fr/Makefile
1090 manual/fr/dist/Makefile
1091 manual/fr/dist/pdf/Makefile
1092 manual/fr/dist/ps/Makefile
1093 manual/fr/dist/html/Makefile
1094 manual/fr/dist/txt/Makefile
1095 manual/pl/Makefile
1096 manual/pl/dist/Makefile
1097 manual/pl/dist/pdf/Makefile
1098 manual/pl/dist/ps/Makefile
1099 manual/pl/dist/html/Makefile
1100 manual/pl/dist/txt/Makefile
1101 manual/es/Makefile
1102 manual/es/dist/Makefile
1103 manual/es/dist/pdf/Makefile
1104 manual/es/dist/ps/Makefile
1105 manual/es/dist/html/Makefile
1106 manual/es/dist/txt/Makefile
1107 manual/de/Makefile
1108 manual/de/dist/Makefile
1109 manual/de/dist/pdf/Makefile
1110 manual/de/dist/ps/Makefile
1111 manual/de/dist/html/Makefile
1112 manual/de/dist/txt/Makefile
1113 claws-mail.pc
1114 ])
1115
1116 dnl Output the configuration summary
1117 echo ""
1118 echo "$PACKAGE $VERSION"
1119 echo ""
1120 echo "JPilot            : $ac_cv_enable_jpilot"
1121 echo "LDAP              : $ac_cv_enable_ldap"
1122 echo "gnuTLS            : $ac_cv_enable_gnutls"
1123 echo "iconv             : $am_cv_func_iconv"
1124 echo "compface          : $ac_cv_enable_compface"
1125 echo "IPv6              : $ac_cv_enable_ipv6"
1126 echo "enchant           : $ac_cv_enable_enchant"
1127 echo "IMAP4             : $ac_cv_enable_libetpan"
1128 echo "NNTP              : $ac_cv_enable_libetpan"
1129 echo "Crash dialog      : $ac_cv_enable_crash_dialog"
1130 echo "LibSM             : $ac_cv_enable_libsm"
1131 echo "DBUS              : $enable_dbus"
1132 echo "NetworkManager    : $enable_networkmanager_support"
1133 echo "Manual            : $ac_cv_enable_manual"
1134 echo "Plugins           : $PLUGINS"
1135 echo "Generic UMPC code : $ac_cv_enable_generic_umpc"
1136 echo "Maemo  build      : $ac_cv_enable_maemo"
1137 echo "Config dir        : $ac_cv_with_config_dir"
1138 echo ""
1139 echo "The binary will be installed in $prefix/bin"
1140 echo ""
1141 echo "Configure finished, type 'make' to build."