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