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