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