81f0b34ba9b86e30772a417580fbd8a29d5df07b
[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=12
12 INTERFACE_AGE=0
13 BINARY_AGE=0
14 EXTRA_VERSION=64
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 libgnomeprint installed?
57 PKG_CHECK_MODULES(GNOMEPRINT, libgnomeprint-2.2 libgnomeprintui-2.2, ac_enable_gnomeprint=yes, ac_enable_gnomeprint=no)
58 AM_CONDITIONAL(SYLPHEED_GNOMEPRINT, test x"$ac_enable_gnomeprint" = x"yes")
59 if test x$ac_enable_gnomeprint = xyes; then
60         AC_DEFINE(USE_GNOMEPRINT, 1, Define if you want libgnomeprint support)
61 fi
62
63 dnl Claws version
64 AC_DEFINE(CLAWS, 1, Compiling Claws branch of sylpheed)
65
66 dnl libtool versioning
67 LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
68 LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
69 LT_REVISION=$INTERFACE_AGE
70 LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
71 AC_SUBST(LT_RELEASE)
72 AC_SUBST(LT_CURRENT)
73 AC_SUBST(LT_REVISION)
74 AC_SUBST(LT_AGE)
75
76 dnl Specify a header configuration file
77 AC_CONFIG_HEADERS(config.h)
78
79 AM_MAINTAINER_MODE
80
81 dnl Checks for programs.
82 dnl AC_ARG_PROGRAM
83 AC_PROG_CC
84 AC_ISC_POSIX
85 AC_PROG_INSTALL
86 AC_PROG_LN_S
87 AC_PROG_MAKE_SET
88 AC_PROG_CPP
89 dnl AC_PROG_RANLIB
90 AM_PROG_LEX
91 AC_PROG_YACC
92 AC_PROG_LIBTOOL
93
94 SYLPHEED_ACLOCAL_INCLUDE(m4)
95   
96 dnl ******************************
97 dnl Checks for host
98 dnl ******************************
99 AC_CANONICAL_HOST
100
101 dnl Copied from the official gtk+-2 configure.in
102 AC_MSG_CHECKING([for some Win32 platform])
103 case "$host" in
104   *-*-mingw*|*-*-cygwin*)
105     platform_win32=yes
106     LDFLAGS="$LDFLAGS -mwindows"
107     ;;
108   *)
109     platform_win32=no
110     ;;
111 esac
112 AC_MSG_RESULT([$platform_win32])
113 AM_CONDITIONAL(PLATFORM_WIN32, test x"$platform_win32" = x"yes")
114
115 if test x"$platform_win32" = x"yes"; then
116     WINDRES=windres
117     AC_SUBST(WINDRES)
118 fi
119
120 AC_MSG_CHECKING([for native Win32])
121 case "$host" in
122   *-*-mingw*)
123     os_win32=yes
124     ;;
125   *)
126     os_win32=no
127     ;;
128 esac
129 AC_MSG_RESULT([$os_win32])
130 AM_CONDITIONAL(OS_WIN32, test x"$os_win32" = x"yes")
131
132 CFLAGS="$CFLAGS -Wall"
133
134 case "$target" in
135 *-darwin*)
136         CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
137         ;;
138 esac
139   
140 dnl Checks for iconv
141 AM_ICONV
142
143 dnl
144 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
145 dnl
146 syl_save_LIBS=$LIBS
147 LIBS="$LIBS $GTK_LIBS"
148 AC_CHECK_FUNCS(bind_textdomain_codeset)
149 LIBS=$syl_save_LIBS
150
151 dnl for gettext
152 ALL_LINGUAS="bg ca cs de el en_GB es fi fr hr hu it ja ko nl pl pt_BR ru sk sr sv zh_CN zh_TW.Big5"
153 GETTEXT_PACKAGE=sylpheed-claws
154 AC_SUBST(GETTEXT_PACKAGE)
155 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define text domain.])
156
157 AM_GLIB_GNU_GETTEXT
158 dnl AM_GNU_GETTEXT
159 dnl AC_CHECK_FUNC(gettext, AC_CHECK_LIB(intl, gettext))
160 localedir='${prefix}/${DATADIRNAME}/locale'
161 AC_SUBST(localedir)
162
163 manualdir='${prefix}/${DATADIRNAME}/${PACKAGE}/manual'
164 AC_SUBST(manualdir)
165 faqdir='${prefix}/${DATADIRNAME}/${PACKAGE}/faq'
166 AC_SUBST(faqdir)
167
168 dnl Set PACKAGE_DATA_DIR in config.h.
169 if test "x${datadir}" = 'x${prefix}/share'; then
170   if test "x${prefix}" = "xNONE"; then
171     AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}", PACKAGE_DATA_DIR)
172   else
173     AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/share/${PACKAGE}", PACKAGE_DATA_DIR)
174   fi
175 else
176   AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${datadir}/${PACKAGE}", PACKAGE_DATA_DIR)
177 fi
178
179 AC_CHECK_LIB(xpg4, setlocale)
180
181 dnl for GThread support (currently disabled)
182 dnl AC_ARG_ENABLE(threads,
183 dnl     [  --enable-threads        Enable multithread support [default=no]],
184 dnl     [use_threads=$enableval], [use_threads=no])
185
186 AC_MSG_CHECKING([whether to use threads])
187 if test x"$use_threads" = xyes ; then
188         AC_MSG_RESULT(yes)
189         if test ! -z `$GLIB_CONFIG --help 2>&1 |grep 'gthread'` ; then
190                 CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags gthread`"
191                 LIBS="$LIBS `$GLIB_CONFIG --libs gthread`"
192                 AC_DEFINE(USE_THREADS, 1, Whether to use multithread or not)
193         else
194                 AC_MSG_ERROR([Sylpheed requires GThread from GLib to use threading.])
195         fi
196 else
197         AC_MSG_RESULT(no)
198 fi
199
200 dnl Check for d_type member in struct dirent
201 AC_MSG_CHECKING([whether struct dirent has d_type member])
202 AC_CACHE_VAL(ac_cv_dirent_d_type,[
203         AC_TRY_COMPILE([#include <dirent.h>],
204                        [struct dirent d; d.d_type = DT_REG;],
205                        ac_cv_dirent_d_type=yes, ac_cv_dirent_d_type=no)
206 ])
207 AC_MSG_RESULT($ac_cv_dirent_d_type)
208 if test $ac_cv_dirent_d_type = yes; then
209         AC_DEFINE(HAVE_DIRENT_D_TYPE, 1,
210                   Define if `struct dirent' has `d_type' member.)
211 fi
212
213 dnl Checks for header files.
214 AC_HEADER_DIRENT
215 AC_HEADER_STDC
216 AC_HEADER_SYS_WAIT
217 AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h \
218                  sys/param.h sys/utsname.h sys/select.h \
219                  wchar.h wctype.h locale.h)
220
221 dnl alf - Check for apache installation f*ck up. apache may also install an 
222 dnl fnmatch, which includes their own regex stuff if USE_HSREGEX is defined
223 AC_TRY_COMPILE([#include <stdlib.h>
224                 #include <fnmatch.h>],
225         [int x = USE_HSREGEX;],
226         ac_cv_have_apache_fnmatch=yes, ac_cv_have_apache_fnmatch=no)
227 if test $ac_cv_have_apache_fnmatch = yes; then
228         AC_DEFINE(HAVE_APACHE_FNMATCH, 1, Define if you need to work around apache regex/fnmatch !KLUDGE!)
229 fi
230 AC_MSG_CHECKING([whether to use Apache regex header kludge])
231 AC_MSG_RESULT($ac_cv_have_apache_fnmatch)
232
233 dnl Checks for typedefs, structures, and compiler characteristics.
234 AC_C_CONST
235 AC_TYPE_OFF_T
236 AC_TYPE_PID_T
237 AC_TYPE_SIZE_T
238 AC_STRUCT_TM
239
240 dnl AC_CHECK_TYPE(wint_t, unsigned int) does not work because wint_t
241 dnl may be defined only in wchar.h (this happens with gcc-2.96).
242 dnl So we need to use this extended macro.
243 SYLPHEED_CHECK_TYPE(wint_t, unsigned int,
244 [
245 #if HAVE_WCHAR_H
246 #include <wchar.h>
247 #endif
248 ], Define to `unsigned int' if <stddef.h> or <wchar.h> doesn't define.)
249
250 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF, Used to test for a u32 typedef)
251 AC_CHECK_SIZEOF(unsigned short, 2)
252 AC_CHECK_SIZEOF(unsigned int, 4)
253 AC_CHECK_SIZEOF(unsigned long, 4)
254
255 dnl Checks for library functions.
256 AC_FUNC_ALLOCA
257 AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr strchr \
258                wcsstr wcswcs iswalnum iswspace towlower \
259                wcslen wcscpy wcsncpy \
260                uname flock lockf inet_aton inet_addr \
261                fchmod mkstemp)
262
263 dnl *****************
264 dnl ** common code **
265 dnl *****************
266
267 dnl check for glib
268 AM_PATH_GLIB_2_0(2.0.0,,
269         AC_MSG_ERROR(Test for GLIB failed. See the file 'INSTALL' for help.),
270         gmodule gobject gthread)
271
272 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
273 syl_save_LIBS=$LIBS
274 LIBS="$LIBS $GTK_LIBS"
275 AC_CHECK_FUNCS(bind_textdomain_codeset)
276 LIBS=$syl_save_LIBS
277
278 dnl check for IPv6 option
279 AC_ARG_ENABLE(ipv6,
280         [  --disable-ipv6           Disable IPv6 support],
281         [ac_cv_enable_ipv6=$enableval], [ac_cv_enable_ipv6=yes])
282
283 dnl automated checks for IPv6 support.
284 AC_MSG_CHECKING([whether to use IPv6])
285 if test x"$ac_cv_enable_ipv6" = xyes; then
286         AC_MSG_RESULT(yes)
287         AC_MSG_CHECKING([for IPv6 support])
288         AC_CACHE_VAL(ac_cv_ipv6,[
289                 AC_TRY_COMPILE([#define INET6
290                                 #include <sys/types.h>
291                                 #include <netinet/in.h>],
292                         [int x = IPPROTO_IPV6; struct in6_addr a;],
293                         ac_cv_ipv6=yes, ac_cv_ipv6=no)
294         ])
295         AC_MSG_RESULT($ac_cv_ipv6)
296         if test $ac_cv_ipv6 = yes; then
297                 AC_DEFINE(INET6, 1, Define if you want IPv6 support.)
298         else
299                 AC_MSG_WARN(*** IPv6 will not be supported ***)
300                 ac_cv_enable_ipv6=no
301         fi
302 else
303         AC_MSG_RESULT(no)
304 fi
305
306 dnl Check for OpenSSL
307 AC_ARG_ENABLE(openssl,
308         [  --enable-openssl    Attempt to use OpenSSL for SSL support.],
309         [ac_cv_enable_openssl=$enableval], [ac_cv_enable_openssl=yes])
310 if test x"$ac_cv_enable_openssl" = xyes; then
311         PKG_CHECK_MODULES(OPENSSL, openssl >= 0.9.7, :, ac_cv_enable_openssl=no)
312         if test x$ac_cv_enable_openssl = xyes; then
313                 AC_DEFINE(USE_OPENSSL, 1, Define if you want OpenSSL support)
314         fi
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 dnl for LDAP support in addressbook
423 dnl no check for libraries; dynamically loaded
424 AC_ARG_ENABLE(ldap,
425         [  --enable-ldap           Enable LDAP support [default=no]],
426         [ac_cv_enable_ldap=$enableval], [ac_cv_enable_ldap=no])
427 AC_MSG_CHECKING([whether to use LDAP])
428 if test x"$ac_cv_enable_ldap" = xno; then
429         AC_MSG_RESULT(no)
430 elif test x"$ac_cv_enable_ldap" = xyes -a x"$ac_cv_enable_pthread" = xno; then
431         AC_MSG_RESULT(no - LDAP support needs pthread support)
432
433         ac_cv_enable_ldap=no
434 else
435         AC_MSG_RESULT(yes)
436
437         dnl check for available libraries, and pull them in
438         AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="$LDAP_LIBS -lresolv")
439         AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket")
440         AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
441         AC_CHECK_LIB(lber, ber_get_tag, LDAP_LIBS="$LDAP_LIBS -llber",,
442                      $LDAP_LIBS)
443
444         AC_CHECK_HEADERS(ldap.h lber.h,
445                          [ ac_cv_enable_ldap=yes ],
446                          [ ac_cv_enable_ldap=no ])
447
448         if test "$ac_cv_enable_ldap" = yes; then
449                 AC_CHECK_LIB(ldap, ldap_open,
450                              [ ac_cv_enable_ldap=yes ],
451                              [ ac_cv_enable_ldap=no ],
452                              $LDAP_LIBS)
453
454                 AC_CHECK_LIB(ldap, ldap_start_tls_s,
455                              [ ac_cv_have_tls=yes ],
456                              [ ac_cv_have_tls=no ])
457
458         fi
459
460         AC_MSG_CHECKING([whether ldap library is available])
461         AC_MSG_RESULT($ac_cv_enable_ldap)
462
463         AC_MSG_CHECKING([whether TLS library is available])
464         AC_MSG_RESULT($ac_cv_have_tls)
465
466         if test "$ac_cv_enable_ldap" = yes; then
467                 CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags gthread`"
468                 LDAP_LIBS="$LDAP_LIBS -lldap `$GLIB_CONFIG --libs gthread`"
469                 AC_DEFINE(USE_LDAP, 1, Define if you want LDAP support in addressbook.)
470                 AC_SUBST(LDAP_LIBS)
471                 if test "$ac_cv_have_tls" = yes; then
472                         AC_DEFINE(USE_LDAP_TLS, 1, Define if you want LDAP TLS support in addressbook.)
473                 fi
474         fi
475 fi
476
477 dnl for JPilot support in addressbook
478 dnl no check for libraries; these are dynamically loaded
479 AC_ARG_ENABLE(jpilot,
480         [  --enable-jpilot         Enable JPilot support [default=no]],
481         [ac_cv_enable_jpilot=$enableval], [ac_cv_enable_jpilot=no])
482 AC_MSG_CHECKING([whether to use JPilot])
483 if test "$ac_cv_enable_jpilot" = yes; then
484         AC_MSG_RESULT(yes)
485         AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h,
486                          [ AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ],
487                          [ ac_cv_enable_jpilot=no ])
488         if test "$ac_cv_enable_jpilot" = no; then
489                 AC_CHECK_HEADERS(libpisock/pi-args.h libpisock/pi-appinfo.h libpisock/pi-address.h,
490                                  [ ac_cv_enable_jpilot=yes
491                                    AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ])
492         fi
493
494         AC_CHECK_LIB(pisock, unpack_Address, [JPILOT_LIBS="-lpisock"], [JPILOT_LIBS="" ac_cv_enable_jpilot="no"])
495         if test x"$ac_cv_enable_jpilot" = xyes; then
496                 AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.)
497         else
498                 AC_MSG_NOTICE([JPilot support not available])
499         fi
500         AC_SUBST(JPILOT_LIBS)
501 else
502         AC_MSG_RESULT(no)
503 fi
504
505 dnl #######################################################################
506 dnl # Check for startup notification
507 dnl #######################################################################
508 AC_ARG_ENABLE(startup-notification, [  --disable-startup-notification    compile without startup notification support],,enable_startup_notification=yes)
509
510 if test "x$enable_startup_notification" = "xyes"; then
511         PKG_CHECK_MODULES(STARTUP_NOTIFICATION, libstartup-notification-1.0 >= 0.5,
512         [
513                 AC_DEFINE(HAVE_STARTUP_NOTIFICATION, 1, [Define if we're using libstartup-notification.])
514                 echo "Building with libstartup-notification"
515                 enable_startup_notification=yes
516         ],
517         [
518                 echo "Building without libstartup-notification"
519                 enable_startup_notification=no
520         ])
521
522         AC_SUBST(STARTUP_NOTIFICATION_CFLAGS)
523         AC_SUBST(STARTUP_NOTIFICATION_LIBS)
524 fi
525
526 dnl *************************
527 dnl ** section for plugins **
528 dnl *************************
529
530 PLUGINS=""
531
532 dnl --- Trayicon ---
533 AC_ARG_ENABLE(trayicon-plugin,
534         [  --disable-trayicon-plugin         Do not build System Tray Icon plugin],
535         [ac_cv_enable_trayicon_plugin=$enableval], [ac_cv_enable_trayicon_plugin=yes])
536 if test x"$ac_cv_enable_trayicon_plugin" = xyes; then
537         PLUGINS="trayicon $PLUGINS"
538 fi
539 AM_CONDITIONAL(BUILD_TRAYICON_PLUGIN, test x"$ac_cv_enable_trayicon_plugin" = xyes)
540
541 dnl --- SpamAssassin ---
542 AC_ARG_ENABLE(spamassassin-plugin,
543         [  --enable-spamassassin-plugin      Build SpamAssassin plugin [default=no]],
544         [ac_cv_enable_spamassassin_plugin=$enableval], [ac_cv_enable_spamassassin_plugin=no])
545 if test x"$ac_cv_enable_spamassassin_plugin" = xyes; then
546         AC_SPAMASSASSIN
547         PLUGINS="spamassassin $PLUGINS"
548 fi
549 AM_CONDITIONAL(BUILD_SPAMASSASSIN_PLUGIN, test x"$ac_cv_enable_spamassassin_plugin" = xyes)
550
551 dnl --- PGP/CORE ---
552 AC_ARG_ENABLE(pgpcore-plugin,
553         [  --disable-pgpcore-plugin           Do not build PGP/Core plugin],
554         [ac_cv_enable_pgpcore_plugin=$enableval], [ac_cv_enable_pgpcore_plugin=yes])
555 if test x"$ac_cv_enable_pgpcore_plugin" = xyes; then
556         AM_PATH_GPGME(0.4.5, AC_DEFINE(USE_GPGME, 1, Define if you use GPGME to support OpenPGP.),
557                       [ac_cv_enable_pgpcore_plugin=no])
558         if test x"$ac_cv_enable_pgpcore_plugin" = xyes; then
559                 PLUGINS="pgpcore $PLUGINS"
560         fi
561 fi
562 AM_CONDITIONAL(BUILD_PGPCORE_PLUGIN, test x"$ac_cv_enable_pgpcore_plugin" = xyes)
563
564 AC_ARG_ENABLE(pgpmime-plugin,
565         [  --disable-pgpmime-plugin           Do not build PGP/MIME plugin],
566         [ac_cv_enable_pgpmime_plugin=$enableval], [ac_cv_enable_pgpmime_plugin=yes])
567 if test x"$ac_cv_enable_pgpmime_plugin" = xyes; then
568         AM_PATH_GPGME(0.4.5, AC_DEFINE(USE_GPGME, 1, Define if you use GPGME to support OpenPGP.),
569                       [ac_cv_enable_pgpmime_plugin=no])
570         if test x"$ac_cv_enable_pgpmime_plugin" = xyes; then
571                 PLUGINS="pgpmime $PLUGINS"
572         fi
573 fi
574 AM_CONDITIONAL(BUILD_PGPMIME_PLUGIN, test x"$ac_cv_enable_pgpmime_plugin" = xyes)
575
576 dnl --- MathML Viewer ---
577 AC_ARG_ENABLE(mathml-viewer-plugin,
578         [  --disable-mathml-viewer-plugin    Do not build MathML-Viewer plugin],
579         [ac_cv_enable_mathml_viewer_plugin=$enableval], [ac_cv_enable_mathml_viewer_plugin=yes])
580 if test x"$ac_cv_enable_mathml_viewer_plugin" = xyes; then
581         PKG_CHECK_MODULES(GTK_MATH_VIEW, gtkmathview >= 0.5, :, ac_cv_enable_mathml_viewer_plugin=no)
582
583         if test x"$ac_cv_enable_mathml_viewer_plugin" = xyes; then
584
585                 PLUGINS="mathml-viewer $PLUGINS"
586         fi
587 fi
588 AC_SUBST(GTK_MATH_VIEW_CFLAGS)
589 AC_SUBST(GTK_MATH_VIEW_LIBS)
590 AM_CONDITIONAL(BUILD_MATHML_VIEWER_PLUGIN, test x"$ac_cv_enable_mathml_viewer_plugin" = xyes)
591
592 dnl --- Dillo Viewer ---
593 AC_ARG_ENABLE(dillo-viewer-plugin,
594         [  --disable-dillo-viewer-plugin     Do not build Dillo plugin for html mail rendering],
595         [ac_cv_enable_dillo_viewer_plugin=$enableval], [ac_cv_enable_dillo_viewer_plugin=yes])
596 if test x"$ac_cv_enable_dillo_viewer_plugin" = xyes; then
597         PLUGINS="dillo-viewer $PLUGINS"
598 fi
599 AM_CONDITIONAL(BUILD_DILLO_VIEWER_PLUGIN, test x"$ac_cv_enable_dillo_viewer_plugin" = xyes)
600
601 dnl --- Demo ---
602 AC_ARG_ENABLE(demo-plugin,
603         [  --enable-demo-plugin              Build demo plugin [default=no]],
604         [ac_cv_enable_demo_plugin=$enableval], [ac_cv_enable_demo_plugin=no])
605 if test x"$ac_cv_enable_demo_plugin" = xyes; then
606         PLUGINS="demo $PLUGINS"
607 fi
608 AM_CONDITIONAL(BUILD_DEMO_PLUGIN, test x"$ac_cv_enable_demo_plugin" = xyes)
609
610 dnl --- ClamAV ---
611 AC_ARG_ENABLE(clamav-plugin,
612         [  --disable-clamav-plugin           Do not build Clam AntiVirus plugin],
613         [ac_cv_enable_clamav_plugin=$enableval], [ac_cv_enable_clamav_plugin=yes])
614 if test x"$ac_cv_enable_clamav_plugin" = xyes; then
615         AC_CHECK_LIB(clamav, cl_scanfile, clamav_lib=-lclamav, ac_cv_enable_clamav_plugin=no)
616         AC_CHECK_HEADERS(clamav.h, :, ac_cv_enable_clamav_plugin=no)
617         if test x"$ac_cv_enable_clamav_plugin" = xyes; then
618                 CLAMAV_LIBS="${clamav_lib}"
619
620                 PLUGINS="clamav $PLUGINS"
621         else
622                 AC_MSG_NOTICE([clamav library not found, will not build clamav plugin])
623         fi
624 fi
625 AC_SUBST(CLAMAV_LIBS)
626 AM_CONDITIONAL(BUILD_CLAMAV_PLUGIN, test x"$ac_cv_enable_clamav_plugin" = xyes)
627
628 dnl Libetpan
629 AC_ARG_ENABLE(libetpan,
630         [  --disable-libetpan           Do not compile IMAP4 support with libetpan],
631         [ac_cv_enable_libetpan=$enableval], [ac_cv_enable_libetpan=yes])
632 if test x"$ac_cv_enable_libetpan" = xyes; then
633         libetpan_result=no
634         AC_PATH_PROG(libetpanconfig, [libetpan-config])
635         if test "x$libetpanconfig" != "x"; then
636           CPPFLAGS="$CPPFLAGS `$libetpanconfig --cflags 2>/dev/null`"
637           AC_CHECK_HEADER(libetpan/libetpan.h, [libetpan_result=yes])
638           if test "x$libetpan_result" = "xyes"; then
639             AC_MSG_CHECKING([whether libetpan-config hints compiles and links fine])
640             LDFLAGS="$LDFLAGS `$libetpanconfig --libs 2>/dev/null`"
641             AC_TRY_LINK([], [db_mailstorage_init();], [libetpan_result=yes], [libetpan_result=no])
642             AC_MSG_RESULT([$libetpan_result])
643           fi
644         fi
645         if test "x$libetpan_result" = "xyes"; then
646            LIBETPAN_CPPFLAGS="`$libetpanconfig --cflags`"
647            LIBETPAN_LIBS="`$libetpanconfig --libs`"
648            LIBETPAN_VERSION=`$libetpanconfig --version | sed "s/\.//g" | sed "s/-.*$//"`
649            if test "$LIBETPAN_VERSION" -lt "038"; then
650                 AC_MSG_ERROR([Sylpheed requires libetpan 0.38 or newer. See http://www.etpan.org/])
651                 AC_MSG_ERROR([You can use --disable-libetpan if you don't need IMAP4 support.])
652            fi
653            AC_SUBST(LIBETPAN_FLAGS)
654            AC_SUBST(LIBETPAN_LIBS)
655            AC_DEFINE(HAVE_LIBETPAN, 1, Define if you want IMAP support.)
656         else
657            AC_MSG_ERROR([Sylpheed requires libetpan 0.38 or newer. See http://www.etpan.org/ ])
658            AC_MSG_ERROR([You can use --disable-libetpan if you don't need IMAP4 support.])
659         fi
660 fi
661 dnl ****************************
662 dnl ** Final configure output **
663 dnl ****************************
664
665 AC_OUTPUT([
666 Makefile
667 sylpheed.spec
668 m4/Makefile
669 po/Makefile.in
670 src/common/version.h
671 src/Makefile
672 src/common/Makefile
673 src/common/passcrypt.h
674 src/gtk/Makefile
675 src/etpan/Makefile
676 src/plugins/Makefile
677 src/plugins/demo/Makefile
678 src/plugins/spamassassin/Makefile
679 src/plugins/mathml_viewer/Makefile
680 src/plugins/dillo_viewer/Makefile
681 src/plugins/trayicon/Makefile
682 src/plugins/trayicon/libeggtrayicon/Makefile
683 src/plugins/clamav/Makefile
684 src/plugins/pgpcore/Makefile
685 src/plugins/pgpmime/Makefile
686 doc/Makefile
687 doc/faq/Makefile
688 doc/faq/de/Makefile
689 doc/faq/en/Makefile
690 doc/faq/es/Makefile
691 doc/faq/fr/Makefile
692 doc/faq/it/Makefile
693 doc/man/Makefile
694 doc/manual/Makefile
695 doc/manual/de/Makefile
696 doc/manual/en/Makefile
697 doc/manual/es/Makefile
698 doc/manual/fr/Makefile
699 doc/manual/ja/Makefile
700 tools/Makefile
701 config/Makefile
702 sylpheed-claws.pc
703 ])
704
705 dnl Output the configuration summary
706 echo ""
707 echo "$PACKAGE $VERSION"
708 echo ""
709 echo "JPilot        : $ac_cv_enable_jpilot"
710 echo "LDAP          : $ac_cv_enable_ldap"
711 echo "OpenSSL       : $ac_cv_enable_openssl"
712 echo "iconv         : $am_cv_func_iconv"
713 echo "compface      : $ac_cv_enable_compface"
714 echo "IPv6          : $ac_cv_enable_ipv6"
715 echo "GNU/aspell    : $ac_cv_enable_aspell"
716 echo "IMAP4         : $ac_cv_enable_libetpan"
717 echo "Crash dialog  : $ac_cv_enable_crash_dialog"
718 echo "Plugins       : $PLUGINS"
719 echo "Config dir    : $ac_cv_with_config_dir"
720 echo ""
721 echo "The binary will be installed in $prefix/bin"
722 echo ""
723 echo "Configure finished, type 'make' to build."