0.8.10claws3
[claws.git] / configure.ac
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=10
12 INTERFACE_AGE=0
13 BINARY_AGE=0
14 EXTRA_VERSION=claws3
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 ************************
198 dnl ** GTK user interface **
199 dnl ************************
200
201 dnl Checks for GTK
202 AM_PATH_GTK(1.2.6,,
203         AC_MSG_ERROR(Test for GTK failed. See the file 'INSTALL' for help.))
204
205 dnl check if gdk / gtk was compiled with USE_XIM
206 AC_MSG_CHECKING([whether GTK was compiled with XIM support])
207 CFLAGS_SAVE="$CFLAGS"
208 LDFLAGS_SAVE="$LDFLAGS"
209 CFLAGS="$CFLAGS `$GTK_CONFIG --cflags`"
210 LDFLAGS="$LDFLAGS `$GTK_CONFIG --libs`"
211 AC_CACHE_VAL(ac_cv_use_xim, [
212         AC_TRY_LINK_FUNC([gdk_ic_attr_new],
213                          ac_cv_use_xim=yes, ac_cv_use_xim=no)
214 ])
215 AC_MSG_RESULT($ac_cv_use_xim)
216 if test $ac_cv_use_xim = yes; then
217         AC_DEFINE(USE_XIM, 1, Whether GTK was compiled with XIM support or not)
218 fi
219 CFLAGS="$CFLAGS_SAVE"
220 LDFLAGS="$LDFLAGS_SAVE"
221
222 dnl GNU/Aspell is used for spell checking
223 AC_ARG_ENABLE(aspell,
224         [  --enable-aspell         Enable GNU/aspell support [default=no]],
225         [ac_cv_enable_aspell=$enableval], [ac_cv_enable_aspell=no])
226 AC_MSG_CHECKING([whether to use GNU/aspell])
227 if test $ac_cv_enable_aspell = yes; then
228         AC_MSG_RESULT(yes)
229         AM_PATH_ASPELL(0.50, AC_DEFINE(USE_ASPELL, 1, Define if you use ASPELL to support spell checking),
230                       [use_aspell=no ac_cv_enable_aspell=no])
231 else
232         AC_MSG_RESULT(no)
233 fi
234
235 dnl want crash dialog
236 AC_ARG_ENABLE(crash-dialog,
237         [  --enable-crash-dialog   Enable crash dialog [default=no]],
238         [ac_cv_enable_crash_dialog=$enableval], [ac_cv_enable_crash_dialog=no])
239 if test $ac_cv_enable_crash_dialog = yes; then
240 dnl check if GDB is somewhere
241         AC_CHECK_PROG(ac_cv_enable_crash_dialog, gdb, yes, no)
242         AC_MSG_CHECKING([whether to use crash dialog])
243         if test $ac_cv_enable_crash_dialog = yes; then
244                 AC_DEFINE(CRASH_DIALOG, 1, Pop up crash dialog)
245         fi
246         AC_MSG_RESULT($ac_cv_enable_crash_dialog)
247 fi
248
249 dnl Check for X-Face support
250 AC_ARG_ENABLE(compface,
251         [  --disable-compface      Do not use compface (X-Face)],
252         [ac_cv_enable_compface=$enableval], [ac_cv_enable_compface=yes])
253 if test "$ac_cv_enable_compface" = yes; then
254         AC_CHECK_LIB(compface, uncompface,,[ac_cv_enable_compface=no])
255 fi
256
257 dnl for LDAP support in addressbook
258 dnl no check for libraries; dynamically loaded
259 AC_ARG_ENABLE(ldap,
260         [  --enable-ldap           Enable LDAP support [default=no]],
261         [ac_cv_enable_ldap=$enableval], [ac_cv_enable_ldap=no])
262 AC_MSG_CHECKING([whether to use LDAP])
263 if test "$ac_cv_enable_ldap" = yes; then
264         AC_MSG_RESULT(yes)
265
266         dnl check for available libraries, and pull them in
267         AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="$LDAP_LIBS -lresolv")
268         AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket")
269         AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
270         AC_CHECK_LIB(lber, ber_get_tag, LDAP_LIBS="$LDAP_LIBS -llber",,
271                      $LDAP_LIBS)
272
273         dnl we need libpthread for sylpheed ldap,  until we find
274         dnl a better way to handle ldap requests asynchronously...
275         AC_CHECK_LIB(pthread, pthread_create, LDAP_LIBS="$LDAP_LIBS -lpthread")
276
277         AC_CHECK_HEADERS(ldap.h lber.h pthread.h,
278                          [ ac_cv_enable_ldap=yes ],
279                          [ ac_cv_enable_ldap=no ])
280
281         if test "$ac_cv_enable_ldap" = yes; then
282                 AC_CHECK_LIB(ldap, ldap_open,
283                              [ ac_cv_enable_ldap=yes ],
284                              [ ac_cv_enable_ldap=no ],
285                              $LDAP_LIBS)
286         fi
287
288         AC_MSG_CHECKING([whether ldap library is available])
289         AC_MSG_RESULT($ac_cv_enable_ldap)
290
291         if test "$ac_cv_enable_ldap" = yes; then
292                 CFLAGS="$CFLAGS `$GLIB_CONFIG --cflags gthread`"
293                 LDAP_LIBS="$LDAP_LIBS -lldap `$GLIB_CONFIG --libs gthread`"
294                 AC_DEFINE(USE_LDAP, 1, Define if you want LDAP support in addressbook.)
295                 AC_SUBST(LDAP_LIBS)
296         fi
297 else
298         AC_MSG_RESULT(no)
299 fi
300
301 dnl for JPilot support in addressbook
302 dnl no check for libraries; these are dynamically loaded
303 AC_ARG_ENABLE(jpilot,
304         [  --enable-jpilot         Enable JPilot support [default=no]],
305         [ac_cv_enable_jpilot=$enableval], [ac_cv_enable_jpilot=no])
306 AC_MSG_CHECKING([whether to use JPilot])
307 if test "$ac_cv_enable_jpilot" = yes; then
308         AC_MSG_RESULT(yes)
309         AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h,
310                          [ AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ],
311                          [ ac_cv_enable_jpilot=no ])
312         if test "$ac_cv_enable_jpilot" = no; then
313                 AC_CHECK_HEADERS(libpisock/pi-args.h libpisock/pi-appinfo.h libpisock/pi-address.h,
314                                  [ ac_cv_enable_jpilot=yes
315                                    AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ])
316         fi
317         AC_MSG_CHECKING([whether jpilot is available])
318         AC_MSG_RESULT($ac_cv_enable_jpilot)
319
320         if test "$ac_cv_enable_jpilot" = yes; then
321                 LIBS="$LIBS -lpisock"
322         fi
323 else
324         AC_MSG_RESULT(no)
325 fi
326
327 dnl Check for built-in image view support
328 AC_ARG_ENABLE(gdk-pixbuf,
329         [  --disable-gdk-pixbuf    Do not use gdk-pixbuf],
330         [ac_cv_enable_gdk_pixbuf=$enableval], [ac_cv_enable_gdk_pixbuf=yes])
331 AC_ARG_ENABLE(imlib,
332         [  --disable-imlib         Do not use imlib],
333         [ac_cv_enable_imlib=$enableval], [ac_cv_enable_imlib=yes])
334
335 if test "$ac_cv_enable_gdk_pixbuf" = yes; then
336         AM_PATH_GDK_PIXBUF(0.8.0,
337                 [AC_DEFINE(HAVE_GDK_PIXBUF, 1, Define if you use gdk-pixbuf to support image view)
338                  ac_cv_enable_imlib=no], [ac_cv_enable_gdk_pixbuf=no])
339 fi
340 if test "$ac_cv_enable_imlib" = yes; then
341         AM_PATH_GDK_IMLIB(1.9,
342                 AC_DEFINE(HAVE_GDK_IMLIB, 1, Define if you use gdk_imlib to support image view),
343                 [ac_cv_enable_imlib=no])
344 fi
345 if test "$ac_cv_enable_gdk_pixbuf" = no -a "$ac_cv_enable_imlib" = no; then
346         AC_MSG_WARN(*** Built-in image view will not be supported ***)
347 fi
348
349 dnl GPGME is used to support OpenPGP 
350 AC_ARG_ENABLE(gpgme,
351         [  --enable-gpgme          Enable GnuPG support using GPGME [default=no]],
352         [ac_cv_enable_gpgme=$enableval], [ac_cv_enable_gpgme=no])
353 AC_MSG_CHECKING([whether to use GPGME])
354 if test $ac_cv_enable_gpgme = yes; then
355         AC_MSG_RESULT(yes)
356         AM_PATH_GPGME(0.3.10, AC_DEFINE(USE_GPGME, 1, Define if you use GPGME to support OpenPGP.),
357                       [use_gpgme=no
358                        ac_cv_enable_gpgme=no])
359 else
360         AC_MSG_RESULT(no)
361 fi
362
363 dnl *************************
364 dnl ** section for plugins **
365 dnl *************************
366
367 PLUGINS=""
368
369 AC_ARG_ENABLE(demo-plugin,
370         [  --enable-demo-plugin    Build demo plugin [default=no]],
371         [ac_cv_enable_demo_plugin=$enableval], [ac_cv_enable_demo_plugin=no])
372 AM_CONDITIONAL(BUILD_DEMO_PLUGIN, test x"$ac_cv_enable_demo_plugin" = xyes)
373
374 AC_ARG_ENABLE(spamassassin-plugin,
375         [  --enable-spamassassin-plugin    Build spamassassin plugin [default=no]],
376         [ac_cv_enable_spamassassin_plugin=$enableval], [ac_cv_enable_spamassassin_plugin=no])
377 AM_CONDITIONAL(BUILD_SPAMASSASSIN_PLUGIN, test x"$ac_cv_enable_spamassassin_plugin" = xyes)
378 if test x"$ac_cv_enable_spamassassin_plugin" = xyes; then
379         AC_SPAMASSASSIN
380 fi
381
382 dnl ****************************
383 dnl ** Final configure output **
384 dnl ****************************
385
386 AC_OUTPUT([
387 Makefile
388 sylpheed.spec
389 intl/Makefile
390 ac/Makefile
391 po/Makefile.in
392 src/common/version.h
393 src/Makefile
394 src/common/Makefile
395 src/gtk/Makefile
396 src/plugins/Makefile
397 src/plugins/demo/Makefile
398 src/plugins/spamassassin/Makefile
399 faq/Makefile
400 faq/de/Makefile
401 faq/en/Makefile
402 faq/es/Makefile
403 faq/fr/Makefile
404 faq/it/Makefile
405 man/Makefile
406 manual/Makefile
407 manual/de/Makefile
408 manual/en/Makefile
409 manual/es/Makefile
410 manual/fr/Makefile
411 manual/ja/Makefile
412 tools/Makefile
413 config/Makefile
414 ])
415
416 dnl Output the configuration summary
417 echo ""
418 echo "$PACKAGE $VERSION"
419 echo ""
420 if test "$ac_cv_enable_gdk_pixbuf" = yes; then
421         echo "image support : yes (gdk-pixbuf)"
422 elif test "$ac_cv_enable_imlib" = yes; then
423         echo "image support : yes (gdk_imlib)"
424 else
425         echo "image support : no"
426 fi
427 echo "GnuPG         : $ac_cv_enable_gpgme"
428 echo "JPilot        : $ac_cv_enable_jpilot"
429 echo "LDAP          : $ac_cv_enable_ldap"
430 echo "OpenSSL       : $ac_cv_enable_openssl"
431 echo "iconv         : $am_cv_func_iconv"
432 echo "compface      : $ac_cv_enable_compface"
433 echo "IPv6          : $ac_cv_enable_ipv6"
434 echo "GNU/aspell    : $ac_cv_enable_aspell"
435 echo "Crash dialog  : $ac_cv_enable_crash_dialog"
436 echo "Plugins       : $PLUGINS"
437 echo ""
438 echo "The binary will be installed in $prefix/bin"
439 echo ""
440 echo "Configure finished, type 'make' to build."