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