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