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