2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([centerim], m4_esyscmd([misc/git-version-gen .tarball-version]), [http://bugzilla.centerim.org])
6 AC_CONFIG_SRCDIR([config.h.in])
7 AC_CONFIG_HEADER([config.h])
8 AM_INIT_AUTOMAKE([-Wall])
16 ########################
17 # Checks for programs. #
18 ########################
24 AM_GNU_GETTEXT_VERSION([0.14.6])
27 #########################
28 # Checks for libraries. #
29 #########################
31 AS_HELP_STRING([--disable-icq], [Build without ICQ]),
32 build_icq="$enableval",
36 AS_HELP_STRING([--disable-yahoo], [Build without Yahoo!]),
37 build_yahoo="$enableval",
41 AS_HELP_STRING([--disable-aim], [Build without AIM]),
42 build_aim="$enableval",
46 AS_HELP_STRING([--disable-irc], [Build without IRC]),
47 build_irc="$enableval",
51 AS_HELP_STRING([--disable-jabber], [Build without Jabber]),
52 build_jabber="$enableval",
56 AS_HELP_STRING([--disable-gg], [Build without Gadu-Gadu]),
57 build_gg="$enableval",
61 AS_HELP_STRING([--disable-msn], [Build without MSN]),
62 build_msn="$enableval",
66 AS_HELP_STRING([--disable-rss], [Build without RSS reader]),
67 build_rss="$enableval",
71 AS_HELP_STRING([--disable-lj], [Build without LiveJournal client]),
72 build_lj="$enableval",
75 AC_ARG_ENABLE(locales-fix,
76 AS_HELP_STRING([--enable-locales-fix], [enables workaround for
77 broken locales. use this option if some of
78 characters in your texts in Chinese or Japanese
80 locales_fix="$enableval",
85 AS_HELP_STRING([--with-fribidi=[DIR]], [enable Hebrew and Arabic
86 support using fribidi library in DIR]),
87 [with_fribidi=$withval],
91 AS_HELP_STRING([--with-ssl], [enable SSL secured connections using
92 either OpenSSL or GnuTLS (auto)]),
96 AS_HELP_STRING([--with-openssl=[DIR]], [enable SSL secured
97 connections using the OpenSSL library in DIR
99 [with_openssl=$withval]
101 AC_ARG_WITH(nss_compat,
102 AS_HELP_STRING([--with-nss_compat=[DIR]], [enable SSL secured
103 connections using the NSS compat library in DIR
105 [with_nss_compat=$withval]
112 LIBCURL_CHECK_CONFIG(
119 AS_HELP_STRING([--without-libjpeg], [Compile without JPEG token
120 support (for Gadu-Gadu registration)])
123 AS_HELP_STRING([--with-libotr], [enable Off-the-Record Messaging (libotr) WARNING: use at your own risk, not supported yet]),
124 [with_libotr=$withval],
128 AS_HELP_STRING([--with-libXss], [enable Xss]),
129 [with_libXss=$withval],
133 #####################
134 # Check for fribidi #
135 #####################
136 AC_MSG_CHECKING(whether to use fribidi)
142 if test "x$with_fribidi" = "xyes"; then
143 if ! pkg-config fribidi; then
144 AC_MSG_ERROR([*** fribidi.pc not found])
147 FRIBIDI_CFLAGS=`pkg-config --cflags fribidi`
148 CFLAGS="$CFLAGS $FRIBIDI_CFLAGS"
149 FRIBIDI_LIBS=`pkg-config --libs fribidi`
150 FRIBIDI_PC="fribidi,"
152 AC_CHECK_LIB(fribidi, fribidi_get_mirror_char, :, AC_MSG_ERROR([*** libfribidi not found.]), $FRIBIDI_LIBS)
153 AC_DEFINE(HAVE_FRIBIDI, 1, [has fribidi library])
154 AC_DEFINE(KTOOL_USE_FRIBIDI, 1, [use fribidi in ktools])
157 AC_MSG_RESULT([$have_fribidi])
163 if test "x$with_ssl" != "xno"; then
167 AC_MSG_CHECKING(for OpenSSL)
168 if test -z "$with_openssl" -o "x$with_openssl" = "xyes"; then
169 for ac_dir in $with_openssl /usr/local /usr; do
170 if test -f "$ac_dir/include/openssl/ssl.h"; then
177 if test -n "$with_openssl" -a "x$with_openssl" != "xno" -a -z "$with_nss_compat"; then
178 CFLAGS="$CFLAGS -I${with_openssl}"
180 AC_MSG_RESULT([found in $with_openssl])
181 AC_DEFINE(HAVE_OPENSSL, 1, [use openssl])
184 AC_CHECK_LIB(crypto, main)
185 AC_CHECK_LIB(ssl, main)
187 AC_CHECK_LIB(crypto, SSLeay_add_all_algorithms,
188 AC_DEFINE(HAVE_SSLEAY, 1, [use SSLeay]))
190 AC_MSG_RESULT([not found or disabled])
193 if test "x$with_ssl" = "xno" -a -z "$with_nss_compat"; then
194 AC_CHECK_LIB(gnutls-extra, gnutls_global_init_extra, [
195 AC_CHECK_LIB(lzo, lzo1x_1_compress, LZO_LIBS=-llzo)
197 if test -z "$LZO_LIBS"; then
198 AC_CHECK_LIB(lzo2, lzo1x_1_compress, LZO_LIBS=-llzo2, [
201 *** Could not find liblzo or liblzo2.
206 CXXFLAGS="$CXXFLAGS $LIBGNUTLS_CFLAGS"
207 LIBS="$LIBS $LIBGNUTLS_LIBS -lgnutls-extra -lgnutls"
208 AC_DEFINE(HAVE_GNUTLS, 1, [use gnutls])
211 Could not find gnutls-extra. Stopping.
215 if test "x$with_ssl" = "xno"; then
218 # NSS is essential for OpenSSL compatibility layer
219 # drags in NSPR as well
220 PKG_CHECK_MODULES(NSS, nss >= 3)
221 CFLAGS="$CFLAGS $NSS_CFLAGS"
222 CXXFLAGS="$CXXFLAGS $NSS_CFLAGS"
223 LIBS="$LIBS $NSS_LIBS"
225 # The compatibility layer
226 AC_MSG_CHECKING(for NSS compat)
227 if test -n "$with_nss_compat" -a "x$with_nss_compat" != "xno"; then
228 if test -f "${with_nss_compat}"; then
229 CFLAGS="$CFLAGS -I${with_nss_compat} -I/usr/include/nspr4"
230 CXXFLAGS="$CXXFLAGS -I${with_nss_compat} -I/usr/include/nspr4"
232 AC_CHECK_LIB(nss_compat_ossl, SSL_CTX_new, [
233 AC_DEFINE(HAVE_NSS_COMPAT, 1, [use nss_compat])
234 LIBS="$LIBS -lnss_compat_ossl"
238 AC_MSG_RESULT([Not enabled, sadly])
242 if test x"$with_ssl" != x"no"; then
243 AC_DEFINE(HAVE_SSL, 1, [ssl is available])
245 AC_MSG_ERROR([Karamba! SSL library not found.])
249 AC_MSG_RESULT([disabled (use --with-ssl=[DIR] to enable)])
255 if test "x$have_gpgme" = "xyes"; then
256 AC_DEFINE(HAVE_GPGME, 1, [has gpgme library])
257 GPGME_CXXFLAGS="$GPGME_CFLAGS"
258 CFLAGS="$CFLAGS $GPGME_CFLAGS"
259 CXXFLAGS="$CXXFLAGS $GPGME_CXXFLAGS"
260 LIBS="$LIBS $GPGME_LIBS"
263 ###############################
264 # Check for Largefile support #
265 ###############################
270 #############################
271 # Check for pthread library #
272 #############################
273 original_LIBS="$LIBS"
274 LIBS="-lpthread $original_LIBS"
276 AC_TRY_LINK([#include<pthread.h>],
277 [pthread_create((void *)0, (void *)0, (void *)0, (void *)0)],
278 [pthread=yes], [pthread=no])
280 if test x${pthread} = xyes; then
282 AC_DEFINE(HAVE_THREAD, 1, [pthread library is available])
284 LIBS="$original_LIBS"
288 AC_CHECK_HEADERS(sys/utsname.h,
290 AC_CHECK_FUNC(uname, AC_DEFINE(HAVE_UNAME, 1, [check uname function]),)
293 #####################
294 # Check for libcurl #
295 #####################
297 CURL_CFLAGS="$LIBCURL_CPPFLAGS"
298 CURL_CXXFLAGS="$LIBCURL_CPPFLAGS"
300 CFLAGS="$CFLAGS $CURL_CFLAGS"
301 CXXFLAGS="$CXXFLAGS $CURL_CXXFLAGS"
302 LIBS="$LIBS $CURL_LIBS"
304 #####################
305 # Check for libjpeg #
306 #####################
307 AC_MSG_CHECKING(for libjpeg (for Gadu-Gadu registration))
311 if test "x$with_libjpeg" != "xno"; then
314 AC_CHECK_LIB(jpeg, jpeg_start_decompress,
316 AC_CHECK_HEADERS(jpeglib.h,
318 AC_DEFINE(HAVE_LIBJPEG, 1, [define if you have libjpeg])
319 JPEG_LIBS="-ljpeg $LIBS"
320 LIBS="$LIBS $JPEG_LIBS"
327 #####################
329 #####################
330 AC_MSG_CHECKING(for libotr)
333 if test "x$with_libotr" != "xno"; then
336 AC_CHECK_LIB(otr, otrl_init,
338 AC_CHECK_HEADERS(libotr/context.h libotr/userstate.h,
340 AC_DEFINE(HAVE_LIBOTR, 1, [define if you have libotr])
341 OTR_LIBS="-lotr $LIBS"
342 LIBS="$LIBS $OTR_LIBS"
348 #####################
350 #####################
351 AC_MSG_CHECKING(whether to use Xss)
354 if test "x$with_libXss" = "xyes"; then
357 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
359 AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
361 AC_DEFINE(HAVE_LIBXSS, 1, [define if you have Xss])
362 XSS_LIBS="-lX11 -lXss"
363 LIBS="$LIBS $XSS_LIBS"
379 LIBS="$LIBS $LIBICONV"
381 AC_CHECK_SIZEOF([int])
382 AC_CHECK_SIZEOF([short])
384 AC_CHECK_LIB(socket, socket)
385 AC_CHECK_LIB(nsl, gethostbyname)
388 if test "x$ax_cv_ncurses" = "xyes"
390 LIBS="$LIBS $CURSES_LIB"
392 AC_MSG_ERROR([You need ncurses/ncursesw library and header files.])
397 #include <sys/types.h>
398 #include <sys/socket.h>
399 ],[ socklen_t foo; ], ac_cv_c_socklen_t=yes, ac_cv_c_socklen_t=no)
401 if test "x$ac_cv_c_socklen_t" = "xno"; then
402 AC_DEFINE(socklen_t, int, [Define type of socklen_t for systems missing it])
407 LIBS="$LIBS -flat_namespace"
408 CXXFLAGS="$CXXFLAGS -I/sw/include"
412 AM_CONDITIONAL(BUILD_ICQ, test "x$build_icq" = "xyes")
413 AM_CONDITIONAL(BUILD_YAHOO, test "x$build_yahoo" = "xyes")
414 AM_CONDITIONAL(BUILD_AIM, test "x$build_aim" = "xyes")
415 AM_CONDITIONAL(BUILD_IRC, test "x$build_irc" = "xyes")
416 AM_CONDITIONAL(BUILD_FIRETALK, test "x$build_irc" = "xyes" -o "x$build_aim" = "xyes")
417 AM_CONDITIONAL(BUILD_JABBER, test "x$build_jabber" = "xyes")
418 AM_CONDITIONAL(BUILD_GADU, test "x$build_gg" = "xyes")
419 AM_CONDITIONAL(BUILD_MSN, test "x$build_msn" = "xyes")
420 AM_CONDITIONAL(BUILD_RSS, test "x$build_rss" = "xyes" -o "x$build_lj" = "xyes")
421 AM_CONDITIONAL(BUILD_LJ, test "x$build_lj" = "xyes")
422 AM_CONDITIONAL(HAVE_THREAD, test "x$pthread" = "xyes")
423 AM_CONDITIONAL(HAVE_LIBOTR, test "x$have_libotr" = "xyes")
424 AM_CONDITIONAL(HAVE_FRIBIDI, test "x$have_fribidi" = "xyes")
426 if test "x$build_icq" = "xyes"; then
427 AC_DEFINE(BUILD_ICQ, 1, [build with ICQ support])
429 if test "x$build_yahoo" = "xyes"; then
430 if test "x$have_curl" = "xno"; then
431 AC_MSG_ERROR([Yahoo cannot be built without the curl library.])
433 if test -z "$libcurl_feature_SSL" -o "x$libcurl_feature_SSL" = "xno"; then
434 AC_MSG_ERROR([Yahoo requires libcurl built with SSL support.])
436 AC_DEFINE(BUILD_YAHOO, 1, [build with yahoo support])
438 if test "x$build_aim" = "xyes"; then
439 AC_DEFINE(BUILD_AIM, 1, [build with aim support])
441 if test "x$build_irc" = "xyes";
442 then AC_DEFINE(BUILD_IRC, 1, [build with irc support])
444 if test "x$build_jabber" = "xyes"; then
445 if test "x$have_gpgme" = "xno"; then
446 AC_MSG_WARN([No GPG support in Jabber, since GPGME library not found or its setup not ok])
448 AC_DEFINE(BUILD_JABBER, 1, [build with jabber support])
450 if test "x$build_gg" = "xyes"; then
451 if test "x$have_libjpeg" = "xno"; then
452 AC_MSG_WARN([No jpeg support in Gadu-Gadu, you will not be able to register??????????])
454 AC_DEFINE(BUILD_GADU, 1, [build with gadu-gadu support])
456 if test "x$build_msn" = "xyes"; then
457 if test "x$have_curl" = "xno"; then
458 AC_MSG_ERROR([MSN cannot be built without the curl library.])
460 if test -z "$libcurl_feature_SSL" -o "x$libcurl_feature_SSL" = "xno"; then
461 AC_MSG_ERROR([MSN requires libcurl built with SSL support.])
463 AC_DEFINE(BUILD_MSN, 1, [build with MSN support])
465 if test "x$build_rss" = "xyes" -o "x$build_lj" = "xyes"; then
466 AC_DEFINE(BUILD_RSS, 1, [build the integrated rss feeds reader])
468 if test "x$build_lj" = "xyes"; then
469 AC_DEFINE(BUILD_LJ, 1, [build the integrated livejournal client])
471 if test "x$locales_fx" != "xno"; then
472 AC_DEFINE([LOCALES_HACK], 1, [enables workaround for broken locales])
475 ############################
476 # Checks for header files. #
477 ############################
482 AC_CHECK_HEADERS([argz.h])
483 AC_CHECK_HEADERS([arpa/inet.h])
484 AC_CHECK_HEADERS([fcntl.h])
485 AC_CHECK_HEADERS([float.h])
486 AC_CHECK_HEADERS([ftw.h])
487 AC_CHECK_HEADERS([inttypes.h])
488 AC_CHECK_HEADERS([langinfo.h])
489 AC_CHECK_HEADERS([libintl.h])
490 AC_CHECK_HEADERS([limits.h])
491 AC_CHECK_HEADERS([locale.h])
492 AC_CHECK_HEADERS([malloc.h])
493 AC_CHECK_HEADERS([netdb.h])
494 AC_CHECK_HEADERS([netinet/in.h])
495 AC_CHECK_HEADERS([stddef.h])
496 AC_CHECK_HEADERS([stdint.h])
497 AC_CHECK_HEADERS([stdio_ext.h])
498 AC_CHECK_HEADERS([stdlib.h])
499 AC_CHECK_HEADERS([string.h])
500 AC_CHECK_HEADERS([strings.h])
501 AC_CHECK_HEADERS([sys/ioctl.h])
502 AC_CHECK_HEADERS([sys/mount.h])
503 AC_CHECK_HEADERS([sys/param.h])
504 AC_CHECK_HEADERS([sys/socket.h])
505 AC_CHECK_HEADERS([sys/statvfs.h])
506 AC_CHECK_HEADERS([sys/time.h])
507 AC_CHECK_HEADERS([sys/vfs.h])
508 AC_CHECK_HEADERS([syslog.h])
509 AC_CHECK_HEADERS([unistd.h])
510 AC_CHECK_HEADERS([utmp.h])
511 AC_CHECK_HEADERS([wchar.h])
512 AC_CHECK_HEADERS([sys/types.h])
513 AC_CHECK_HEADERS([_G_config.h])
517 AC_CHECK_HEADERS([vector iostream fstream string algorithm list memory iterator exception utility],, AC_MSG_ERROR([You need to have the libstdc++ headers installed]))
518 AC_CHECK_HEADERS([hash_map strstream ext/hash_map sstream],,)
521 ##################################################
522 # check whether make supports order-only targets #
523 ##################################################
525 AC_CACHE_CHECK([whether ${MAKE-make} supports order-only targets],
526 [centerim_cv_make_order_only],
527 [cat >conftest.make <<\_ACEOF
536 centerim_cv_make_order_only=no
538 ${MAKE-make} -f conftest.make >/dev/null 2>&1 && centerim_cv_make_order_only=yes
541 if test x$centerim_cv_make_order_only = xyes; then
546 ##################################################################
547 # Checks for typedefs, structures, and compiler characteristics. #
548 ##################################################################
558 AC_CHECK_TYPES([ptrdiff_t])
564 AC_SUBST(FRIBIDI_LIBS)
565 AC_SUBST(FRIBIDI_CFLAGS)
569 AC_SUBST(GPGME_CFLAGS)
570 AC_SUBST(GPGME_CXXFLAGS)
572 AC_SUBST(GNUTLS_LIBS)
573 AC_SUBST(GNUTLS_CFLAGS)
574 AC_SUBST(GNUTLS_CXXFLAGS)
577 AC_SUBST(CURL_CFLAGS)
578 AC_SUBST(CURL_CXXFLAGS)
584 #################################
585 # Checks for library functions. #
586 #################################
587 AC_FUNC_SELECT_ARGTYPES
589 AC_CHECK_FUNCS([gethostbyname])
590 AC_CHECK_FUNCS([gethostname])
591 AC_CHECK_FUNCS([getpass])
592 AC_CHECK_FUNCS([inet_aton])
593 AC_CHECK_FUNCS([inet_ntoa])
594 AC_CHECK_FUNCS([memset])
595 AC_CHECK_FUNCS([select])
596 AC_CHECK_FUNCS([setenv])
597 AC_CHECK_FUNCS([socket])
598 AC_CHECK_FUNCS([strerror])
599 AC_CHECK_FUNCS([strtol])
602 ########################
603 # Create output files. #
604 ########################
605 ALL_LINGUAS="zh_TW zh_CN uk sv ru ro pt_BR pl nl ms it hu fr es de cs bg"
606 AC_CONFIG_FILES([Makefile
610 kkconsui/include/Makefile
611 kkconsui/src/Makefile
614 kksystr/include/Makefile
618 libicq2000/libicq2000/Makefile
619 libicq2000/src/Makefile
636 Install prefix $prefix
640 Protocols and Clients:])
641 if test "x$build_icq" = "xyes"; then AC_MSG_RESULT([ ICQ]); fi
642 if test "x$build_yahoo" = "xyes"; then AC_MSG_RESULT([ Yahoo]); fi
643 if test "x$build_aim" = "xyes"; then AC_MSG_RESULT([ AIM]); fi
644 if test "x$build_jabber" = "xyes"; then AC_MSG_RESULT([ jabber]); fi
645 if test "x$build_gg" = "xyes"; then AC_MSG_RESULT([ Gadu-Gadu]); fi
646 if test "x$build_msn" = "xyes"; then AC_MSG_RESULT([ MSN Messenger]); fi
647 if test "x$build_rss" = "xyes"; then AC_MSG_RESULT([ RSS Reader]); fi
648 if test "x$build_lj" = "xyes"; then AC_MSG_RESULT([ LiveJournal client]); fi
649 if test "x$have_fribidi" = "xyes"; then AC_MSG_RESULT([ LiveJournal client]); fi
650 if test "x$with_ssl" = "xno"; then
652 WARNING: SSL disabled (This means no Google Talk)
655 if test "x$have_gpgme" = "xno"; then
657 WARNING: GPGME disabled (This means no encrypted messages between users)
659 if test "x$have_libotr" = "xyes"; then
661 WARNING: libotr enabled (OTR is not supported yet, use at your own risk)
663 if test "x$pthread" = "xno"; then
665 WARNING: pthreads disabled (No file-transfers in jabber)