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