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