2007-03-21 [colin] 2.8.1cvs34
[claws.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
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=2
10 MINOR_VERSION=8
11 MICRO_VERSION=1
12 INTERFACE_AGE=0
13 BINARY_AGE=0
14 EXTRA_VERSION=34
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 dnl GNOME 2.x installed?
53 PKG_CHECK_MODULES(GNOME2, libgnome-2.0 >= 2.0, ac_enable_gnome2=yes, ac_enable_gnome2=no)
54 AM_CONDITIONAL(CLAWS_GNOME2, test x"$ac_enable_gnome2" = x"yes")
55
56 dnl libtool versioning
57 LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
58 LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
59 LT_REVISION=$INTERFACE_AGE
60 LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
61 AC_SUBST(LT_RELEASE)
62 AC_SUBST(LT_CURRENT)
63 AC_SUBST(LT_REVISION)
64 AC_SUBST(LT_AGE)
65
66 dnl Specify a header configuration file
67 AC_CONFIG_HEADERS(config.h)
68
69 AM_MAINTAINER_MODE
70
71 dnl Checks for programs.
72 dnl AC_ARG_PROGRAM
73 AC_PROG_CC
74 AC_ISC_POSIX
75 AC_PROG_INSTALL
76 AC_PROG_LN_S
77 AC_PROG_MAKE_SET
78 AC_PROG_CPP
79 dnl AC_PROG_RANLIB
80 AM_PROG_LEX
81 AC_PROG_YACC
82 AC_LIB_PREFIX
83 AC_LIBTOOL_WIN32_DLL
84 AC_LIBTOOL_RC
85 AC_PROG_LIBTOOL
86
87 CLAWS_ACLOCAL_INCLUDE(m4)
88   
89 dnl ******************************
90 dnl Checks for host
91 dnl Not needed anymore because we 
92 dnl do AC_CANONICAL_SYSTEM above
93 dnl ******************************
94 dnl AC_CANONICAL_HOST
95
96 dnl Copied from the official gtk+-2 configure.in
97 AC_MSG_CHECKING([for some Win32 platform])
98 case "$host" in
99   *-*-mingw*|*-*-cygwin*)
100     platform_win32=yes
101     LDFLAGS="$LDFLAGS -mwindows"
102     ;;
103   *)
104     platform_win32=no
105     ;;
106 esac
107 AC_MSG_RESULT([$platform_win32])
108 AM_CONDITIONAL(PLATFORM_WIN32, test x"$platform_win32" = x"yes")
109
110 AC_MSG_CHECKING([for native Win32])
111 case "$host" in
112   *-*-mingw*)
113     os_win32=yes
114     ;;
115   *)
116     os_win32=no
117     ;;
118 esac
119 AC_MSG_RESULT([$os_win32])
120 AM_CONDITIONAL(OS_WIN32, test x"$os_win32" = x"yes")
121
122 AC_MSG_CHECKING([for Cygwin])
123 case "$host" in
124   *-*-cygwin*)
125     env_cygwin=yes
126     ;;
127   *)
128     env_cygwin=no
129     ;;
130 esac
131 AC_MSG_RESULT([$env_cygwin])
132 AM_CONDITIONAL(CYGWIN, test x"$env_cygwin" = x"yes")
133
134 CFLAGS="$CFLAGS -Wall"
135
136 pthread_name=
137 case "$target" in
138 *-darwin*)
139         CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
140         ;;
141 *-*-mingw*)
142         # Note that we need to link to pthreadGC2 in all cases. This
143         # is because some locking is used even when pthread support is
144         # disabled.
145         pthread_name=pthreadGC2
146         CFLAGS="$CFLAGS -mms-bitfields"
147         LIBS="$LIBS -l${pthread_name} -lws2_32 -lregex"
148         ;;
149 esac
150   
151 dnl Checks for iconv
152 AM_ICONV
153
154 dnl
155 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
156 dnl
157 syl_save_LIBS=$LIBS
158 LIBS="$LIBS $GTK_LIBS"
159 AC_CHECK_FUNCS(bind_textdomain_codeset)
160 LIBS=$syl_save_LIBS
161
162 dnl for gettext
163 ALL_LINGUAS="bg ca cs de el en_GB es fi fr hr hu it ja ko nb nl pl pt_BR ru sk sr sv zh_CN zh_TW"
164 GETTEXT_PACKAGE=claws-mail
165 AC_SUBST(GETTEXT_PACKAGE)
166 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define text domain.])
167
168 AM_GNU_GETTEXT_VERSION([0.15])
169 AM_GNU_GETTEXT([external])
170
171 manualdir='${docdir}/manual'
172 AC_ARG_WITH(manualdir,
173         [  --with-manualdir=DIR    Manual directory],
174         [manualdir="$withval"])
175 AC_SUBST(manualdir)
176
177 AC_ARG_ENABLE(manual,
178         [  --disable-manual           Disable manual support],
179         [ac_cv_enable_manual=$enableval], [ac_cv_enable_manual=yes])
180
181 AM_CONDITIONAL(BUILD_MANUAL, test x"$ac_cv_enable_manual" = xyes)
182
183 dnl Set PACKAGE_DATA_DIR in config.h.
184 if test "x${datarootdir}" = 'x${prefix}/share'; then
185         if test "x${prefix}" = "xNONE"; then
186                 AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}",[PACKAGE_DATA_DIR])
187         else
188                 AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/share/${PACKAGE}",[PACKAGE_DATA_DIR])
189         fi
190 else
191         AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${datarootdir}/${PACKAGE}",[PACKAGE_DATA_DIR])
192 fi
193
194 AC_CHECK_LIB(xpg4, setlocale)
195
196 SM_LIBS=""
197 dnl Check for LibSM
198 AC_ARG_ENABLE(libsm,
199         [  --disable-libsm    Do not use libSM for session management.],
200         [ac_cv_enable_libsm=$enableval], [ac_cv_enable_libsm=yes])
201 AC_MSG_CHECKING([whether to use LibSM])
202 if test x"$ac_cv_enable_libsm" = xyes; then
203         AC_MSG_RESULT(yes)
204         AC_CHECK_LIB(SM, SmcSaveYourselfDone,
205                 [SM_LIBS="$X_LIBS -lSM -lICE"],ac_cv_enable_libsm=no,
206                 $X_LIBS -lICE)
207         AC_CHECK_HEADERS(X11/SM/SMlib.h,,ac_cv_enable_libsm=no)
208         if test x"$ac_cv_enable_libsm" = xyes; then
209                 AC_DEFINE(HAVE_LIBSM, 1, [Define to 1 if you have libSM installed])
210         else
211                 AC_MSG_RESULT(not found)
212                 AC_MSG_WARN([*** LibSM will not be supported ***])
213         fi
214 else
215         AC_MSG_RESULT(no)
216 fi
217 AC_SUBST(SM_LIBS)
218
219 dnl for GThread support (currently disabled)
220 dnl AC_ARG_ENABLE(threads,
221 dnl     [  --enable-threads        Enable multithread support [default=no]],
222 dnl     [use_threads=$enableval], [use_threads=no])
223
224 AC_MSG_CHECKING([whether to use threads])
225 if test x"$use_threads" = xyes ; then
226         AC_MSG_RESULT(yes)
227         if test ! -z `$GLIB_CONFIG --help 2>&1 |grep 'gthread'` ; then
228                 CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags gthread`"
229                 LIBS="$LIBS `$GLIB_CONFIG --libs gthread`"
230                 AC_DEFINE(USE_THREADS, 1, Whether to use multithread or not)
231         else
232                 AC_MSG_ERROR([Sylpheed requires GThread from GLib to use threading.])
233         fi
234 else
235         AC_MSG_RESULT(no)
236 fi
237
238 dnl Check for d_type member in struct dirent
239 AC_MSG_CHECKING([whether struct dirent has d_type member])
240 AC_CACHE_VAL(ac_cv_dirent_d_type,[
241         AC_TRY_COMPILE([#include <dirent.h>],
242                        [struct dirent d; d.d_type = DT_REG;],
243                        ac_cv_dirent_d_type=yes, ac_cv_dirent_d_type=no)
244 ])
245 AC_MSG_RESULT($ac_cv_dirent_d_type)
246 if test $ac_cv_dirent_d_type = yes; then
247         AC_DEFINE(HAVE_DIRENT_D_TYPE, 1,
248                   Define if `struct dirent' has `d_type' member.)
249 fi
250
251 # Check whether mkdir does not take the permission argument.
252 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
253
254 dnl Checks for header files.
255 AC_HEADER_DIRENT
256 AC_HEADER_STDC
257 AC_HEADER_SYS_WAIT
258 AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h \
259                  sys/param.h sys/utsname.h sys/select.h \
260                  wchar.h wctype.h locale.h netdb.h)
261
262 dnl alf - Check for apache installation f*ck up. apache may also install an 
263 dnl fnmatch, which includes their own regex stuff if USE_HSREGEX is defined
264 AC_TRY_COMPILE([#include <stdlib.h>
265                 #include <fnmatch.h>],
266         [int x = USE_HSREGEX;],
267         ac_cv_have_apache_fnmatch=yes, ac_cv_have_apache_fnmatch=no)
268 if test $ac_cv_have_apache_fnmatch = yes; then
269         AC_DEFINE(HAVE_APACHE_FNMATCH, 1, Define if you need to work around apache regex/fnmatch !KLUDGE!)
270 fi
271 AC_MSG_CHECKING([whether to use Apache regex header kludge])
272 AC_MSG_RESULT($ac_cv_have_apache_fnmatch)
273
274 dnl Checks for typedefs, structures, and compiler characteristics.
275 AC_C_CONST
276 AC_TYPE_OFF_T
277 AC_TYPE_PID_T
278 AC_TYPE_SIZE_T
279 AC_STRUCT_TM
280
281 dnl AC_CHECK_TYPE(wint_t, unsigned int) does not work because wint_t
282 dnl may be defined only in wchar.h (this happens with gcc-2.96).
283 dnl So we need to use this extended macro.
284 CLAWS_CHECK_TYPE(wint_t, unsigned int,
285 [
286 #if HAVE_WCHAR_H
287 #include <wchar.h>
288 #endif
289 ], Define to `unsigned int' if <stddef.h> or <wchar.h> doesn't define.)
290
291 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF, Used to test for a u32 typedef)
292 AC_CHECK_SIZEOF(unsigned short, 2)
293 AC_CHECK_SIZEOF(unsigned int, 4)
294 AC_CHECK_SIZEOF(unsigned long, 4)
295
296 dnl Checks for library functions.
297 AC_FUNC_ALLOCA
298 AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr strchr \
299                uname flock lockf inet_aton inet_addr \
300                fchmod mkstemp truncate getuid regcomp)
301
302 AC_CHECK_FUNCS(fgets_unlocked fwrite_unlocked)
303
304 dnl *****************
305 dnl ** common code **
306 dnl *****************
307
308 dnl check for glib
309 AM_PATH_GLIB_2_0(2.6.0,,
310         AC_MSG_ERROR(Test for GLIB failed. See the file 'INSTALL' for help.),
311         gmodule gobject gthread)
312
313 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
314 syl_save_LIBS=$LIBS
315 LIBS="$LIBS $GTK_LIBS"
316 AC_CHECK_FUNCS(bind_textdomain_codeset)
317 LIBS=$syl_save_LIBS
318
319 dnl check for IPv6 option
320 AC_ARG_ENABLE(ipv6,
321         [  --disable-ipv6           Disable IPv6 support],
322         [ac_cv_enable_ipv6=$enableval], [ac_cv_enable_ipv6=yes])
323
324 dnl automated checks for IPv6 support.
325 AC_MSG_CHECKING([whether to use IPv6])
326 if test x"$ac_cv_enable_ipv6" = xyes; then
327         AC_MSG_RESULT(yes)
328         AC_MSG_CHECKING([for IPv6 support])
329         AC_CACHE_VAL(ac_cv_ipv6,[
330                 AC_TRY_COMPILE([#define INET6
331                                 #include <sys/types.h>
332                                 #include <netinet/in.h>],
333                         [int x = IPPROTO_IPV6; struct in6_addr a;],
334                         ac_cv_ipv6=yes, ac_cv_ipv6=no)
335         ])
336         AC_MSG_RESULT($ac_cv_ipv6)
337         if test $ac_cv_ipv6 = yes; then
338                 AC_DEFINE(INET6, 1, Define if you want IPv6 support.)
339         else
340                 AC_MSG_WARN(*** IPv6 will not be supported ***)
341                 ac_cv_enable_ipv6=no
342         fi
343 else
344         AC_MSG_RESULT(no)
345 fi
346
347 dnl Check for OpenSSL
348 AC_ARG_ENABLE(openssl,
349         [  --disable-openssl    Do not use OpenSSL for SSL support.],
350         [ac_cv_enable_openssl=$enableval], [ac_cv_enable_openssl=yes])
351 AC_MSG_CHECKING([whether to use OpenSSL])
352 if test x"$ac_cv_enable_openssl" = xyes; then
353         AC_MSG_RESULT(yes)
354         PKG_CHECK_MODULES(OPENSSL, openssl >= 0.9.7, :, ac_cv_enable_openssl=no)
355         if test x$ac_cv_enable_openssl = xyes; then
356                 AC_DEFINE(USE_OPENSSL, 1, Define if you want OpenSSL support)
357         else
358                 AC_MSG_RESULT(not found)
359                 AC_MSG_WARN([*** OpenSSL will not be supported ***])
360         fi
361 else
362         AC_MSG_RESULT(no)
363 fi
364 AC_SUBST(OPENSSL_CFLAGS)
365 AC_SUBST(OPENSSL_LIBS)
366
367 dnl password encryption
368 OLDLIBS=$LIBS
369 LIBS=
370 case $host_os in
371         *dragonfly*)
372                 AC_SEARCH_LIBS(encrypt, cipher, [], AC_MSG_ERROR(['encrypt'-function not found.]))
373         ;;
374         *)
375                 AC_SEARCH_LIBS(encrypt, crypt, [], AC_MSG_ERROR(['encrypt'-function not found.]))
376         ;;
377 esac
378 CRYPT_LIBS=$LIBS
379 AC_SUBST(CRYPT_LIBS)
380 LIBS=$OLDLIBS
381
382 AC_ARG_WITH(passcrypt-key, [  --with-passcrypt-key=KEY     Key used to encode passwords (8 byte string)],
383             with_passcrypt_key="$withval", with_passcrypt_key="passkey0")
384 AC_SUBST(PASSCRYPT_KEY, $with_passcrypt_key)
385
386 dnl RC dir (will be default at a certain point in time)
387 AC_ARG_WITH(config-dir,    [  --with-config-dir=RCDIR      Local configuration dir (default: .claws-mail)],
388               ac_cv_with_config_dir="$withval", ac_cv_with_config_dir=".claws-mail")
389 if test x"$ac_cv_with_config_dir" = x""; then
390         ac_cv_with_config_dir=".claws-mail"
391 fi 
392 AC_DEFINE_UNQUOTED(CFG_RC_DIR, "$ac_cv_with_config_dir", Configuration directory)
393
394 dnl ************************
395 dnl ** GTK user interface **
396 dnl ************************
397
398 dnl Checks for GTK
399 AM_PATH_GTK_2_0(2.6.0,,
400         AC_MSG_ERROR(Test for GTK failed. See the file 'INSTALL' for help.))
401
402 dnl --disable-deprecated switch for GTK2 purification
403 AC_ARG_ENABLE(deprecated, [  --disable-deprecated  Disable deprecated GTK functions. ],
404                           [GTK_CFLAGS="$GTK_CFLAGS -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"], [])
405
406 AC_SUBST(GTK_CFLAGS)
407 AC_SUBST(GTK_LIBS)
408
409 dnl GNU/Aspell is used for spell checking
410 AC_ARG_ENABLE(aspell,
411         [  --disable-aspell         Disable GNU/aspell support [default=yes]],
412         [ac_cv_enable_aspell=$enableval], [ac_cv_enable_aspell=yes])
413 AC_MSG_CHECKING([whether to use GNU/aspell])
414 if test $ac_cv_enable_aspell = yes; then
415         AC_MSG_RESULT(yes)
416         AM_PATH_ASPELL(0.50, AC_DEFINE(USE_ASPELL, 1, Define if you use ASPELL to support spell checking),
417                       [use_aspell=no ac_cv_enable_aspell=no])
418 else
419         AC_MSG_RESULT(no)
420 fi
421
422 dnl want crash dialog
423 AC_ARG_ENABLE(crash-dialog,
424         [  --enable-crash-dialog   Enable crash dialog [default=no]],
425         [ac_cv_enable_crash_dialog=$enableval], [ac_cv_enable_crash_dialog=no])
426 if test $ac_cv_enable_crash_dialog = yes; then
427 dnl check if GDB is somewhere
428         AC_CHECK_PROG(ac_cv_enable_crash_dialog, gdb, yes, no)
429         AC_MSG_CHECKING([whether to use crash dialog])
430         if test $ac_cv_enable_crash_dialog = yes; then
431                 AC_DEFINE(CRASH_DIALOG, 1, Pop up crash dialog)
432         fi
433         AC_MSG_RESULT($ac_cv_enable_crash_dialog)
434 fi
435
436 dnl Maemo platform
437 AC_ARG_ENABLE(maemo,
438         [  --enable-maemo   Build for the Maemo platform [default=no]],
439         [ac_cv_enable_maemo=$enableval], [ac_cv_enable_maemo=no])
440 if test $ac_cv_enable_maemo = yes; then
441         PKG_CHECK_MODULES(MAEMO, libosso hildon-libs, ac_cv_enable_maemo=yes,
442                   ac_cv_enable_maemo=no)
443         AC_SUBST(MAEMO_CFLAGS)
444         AC_SUBST(MAEMO_LIBS)
445         if test $ac_cv_enable_maemo = no; then
446                 AC_MSG_ERROR(libosso or hildon-libs not found)
447         fi
448 fi
449
450 dnl Check for X-Face support
451 AC_ARG_ENABLE(compface,
452         [  --disable-compface      Do not use compface (X-Face)],
453         [ac_cv_enable_compface=$enableval], [ac_cv_enable_compface=yes])
454 AC_MSG_CHECKING([whether to use compface])
455 if test x"$ac_cv_enable_compface" = xyes; then
456         AC_MSG_RESULT(yes)
457         AC_CHECK_LIB(compface, uncompface, 
458                 [AC_DEFINE(HAVE_LIBCOMPFACE, 1, Define if you want compface support.)],
459                 [ac_cv_enable_compface=no])
460         if test x"$ac_cv_enable_compface" = xyes; then
461                 COMPFACE_LIBS="-lcompface"
462         else
463                 COMPFACE_LIBS=""
464         fi
465         AC_SUBST(COMPFACE_LIBS)
466 else
467         AC_MSG_RESULT(no)
468 fi
469
470 dnl check for pthread support
471 AC_ARG_ENABLE(pthread,
472         [  --disable-pthread           Disable pthread support],
473         [ac_cv_enable_pthread=$enableval], [ac_cv_enable_pthread=yes])
474 AC_MSG_CHECKING([whether to use pthread])
475 if test x$ac_cv_enable_pthread = xno; then
476         AC_MSG_RESULT(no)
477 else
478         AC_MSG_RESULT(yes)
479
480         # For W32 we need to use a special ptrhead lib. In this case we can't
481         # use AC_CHECK_LIB because it has no means of checking for a
482         # library installed under a different name.  Checking for the
483         # header is okay.
484         if test -n "${pthread_name}" ; then
485            ac_cv_enable_pthread=yes
486         else
487         AC_CHECK_LIB(pthread, pthread_create, :, ac_cv_enable_pthread=no)
488         fi
489         AC_CHECK_HEADERS(pthread.h, :, ac_cv_enable_pthread=no)
490
491         if test x$ac_cv_enable_pthread = xyes; then
492                 AC_DEFINE(USE_PTHREAD, 1, Define if you have pthread)
493                 if test -z "${pthread_name}" ; then
494                 PTHREAD_LIBS="-lpthread"
495         fi
496         fi
497
498 fi
499 AC_SUBST(PTHREAD_LIBS)
500
501 dnl
502 dnl Check whether we need to pass -lresolv
503 dnl We know that we don't need it for W32.
504 dnl
505 if test x$os_win32 = xno; then
506   t_oldLibs="$LIBS"
507   LIBS="$LIBS"
508   ac_cv_var__res_options=no
509   AC_TRY_LINK([#include <sys/types.h>
510              #include <sys/socket.h>
511              #include <netinet/in.h>
512              #include <arpa/nameser.h>
513              #include <resolv.h>],
514                 [_res.options = RES_INIT;],
515                 ac_cv_var__res_options=yes);
516   if test "$ac_cv_var__res_options" != "yes"; then
517         LIBRESOLV="-lresolv"
518   fi
519   LIBS="$t_oldLibs"
520
521   if test "x$LIBRESOLV" = "x"; then
522         AC_CHECK_LIB(resolv, res_query, [LIBRESOLV=-lresolv])
523         LIBS="$t_oldLibs"
524   fi
525 fi
526 AC_SUBST(LIBRESOLV)
527
528 LIBS="$LIBS $LIBRESOLV"
529                  
530 dnl for LDAP support in addressbook
531 dnl no check for libraries; dynamically loaded
532 AC_ARG_ENABLE(ldap,
533         [  --disable-ldap         Do not build LDAP support [default=yes]],
534         [ac_cv_enable_ldap=$enableval], [ac_cv_enable_ldap=yes])
535 AC_MSG_CHECKING([whether to use LDAP])
536 if test x"$ac_cv_enable_ldap" = xno; then
537         AC_MSG_RESULT(no)
538 elif test x"$ac_cv_enable_ldap" = xyes -a x"$ac_cv_enable_pthread" = xno; then
539         AC_MSG_RESULT(no - LDAP support needs pthread support)
540
541         ac_cv_enable_ldap=no
542 else
543         AC_MSG_RESULT(yes)
544
545         dnl check for available libraries, and pull them in
546         AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="$LDAP_LIBS -lresolv")
547         AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket")
548         AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
549         AC_CHECK_LIB(lber, ber_get_tag, LDAP_LIBS="$LDAP_LIBS -llber",,
550                      $LDAP_LIBS)
551
552         AC_CHECK_HEADERS(ldap.h lber.h,
553                          [ ac_cv_enable_ldap=yes ],
554                          [ ac_cv_enable_ldap=no ])
555
556         if test "$ac_cv_enable_ldap" = yes; then
557                 AC_CHECK_LIB(ldap, ldap_open,
558                              [ ac_cv_enable_ldap=yes ],
559                              [ ac_cv_enable_ldap=no ],
560                              $LDAP_LIBS)
561
562                 AC_CHECK_LIB(ldap, ldap_start_tls_s,
563                              [ ac_cv_have_tls=yes ],
564                              [ ac_cv_have_tls=no ])
565
566         fi
567
568         AC_MSG_CHECKING([whether ldap library is available])
569         AC_MSG_RESULT($ac_cv_enable_ldap)
570
571         AC_MSG_CHECKING([whether TLS library is available])
572         AC_MSG_RESULT($ac_cv_have_tls)
573
574         if test "$ac_cv_enable_ldap" = yes; then
575                 AC_DEFINE(USE_LDAP, 1, Define if you want LDAP support in addressbook.)
576                 LDAP_LIBS="$LDAP_LIBS -lldap"
577                 AC_SUBST(LDAP_LIBS)
578                 if test "$ac_cv_have_tls" = yes; then
579                         AC_DEFINE(USE_LDAP_TLS, 1, Define if you want LDAP TLS support in addressbook.)
580                 fi
581         fi
582 fi
583
584 dnl for JPilot support in addressbook
585 dnl no check for libraries; these are dynamically loaded
586 AC_ARG_ENABLE(jpilot,
587         [  --disable-jpilot         Enable JPilot support [default=yes]],
588         [ac_cv_enable_jpilot=$enableval], [ac_cv_enable_jpilot=yes])
589 AC_MSG_CHECKING([whether to use JPilot])
590 if test "$ac_cv_enable_jpilot" = yes; then
591         AC_MSG_RESULT(yes)
592         AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h pi-version.h,
593                          [ AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ],
594                          [ ac_cv_enable_jpilot=no ])
595         if test "$ac_cv_enable_jpilot" = no; then
596                 AC_CHECK_HEADERS(libpisock/pi-args.h libpisock/pi-appinfo.h libpisock/pi-address.h libpisock/pi-version.h,
597                                  [ ac_cv_enable_jpilot=yes
598                                    AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ])
599         fi
600
601         AC_CHECK_LIB(pisock, unpack_Address, [JPILOT_LIBS="-lpisock"], [JPILOT_LIBS="" ac_cv_enable_jpilot="no"])
602         if test x"$ac_cv_enable_jpilot" = xyes; then
603                 AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.)
604         else
605                 AC_MSG_NOTICE([JPilot support not available])
606         fi
607         AC_SUBST(JPILOT_LIBS)
608 else
609         AC_MSG_RESULT(no)
610 fi
611
612 dnl #######################################################################
613 dnl # Check for startup notification
614 dnl #######################################################################
615 AC_ARG_ENABLE(startup-notification, [  --disable-startup-notification    compile without startup notification support],,enable_startup_notification=yes)
616
617 if test "x$enable_startup_notification" = "xyes"; then
618         PKG_CHECK_MODULES(STARTUP_NOTIFICATION, libstartup-notification-1.0 >= 0.5,
619         [
620                 AC_DEFINE(HAVE_STARTUP_NOTIFICATION, 1, [Define if we're using libstartup-notification.])
621                 echo "Building with libstartup-notification"
622                 enable_startup_notification=yes
623         ],
624         [
625                 echo "Building without libstartup-notification"
626                 enable_startup_notification=no
627         ])
628
629         AC_SUBST(STARTUP_NOTIFICATION_CFLAGS)
630         AC_SUBST(STARTUP_NOTIFICATION_LIBS)
631 fi
632
633 dnl *************************
634 dnl ** section for plugins **
635 dnl *************************
636
637 PLUGINS=""
638
639 dnl --- Trayicon ---
640 AC_MSG_CHECKING([whether to build Trayicon plugin])
641 AC_ARG_ENABLE(trayicon-plugin,
642         [  --disable-trayicon-plugin         Do not build System Tray Icon plugin],
643         [ac_cv_enable_trayicon_plugin=$enableval], [ac_cv_enable_trayicon_plugin=yes])
644 if test x"$ac_cv_enable_trayicon_plugin" = xyes; then
645         AC_MSG_RESULT(yes)
646         PLUGINS="trayicon $PLUGINS"
647 else
648         AC_MSG_RESULT(no)
649 fi
650 AM_CONDITIONAL(BUILD_TRAYICON_PLUGIN, test x"$ac_cv_enable_trayicon_plugin" = xyes)
651
652 dnl --- SpamAssassin ---
653 AC_MSG_CHECKING([whether to build SpamAssassin plugin])
654 AC_ARG_ENABLE(spamassassin-plugin,
655         [  --disable-spamassassin-plugin      Build SpamAssassin plugin [default=yes]],
656         [ac_cv_enable_spamassassin_plugin=$enableval], [ac_cv_enable_spamassassin_plugin=yes])
657 if test x"$ac_cv_enable_spamassassin_plugin" = xyes; then
658         AC_MSG_RESULT(yes)
659         AC_SPAMASSASSIN
660         PLUGINS="spamassassin $PLUGINS"
661         AC_DEFINE(USE_SPAMASSASSIN_PLUGIN, 1, Define if spamassassin plugin is being build.)
662 else
663         AC_MSG_RESULT(no)
664 fi
665 AM_CONDITIONAL(BUILD_SPAMASSASSIN_PLUGIN, test x"$ac_cv_enable_spamassassin_plugin" = xyes)
666
667 dnl --- Bogofilter ---
668 AC_MSG_CHECKING([whether to build Bogofilter plugin])
669 AC_ARG_ENABLE(bogofilter-plugin,
670         [  --disable-bogofilter-plugin      Build bogofilter plugin [default=yes]],
671         [ac_cv_enable_bogofilter_plugin=$enableval], [ac_cv_enable_bogofilter_plugin=yes])
672 if test x"$ac_cv_enable_bogofilter_plugin" = xyes; then
673         AC_MSG_RESULT(yes)
674         PLUGINS="bogofilter $PLUGINS"
675         AC_DEFINE(USE_BOGOFILTER_PLUGIN, 1, Define if bogofilter plugin is being build.)
676 else
677         AC_MSG_RESULT(no)
678 fi
679 AM_CONDITIONAL(BUILD_BOGOFILTER_PLUGIN, test x"$ac_cv_enable_bogofilter_plugin" = xyes)
680
681 dnl --- PGP/CORE ---
682 AC_MSG_CHECKING([whether to build PGP/CORE plugin])
683 AC_ARG_ENABLE(pgpcore-plugin,
684         [  --disable-pgpcore-plugin           Do not build PGP/Core plugin],
685         [ac_cv_enable_pgpcore_plugin=$enableval], [ac_cv_enable_pgpcore_plugin=yes])
686 if test x"$ac_cv_enable_pgpcore_plugin" = xyes; then
687         AC_MSG_RESULT(yes)
688         AM_PATH_GPGME(1.0.0, AC_DEFINE(USE_GPGME, 1, Define if you use GPGME to support OpenPGP.),
689                       [ac_cv_enable_pgpcore_plugin=no])
690         if test x"$ac_cv_enable_pgpcore_plugin" = xyes; then
691                 PLUGINS="pgpcore $PLUGINS"
692                 AM_PATH_GPGME(1.1.1,
693                               AC_DEFINE(HAVE_GPGME_PKA_TRUST, 1,
694                                         [Define if GPGME supports PKA.]))
695                 #needed to get GPGME_LIBS and al correctly
696                 AM_PATH_GPGME(1.0.0, AC_DEFINE(USE_GPGME, 1, Define if you use GPGME to support OpenPGP.),
697                           [ac_cv_enable_pgpcore_plugin=no])
698         else
699                 AC_MSG_WARN([*** PGP/CORE plugin will not be built ***])
700         fi
701 else
702         AC_MSG_RESULT(no)
703 fi
704 AM_CONDITIONAL(BUILD_PGPCORE_PLUGIN, test x"$ac_cv_enable_pgpcore_plugin" = xyes)
705
706 AC_MSG_CHECKING([whether to build PGP/MIME plugin])
707 AC_ARG_ENABLE(pgpmime-plugin,
708         [  --disable-pgpmime-plugin           Do not build PGP/MIME plugin],
709         [ac_cv_enable_pgpmime_plugin=$enableval], [ac_cv_enable_pgpmime_plugin=yes])
710 if test x"$ac_cv_enable_pgpmime_plugin" = xyes; then
711         AC_MSG_RESULT(yes)
712         if test x"$ac_cv_enable_pgpcore_plugin" = xyes; then
713                 PLUGINS="pgpmime $PLUGINS"
714         else
715                 AC_MSG_WARN([*** PGP/MIME plugin cannot be built ***])
716                 AC_MSG_WARN([*** without the PGP/CORE plugin     ***])
717         fi
718 else
719         AC_MSG_RESULT(no)
720 fi
721 AM_CONDITIONAL(BUILD_PGPMIME_PLUGIN, test x"$ac_cv_enable_pgpmime_plugin" = xyes)
722
723 AC_MSG_CHECKING([whether to build PGP/Inline plugin])
724 AC_ARG_ENABLE(pgpinline-plugin,
725         [  --disable-pgpinline-plugin           Do not build PGP/Inline plugin],
726         [ac_cv_enable_pgpinline_plugin=$enableval], [ac_cv_enable_pgpinline_plugin=yes])
727 if test x"$ac_cv_enable_pgpinline_plugin" = xyes; then
728         AC_MSG_RESULT(yes)
729         if test x"$ac_cv_enable_pgpcore_plugin" = xyes; then
730                 PLUGINS="pgpinline $PLUGINS"
731         else
732                 AC_MSG_WARN([*** PGP/Inline plugin cannot be built ***])
733                 AC_MSG_WARN([*** without the PGP/CORE plugin     ***])
734         fi
735 else
736         AC_MSG_RESULT(no)
737 fi
738 AM_CONDITIONAL(BUILD_PGPINLINE_PLUGIN, test x"$ac_cv_enable_pgpinline_plugin" = xyes)
739
740 dnl --- Dillo Viewer ---
741 AC_MSG_CHECKING([whether to build Dillo plugin])
742 AC_ARG_ENABLE(dillo-viewer-plugin,
743         [  --disable-dillo-viewer-plugin     Do not build Dillo plugin for html mail rendering],
744         [ac_cv_enable_dillo_viewer_plugin=$enableval], [ac_cv_enable_dillo_viewer_plugin=yes])
745 if test x"$ac_cv_enable_dillo_viewer_plugin" = xyes; then
746         AC_MSG_RESULT(yes)
747         PLUGINS="dillo-viewer $PLUGINS"
748 else
749         AC_MSG_RESULT(no)
750 fi
751 AM_CONDITIONAL(BUILD_DILLO_VIEWER_PLUGIN, test x"$ac_cv_enable_dillo_viewer_plugin" = xyes)
752
753 dnl --- Demo ---
754 AC_ARG_ENABLE(demo-plugin,
755         [  --enable-demo-plugin              Build demo plugin [default=no]],
756         [ac_cv_enable_demo_plugin=$enableval], [ac_cv_enable_demo_plugin=no])
757 if test x"$ac_cv_enable_demo_plugin" = xyes; then
758         PLUGINS="demo $PLUGINS"
759 fi
760 AM_CONDITIONAL(BUILD_DEMO_PLUGIN, test x"$ac_cv_enable_demo_plugin" = xyes)
761
762 dnl --- ClamAV ---
763 AC_MSG_CHECKING([whether to build ClamAV plugin])
764 AC_ARG_ENABLE(clamav-plugin,
765         [  --disable-clamav-plugin           Do not build Clam AntiVirus plugin],
766         [ac_cv_enable_clamav_plugin=$enableval], [ac_cv_enable_clamav_plugin=yes])
767 if test x"$ac_cv_enable_clamav_plugin" = xyes; then
768         AC_MSG_RESULT(yes)
769         PKG_CHECK_MODULES(CLAMAV, libclamav, ac_cv_enable_clamav_plugin=yes,
770                           ac_cv_enable_clamav_plugin=no)
771         if test x"$ac_cv_enable_clamav_plugin" = xyes; then
772                 PLUGINS="clamav $PLUGINS"
773         else
774                 AC_MSG_RESULT(not found)
775                 AC_MSG_WARN([*** ClamAV plugin will not be built ***])
776         fi
777 else
778         AC_MSG_RESULT(no)
779 fi
780 AC_SUBST(CLAMAV_LIBS)
781 AM_CONDITIONAL(BUILD_CLAMAV_PLUGIN, test x"$ac_cv_enable_clamav_plugin" = xyes)
782
783 dnl Libetpan
784 AC_MSG_CHECKING([whether to use libetpan])
785 AC_ARG_ENABLE(libetpan,
786         [  --disable-libetpan           Do not compile IMAP4 support with libetpan],
787         [ac_cv_enable_libetpan=$enableval], [ac_cv_enable_libetpan=yes])
788 if test x"$ac_cv_enable_libetpan" = xyes; then
789         AC_MSG_RESULT(yes)
790         libetpan_result=no
791         AC_PATH_PROG(libetpanconfig, [libetpan-config])
792         if test "x$libetpanconfig" != "x"; then
793           CPPFLAGS="$CPPFLAGS `$libetpanconfig --cflags 2>/dev/null`"
794           AC_CHECK_HEADER(libetpan/libetpan.h, [libetpan_result=yes])
795           if test "x$libetpan_result" = "xyes"; then
796             AC_MSG_CHECKING([whether libetpan-config hints compiles and links fine])
797             LIBS="$LIBS `$libetpanconfig --libs 2>/dev/null`"
798             AC_TRY_LINK([#include <libetpan/dbstorage.h>], [db_mailstorage_init(NULL, NULL);], [libetpan_result=yes], [libetpan_result=no])
799             AC_MSG_RESULT([$libetpan_result])
800           fi
801         fi
802         if test "x$libetpan_result" = "xyes"; then
803            LIBETPAN_CPPFLAGS="`$libetpanconfig --cflags`"
804            LIBETPAN_LIBS="`$libetpanconfig --libs`"
805            LIBETPAN_VERSION=`$libetpanconfig --version | sed "s/\.//g" | sed "s/-.*$//"`
806            if test "$LIBETPAN_VERSION" -lt "048"; then
807                 AC_MSG_RESULT([*** Claws Mail requires libetpan 0.48 or newer. See http://www.etpan.org/])
808                 AC_MSG_RESULT([*** You can use --disable-libetpan if you don't need IMAP4 support.])
809                 AC_MSG_ERROR([libetpan 0.48 not found])
810            fi
811            AC_SUBST(LIBETPAN_FLAGS)
812            AC_SUBST(LIBETPAN_LIBS)
813            AC_DEFINE(HAVE_LIBETPAN, 1, Define if you want IMAP support.)
814         else
815            AC_MSG_RESULT([*** Claws Mail requires libetpan 0.48 or newer. See http://www.etpan.org/ ])
816            AC_MSG_RESULT([*** You can use --disable-libetpan if you don't need IMAP4 support.])
817            AC_MSG_ERROR([libetpan 0.48 not found])
818         fi
819 else
820         AC_MSG_RESULT(no)
821 fi
822 AM_CONDITIONAL(CLAWS_LIBETPAN, test "x$libetpan_result" = "xyes")
823
824
825 dnl Libgnomeprint
826 AC_MSG_CHECKING([whether to use libgnomeprint])
827 AC_ARG_ENABLE(gnomeprint,
828         [  --disable-gnomeprint         Do not use libgnomeprint for printing],
829         [ac_cv_enable_gnomeprint=$enableval], [ac_cv_enable_gnomeprint=yes])
830 if test x$ac_cv_enable_gnomeprint = xyes; then
831         AC_MSG_RESULT(yes)
832         PKG_CHECK_MODULES(GNOMEPRINT, libgnomeprint-2.2 libgnomeprintui-2.2,
833                           ac_cv_enable_gnomeprint=yes, ac_cv_enable_gnomeprint=no)
834         if test x"$ac_cv_enable_gnomeprint" = xyes; then
835                 AC_DEFINE(USE_GNOMEPRINT, 1, Define if you want libgnomeprint support)
836         else
837                 AC_MSG_RESULT(not found)
838                 AC_MSG_WARN([*** libgnomeprintui wasn't found    ***])
839                 AC_MSG_WARN([*** using built-in printing support ***])
840         fi
841 else
842         AC_MSG_RESULT(no)
843 fi
844 AM_CONDITIONAL(CLAWS_GNOMEPRINT, test x"$ac_cv_enable_gnomeprint" = x"yes")
845
846 AC_MSG_CHECKING([whether to use valgrind])
847 AC_ARG_ENABLE(valgrind,
848         [  --disable-valgrind           Do not use valgrind for debugging],
849         [ac_cv_enable_valgrind=$enableval], [ac_cv_enable_valgrind=yes])
850 if test x$ac_cv_enable_valgrind = xyes; then
851         AC_MSG_RESULT(yes)
852         PKG_CHECK_MODULES(VALGRIND, valgrind >= 2.4.0,
853                           ac_cv_enable_valgrind=yes, ac_cv_enable_valgrind=no)
854         if test x"$ac_cv_enable_valgrind" = xyes; then
855                 AC_DEFINE(HAVE_VALGRIND, 1, Define if you want valgrind support)
856         else
857                 AC_MSG_RESULT(not found)
858         fi
859 else
860         AC_MSG_RESULT(no)
861 fi
862 AM_CONDITIONAL(CLAWS_VALGRIND, test x"$ac_cv_enable_valgrind" = x"yes")
863
864 dnl ****************************
865 dnl ** Final configure output **
866 dnl ****************************
867
868 AC_OUTPUT([
869 Makefile
870 m4/Makefile
871 po/Makefile.in
872 src/common/version.h
873 src/Makefile
874 src/common/Makefile
875 src/common/passcrypt.h
876 src/gtk/Makefile
877 src/etpan/Makefile
878 src/plugins/Makefile
879 src/plugins/demo/Makefile
880 src/plugins/bogofilter/Makefile
881 src/plugins/spamassassin/Makefile
882 src/plugins/dillo_viewer/Makefile
883 src/plugins/trayicon/Makefile
884 src/plugins/trayicon/libeggtrayicon/Makefile
885 src/plugins/clamav/Makefile
886 src/plugins/pgpcore/Makefile
887 src/plugins/pgpmime/Makefile
888 src/plugins/pgpinline/Makefile
889 doc/Makefile
890 doc/man/Makefile
891 tools/Makefile
892 config/Makefile
893 manual/Makefile
894 manual/dtd/Makefile
895 manual/dist/Makefile
896 manual/dist/pdf/Makefile
897 manual/dist/ps/Makefile
898 manual/dist/html/Makefile
899 manual/dist/txt/Makefile
900 manual/fr/Makefile
901 manual/fr/dist/Makefile
902 manual/fr/dist/pdf/Makefile
903 manual/fr/dist/ps/Makefile
904 manual/fr/dist/html/Makefile
905 manual/fr/dist/txt/Makefile
906 manual/pl/Makefile
907 manual/pl/dist/Makefile
908 manual/pl/dist/pdf/Makefile
909 manual/pl/dist/ps/Makefile
910 manual/pl/dist/html/Makefile
911 manual/pl/dist/txt/Makefile
912 manual/es/Makefile
913 manual/es/dist/Makefile
914 manual/es/dist/pdf/Makefile
915 manual/es/dist/ps/Makefile
916 manual/es/dist/html/Makefile
917 manual/es/dist/txt/Makefile
918 claws-mail.pc
919 ])
920
921 dnl Output the configuration summary
922 echo ""
923 echo "$PACKAGE $VERSION"
924 echo ""
925 echo "JPilot        : $ac_cv_enable_jpilot"
926 echo "LDAP          : $ac_cv_enable_ldap"
927 echo "OpenSSL       : $ac_cv_enable_openssl"
928 echo "iconv         : $am_cv_func_iconv"
929 echo "compface      : $ac_cv_enable_compface"
930 echo "IPv6          : $ac_cv_enable_ipv6"
931 echo "GNU/aspell    : $ac_cv_enable_aspell"
932 echo "IMAP4         : $ac_cv_enable_libetpan"
933 echo "Crash dialog  : $ac_cv_enable_crash_dialog"
934 echo "Libgnomeprint : $ac_cv_enable_gnomeprint"
935 echo "LibSM         : $ac_cv_enable_libsm"
936 echo "Manual        : $ac_cv_enable_manual"
937 echo "Plugins       : $PLUGINS"
938 echo "Maemo  build  : $ac_cv_enable_maemo"
939 echo "Config dir    : $ac_cv_with_config_dir"
940 echo ""
941 echo "The binary will be installed in $prefix/bin"
942 echo ""
943 echo "Configure finished, type 'make' to build."