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