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