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