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