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