sync with sylpheed 0.6.0cvs4
[claws.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(src/main.c)
3 PACKAGE=sylpheed
4
5 dnl version number
6 MAJOR_VERSION=0
7 MINOR_VERSION=6
8 MICRO_VERSION=0
9 INTERFACE_AGE=0
10 BINARY_AGE=0
11 EXTRA_VERSION=claws2
12 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
13
14 dnl
15 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
16 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
17 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
18
19 dnl GNOME installed?
20 AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
21 if test "$GNOME_CONFIG" != no; then
22         gnomedir="`gnome-config --prefix`"
23         AC_SUBST(gnomedir)
24 fi
25 AM_CONDITIONAL(SYLPHEED_GNOME, test -d "$gnomedir")
26
27 dnl Claws version
28 AC_DEFINE(CLAWS, 1)
29
30 dnl libtool versioning
31 LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
32 LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
33 LT_REVISION=$INTERFACE_AGE
34 LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
35 AC_SUBST(LT_RELEASE)
36 AC_SUBST(LT_CURRENT)
37 AC_SUBST(LT_REVISION)
38 AC_SUBST(LT_AGE)
39
40 dnl Specify a header configuration file
41 AM_CONFIG_HEADER(config.h)
42
43 AM_PROG_LIBTOOL
44 AM_MAINTAINER_MODE
45
46 dnl Checks for programs.
47 AC_ARG_PROGRAM
48 AC_PROG_CC
49 AC_ISC_POSIX
50 AM_PROG_CC_STDC
51 AC_PROG_INSTALL
52 AC_PROG_LN_S
53 AC_PROG_MAKE_SET
54 AC_PROG_CPP
55 dnl AC_PROG_RANLIB
56 AM_PROG_LEX
57 AC_PROG_YACC
58
59 SYLPHEED_ACLOCAL_INCLUDE(ac)
60
61 dnl for gettext
62 ALL_LINGUAS="cs de el es fr it ja ko nl pl pt_BR ru zh_CN.GB2312 zh_TW.Big5"
63 AM_GNU_GETTEXT
64 dnl AC_CHECK_FUNC(gettext, AC_CHECK_LIB(intl, gettext))
65 localedir='${prefix}/${DATADIRNAME}/locale'
66 AC_SUBST(localedir)
67
68 manualdir='${prefix}/${DATADIRNAME}/${PACKAGE}/manual'
69 AC_SUBST(manualdir)
70
71 dnl Checks for libraries.
72 AM_PATH_GLIB(1.2.6,,
73         AC_MSG_ERROR(Test for GLIB failed. See the file 'INSTALL' for help.),
74         gthread)
75 AM_PATH_GTK(1.2.6,,
76         AC_MSG_ERROR(Test for GTK failed. See the file 'INSTALL' for help.))
77
78 dnl Check for built-in image view support
79 AC_ARG_ENABLE(gdk-pixbuf,
80         [  --disable-gdk-pixbuf    Do not use gdk-pixbuf],
81         [ac_cv_enable_gdk_pixbuf=$enableval], [ac_cv_enable_gdk_pixbuf=yes])
82 AC_ARG_ENABLE(imlib,
83         [  --disable-imlib         Do not use imlib],
84         [ac_cv_enable_imlib=$enableval], [ac_cv_enable_imlib=yes])
85
86 if test "$ac_cv_enable_gdk_pixbuf" = yes; then
87         AM_PATH_GDK_PIXBUF(0.8.0,
88                 [AC_DEFINE(HAVE_GDK_PIXBUF)
89                  ac_cv_enable_imlib=no], [ac_cv_enable_gdk_pixbuf=no])
90 fi
91 if test "$ac_cv_enable_imlib" = yes; then
92         AM_PATH_GDK_IMLIB(1.9,
93                 AC_DEFINE(HAVE_GDK_IMLIB), [ac_cv_enable_imlib=no])
94 fi
95 if test "$ac_cv_enable_gdk_pixbuf" = no -a "$ac_cv_enable_imlib" = no; then
96         AC_MSG_WARN(*** Built-in image view will not be supported ***)
97 fi
98
99 dnl GPGME is used to support OpenPGP 
100 AC_ARG_ENABLE(gpgme,
101         [  --enable-gpgme          Enable GnuPG support using GPGME [default=no]],
102         [ac_cv_enable_gpgme=$enableval], [ac_cv_enable_gpgme=no])
103 AC_MSG_CHECKING([whether to use GPGME])
104 if test $ac_cv_enable_gpgme = yes; then
105         AC_MSG_RESULT(yes)
106         AM_PATH_GPGME(0.2.1, AC_DEFINE(USE_GPGME), [use_gpgme=no
107                                                     ac_cv_enable_gpgme=no])
108 else
109         AC_MSG_RESULT(no)
110 fi
111
112 dnl Check for OpenSSL
113 AC_ARG_ENABLE(ssl,
114         [  --enable-ssl            Enable SSL support using OpenSSL [default=no]],
115         [ac_cv_enable_ssl=$enableval], [ac_cv_enable_ssl=no])
116 AC_MSG_CHECKING([whether to use OpenSSL])
117 if test $ac_cv_enable_ssl = yes; then
118         AC_MSG_RESULT(yes)
119         AC_MSG_CHECKING([if openssl is available])
120         LIBS="$LIBS -lssl -lcrypto"
121         AC_TRY_LINK([
122 #include <openssl/opensslv.h>
123 ],      [ return OPENSSL_VERSION_NUMBER; ],
124         [ AC_MSG_RESULT(yes)
125           AC_DEFINE(USE_SSL) ],
126         [ AC_MSG_RESULT(no)
127           LIBS="$ac_save_LIBS"
128           ac_cv_enable_ssl=no ])
129 else
130         AC_MSG_RESULT(no)
131 fi
132
133 dnl Check for X-Face support
134 AC_ARG_ENABLE(compface,
135         [  --disable-compface      Do not use compface (X-Face)],
136         [ac_cv_enable_compface=$enableval], [ac_cv_enable_compface=yes])
137 if test "$ac_cv_enable_compface" = yes; then
138         AC_CHECK_LIB(compface, uncompface,,[ac_cv_enable_compface=no])
139 fi
140
141 dnl for JPilot support in addressbook
142 dnl no check for libraries: these are dynamically loaded
143 AC_ARG_ENABLE(jpilot,
144         [  --enable-jpilot         Enable JPilot support [default=no]],
145         [ac_cv_enable_jpilot=$enableval], [ac_cv_enable_jpilot=no])
146
147 AC_MSG_CHECKING([whether to use jpilot])
148 if test "$ac_cv_enable_jpilot" = yes; then
149         AC_MSG_RESULT(yes)
150         if test "$ac_cv_enable_jpilot" = yes; then
151                 AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h, , [ac_cv_enable_jpilot=no])
152                 if test "$ac_cv_enable_jpilot" = yes; then              
153                         LIBS="$LIBS -lpisock"
154                         AC_DEFINE(USE_JPILOT)
155                 fi
156         fi
157         AC_MSG_CHECKING(whether jpilot is available)
158         if test "$ac_cv_enable_jpilot" = yes; then
159                 AC_MSG_RESULT(yes)
160         else
161                 AC_MSG_RESULT(no)
162         fi
163 else
164         AC_MSG_RESULT(no)
165 fi
166
167 dnl for LDAP support in addressbook
168 dnl no check for libraries; dynamically loaded
169 AC_ARG_ENABLE(ldap,
170         [  --enable-ldap         Enable LDAP support [default=no]],
171         [ac_cv_enable_ldap=$enableval], [ac_cv_enable_ldap=no])
172
173 AC_MSG_CHECKING([whether to use ldap])
174 if test "$ac_cv_enable_ldap" = yes; then
175         AC_MSG_RESULT(yes)
176         if test "$ac_cv_enable_ldap" = yes; then
177                 AC_CHECK_HEADERS(ldap.h lber.h pthread.h, , [ac_cv_enable_ldap=no])
178                 if test "$ac_cv_enable_ldap" = yes; then
179                         LIBS="$LIBS -lldap -llber -lpthread -lresolv"
180                         AC_DEFINE(USE_LDAP)
181                 fi      
182         fi
183         AC_MSG_CHECKING(whether ldap is available)
184         if test "$ac_cv_enable_ldap" = yes; then
185                 AC_MSG_RESULT(yes)
186         else
187                 AC_MSG_RESULT(no)
188         fi
189 else
190         AC_MSG_RESULT(no)
191 fi
192
193 dnl get ispell path
194 dnl
195 AC_PATH_PROG(ispell_path, ispell, no)
196 if test "$ispell_path" != no; then
197         AC_DEFINE_UNQUOTED(ISPELL_PATH, "$ispell_path")
198         AC_SUBST(ISPELL_PATH)
199 else
200         AC_DEFINE_UNQUOTED(ISPELL_PATH, "/usr/bin/ispell")
201         AC_SUBST(ISPELL_PATH)
202 fi
203
204 dnl Check for libjconv
205 AC_ARG_ENABLE(jconv,
206         [  --disable-jconv         Do not use libjconv],
207         [ac_cv_enable_jconv=$enableval], [ac_cv_enable_jconv=yes])
208 if test "$ac_cv_enable_jconv" = yes; then
209         AC_CHECK_LIB(jconv, jconv_alloc_conv,,[ac_cv_enable_jconv=no])
210 fi
211
212 AC_CHECK_LIB(xpg4, setlocale)
213 dnl AC_CHECK_LIB(kcc, KCC_filter)
214
215 dnl for GThread support (currently disabled)
216 dnl AC_ARG_ENABLE(threads,
217 dnl     [  --enable-threads        Enable multithread support [default=no]],
218 dnl     [use_threads=$enableval], [use_threads=no])
219
220 AC_MSG_CHECKING([whether to use threads])
221 if test x"$use_threads" = xyes ; then
222         AC_MSG_RESULT(yes)
223         if test ! -z `$GLIB_CONFIG --help 2>&1 |grep 'gthread'` ; then
224                 CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags gthread`"
225                 LIBS="$LIBS `$GLIB_CONFIG --libs gthread`"
226                 AC_DEFINE(USE_THREADS)
227         else
228                 AC_MSG_ERROR([Sylpheed requires GThread from GLib to use threading.])
229         fi
230 else
231         AC_MSG_RESULT(no)
232 fi
233
234 dnl check for IPv6 option
235 AC_ARG_ENABLE(ipv6,
236         [  --enable-ipv6           Enable IPv6 support [default=no]],
237         [ac_cv_enable_ipv6=$enableval], [ac_cv_enable_ipv6=no])
238
239 dnl automated checks for IPv6 support.
240 AC_MSG_CHECKING([whether to use IPv6])
241 if test x"$ac_cv_enable_ipv6" = xyes; then
242         AC_MSG_RESULT(yes)
243         AC_MSG_CHECKING([for IPv6 support])
244         AC_CACHE_VAL(ac_cv_ipv6,[
245                 AC_TRY_COMPILE([#define INET6
246                                 #include <sys/types.h>
247                                 #include <netinet/in.h>],
248                         [int x = IPPROTO_IPV6; struct in6_addr a;],
249                         ac_cv_ipv6=yes, ac_cv_ipv6=no)
250         ])
251         AC_MSG_RESULT($ac_cv_ipv6)
252         if test $ac_cv_ipv6 = yes; then
253                 AC_DEFINE(INET6)
254         else
255                 AC_MSG_WARN(*** IPv6 will not be supported ***)
256                 ac_cv_enable_ipv6=no
257         fi
258 else
259         AC_MSG_RESULT(no)
260 fi
261
262 dnl check if gdk / gtk was compiled with USE_XIM
263 AC_MSG_CHECKING([whether GTK was compiled with XIM support])
264 CFLAGS_SAVE="$CFLAGS"
265 LDFLAGS_SAVE="$LDFLAGS"
266 CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags` `gtk-config --cflags`"
267 LDFLAGS="$LIBS `$GLIB_CONFIG --libs` `gtk-config --libs`"
268 AC_CACHE_VAL(ac_cv_use_gtkgdk_xim, [
269         AC_TRY_COMPILE([#include <gtk/gtk.h>
270                         #include <gdk/gdk.h>],
271                         [extern gint gdk_im_open(void); gdk_im_open();],
272                          ac_cv_use_gtkgdk_xim=yes, ac_cv_use_gtkgdk_xim=no)
273         ])
274 AC_MSG_RESULT($ac_cv_use_gtkgdk_xim)
275 if test $ac_cv_use_gtkgdk_xim = yes; then
276         AC_DEFINE(USE_GTKGDK_XIM)
277 fi
278 CFLAGS="$CFLAGS_SAVE"
279 LDFLAGS="$LDFLAGS_SAVE"
280
281
282 dnl Checks for header files.
283 AC_HEADER_DIRENT
284 AC_HEADER_STDC
285 AC_HEADER_SYS_WAIT
286 AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h \
287                  sys/param.h sys/utsname.h \
288                  wchar.h wctype.h)
289
290 dnl Checks for typedefs, structures, and compiler characteristics.
291 AC_C_CONST
292 AC_TYPE_OFF_T
293 AC_TYPE_PID_T
294 AC_TYPE_SIZE_T
295 AC_STRUCT_TM
296
297 dnl AC_CHECK_TYPE(wint_t, unsigned int) does not work because wint_t
298 dnl may be defined only in wchar.h (this happens with gcc-2.96).
299 dnl So we need to use this extended macro.
300 SYLPHEED_CHECK_TYPE(wint_t, unsigned int,
301 [
302 #if HAVE_WCHAR_H
303 #include <wchar.h>
304 #endif
305 ])
306
307 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
308 AC_CHECK_SIZEOF(unsigned short, 2)
309 AC_CHECK_SIZEOF(unsigned int, 4)
310 AC_CHECK_SIZEOF(unsigned long, 4)
311
312 dnl Checks for library functions.
313 AC_FUNC_ALLOCA
314 AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr \
315                wcsstr wcswcs iswalnum iswspace towlower \
316                wcslen wcscpy wcsncpy \
317                uname flock lockf inet_aton inet_addr \
318                fchmod mkstemp)
319
320 AC_OUTPUT([
321 Makefile
322 sylpheed.spec
323 intl/Makefile
324 ac/Makefile
325 po/Makefile.in
326 libkcc/Makefile
327 src/version.h
328 src/Makefile
329 manual/Makefile
330 manual/en/Makefile
331 manual/ja/Makefile
332 tools/Makefile
333 ])
334
335 dnl Output the configuration summary
336 echo ""
337 echo "$PACKAGE $VERSION"
338 echo ""
339 echo "gdk-pixbuf : $ac_cv_enable_gdk_pixbuf"
340 echo "gdk_imlib  : $ac_cv_enable_imlib"
341 echo "GPGME      : $ac_cv_enable_gpgme"
342 echo "JPilot     : $ac_cv_enable_jpilot"
343 echo "LDAP       : $ac_cv_enable_ldap"
344 echo "OpenSSL    : $ac_cv_enable_ssl"
345 echo "compface   : $ac_cv_enable_compface"
346 echo "libjconv   : $ac_cv_enable_jconv"
347 echo "IPv6       : $ac_cv_enable_ipv6"
348 echo ""
349 echo "The binary will be installed in $prefix/bin"
350 echo ""
351 echo "Configure finished, type 'make' to build."