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