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