sync with 0.7.8cvs21
[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=7
8 MICRO_VERSION=8
9 INTERFACE_AGE=0
10 BINARY_AGE=0
11 EXTRA_VERSION=claws54
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 mandir='${prefix}/man/man1'
89 AC_SUBST(mandir)
90
91 dnl Set PACKAGE_DATA_DIR in config.h.
92 if test "x${datadir}" = 'x${prefix}/share'; then
93   if test "x${prefix}" = "xNONE"; then
94     AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}")
95   else
96     AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/share/${PACKAGE}")
97   fi
98 else
99   AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${datadir}/${PACKAGE}")
100 fi
101
102 dnl Checks for libraries.
103 AM_PATH_GLIB(1.2.6,,
104         AC_MSG_ERROR(Test for GLIB failed. See the file 'INSTALL' for help.),
105         gthread)
106 AM_PATH_GTK(1.2.6,,
107         AC_MSG_ERROR(Test for GTK failed. See the file 'INSTALL' for help.))
108
109 dnl Check for built-in image view support
110 AC_ARG_ENABLE(gdk-pixbuf,
111         [  --disable-gdk-pixbuf    Do not use gdk-pixbuf],
112         [ac_cv_enable_gdk_pixbuf=$enableval], [ac_cv_enable_gdk_pixbuf=yes])
113 AC_ARG_ENABLE(imlib,
114         [  --disable-imlib         Do not use imlib],
115         [ac_cv_enable_imlib=$enableval], [ac_cv_enable_imlib=yes])
116
117 if test "$ac_cv_enable_gdk_pixbuf" = yes; then
118         AM_PATH_GDK_PIXBUF(0.8.0,
119                 [AC_DEFINE(HAVE_GDK_PIXBUF)
120                  ac_cv_enable_imlib=no], [ac_cv_enable_gdk_pixbuf=no])
121 fi
122 if test "$ac_cv_enable_imlib" = yes; then
123         AM_PATH_GDK_IMLIB(1.9,
124                 AC_DEFINE(HAVE_GDK_IMLIB), [ac_cv_enable_imlib=no])
125 fi
126 if test "$ac_cv_enable_gdk_pixbuf" = no -a "$ac_cv_enable_imlib" = no; then
127         AC_MSG_WARN(*** Built-in image view will not be supported ***)
128 fi
129
130 dnl GPGME is used to support OpenPGP 
131 AC_ARG_ENABLE(gpgme,
132         [  --enable-gpgme          Enable GnuPG support using GPGME [default=no]],
133         [ac_cv_enable_gpgme=$enableval], [ac_cv_enable_gpgme=no])
134 AC_MSG_CHECKING([whether to use GPGME])
135 if test $ac_cv_enable_gpgme = yes; then
136         AC_MSG_RESULT(yes)
137         AM_PATH_GPGME(0.2.3, AC_DEFINE(USE_GPGME), [use_gpgme=no
138                                                     ac_cv_enable_gpgme=no])
139 else
140         AC_MSG_RESULT(no)
141 fi
142
143 dnl for JPilot support in addressbook
144 dnl no check for libraries; these are dynamically loaded
145 AC_ARG_ENABLE(jpilot,
146         [  --enable-jpilot         Enable JPilot support [default=no]],
147         [ac_cv_enable_jpilot=$enableval], [ac_cv_enable_jpilot=no])
148 AC_MSG_CHECKING([whether to use JPilot])
149 if test "$ac_cv_enable_jpilot" = yes; then
150         AC_MSG_RESULT(yes)
151         AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h,
152                          [ AC_DEFINE(USE_JPILOT) ],
153                          [ ac_cv_enable_jpilot=no ])
154         if test "$ac_cv_enable_jpilot" = no; then
155                 AC_CHECK_HEADERS(libpisock/pi-args.h libpisock/pi-appinfo.h libpisock/pi-address.h,
156                                  [ ac_cv_enable_jpilot=yes
157                                    AC_DEFINE(USE_JPILOT) ])
158         fi
159         AC_MSG_CHECKING([whether jpilot is available])
160         AC_MSG_RESULT($ac_cv_enable_jpilot)
161
162         if test "$ac_cv_enable_jpilot" = yes; then
163                 LIBS="$LIBS -lpisock"
164         fi
165 else
166         AC_MSG_RESULT(no)
167 fi
168
169 dnl for LDAP support in addressbook
170 AC_ARG_ENABLE(ldap,
171         [  --enable-ldap           Enable LDAP support [default=no]],
172         [ac_cv_enable_ldap=$enableval], [ac_cv_enable_ldap=no])
173 AC_MSG_CHECKING([whether to use LDAP])
174 if test "$ac_cv_enable_ldap" = yes; then
175         AC_MSG_RESULT(yes)
176
177         dnl check for available libraries, and pull them in
178         AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="$LDAP_LIBS -lresolv")
179         AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket")
180         AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
181         AC_CHECK_LIB(lber, ber_get_tag, LDAP_LIBS="$LDAP_LIBS -llber")
182
183         dnl we need libpthread for sylpheed ldap,  until we find
184         dnl a better way to handle ldap requests asynchronously...
185         AC_CHECK_LIB(pthread, pthread_create, LDAP_LIBS="$LDAP_LIBS -lpthread")
186
187         dnl the check for the headers 
188         AC_CHECK_HEADERS(ldap.h lber.h pthread.h,
189                          [ ac_cv_enable_ldap=yes ],
190                          [ ac_cv_enable_ldap=no ])
191         AC_MSG_CHECKING([whether ldap headers were detected])
192         AC_MSG_RESULT($ac_cv_enable_ldap)
193
194         if test "$ac_cv_enable_ldap" = yes; then
195                 AC_CHECK_LIB(ldap, ldap_open, [ 
196                                 ac_cv_enable_ldap=yes
197                                 CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags gthread`"
198                                 LDAP_LIBS="$LDAP_LIBS -lldap `$GLIB_CONFIG --libs gthread`"
199                                 AC_DEFINE(USE_LDAP)
200                                 AC_SUBST(LDAP_LIBS)
201                                 ], 
202                                 [ ac_cv_enable_ldap=no ], $LDAP_LIBS )
203                 AC_MSG_CHECKING([whether ldap libs were detected])
204                 AC_MSG_RESULT($ac_cv_enable_ldap)
205         fi
206 else
207         AC_MSG_RESULT(no)
208 fi
209
210 dnl Check for OpenSSL
211 AC_ARG_ENABLE(ssl,
212         [  --enable-ssl            Enable SSL support using OpenSSL [default=no]],
213         [ac_cv_enable_ssl=$enableval], [ac_cv_enable_ssl=no])
214 AC_MSG_CHECKING([whether to use OpenSSL])
215 if test $ac_cv_enable_ssl = yes; then
216         AC_MSG_RESULT(yes)
217         AC_MSG_CHECKING([if openssl is available])
218         LIBS="$LIBS -lssl -lcrypto"
219         AC_TRY_LINK([
220 #include <openssl/opensslv.h>
221 ],      [ return OPENSSL_VERSION_NUMBER; ],
222         [ AC_MSG_RESULT(yes)
223           AC_DEFINE(USE_SSL) ],
224         [ AC_MSG_RESULT(no)
225           LIBS="$ac_save_LIBS"
226           ac_cv_enable_ssl=no ])
227 else
228         AC_MSG_RESULT(no)
229 fi
230
231 dnl Check for X-Face support
232 AC_ARG_ENABLE(compface,
233         [  --disable-compface      Do not use compface (X-Face)],
234         [ac_cv_enable_compface=$enableval], [ac_cv_enable_compface=yes])
235 if test "$ac_cv_enable_compface" = yes; then
236         AC_CHECK_LIB(compface, uncompface,,[ac_cv_enable_compface=no])
237 fi
238
239 dnl Check for libjconv
240 AC_ARG_ENABLE(jconv,
241         [  --disable-jconv         Do not use libjconv],
242         [ac_cv_enable_jconv=$enableval], [ac_cv_enable_jconv=yes])
243 if test "$ac_cv_enable_jconv" = yes; then
244         AC_CHECK_LIB(jconv, jconv_alloc_conv,,[ac_cv_enable_jconv=no])
245 fi
246
247 AC_CHECK_LIB(xpg4, setlocale)
248
249 dnl for GThread support (currently disabled)
250 dnl AC_ARG_ENABLE(threads,
251 dnl     [  --enable-threads        Enable multithread support [default=no]],
252 dnl     [use_threads=$enableval], [use_threads=no])
253
254 AC_MSG_CHECKING([whether to use threads])
255 if test x"$use_threads" = xyes ; then
256         AC_MSG_RESULT(yes)
257         if test ! -z `$GLIB_CONFIG --help 2>&1 |grep 'gthread'` ; then
258                 CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags gthread`"
259                 LIBS="$LIBS `$GLIB_CONFIG --libs gthread`"
260                 AC_DEFINE(USE_THREADS)
261         else
262                 AC_MSG_ERROR([Sylpheed requires GThread from GLib to use threading.])
263         fi
264 else
265         AC_MSG_RESULT(no)
266 fi
267
268 dnl check for IPv6 option
269 AC_ARG_ENABLE(ipv6,
270         [  --enable-ipv6           Enable IPv6 support [default=no]],
271         [ac_cv_enable_ipv6=$enableval], [ac_cv_enable_ipv6=no])
272
273 dnl automated checks for IPv6 support.
274 AC_MSG_CHECKING([whether to use IPv6])
275 if test x"$ac_cv_enable_ipv6" = xyes; then
276         AC_MSG_RESULT(yes)
277         AC_MSG_CHECKING([for IPv6 support])
278         AC_CACHE_VAL(ac_cv_ipv6,[
279                 AC_TRY_COMPILE([#define INET6
280                                 #include <sys/types.h>
281                                 #include <netinet/in.h>],
282                         [int x = IPPROTO_IPV6; struct in6_addr a;],
283                         ac_cv_ipv6=yes, ac_cv_ipv6=no)
284         ])
285         AC_MSG_RESULT($ac_cv_ipv6)
286         if test $ac_cv_ipv6 = yes; then
287                 AC_DEFINE(INET6)
288         else
289                 AC_MSG_WARN(*** IPv6 will not be supported ***)
290                 ac_cv_enable_ipv6=no
291         fi
292 else
293         AC_MSG_RESULT(no)
294 fi
295
296 dnl PSPELL is user for spell checking
297 AC_ARG_ENABLE(pspell,
298         [  --enable-pspell           Enable pspell support [default=no]],
299         [ac_cv_enable_pspell=$enableval], [ac_cv_enable_pspell=no])
300 AC_MSG_CHECKING([whether to use pspell])
301 if test $ac_cv_enable_pspell = yes; then
302         AC_MSG_RESULT(yes)
303         AM_PATH_PSPELL(.12.2, AC_DEFINE(USE_PSPELL), [use_pspell=no
304                                                     ac_cv_enable_pspell=no])
305         pspell_path="`pspell-config --pkgdatadir`"
306         AC_DEFINE_UNQUOTED(PSPELL_PATH, "${pspell_path}/")
307 else
308         AC_MSG_RESULT(no)
309 fi
310
311 dnl check if gdk / gtk was compiled with USE_XIM
312 AC_MSG_CHECKING([whether GTK was compiled with XIM support])
313 CFLAGS_SAVE="$CFLAGS"
314 LDFLAGS_SAVE="$LDFLAGS"
315 CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags` `gtk-config --cflags`"
316 LDFLAGS="$LIBS `$GLIB_CONFIG --libs` `gtk-config --libs`"
317 AC_CACHE_VAL(ac_cv_use_gtkgdk_xim, [
318         AC_TRY_COMPILE([#include <gtk/gtk.h>
319                         #include <gdk/gdk.h>],
320                         [extern gint gdk_im_open(void); gdk_im_open();],
321                          ac_cv_use_gtkgdk_xim=yes, ac_cv_use_gtkgdk_xim=no)
322         ])
323 AC_MSG_RESULT($ac_cv_use_gtkgdk_xim)
324 if test $ac_cv_use_gtkgdk_xim = yes; then
325         AC_DEFINE(USE_GTKGDK_XIM)
326 fi
327 CFLAGS="$CFLAGS_SAVE"
328 LDFLAGS="$LDFLAGS_SAVE"
329
330
331 dnl Checks for header files.
332 AC_HEADER_DIRENT
333 AC_HEADER_STDC
334 AC_HEADER_SYS_WAIT
335 AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h \
336                  sys/param.h sys/utsname.h \
337                  wchar.h wctype.h)
338
339 dnl Checks for typedefs, structures, and compiler characteristics.
340 AC_C_CONST
341 AC_TYPE_OFF_T
342 AC_TYPE_PID_T
343 AC_TYPE_SIZE_T
344 AC_STRUCT_TM
345
346 dnl AC_CHECK_TYPE(wint_t, unsigned int) does not work because wint_t
347 dnl may be defined only in wchar.h (this happens with gcc-2.96).
348 dnl So we need to use this extended macro.
349 SYLPHEED_CHECK_TYPE(wint_t, unsigned int,
350 [
351 #if HAVE_WCHAR_H
352 #include <wchar.h>
353 #endif
354 ])
355
356 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
357 AC_CHECK_SIZEOF(unsigned short, 2)
358 AC_CHECK_SIZEOF(unsigned int, 4)
359 AC_CHECK_SIZEOF(unsigned long, 4)
360
361 dnl Checks for library functions.
362 AC_FUNC_ALLOCA
363 AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr strchr \
364                wcsstr wcswcs iswalnum iswspace towlower \
365                wcslen wcscpy wcsncpy \
366                uname flock lockf inet_aton inet_addr \
367                fchmod mkstemp)
368
369 AC_OUTPUT([
370 Makefile
371 sylpheed.spec
372 intl/Makefile
373 ac/Makefile
374 po/Makefile.in
375 src/version.h
376 src/Makefile
377 faq/Makefile
378 faq/de/Makefile
379 faq/en/Makefile
380 faq/es/Makefile
381 faq/fr/Makefile
382 faq/it/Makefile
383 man/Makefile
384 manual/Makefile
385 manual/de/Makefile
386 manual/en/Makefile
387 manual/es/Makefile
388 manual/fr/Makefile
389 manual/ja/Makefile
390 tools/Makefile
391 ])
392
393 dnl Output the configuration summary
394 echo ""
395 echo "$PACKAGE $VERSION"
396 echo ""
397 if test "$ac_cv_enable_gdk_pixbuf" = yes; then
398         echo "image support : yes (gdk-pixbuf)"
399 elif test "$ac_cv_enable_imlib" = yes; then
400         echo "image support : yes (gdk_imlib)"
401 else
402         echo "image support : no"
403 fi
404 echo "GPGME         : $ac_cv_enable_gpgme"
405 echo "JPilot        : $ac_cv_enable_jpilot"
406 echo "LDAP          : $ac_cv_enable_ldap"
407 echo "OpenSSL       : $ac_cv_enable_ssl"
408 echo "compface      : $ac_cv_enable_compface"
409 echo "libjconv      : $ac_cv_enable_jconv"
410 echo "IPv6          : $ac_cv_enable_ipv6"
411 echo "Pspell        : $ac_cv_enable_pspell"
412 echo ""
413 echo "The binary will be installed in $prefix/bin"
414 echo ""
415 echo "Configure finished, type 'make' to build."