54f1d2a330b94696360398f930deb880515a7501
[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=5
8 MICRO_VERSION=1
9 INTERFACE_AGE=0
10 BINARY_AGE=0
11 EXTRA_VERSION=claws4
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 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_disable_gdk_pixbuf=disable], [ac_cv_disable_gdk_pixbuf=no])
82 AC_ARG_ENABLE(imlib,
83         [  --disable-imlib         Do not use imlib],
84         [ac_cv_disable_imlib=disable], [ac_cv_disable_imlib=no])
85
86 if test "$ac_cv_disable_gdk_pixbuf" = no; then
87         AM_PATH_GDK_PIXBUF(0.8.0,
88                 AC_DEFINE(HAVE_GDK_PIXBUF), [ac_cv_disable_gdk_pixbuf=disable])
89 fi
90 if test "$ac_cv_disable_gdk_pixbuf" = disable -a "$ac_cv_disable_imlib" = no; then
91         AM_PATH_GDK_IMLIB(1.9,
92                 AC_DEFINE(HAVE_GDK_IMLIB), [ac_cv_disable_imlib=disable])
93 fi
94 if test "$ac_cv_disable_gdk_pixbuf" = disable -a "$ac_cv_disable_imlib" = disable; then
95         AC_MSG_WARN(*** Built-in image view will not be supported ***)
96 fi
97
98 dnl GPGME is used to support OpenPGP 
99 AC_ARG_ENABLE(gpgme,
100         [  --enable-gpgme          Enable GnuPG support using GPGME [default=no]],
101         [ac_cv_enable_gpgme=$enableval], [ac_cv_enable_gpgme=no])
102 if test $ac_cv_enable_gpgme = yes; then
103         AM_PATH_GPGME(0.2.1, AC_DEFINE(USE_GPGME), [use_gpgme=no])
104 fi
105
106 dnl Use OpenSSL for SSL connections 
107 AC_MSG_CHECKING([whether to use ssl])
108 AC_ARG_ENABLE(ssl,
109         [  --enable-ssl            Enable SSL support using OpenSSL [default=no]],
110         [ac_cv_enable_ssl=$enableval], [ac_cv_enable_ssl=no])
111 if test $ac_cv_enable_ssl = yes; then
112         AC_MSG_RESULT(yes)
113 else
114         AC_MSG_RESULT(no)
115 fi
116
117 if test $ac_cv_enable_ssl = yes; then
118         AC_MSG_CHECKING([whether to openssl is available])
119         LIBS="$LIBS -lssl"
120         AC_TRY_LINK([
121 #include <openssl/opensslv.h>
122 ],      [ return(OPENSSL_VERSION_NUMBER); ],
123         [ AC_MSG_RESULT(yes)
124           AC_DEFINE(USE_SSL) ],
125         [ AC_MSG_RESULT(no) 
126           LIBS="$ac_save_LIBS" ])
127 fi
128
129 dnl Check for X-Face support
130 AC_ARG_ENABLE(compface,
131         [  --disable-compface      Do not use compface (X-Face)],
132         [ac_cv_disable_compface=disable], [ac_cv_disable_compface=no])
133 if test "$ac_cv_disable_compface" = no; then
134         AC_CHECK_LIB(compface, uncompface)
135 fi
136
137 dnl for JPilot support in addressbook
138 dnl no check for libraries: these are dynamically loaded
139 AC_ARG_ENABLE(jpilot,
140         [  --enable-jpilot         Enable JPilot support [default=no]],
141         [ac_cv_enable_jpilot=$enableval], [ac_cv_enable_jpilot=no])
142
143 AC_MSG_CHECKING([whether to use jpilot])
144 if test "$ac_cv_enable_jpilot" = yes; then
145         AC_MSG_RESULT(yes)
146         if test "$ac_cv_enable_jpilot" = yes; then
147                 AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h, , [ac_cv_enable_jpilot=no])
148                 if test "$ac_cv_enable_jpilot" = yes; then              
149                         LIBS="$LIBS -lpisock"
150                         AC_DEFINE(USE_JPILOT)
151                 fi
152         fi
153         AC_MSG_CHECKING(whether jpilot is available)
154         if test "$ac_cv_enable_jpilot" = yes; then
155                 AC_MSG_RESULT(yes)
156         else
157                 AC_MSG_RESULT(no)
158         fi
159 else
160         AC_MSG_RESULT(no)
161 fi
162
163 dnl for LDAP support in addressbook
164 dnl no check for libraries; dynamically loaded
165 AC_ARG_ENABLE(ldap,
166         [  --enable-ldap         Enable LDAP support [default=no]],
167         [ac_cv_enable_ldap=$enableval], [ac_cv_enable_ldap=no])
168
169 AC_MSG_CHECKING([whether to use ldap])
170 if test "$ac_cv_enable_ldap" = yes; then
171         AC_MSG_RESULT(yes)
172         if test "$ac_cv_enable_ldap" = yes; then
173                 AC_CHECK_HEADERS(ldap.h lber.h pthread.h, , [ac_cv_enable_ldap=no])
174                 if test "$ac_cv_enable_ldap" = yes; then
175                         LIBS="$LIBS -lldap -llber -lpthread -lresolv"
176                         AC_DEFINE(USE_LDAP)
177                 fi      
178         fi
179         AC_MSG_CHECKING(whether ldap is available)
180         if test "$ac_cv_enable_ldap" = yes; then
181                 AC_MSG_RESULT(yes)
182         else
183                 AC_MSG_RESULT(no)
184         fi
185 else
186         AC_MSG_RESULT(no)
187 fi
188
189 dnl get ispell path
190 dnl
191 AC_PATH_PROG(ispell_path, ispell, x)
192 if test "$ispell_path" != x; then
193         AC_DEFINE_UNQUOTED(ISPELL_PATH, "$ispell_path")
194         AC_SUBST(ISPELL_PATH)
195 else
196         AC_DEFINE_UNQUOTED(ISPELL_PATH, "$ispell_path")
197         AC_SUBST(ISPELL_PATH)
198 fi
199
200 dnl Check for libjconv
201 AC_ARG_ENABLE(jconv,
202         [  --disable-jconv         Do not use libjconv],
203         [ac_cv_disable_jconv=disable], [ac_cv_disable_jconv=no])
204 if test "$ac_cv_disable_jconv" = no; then
205         AC_CHECK_LIB(jconv, jconv_alloc_conv)
206 fi
207
208 AC_CHECK_LIB(xpg4, setlocale)
209 dnl AC_CHECK_LIB(kcc, KCC_filter)
210
211 dnl for GThread support
212 dnl AC_ARG_ENABLE(threads,
213 dnl     [  --enable-threads        Enable multithread support [default=no]],
214 dnl     [use_threads=$enableval], [use_threads=no])
215
216 AC_MSG_CHECKING([whether to use threads])
217 if test x"$use_threads" = xyes ; then
218         AC_MSG_RESULT(yes)
219         if test ! -z `$GLIB_CONFIG --help 2>&1 |grep 'gthread'` ; then
220                 CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags gthread`"
221                 LIBS="$LIBS `$GLIB_CONFIG --libs gthread`"
222                 AC_DEFINE(USE_THREADS)
223         else
224                 AC_MSG_ERROR([Sylpheed requires GThread from GLib to use threading.])
225         fi
226 else
227         AC_MSG_RESULT(no)
228 fi
229
230 dnl check for IPv6 option
231 AC_ARG_ENABLE(ipv6,
232         [  --enable-ipv6           Enable IPv6 support [default=no]],
233         [ac_cv_enableipv6=$enableval], [ac_cv_enableipv6=no])
234
235 dnl automated checks for IPv6 support.
236 if test x"$ac_cv_enableipv6" = xyes; then
237         AC_MSG_CHECKING([for IPv6 support])
238         AC_CACHE_VAL(ac_cv_ipv6,[
239                 AC_TRY_COMPILE([#define INET6
240                                 #include <sys/types.h>
241                                 #include <netinet/in.h>],
242                         [int x = IPPROTO_IPV6; struct in6_addr a;],
243                         ac_cv_ipv6=yes, ac_cv_ipv6=no)
244         ])
245         AC_MSG_RESULT($ac_cv_ipv6)
246         if test $ac_cv_ipv6 = yes; then
247                 AC_DEFINE(INET6)
248         fi
249 fi
250
251 dnl check if gdk / gtk was compiled with USE_XIM
252 AC_MSG_CHECKING([whether GTK was compiled with XIM support])
253 CFLAGS_SAVE="$CFLAGS"
254 LDFLAGS_SAVE="$LDFLAGS"
255 CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags` `gtk-config --cflags`"
256 LDFLAGS="$LIBS `$GLIB_CONFIG --libs` `gtk-config --libs`"
257 AC_CACHE_VAL(ac_cv_use_gtkgdk_xim, [
258         AC_TRY_COMPILE([#include <gtk/gtk.h>
259                         #include <gdk/gdk.h>],
260                         [extern gint gdk_im_open(void); gdk_im_open();],
261                          ac_cv_use_gtkgdk_xim=yes, ac_cv_use_gtkgdk_xim=no)
262         ])
263 AC_MSG_RESULT($ac_cv_use_gtkgdk_xim)
264 if test $ac_cv_use_gtkgdk_xim = yes; then
265         AC_DEFINE(USE_GTKGDK_XIM)
266 fi
267 CFLAGS="$CFLAGS_SAVE"
268 LDFLAGS="$LDFLAGS_SAVE"
269
270
271 dnl Checks for header files.
272 AC_HEADER_DIRENT
273 AC_HEADER_STDC
274 AC_HEADER_SYS_WAIT
275 AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h \
276                  sys/param.h sys/utsname.h \
277                  wchar.h wctype.h)
278
279 dnl Checks for typedefs, structures, and compiler characteristics.
280 AC_C_CONST
281 AC_TYPE_OFF_T
282 AC_TYPE_PID_T
283 AC_TYPE_SIZE_T
284 AC_STRUCT_TM
285
286 dnl AC_CHECK_TYPE(wint_t, unsigned int) does not work because wint_t
287 dnl may be defined only in wchar.h (this happens with gcc-2.96).
288 dnl So we need to use this extended macro.
289 SYLPHEED_CHECK_TYPE(wint_t, unsigned int,
290 [
291 #if HAVE_WCHAR_H
292 #include <wchar.h>
293 #endif
294 ])
295
296 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
297 AC_CHECK_SIZEOF(unsigned short, 2)
298 AC_CHECK_SIZEOF(unsigned int, 4)
299 AC_CHECK_SIZEOF(unsigned long, 4)
300
301 dnl Checks for library functions.
302 AC_FUNC_ALLOCA
303 AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr \
304                wcsstr wcswcs iswalnum iswspace towlower \
305                wcslen wcscpy wcsncpy \
306                uname flock lockf inet_aton inet_addr \
307                fchmod mkstemp)
308
309 AC_OUTPUT([
310 Makefile
311 sylpheed.spec
312 intl/Makefile
313 ac/Makefile
314 po/Makefile.in
315 libkcc/Makefile
316 src/Makefile
317 manual/Makefile
318 manual/ja/Makefile
319 manual/en/Makefile
320 ])