Reverted some changes
[centerim.git] / configure.ac
bloba328d38b977608cff5de9279b998f6d7643b0495
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.59)
5 AC_INIT([centerim], [4.22.0], [http://centericq.de/mailinglist.php])
6 AC_CONFIG_SRCDIR([config.h.in])
7 AC_CONFIG_HEADER([config.h])
8 AM_INIT_AUTOMAKE
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(yahoo,
35               AS_HELP_STRING([--disable-yahoo], [Build without Yahoo!]),
36               build_yahoo="$enableval",
37               build_yahoo="yes"
38               )
39 AC_ARG_ENABLE(aim,
40               AS_HELP_STRING([--disable-aim], [Build without AIM]),
41               build_aim="$enableval",
42               build_aim="yes"
43               )
44 AC_ARG_ENABLE(irc,
45               AS_HELP_STRING([--disable-irc], [Build without IRC]),
46               build_irc="$enableval",
47               build_irc="yes"
48               )
49 AC_ARG_ENABLE(jabber,
50               AS_HELP_STRING([--disable-jabber], [Build without Jabber]),
51               build_jabber="$enableval",
52               build_jabber="yes"
53               )
54 AC_ARG_ENABLE(gg,
55               AS_HELP_STRING([--disable-gg], [Build without Gadu-Gadu]),
56               build_gg="$enableval",
57               build_gg="yes"
58               )
59 AC_ARG_ENABLE(msn,
60               AS_HELP_STRING([--disable-msn], [Build without MSN]),
61               build_msn="$enableval",
62               build_msn="yes"
63               )
64 AC_ARG_ENABLE(rss,
65               AS_HELP_STRING([--disable-rss], [Build without RSS reader]),
66               build_rss="$enableval",
67               build_rss="yes"
68               )
69 AC_ARG_ENABLE(lj,
70               AS_HELP_STRING([--disable-lj], [Build without LiveJournal client]),
71               build_lj="$enableval",
72               build_lj="yes"
73               )
74 AC_ARG_ENABLE(locales-fix,
75               AS_HELP_STRING([--enable-locales-fix], [enables workaround for
76                               broken locales. use this option if some of
77                               characters in your texts in Chinese or Japanese
78                               diappear])
79               )
81 AC_ARG_WITH(fribidi,
82             AS_HELP_STRING([--with-fribidi=[DIR]], [enable Hebrew and Arabic
83                             support using fribidi library in DIR]),
84             [with_fribidi=$withval],
85             [with_fribidi=no]
86             )
87 AC_ARG_WITH(ssl,
88             AS_HELP_STRING([--with-ssl], [enable SSL secured connections using
89                             either OpenSSL or GnuTLS]),
90             [with_ssl=$withval],
91             [with_ssl=no]
92             )
93 AC_ARG_WITH(openssl,
94             AS_HELP_STRING([--with-openssl=[DIR]], [enable SSL secured
95                             connections using the OpenSSL library in DIR
96                             (optional)]),
97             [with_openssl=$withval],
98             [with_openssl=no]
99             )
100 AC_ARG_WITH(gpgme,
101             AS_HELP_STRING([--with-gpgme=[PATH]], [path to gpgme-config (auto)]),
102             [with_gpgme=$withval],
103             [with_gpgme=no]
104             )
105 AC_ARG_WITH(curl,
106             AS_HELP_STRING([--with-curl=[PATH]], [path to curl-config (auto)]),
107             [with_curl=$withval],
108             [with_curl=no]
109             )
110 AC_ARG_WITH(libjpeg,
111             AS_HELP_STRING([--without-libjpeg], [Compile without JPEG token
112                             support (for Gadu-Gadu registration)])
113             )
115 #####################
116 # Check for fribidi #
117 #####################
118 AC_MSG_CHECKING(whether to use fribidi)
119 FRIBIDI_LIBS=""
120 FRIBIDI_CFLAGS=""
121 FRIBIDI_PC="" 
122 have_fribidi=no 
124 if test "x$with_fribidi" = "xyes"; then
125         AC_PATH_PROG(FRIBIDI_CONFIG, fribidi-config, no)
126         if test x$FRIBIDI_CONFIG = xno; then
127                 AC_MSG_ERROR([*** fribidi-config not found])
128         fi
129         
130         FRIBIDI_CFLAGS="`$FRIBIDI_CONFIG --cflags`"
131         CFLAGS="$CFLAGS $FRIBIDI_CFLAGS"
132         FRIBIDI_LIBS="`$FRIBIDI_CONFIG --libs`"
133         FRIBIDI_PC="fribidi,"
135         AC_CHECK_LIB(fribidi, fribidi_get_mirror_char, :, AC_MSG_ERROR([*** libfribidi not found.]), $FRIBIDI_LIBS)
136         AC_DEFINE(HAVE_FRIBIDI, 1, [has fribidi library])
137         have_fribidi=yes
139 AC_MSG_RESULT([$have_fribidi])
141 #################
142 # Check for SSL #
143 #################
144 AC_MSG_CHECKING(for SSL)
145 AC_MSG_RESULT([])
147 if test "$with_ssl" != "no"; then
149         AC_MSG_CHECKING(for OpenSSL)
150         if test -z "$with_openssl"; then
151                 for ac_dir in $with_openssl /usr/local /usr; do
152                         if test -f "$ac_dir/include/openssl/ssl.h"; then
153                                 with_openssl=$ac_dir
154                                 break;
155                         fi
156                 done
157         fi
159         if test -n "$with_openssl" -a "$with_openssl" != "no"; then
160                 if test "$with_openssl" = "yes"; then 
161                         with_openssl="/usr"
162                 fi
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(ssl, main)
168         else
169                 AC_MSG_RESULT([not found or disabled])
170                 with_ssl="no"
172                 AM_PATH_LIBGNUTLS_EXTRA(0.0.1, [
173                         CXXFLAGS="$CXXFLAGS $LIBGNUTLS_CFLAGS"
174                         LIBS="$LIBS $LIBGNUTLS_LIBS -lgnutls-extra"
175                         AC_DEFINE(HAVE_GNUTLS, 1, [use gnutls]) with_ssl="yes" ])
176         fi
177 else 
178         AC_MSG_RESULT([disabled (use --with-ssl=[DIR] to enable)])
181 ###################
182 # Check for gpgme #
183 ###################
184 AC_MSG_CHECKING(for gpgme)
185 GPGME_CFLAGS=""
186 GPGME_CXXFLAGS=""
187 GPGME_LIBS=""
188 have_gpgme=no
190 if true; then
191         AC_MSG_RESULT([])
193         if test -x "$with_gpgme"; then
194                 GPGME_CONFIG= "$with_gpgme"
195         else
196                 AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no)
197         fi
199         if test x$GPGME_CONFIG = xno; then
200                 AC_MSG_ERROR([*** gpgme-config not found])
201         fi
203         save_CFLAGS="$CFLAGS"
204         save_CXXFLAGS="$CXXFLAGS"
205         save_LIBS="$LIBS"
207         GPGME_CFLAGS="`$GPGME_CONFIG --cflags`"
208         GPGME_CXXFLAGS="`$GPGME_CONFIG --cflags`"
209         GPGME_LIBS="`$GPGME_CONFIG --libs`"
210         CFLAGS="$CFLAGS $GPGME_CFLAGS"
211         CXXFLAGS="$CXXFLAGS $GPGME_CXXFLAGS"
212         LIBS="$LIBS $GPGME_LIBS"
214         AC_MSG_CHECKING(for the OpenPGP protocol in gpgme)
215         AC_TRY_RUN([
216                 #include <gpgme.h>
217                 int main() {
218                         gpgme_ctx_t ctx;
219                         if(!gpgme_new(&ctx)) if(!gpgme_set_protocol(ctx, GPGME_PROTOCOL_OpenPGP)) return 0;
220                         return 1;
221                 }
222         ], opengpg_avail=yes, opengpg_avail=no, opengpg_avail=no)
223         AC_MSG_RESULT($opengpg_avail)
225         if test "$opengpg_avail" != "yes"; then
226                 CFLAGS="$save_CFLAGS"
227                 CXXFLAGS="$save_CXXFLAGS"
228                 LIBS="$save_LIBS"
229         fi
230         AC_DEFINE(HAVE_GPGME, 1, [has gpgme library])
231         have_gpgme=yes
234 ##################
235 # Check for curl #
236 ##################
237 AC_MSG_CHECKING(for cURL)
238 AC_MSG_RESULT([])
239 CURL_CFLAGS=""
240 CURL_CXXFLAGS=""
241 CURL_LIBS=""
242 have_curl=no
244 if true; then
245         if test -x "$with_curl"; then
246                 CURL_CONFIG= "$with_curl"
247         else
248                 AC_PATH_PROG(CURL_CONFIG, curl-config, no)
249         fi
251         if test x$CURL_CONFIG = xno; then
252                 AC_MSG_ERROR([*** curl-config not found])
253         fi
255         save_CFLAGS="$CFLAGS"
256         save_CXXFLAGS="$CXXFLAGS"
257         save_LIBS="$LIBS"
259         CURL_CFLAGS="`$CURL_CONFIG --cflags`"
260         CURL_CXXFLAGS="`$CURL_CONFIG --cflags`"
261         CURL_LIBS="`$CURL_CONFIG --libs`"
262         CFLAGS="$CFLAGS $CURL_CFLAGS"
263         CXXFLAGS="$CXXFLAGS $CURL_CXXFLAGS"
264         LIBS="$LIBS $CURL_LIBS"
266         AC_MSG_CHECKING(for SSL support in libcurl)
267         curlssl=`$CURL_CONFIG --feature | grep SSL`
268         if test -z "$curlssl"; then
269                 curlssl=no
270                 AC_MSG_RESULT([no])
271         else
272                 curlssl=yes
273                 AC_MSG_RESULT([yes])
274         fi
276         AC_DEFINE(HAVE_CURL, 1, [has curl library])
277         have_curl=yes
280 #####################
281 # Check for libjpeg #
282 #####################
283 AC_MSG_CHECKING(for libjpeg (for Gadu-Gadu registration))
284 JPEG_LIBS=""
285 have_libjpeg=no
287 if test "x$with_libjpeg" != "xno"; then
288         AC_MSG_RESULT([])
290         AC_CHECK_LIB(jpeg, jpeg_start_decompress,
291         [
292                 AC_CHECK_HEADERS(jpeglib.h,
293                 [
294                         AC_DEFINE(HAVE_LIBJPEG, 1, [define if you have libjpeg])
295                         JPEG_LIBS="-ljpeg $LIBS"
296                         LIBS="$LIBS $JPEG_LIBS"
297                         have_libjpeg=yes
298                 ])
299         ])
302 ####################
303 # Check for others #
304 ####################
305 AM_ICONV_LINK
306 LIBS="$LIBS $LIBICONV"
308 AC_CHECK_LIB(socket, socket)
309 AC_CHECK_LIB(nsl, gethostbyname)
310 AC_CHECK_LIB(ncurses, initscr,, [AC_CHECK_LIB(curses, initscr,, AC_MSG_ERROR(The ncurses terminal library is required in order to build the program))])
312 AC_TRY_COMPILE([
313     #include <sys/types.h>
314     #include <sys/socket.h>
315 ],[ socklen_t foo; ], ac_cv_c_socklen_t=yes, ac_cv_c_socklen_t=no)
317 if test "$ac_cv_c_socklen_t" = "no"; then
318   AC_DEFINE(socklen_t, int, [Define type of socklen_t for systems missing it])
321 case "$host_os" in
322         darwin*)
323                 LIBS="$LIBS -flat_namespace"
324                 ;;
325 esac
327 AM_CONDITIONAL(BUILD_YAHOO, test "x$build_yahoo" = xyes)
328 AM_CONDITIONAL(BUILD_AIM, test "x$build_aim" = xyes)
329 AM_CONDITIONAL(BUILD_IRC, test "x$build_irc" = xyes)
330 AM_CONDITIONAL(BUILD_FIRETALK, test "x$build_irc" = xyes -o "x$build_aim" = xyes)
331 AM_CONDITIONAL(BUILD_JABBER, test "x$build_jabber" = xyes)
332 AM_CONDITIONAL(BUILD_GADU, test "x$build_gg" = xyes)
333 AM_CONDITIONAL(BUILD_MSN, test "x$build_msn" = xyes)
334 AM_CONDITIONAL(BUILD_RSS, test "x$build_rss" = xyes -o "x$build_lj" = xyes)
335 AM_CONDITIONAL(BUILD_LJ, test "x$build_lj" = xyes)
336 AM_CONDITIONAL(HAVE_FRIBIDI, test "x$have_fribidi" = xyes)
338 if test "$build_yahoo" = "yes"; then
339         AC_DEFINE(BUILD_YAHOO, 1, [build with yahoo support])
341 if test "$build_aim" = "yes"; then
342         AC_DEFINE(BUILD_AIM, 1, [build with aim support])
344 if test "$build_irc" = "yes";
345         then AC_DEFINE(BUILD_IRC, 1, [build with irc support])
347 if test "$build_jabber" = "yes"; then
348         if test $have_gpgme = no; then
349                 AC_MSG_WARN([No GPG support in Jabber, since GPGME library not found or its setup not ok])
350         fi
351         AC_DEFINE(BUILD_JABBER, 1, [build with jabber support])
353 if test "$build_gg" = "yes"; then
354         if test $have_libjpeg = no; then
355                 AC_MSG_WARN([No jpeg support in Gadu-Gadu, you will not be able to register??????????])
356         fi
357         AC_DEFINE(BUILD_GADU, 1, [build with gadu-gadu support])
359 if test "$build_msn" = "yes"; then
360         if test $have_curl = no; then
361                 AC_MSG_ERROR([MSN cannot be built without the curl library.])
362         fi
363         if test $curlssl = no; then
364                 AC_MSG_ERROR([MSN requires libcurl built with SSL support.])
365         fi
366         AC_DEFINE(BUILD_MSN, 1, [build with MSN support])
368 if test "$build_rss" = "yes" -o "$build_lj" = "yes"; then
369         AC_DEFINE(BUILD_RSS, 1, [build the integrated rss feeds reader])
371 if test "$build_lj" = "yes"; then
372         AC_DEFINE(BUILD_LJ, 1, [build the integrated livejournal client])
375 ############################
376 # Checks for header files. #
377 ############################
378 AC_FUNC_ALLOCA
379 AC_HEADER_DIRENT
380 AC_HEADER_STDC
381 AC_HEADER_SYS_WAIT
382 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])
383 AC_CHECK_HEADERS([stdint.h sys/types.h],,)
385 AC_LANG_SAVE
386 AC_LANG_CPLUSPLUS
387 AC_CHECK_HEADERS([vector iostream fstream string algorithm list memory iterator exception utility],, AC_MSG_ERROR([You need to have the libstdc++ headers installed]))
388 AC_CHECK_HEADERS([hash_map strstream ext/hash_map sstream],,)
389 AC_LANG_RESTORE
391 ##################################################################
392 # Checks for typedefs, structures, and compiler characteristics. #
393 ##################################################################
394 AC_STRUCT_TIMEZONE
395 AC_HEADER_STDBOOL
396 AC_C_CONST
397 AC_C_INLINE
398 AC_C_RESTRICT
399 AC_TYPE_SIZE_T
400 AC_HEADER_TIME
401 AC_STRUCT_TM
402 AC_C_VOLATILE
403 AC_CHECK_TYPES([ptrdiff_t])
404 AC_TYPE_SIGNAL
406 #################
407 # Substitutions #
408 #################
409 AC_SUBST(FRIBIDI_LIBS)
410 AC_SUBST(FRIBIDI_CFLAGS) 
411 AC_SUBST(FRIBIDI_PC) 
413 AC_SUBST(GPGME_LIBS)
414 AC_SUBST(GPGME_CFLAGS) 
415 AC_SUBST(GPGME_CXXFLAGS) 
417 AC_SUBST(CURL_LIBS)
418 AC_SUBST(CURL_CFLAGS) 
419 AC_SUBST(CURL_CXXFLAGS) 
421 AC_SUBST(JPEG_LIBS)
423 #################################
424 # Checks for library functions. #
425 #################################
426 AC_FUNC_CLOSEDIR_VOID
427 AC_FUNC_ERROR_AT_LINE
428 AC_FUNC_FORK
429 AC_FUNC_LSTAT
430 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
431 AC_FUNC_MALLOC
432 AC_FUNC_MEMCMP
433 AC_FUNC_MKTIME
434 AC_FUNC_MMAP
435 AC_FUNC_REALLOC
436 AC_FUNC_SELECT_ARGTYPES
437 AC_FUNC_STAT
438 AC_FUNC_STRFTIME
439 AC_FUNC_VPRINTF
440 AC_FUNC_WAIT3                                  
441 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])
443 ########################
444 # Create output files. #
445 ########################
446 # also configure other packages
447 AC_CONFIG_SUBDIRS(connwrap firetalk kkconsui kkstrtext kksystr libgadu libicq2000 libjabber libmsn libyahoo2)
449 ALL_LINGUAS="zh_TW.Big5 uk sv ru ro pt_BR pl nl ms it hu fr es de cs bg"
450 AC_CONFIG_FILES([Makefile
451                  misc/Makefile
452                  share/Makefile
453                  src/Makefile
454                  src/hooks/Makefile
455                  intl/Makefile
456                  po/Makefile.in])
458 AC_OUTPUT
460 AC_MSG_RESULT([
461 Build options:
462   Version               $VERSION
463   Install prefix        $prefix
464   Build shared libs     $enable_shared
465   Build static libs     $enable_static
466   CFLAGS                $CFLAGS
467   CPPFLAGS              $CPPFLAGS
469 Protocols and Clients:])
470 if test "x$build_yahoo" = xyes; then AC_MSG_RESULT([  Yahoo]); fi
471 if test "x$build_aim" = xyes; then AC_MSG_RESULT([  AIM]); fi
472 if test "x$build_jabber" = xyes; then AC_MSG_RESULT([  jabber]); fi
473 if test "x$build_gg" = xyes; then AC_MSG_RESULT([  Gadu-Gadu]); fi
474 if test "x$build_msn" = xyes; then AC_MSG_RESULT([  MSN Messenger]); fi
475 if test "x$build_rss" = xyes; then AC_MSG_RESULT([  RSS Reader]); fi
476 if test "x$build_lj" = xyes; then AC_MSG_RESULT([  LiveJournal client]); fi
477 if test "x$have_fribidi" = xyes; then AC_MSG_RESULT([  LiveJournal client]); fi
478 AC_MSG_RESULT([
479 Enjoy!])