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