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