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