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