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