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