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