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