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