Fixed bug #1734670: when logging off of MSN it did not hide the contacts
[centerim.git] / configure.ac
blob18942f757d0b9ff6a060457525d1b2f7dc6eae91
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.59)
5 AC_INIT([centerim], [4.22.1], [http://sourceforge.net/projects/centerim])
6 AC_CONFIG_SRCDIR([config.h.in])
7 AC_CONFIG_HEADER([config.h])
8 AM_INIT_AUTOMAKE([-Wall])
10 AM_MAINTAINER_MODE
11 AC_ISC_POSIX
13 AC_CANONICAL_HOST
15 AC_GNU_SOURCE
17 ########################
18 # Checks for programs. #
19 ########################
20 AC_PROG_CC
21 AC_PROG_CXX
22 AM_PROG_LIBTOOL
23 AC_PROG_INSTALL
24 AC_PROG_LN_S
25 AC_PROG_MAKE_SET
26 AM_GNU_GETTEXT
27 AM_GNU_GETTEXT_VERSION([0.16.1])
28 AC_PROG_YACC
29 AC_PROG_GCC_TRADITIONAL
31 #########################
32 # Checks for libraries. #
33 #########################
34 AC_ARG_ENABLE(icq,
35               AS_HELP_STRING([--disable-icq], [Build without ICQ]),
36               build_icq="$enableval",
37               build_icq="yes"
38               )
39 AC_ARG_ENABLE(yahoo,
40               AS_HELP_STRING([--disable-yahoo], [Build without Yahoo!]),
41               build_yahoo="$enableval",
42               build_yahoo="yes"
43               )
44 AC_ARG_ENABLE(aim,
45               AS_HELP_STRING([--disable-aim], [Build without AIM]),
46               build_aim="$enableval",
47               build_aim="yes"
48               )
49 AC_ARG_ENABLE(irc,
50               AS_HELP_STRING([--disable-irc], [Build without IRC]),
51               build_irc="$enableval",
52               build_irc="yes"
53               )
54 AC_ARG_ENABLE(jabber,
55               AS_HELP_STRING([--disable-jabber], [Build without Jabber]),
56               build_jabber="$enableval",
57               build_jabber="yes"
58               )
59 AC_ARG_ENABLE(gg,
60               AS_HELP_STRING([--disable-gg], [Build without Gadu-Gadu]),
61               build_gg="$enableval",
62               build_gg="yes"
63               )
64 AC_ARG_ENABLE(msn,
65               AS_HELP_STRING([--disable-msn], [Build without MSN]),
66               build_msn="$enableval",
67               build_msn="yes"
68               )
69 AC_ARG_ENABLE(rss,
70               AS_HELP_STRING([--disable-rss], [Build without RSS reader]),
71               build_rss="$enableval",
72               build_rss="yes"
73               )
74 AC_ARG_ENABLE(lj,
75               AS_HELP_STRING([--disable-lj], [Build without LiveJournal client]),
76               build_lj="$enableval",
77               build_lj="yes"
78               )
79 AC_ARG_ENABLE(locales-fix,
80               AS_HELP_STRING([--enable-locales-fix], [enables workaround for
81                               broken locales. use this option if some of
82                               characters in your texts in Chinese or Japanese
83                               diappear])
84               )
86 AC_ARG_WITH(fribidi,
87             AS_HELP_STRING([--with-fribidi=[DIR]], [enable Hebrew and Arabic
88                             support using fribidi library in DIR]),
89             [with_fribidi=$withval],
90             [with_fribidi=no]
91             )
92 AC_ARG_WITH(ssl,
93             AS_HELP_STRING([--with-ssl], [enable SSL secured connections using
94                             either OpenSSL or GnuTLS (auto)]),
95             [with_ssl=$withval]
96             )
97 AC_ARG_WITH(openssl,
98             AS_HELP_STRING([--with-openssl=[DIR]], [enable SSL secured
99                             connections using the OpenSSL library in DIR
100                             (optional)]),
101             [with_openssl=$withval]
102             )
103 AC_ARG_WITH(gpgme,
104             AS_HELP_STRING([--with-gpgme=[PATH]], [path to gpgme-config (auto)]),
105             [with_gpgme=$withval],
106             [with_gpgme=no]
107             )
108 AC_ARG_WITH(curl,
109             AS_HELP_STRING([--with-curl=[PATH]], [path to curl-config (auto)]),
110             [with_curl=$withval],
111             [with_curl=no]
112             )
113 AC_ARG_WITH(libjpeg,
114             AS_HELP_STRING([--without-libjpeg], [Compile without JPEG token
115                             support (for Gadu-Gadu registration)])
116             )
118 #####################
119 # Check for fribidi #
120 #####################
121 AC_MSG_CHECKING(whether to use fribidi)
122 FRIBIDI_LIBS=""
123 FRIBIDI_CFLAGS=""
124 FRIBIDI_PC="" 
125 have_fribidi=no 
127 if test "x$with_fribidi" = "xyes"; then
128         AC_PATH_PROG(FRIBIDI_CONFIG, fribidi-config, no)
129         if test x$FRIBIDI_CONFIG = xno; then
130                 AC_MSG_ERROR([*** fribidi-config not found])
131         fi
132         
133         FRIBIDI_CFLAGS="`$FRIBIDI_CONFIG --cflags`"
134         CFLAGS="$CFLAGS $FRIBIDI_CFLAGS"
135         FRIBIDI_LIBS="`$FRIBIDI_CONFIG --libs`"
136         FRIBIDI_PC="fribidi,"
138         AC_CHECK_LIB(fribidi, fribidi_get_mirror_char, :, AC_MSG_ERROR([*** libfribidi not found.]), $FRIBIDI_LIBS)
139         AC_DEFINE(HAVE_FRIBIDI, 1, [has fribidi library])
140         have_fribidi=yes
142 AC_MSG_RESULT([$have_fribidi])
144 #################
145 # Check for SSL #
146 #################
147 AC_MSG_CHECKING(for SSL)
148 AC_MSG_RESULT([])
150 if test "$with_ssl" != "no"; then
152         AC_MSG_CHECKING(for OpenSSL)
153         if test -z "$with_openssl" -o x"$with_openssl" = xyes; then
154                 for ac_dir in $with_openssl /usr/local /usr; do
155                         if test -f "$ac_dir/include/openssl/ssl.h"; then
156                                 with_openssl=$ac_dir
157                                 break;
158                         fi
159                 done
160         fi
162         if test -n "$with_openssl" -a "$with_openssl" != "no"; then
163                 AC_MSG_RESULT([found in $with_openssl])
164                 CFLAGS="$CFLAGS -I${with_openssl}"
165                 AC_DEFINE(HAVE_OPENSSL, 1, [use openssl])
166         AC_CHECK_LIB(crypto, main, [
167             AC_CHECK_LIB(crypto, SSLeay_add_all_algorithms, [
168                 AC_DEFINE(HAVE_SSLEAY, 1, [use SSLeay])
169             ])
170             ])
171                 AC_CHECK_LIB(ssl, main)
172         ac_configure_args="$ac_configure_args --with-ssl --with-openssl=$with_openssl"
173         else
174                 AC_MSG_RESULT([not found or disabled])
175                 with_ssl="no"
177                 AM_PATH_LIBGNUTLS_EXTRA(0.0.1, [
178             AC_CHECK_LIB(lzo, lzo1x_1_compress, [], [
179                               echo "lzo compression is required.";
180                               exit -1
181                               ] )
182                         CXXFLAGS="$CXXFLAGS $LIBGNUTLS_CFLAGS"
183                         LIBS="$LIBS $LIBGNUTLS_LIBS -lgnutls-extra"
184                         AC_DEFINE(HAVE_GNUTLS, 1, [use gnutls])
185             with_ssl="yes"
186             ac_configure_args="$ac_configure_args --with-ssl"
187             ])
188         fi
189 else 
190         AC_MSG_RESULT([disabled (use --with-ssl=[DIR] to enable)])
193 ###################
194 # Check for gpgme #
195 ###################
196 GPGME_CFLAGS=""
197 GPGME_CXXFLAGS=""
198 GPGME_LIBS=""
199 have_gpgme=no
201 if test x"$with_gpgme" = x"no"; then
202     AC_MSG_CHECKING(for gpgme)
204     AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no)
206         if test x$GPGME_CONFIG = xno; then
207         AC_MSG_RESULT([no])
208     else
209         AC_MSG_RESULT([yes])
211         save_CFLAGS="$CFLAGS"
212         save_CXXFLAGS="$CXXFLAGS"
213         save_LIBS="$LIBS"
215         GPGME_CFLAGS="`$GPGME_CONFIG --cflags`"
216         GPGME_CXXFLAGS="`$GPGME_CONFIG --cflags`"
217         GPGME_LIBS="`$GPGME_CONFIG --libs`"
218         CFLAGS="$CFLAGS $GPGME_CFLAGS"
219         CXXFLAGS="$CXXFLAGS $GPGME_CXXFLAGS"
220         LIBS="$LIBS $GPGME_LIBS"
222         AC_MSG_CHECKING(for the OpenPGP protocol in gpgme)
223         AC_TRY_RUN([
224             #include <gpgme.h>
225             int main( void ) {
226                 gpgme_ctx_t ctx;
227                 if(!gpgme_new(&ctx)) if(!gpgme_set_protocol(ctx, GPGME_PROTOCOL_OpenPGP)) return 0;
228                 return 1;
229             }
230         ], opengpg_avail=yes, opengpg_avail=no, opengpg_avail=no)
231         AC_MSG_RESULT([$opengpg_avail])
233         if test "$opengpg_avail" != "yes"; then
234             CFLAGS="$save_CFLAGS"
235             CXXFLAGS="$save_CXXFLAGS"
236             LIBS="$save_LIBS"
237         fi
238         AC_DEFINE(HAVE_GPGME, 1, [has gpgme library])
239         have_gpgme=yes
240         fi
241 else
242     GPGME_CONFIG= "$with_gpgme"
245 ##################
246 # Check for curl #
247 ##################
248 AC_MSG_CHECKING(for cURL)
249 AC_MSG_RESULT([])
250 CURL_CFLAGS=""
251 CURL_CXXFLAGS=""
252 CURL_LIBS=""
253 have_curl=no
255 if test -x "$with_curl"; then
256         CURL_CONFIG= "$with_curl"
257 else
258         AC_PATH_PROG(CURL_CONFIG, curl-config, no)
261 if test x$CURL_CONFIG = xno; then
262         AC_MSG_ERROR([*** curl-config not found])
265 save_CFLAGS="$CFLAGS"
266 save_CXXFLAGS="$CXXFLAGS"
267 save_LIBS="$LIBS"
269 CURL_CFLAGS="`$CURL_CONFIG --cflags`"
270 CURL_CXXFLAGS="`$CURL_CONFIG --cflags`"
271 CURL_LIBS="`$CURL_CONFIG --libs`"
272 CFLAGS="$CFLAGS $CURL_CFLAGS"
273 CXXFLAGS="$CXXFLAGS $CURL_CXXFLAGS"
274 LIBS="$LIBS $CURL_LIBS"
276 AC_MSG_CHECKING(for SSL support in libcurl)
277 curlssl=`$CURL_CONFIG --feature | grep SSL`
278 if test -z "$curlssl"; then
279 curlssl=no
280 AC_MSG_RESULT([no])
281 else
282 curlssl=yes
283 AC_MSG_RESULT([yes])
286 AC_DEFINE(HAVE_CURL, 1, [has curl library])
287 have_curl=yes
289 #####################
290 # Check for libjpeg #
291 #####################
292 AC_MSG_CHECKING(for libjpeg (for Gadu-Gadu registration))
293 JPEG_LIBS=""
294 have_libjpeg=no
296 if test "x$with_libjpeg" != "xno"; then
297         AC_MSG_RESULT([])
299         AC_CHECK_LIB(jpeg, jpeg_start_decompress,
300         [
301                 AC_CHECK_HEADERS(jpeglib.h,
302                 [
303                         AC_DEFINE(HAVE_LIBJPEG, 1, [define if you have libjpeg])
304                         JPEG_LIBS="-ljpeg $LIBS"
305                         LIBS="$LIBS $JPEG_LIBS"
306                         have_libjpeg=yes
307                 ])
308         ])
311 ####################
312 # Check for others #
313 ####################
314 AM_ICONV_LINK
315 LIBS="$LIBS $LIBICONV"
317 AC_CHECK_LIB(socket, socket)
318 AC_CHECK_LIB(nsl, gethostbyname)
319 AC_CHECK_LIB(ncursesw, get_wch,, [AC_CHECK_LIB(ncurses, initscr,,
320                                   [AC_CHECK_LIB(curses, initscr,,
321                                    AC_MSG_ERROR(The ncurses terminal library is required in order to build the program))])])
323 AC_TRY_COMPILE([
324     #include <sys/types.h>
325     #include <sys/socket.h>
326 ],[ socklen_t foo; ], ac_cv_c_socklen_t=yes, ac_cv_c_socklen_t=no)
328 if test "$ac_cv_c_socklen_t" = "no"; then
329   AC_DEFINE(socklen_t, int, [Define type of socklen_t for systems missing it])
332 case "$host_os" in
333         darwin*)
334                 LIBS="$LIBS -flat_namespace"
335                 ;;
336 esac
338 AM_CONDITIONAL(BUILD_ICQ, test "x$build_icq" = xyes)
339 AM_CONDITIONAL(BUILD_YAHOO, test "x$build_yahoo" = xyes)
340 AM_CONDITIONAL(BUILD_AIM, test "x$build_aim" = xyes)
341 AM_CONDITIONAL(BUILD_IRC, test "x$build_irc" = xyes)
342 AM_CONDITIONAL(BUILD_FIRETALK, test "x$build_irc" = xyes -o "x$build_aim" = xyes)
343 AM_CONDITIONAL(BUILD_JABBER, test "x$build_jabber" = xyes)
344 AM_CONDITIONAL(BUILD_GADU, test "x$build_gg" = xyes)
345 AM_CONDITIONAL(BUILD_MSN, test "x$build_msn" = xyes)
346 AM_CONDITIONAL(BUILD_RSS, test "x$build_rss" = xyes -o "x$build_lj" = xyes)
347 AM_CONDITIONAL(BUILD_LJ, test "x$build_lj" = xyes)
348 AM_CONDITIONAL(HAVE_FRIBIDI, test "x$have_fribidi" = xyes)
350 if test "$build_icq" = "yes"; then
351         AC_DEFINE(BUILD_ICQ, 1, [build with ICQ support])
353 if test "$build_yahoo" = "yes"; then
354         AC_DEFINE(BUILD_YAHOO, 1, [build with yahoo support])
356 if test "$build_aim" = "yes"; then
357         AC_DEFINE(BUILD_AIM, 1, [build with aim support])
359 if test "$build_irc" = "yes";
360         then AC_DEFINE(BUILD_IRC, 1, [build with irc support])
362 if test "$build_jabber" = "yes"; then
363         if test $have_gpgme = no; then
364                 AC_MSG_WARN([No GPG support in Jabber, since GPGME library not found or its setup not ok])
365         fi
366         AC_DEFINE(BUILD_JABBER, 1, [build with jabber support])
368 if test "$build_gg" = "yes"; then
369         if test $have_libjpeg = no; then
370                 AC_MSG_WARN([No jpeg support in Gadu-Gadu, you will not be able to register??????????])
371         fi
372         AC_DEFINE(BUILD_GADU, 1, [build with gadu-gadu support])
374 if test "$build_msn" = "yes"; then
375         if test $have_curl = no; then
376                 AC_MSG_ERROR([MSN cannot be built without the curl library.])
377         fi
378         if test $curlssl = no; then
379                 AC_MSG_ERROR([MSN requires libcurl built with SSL support.])
380         fi
381         AC_DEFINE(BUILD_MSN, 1, [build with MSN support])
383 if test "$build_rss" = "yes" -o "$build_lj" = "yes"; then
384         AC_DEFINE(BUILD_RSS, 1, [build the integrated rss feeds reader])
386 if test "$build_lj" = "yes"; then
387         AC_DEFINE(BUILD_LJ, 1, [build the integrated livejournal client])
390 ############################
391 # Checks for header files. #
392 ############################
393 AC_FUNC_ALLOCA
394 AC_HEADER_DIRENT
395 AC_HEADER_STDC
396 AC_HEADER_SYS_WAIT
397 AC_CHECK_HEADERS([argz.h arpa/inet.h fcntl.h float.h inttypes.h langinfo.h libintl.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdio_ext.h stdlib.h string.h strings.h sys/ioctl.h sys/mount.h sys/param.h sys/socket.h sys/statvfs.h sys/time.h sys/vfs.h syslog.h unistd.h utmp.h wchar.h])
398 AC_CHECK_HEADERS([stdint.h sys/types.h],,)
400 AC_LANG_SAVE
401 AC_LANG_CPLUSPLUS
402 AC_CHECK_HEADERS([vector iostream fstream string algorithm list memory iterator exception utility],, AC_MSG_ERROR([You need to have the libstdc++ headers installed]))
403 AC_CHECK_HEADERS([hash_map strstream ext/hash_map sstream],,)
404 AC_LANG_RESTORE
406 ##################################################################
407 # Checks for typedefs, structures, and compiler characteristics. #
408 ##################################################################
409 AC_STRUCT_TIMEZONE
410 AC_HEADER_STDBOOL
411 AC_C_CONST
412 AC_C_INLINE
413 AC_C_RESTRICT
414 AC_TYPE_SIZE_T
415 AC_HEADER_TIME
416 AC_STRUCT_TM
417 AC_C_VOLATILE
418 AC_CHECK_TYPES([ptrdiff_t])
419 AC_TYPE_SIGNAL
421 #################
422 # Substitutions #
423 #################
424 AC_SUBST(FRIBIDI_LIBS)
425 AC_SUBST(FRIBIDI_CFLAGS) 
426 AC_SUBST(FRIBIDI_PC) 
428 AC_SUBST(GPGME_LIBS)
429 AC_SUBST(GPGME_CFLAGS) 
430 AC_SUBST(GPGME_CXXFLAGS) 
432 AC_SUBST(GNUTLS_LIBS)
433 AC_SUBST(GNUTLS_CFLAGS) 
434 AC_SUBST(GNUTLS_CXXFLAGS) 
436 AC_SUBST(CURL_LIBS)
437 AC_SUBST(CURL_CFLAGS) 
438 AC_SUBST(CURL_CXXFLAGS) 
440 AC_SUBST(JPEG_LIBS)
442 #################################
443 # Checks for library functions. #
444 #################################
445 AC_FUNC_CLOSEDIR_VOID
446 AC_FUNC_ERROR_AT_LINE
447 AC_FUNC_FORK
448 AC_FUNC_LSTAT
449 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
450 AC_FUNC_MALLOC
451 AC_FUNC_MEMCMP
452 AC_FUNC_MKTIME
453 AC_FUNC_MMAP
454 AC_FUNC_REALLOC
455 AC_FUNC_SELECT_ARGTYPES
456 AC_FUNC_STAT
457 AC_FUNC_STRFTIME
458 AC_FUNC_VPRINTF
459 AC_FUNC_WAIT3                                  
460 AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify alarm atexit bzero dup2 floor getcwd gethostbyname gethostname gettimeofday inet_ntoa isascii memmove mempcpy memset mkdir modf munmap nl_langinfo putenv regcomp rmdir select setenv setlocale socket stpcpy strcasecmp strchr strcspn strdup strerror strncasecmp strpbrk strrchr strspn strstr strtol strtoul uname])
462 ########################
463 # Create output files. #
464 ########################
465 # also configure other packages
466 AC_CONFIG_SUBDIRS(connwrap firetalk kkconsui kkstrtext kksystr libgadu libicq2000 libjabber libmsn libyahoo2)
468 ALL_LINGUAS="zh_TW.Big5 uk sv ru ro pt_BR pl nl ms it hu fr es de cs bg"
469 AC_CONFIG_FILES([Makefile
470                  misc/Makefile
471                  share/Makefile
472                  src/Makefile
473                  src/hooks/Makefile
474                  intl/Makefile
475                  po/Makefile.in])
477 AC_OUTPUT
479 AC_MSG_RESULT([
480 Build options:
481   Version               $VERSION
482   Install prefix        $prefix
483   Build shared libs     $enable_shared
484   Build static libs     $enable_static
485   CFLAGS                $CFLAGS
486   CPPFLAGS              $CPPFLAGS
488 Protocols and Clients:])
489 if test "x$build_icq" = xyes; then AC_MSG_RESULT([  ICQ]); fi
490 if test "x$build_yahoo" = xyes; then AC_MSG_RESULT([  Yahoo]); fi
491 if test "x$build_aim" = xyes; then AC_MSG_RESULT([  AIM]); fi
492 if test "x$build_jabber" = xyes; then AC_MSG_RESULT([  jabber]); fi
493 if test "x$build_gg" = xyes; then AC_MSG_RESULT([  Gadu-Gadu]); fi
494 if test "x$build_msn" = xyes; then AC_MSG_RESULT([  MSN Messenger]); fi
495 if test "x$build_rss" = xyes; then AC_MSG_RESULT([  RSS Reader]); fi
496 if test "x$build_lj" = xyes; then AC_MSG_RESULT([  LiveJournal client]); fi
497 if test "x$have_fribidi" = xyes; then AC_MSG_RESULT([  LiveJournal client]); fi
498 if test "x$with_ssl" = xno; then 
499 AC_MSG_RESULT([
500 WARNING: SSL disabled (This means no Google Talk)
502 else
503 if test "x$have_gpgme" = xno; then
504 AC_MSG_RESULT([
505 WARNING: GPGME disabled (This means no encrypted messages between users)
506 ]); fi
508 AC_MSG_RESULT([
509 Enjoy!])