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