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