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