d5a59fe865fbd42d5f3e2f0a053887db68db8786
[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=8
8 MICRO_VERSION=1
9 INTERFACE_AGE=0
10 BINARY_AGE=0
11 EXTRA_VERSION=claws22
12 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
13
14 dnl set $target
15 AC_CANONICAL_SYSTEM
16
17 dnl
18 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
19 dnl AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
20 dnl AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
21 AC_SUBST(PACKAGE)
22 AC_SUBST(VERSION)
23
24 dnl GNOME installed?
25 AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
26 if test "$GNOME_CONFIG" != no; then
27         gnomedir="`gnome-config --prefix`"
28         AC_SUBST(gnomedir)
29 fi
30 AM_CONDITIONAL(SYLPHEED_GNOME, test -d "$gnomedir")
31
32 dnl Claws version
33 AC_DEFINE(CLAWS, 1)
34
35 dnl libtool versioning
36 LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
37 LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
38 LT_REVISION=$INTERFACE_AGE
39 LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
40 AC_SUBST(LT_RELEASE)
41 AC_SUBST(LT_CURRENT)
42 AC_SUBST(LT_REVISION)
43 AC_SUBST(LT_AGE)
44
45 dnl Specify a header configuration file
46 AM_CONFIG_HEADER(config.h)
47
48 AM_MAINTAINER_MODE
49
50 dnl Checks for programs.
51 AC_ARG_PROGRAM
52 AC_PROG_CC
53 AC_ISC_POSIX
54 AM_PROG_CC_STDC
55 AC_PROG_INSTALL
56 AC_PROG_LN_S
57 AC_PROG_MAKE_SET
58 AC_PROG_CPP
59 dnl AC_PROG_RANLIB
60 AM_PROG_LEX
61 AC_PROG_YACC
62 AM_PROG_LIBTOOL
63
64 SYLPHEED_ACLOCAL_INCLUDE(ac)
65
66 case "$target" in
67 *-darwin*)
68         CFLAGS="$CFLAGS -traditional-cpp -fno-common"
69         ;;
70 esac
71
72 dnl add additional parameters
73 AC_ARG_WITH(compiler-flags,
74     [  --with-compiler-flags=FLAGS  add parameters to the compiler command],
75     CFLAGS="$CFLAGS $withval")
76
77 dnl for gettext
78 ALL_LINGUAS="cs de el en_GB es fr hr it ja ko nl pl pt_BR ru sv"
79 AM_GNU_GETTEXT
80 dnl AC_CHECK_FUNC(gettext, AC_CHECK_LIB(intl, gettext))
81 localedir='${prefix}/${DATADIRNAME}/locale'
82 AC_SUBST(localedir)
83
84 manualdir='${prefix}/${DATADIRNAME}/${PACKAGE}/manual'
85 AC_SUBST(manualdir)
86 faqdir='${prefix}/${DATADIRNAME}/${PACKAGE}/faq'
87 AC_SUBST(faqdir)
88
89 dnl Set PACKAGE_DATA_DIR in config.h.
90 if test "x${datadir}" = 'x${prefix}/share'; then
91   if test "x${prefix}" = "xNONE"; then
92     AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}")
93   else
94     AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/share/${PACKAGE}")
95   fi
96 else
97   AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${datadir}/${PACKAGE}")
98 fi
99
100 dnl Checks for libraries.
101 AM_PATH_GLIB(1.2.6,,
102         AC_MSG_ERROR(Test for GLIB failed. See the file 'INSTALL' for help.),
103         gthread)
104 AM_PATH_GTK(1.2.6,,
105         AC_MSG_ERROR(Test for GTK failed. See the file 'INSTALL' for help.))
106
107 dnl Check for built-in image view support
108 AC_ARG_ENABLE(gdk-pixbuf,
109         [  --disable-gdk-pixbuf    Do not use gdk-pixbuf],
110         [ac_cv_enable_gdk_pixbuf=$enableval], [ac_cv_enable_gdk_pixbuf=yes])
111 AC_ARG_ENABLE(imlib,
112         [  --disable-imlib         Do not use imlib],
113         [ac_cv_enable_imlib=$enableval], [ac_cv_enable_imlib=yes])
114
115 if test "$ac_cv_enable_gdk_pixbuf" = yes; then
116         AM_PATH_GDK_PIXBUF(0.8.0,
117                 [AC_DEFINE(HAVE_GDK_PIXBUF)
118                  ac_cv_enable_imlib=no], [ac_cv_enable_gdk_pixbuf=no])
119 fi
120 if test "$ac_cv_enable_imlib" = yes; then
121         AM_PATH_GDK_IMLIB(1.9,
122                 AC_DEFINE(HAVE_GDK_IMLIB), [ac_cv_enable_imlib=no])
123 fi
124 if test "$ac_cv_enable_gdk_pixbuf" = no -a "$ac_cv_enable_imlib" = no; then
125         AC_MSG_WARN(*** Built-in image view will not be supported ***)
126 fi
127
128 dnl GPGME is used to support OpenPGP 
129 AC_ARG_ENABLE(gpgme,
130         [  --enable-gpgme          Enable GnuPG support using GPGME [default=no]],
131         [ac_cv_enable_gpgme=$enableval], [ac_cv_enable_gpgme=no])
132 AC_MSG_CHECKING([whether to use GPGME])
133 if test $ac_cv_enable_gpgme = yes; then
134         AC_MSG_RESULT(yes)
135         AM_PATH_GPGME(0.2.3, AC_DEFINE(USE_GPGME), [use_gpgme=no
136                                                     ac_cv_enable_gpgme=no])
137 else
138         AC_MSG_RESULT(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 AC_MSG_CHECKING([whether to use JPilot])
147 if test "$ac_cv_enable_jpilot" = yes; then
148         AC_MSG_RESULT(yes)
149         AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h,
150                          [ AC_DEFINE(USE_JPILOT) ],
151                          [ ac_cv_enable_jpilot=no ])
152         if test "$ac_cv_enable_jpilot" = no; then
153                 AC_CHECK_HEADERS(libpisock/pi-args.h libpisock/pi-appinfo.h libpisock/pi-address.h,
154                                  [ ac_cv_enable_jpilot=yes
155                                    AC_DEFINE(USE_JPILOT) ])
156         fi
157         AC_MSG_CHECKING([whether jpilot is available])
158         AC_MSG_RESULT($ac_cv_enable_jpilot)
159
160         if test "$ac_cv_enable_jpilot" = yes; then
161                 LIBS="$LIBS -lpisock"
162         fi
163 else
164         AC_MSG_RESULT(no)
165 fi
166
167 dnl for LDAP support in addressbook
168 AC_ARG_ENABLE(ldap,
169         [  --enable-ldap           Enable LDAP support [default=no]],
170         [ac_cv_enable_ldap=$enableval], [ac_cv_enable_ldap=no])
171 AC_MSG_CHECKING([whether to use LDAP])
172 if test "$ac_cv_enable_ldap" = yes; then
173         AC_MSG_RESULT(yes)
174
175         dnl check for available libraries, and pull them in
176         AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="$LDAP_LIBS -lresolv")
177         AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket")
178         AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
179         AC_CHECK_LIB(lber, ber_get_tag, LDAP_LIBS="$LDAP_LIBS -llber")
180
181         dnl we need libpthread for sylpheed ldap,  until we find
182         dnl a better way to handle ldap requests asynchronously...
183         AC_CHECK_LIB(pthread, pthread_create, LDAP_LIBS="$LDAP_LIBS -lpthread")
184
185         dnl the check for the headers 
186         AC_CHECK_HEADERS(ldap.h lber.h pthread.h,
187                          [ ac_cv_enable_ldap=yes ],
188                          [ ac_cv_enable_ldap=no ])
189         AC_MSG_CHECKING([whether ldap headers were detected])
190         AC_MSG_RESULT($ac_cv_enable_ldap)
191
192         if test "$ac_cv_enable_ldap" = yes; then
193                 AC_CHECK_LIB(ldap, ldap_open, [ 
194                                 ac_cv_enable_ldap=yes
195                                 CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags gthread`"
196                                 LDAP_LIBS="$LDAP_LIBS -lldap `$GLIB_CONFIG --libs gthread`"
197                                 AC_DEFINE(USE_LDAP)
198                                 AC_SUBST(LDAP_LIBS)
199                                 ], 
200                                 [ ac_cv_enable_ldap=no ], $LDAP_LIBS )
201                 AC_MSG_CHECKING([whether ldap libs were detected])
202                 AC_MSG_RESULT($ac_cv_enable_ldap)
203         fi
204 else
205         AC_MSG_RESULT(no)
206 fi
207
208 dnl Check for OpenSSL
209 AC_ARG_ENABLE(ssl,
210         [  --enable-ssl            Enable SSL support using OpenSSL [default=no]],
211         [ac_cv_enable_ssl=$enableval], [ac_cv_enable_ssl=no])
212 AC_MSG_CHECKING([whether to use OpenSSL])
213 if test $ac_cv_enable_ssl = yes; then
214         AC_MSG_RESULT(yes)
215         AC_MSG_CHECKING([if openssl is available])
216         LIBS="$LIBS -lssl -lcrypto"
217         AC_TRY_LINK([
218 #include <openssl/opensslv.h>
219 ],      [ return OPENSSL_VERSION_NUMBER; ],
220         [ AC_MSG_RESULT(yes)
221           AC_DEFINE(USE_SSL) ],
222         [ AC_MSG_RESULT(no)
223           LIBS="$ac_save_LIBS"
224           ac_cv_enable_ssl=no ])
225 else
226         AC_MSG_RESULT(no)
227 fi
228
229 dnl Check for X-Face support
230 AC_ARG_ENABLE(compface,
231         [  --disable-compface      Do not use compface (X-Face)],
232         [ac_cv_enable_compface=$enableval], [ac_cv_enable_compface=yes])
233 if test "$ac_cv_enable_compface" = yes; then
234         AC_CHECK_LIB(compface, uncompface,,[ac_cv_enable_compface=no])
235 fi
236
237 dnl Check for libjconv
238 AC_ARG_ENABLE(jconv,
239         [  --disable-jconv         Do not use libjconv],
240         [ac_cv_enable_jconv=$enableval], [ac_cv_enable_jconv=yes])
241 if test "$ac_cv_enable_jconv" = yes; then
242         AC_CHECK_LIB(jconv, jconv_alloc_conv,,[ac_cv_enable_jconv=no])
243 fi
244
245 AC_CHECK_LIB(xpg4, setlocale)
246
247 dnl for GThread support (currently disabled)
248 dnl AC_ARG_ENABLE(threads,
249 dnl     [  --enable-threads        Enable multithread support [default=no]],
250 dnl     [use_threads=$enableval], [use_threads=no])
251
252 AC_MSG_CHECKING([whether to use threads])
253 if test x"$use_threads" = xyes ; then
254         AC_MSG_RESULT(yes)
255         if test ! -z `$GLIB_CONFIG --help 2>&1 |grep 'gthread'` ; then
256                 CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags gthread`"
257                 LIBS="$LIBS `$GLIB_CONFIG --libs gthread`"
258                 AC_DEFINE(USE_THREADS)
259         else
260                 AC_MSG_ERROR([Sylpheed requires GThread from GLib to use threading.])
261         fi
262 else
263         AC_MSG_RESULT(no)
264 fi
265
266 dnl check for IPv6 option
267 AC_ARG_ENABLE(ipv6,
268         [  --enable-ipv6           Enable IPv6 support [default=no]],
269         [ac_cv_enable_ipv6=$enableval], [ac_cv_enable_ipv6=no])
270
271 dnl automated checks for IPv6 support.
272 AC_MSG_CHECKING([whether to use IPv6])
273 if test x"$ac_cv_enable_ipv6" = xyes; then
274         AC_MSG_RESULT(yes)
275         AC_MSG_CHECKING([for IPv6 support])
276         AC_CACHE_VAL(ac_cv_ipv6,[
277                 AC_TRY_COMPILE([#define INET6
278                                 #include <sys/types.h>
279                                 #include <netinet/in.h>],
280                         [int x = IPPROTO_IPV6; struct in6_addr a;],
281                         ac_cv_ipv6=yes, ac_cv_ipv6=no)
282         ])
283         AC_MSG_RESULT($ac_cv_ipv6)
284         if test $ac_cv_ipv6 = yes; then
285                 AC_DEFINE(INET6)
286         else
287                 AC_MSG_WARN(*** IPv6 will not be supported ***)
288                 ac_cv_enable_ipv6=no
289         fi
290 else
291         AC_MSG_RESULT(no)
292 fi
293
294 dnl PSPELL is user for spell checking
295 AC_ARG_ENABLE(pspell,
296         [  --enable-pspell           Enable pspell support [default=no]],
297         [ac_cv_enable_pspell=$enableval], [ac_cv_enable_pspell=no])
298 AC_MSG_CHECKING([whether to use pspell])
299 if test $ac_cv_enable_pspell = yes; then
300         AC_MSG_RESULT(yes)
301         AM_PATH_PSPELL(.12.2, AC_DEFINE(USE_PSPELL), [use_pspell=no
302                                                     ac_cv_enable_pspell=no])
303         pspell_path="`pspell-config --pkgdatadir`"
304         AC_DEFINE_UNQUOTED(PSPELL_PATH, "${pspell_path}/")
305 else
306         AC_MSG_RESULT(no)
307 fi
308
309 dnl check if gdk / gtk was compiled with USE_XIM
310 AC_MSG_CHECKING([whether GTK was compiled with XIM support])
311 CFLAGS_SAVE="$CFLAGS"
312 LDFLAGS_SAVE="$LDFLAGS"
313 CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags` `gtk-config --cflags`"
314 LDFLAGS="$LIBS `$GLIB_CONFIG --libs` `gtk-config --libs`"
315 AC_CACHE_VAL(ac_cv_use_gtkgdk_xim, [
316         AC_TRY_LINK_FUNC([ gdk_ic_attr_new ],
317                          ac_cv_use_gtkgdk_xim=yes, ac_cv_use_gtkgdk_xim=no)
318         ])
319 AC_MSG_RESULT($ac_cv_use_gtkgdk_xim)
320 if test $ac_cv_use_gtkgdk_xim = yes; then
321         AC_DEFINE(USE_GTKGDK_XIM)
322 fi
323 CFLAGS="$CFLAGS_SAVE"
324 LDFLAGS="$LDFLAGS_SAVE"
325
326
327 dnl Checks for header files.
328 AC_HEADER_DIRENT
329 AC_HEADER_STDC
330 AC_HEADER_SYS_WAIT
331 AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h \
332                  sys/param.h sys/utsname.h sys/select.h \
333                  wchar.h wctype.h)
334
335 dnl Checks for typedefs, structures, and compiler characteristics.
336 AC_C_CONST
337 AC_TYPE_OFF_T
338 AC_TYPE_PID_T
339 AC_TYPE_SIZE_T
340 AC_STRUCT_TM
341
342 dnl AC_CHECK_TYPE(wint_t, unsigned int) does not work because wint_t
343 dnl may be defined only in wchar.h (this happens with gcc-2.96).
344 dnl So we need to use this extended macro.
345 SYLPHEED_CHECK_TYPE(wint_t, unsigned int,
346 [
347 #if HAVE_WCHAR_H
348 #include <wchar.h>
349 #endif
350 ])
351
352 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
353 AC_CHECK_SIZEOF(unsigned short, 2)
354 AC_CHECK_SIZEOF(unsigned int, 4)
355 AC_CHECK_SIZEOF(unsigned long, 4)
356
357 dnl Checks for library functions.
358 AC_FUNC_ALLOCA
359 AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr strchr \
360                wcsstr wcswcs iswalnum iswspace towlower \
361                wcslen wcscpy wcsncpy \
362                uname flock lockf inet_aton inet_addr \
363                fchmod mkstemp)
364
365 AC_OUTPUT([
366 Makefile
367 sylpheed.spec
368 intl/Makefile
369 ac/Makefile
370 po/Makefile.in
371 src/version.h
372 src/Makefile
373 faq/Makefile
374 faq/de/Makefile
375 faq/en/Makefile
376 faq/es/Makefile
377 faq/fr/Makefile
378 faq/it/Makefile
379 man/Makefile
380 manual/Makefile
381 manual/de/Makefile
382 manual/en/Makefile
383 manual/es/Makefile
384 manual/fr/Makefile
385 manual/ja/Makefile
386 tools/Makefile
387 ])
388
389 dnl Output the configuration summary
390 echo ""
391 echo "$PACKAGE $VERSION"
392 echo ""
393 if test "$ac_cv_enable_gdk_pixbuf" = yes; then
394         echo "image support : yes (gdk-pixbuf)"
395 elif test "$ac_cv_enable_imlib" = yes; then
396         echo "image support : yes (gdk_imlib)"
397 else
398         echo "image support : no"
399 fi
400 echo "GPGME         : $ac_cv_enable_gpgme"
401 echo "JPilot        : $ac_cv_enable_jpilot"
402 echo "LDAP          : $ac_cv_enable_ldap"
403 echo "OpenSSL       : $ac_cv_enable_ssl"
404 echo "compface      : $ac_cv_enable_compface"
405 echo "libjconv      : $ac_cv_enable_jconv"
406 echo "IPv6          : $ac_cv_enable_ipv6"
407 echo "Pspell        : $ac_cv_enable_pspell"
408 echo ""
409 echo "The binary will be installed in $prefix/bin"
410 echo ""
411 echo "Configure finished, type 'make' to build."