Updated kkstrtext/configure.in to newer syntax. Moved it to
[centerim.git] / configure.ac
blobe604ecd3f284006e461464636b370da16b72d4c2
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.59)
5 AC_INIT([centericq], [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,  [  --disable-yahoo    Build without Yahoo!], build_yahoo="$enableval", build_yahoo="yes")
35 AC_ARG_ENABLE(aim,    [  --disable-aim      Build without AIM], build_aim="$enableval", build_aim="yes")
36 AC_ARG_ENABLE(irc,    [  --disable-irc      Build without IRC], build_irc="$enableval", build_irc="yes")
37 AC_ARG_ENABLE(jabber, [  --disable-jabber   Build without Jabber], build_jabber="$enableval", build_jabber="yes")
38 AC_ARG_ENABLE(gg,     [  --disable-gg       Build without Gadu-Gadu], build_gg="$enableval", build_gg="yes")
39 AC_ARG_ENABLE(msn,    [  --disable-msn      Build without MSN], build_msn="$enableval", build_msn="yes")
40 AC_ARG_ENABLE(rss,    [  --disable-rss      Build without RSS reader], build_rss="$enableval", build_rss="yes")
41 AC_ARG_ENABLE(lj,     [  --disable-lj       Build without LiveJournal client], build_lj="$enableval", build_lj="yes")
42 AC_ARG_ENABLE(locales-fix, [  --enable-locales-fix    enables workaround for broken locales. use this option if some of characters in your texts in Chinese or Japanese diappear])
44 AC_ARG_WITH(fribidi,  [  --with-fribidi=[DIR]   enable Hebrew and Arabic support using fribidi library in DIR], [with_fribidi=$withval], [with_fribidi=no])
45 AC_ARG_WITH(ssl,      [  --with-ssl         enable SSL secured connections using either OpenSSL or GnuTLS], [with_ssl=$withval], [with_ssl=no]) 
46 AC_ARG_WITH(openssl,  [  --with-openssl=[DIR]   enable SSL secured connections using the OpenSSL library in DIR (optional)], [with_openssl=$withval], [with_openssl=no])
47 AC_ARG_WITH(openssl,  [  --with-gpgme=[PATH]   path to gpgme-config (auto)], [with_gpgme=$withval], [with_gpgme=no])
48 AC_ARG_WITH(curl,     [  --with-curl=[PATH]  path to curl-config (auto)], [with_curl=$withval], [with_curl=no])
49 AC_ARG_WITH(libjpeg,  [  --without-libjpeg  Compile without JPEG token support (for Gadu-Gadu registration)])
51 #####################
52 # Check for fribidi #
53 #####################
54 AC_MSG_CHECKING(wether to use fribidi)
55 FRIBIDI_LIBS=""
56 FRIBIDI_CFLAGS=""
57 FRIBIDI_PC="" 
58 have_fribidi=no 
60 if test "x$with_fribidi" = "xyes"; then
61         AC_PATH_PROG(FRIBIDI_CONFIG, fribidi-config, no)
62         if test x$FRIBIDI_CONFIG = xno; then
63                 AC_MSG_ERROR([*** fribidi-config not found])
64         fi
65         
66         FRIBIDI_CFLAGS="`$FRIBIDI_CONFIG --cflags`"
67         CFLAGS="$CFLAGS $FRIBIDI_CFLAGS"
68         FRIBIDI_LIBS="`$FRIBIDI_CONFIG --libs`"
69         FRIBIDI_PC="fribidi,"
71         AC_CHECK_LIB(fribidi, fribidi_get_mirror_char, :, AC_MSG_ERROR([*** libfribidi not found.]), $FRIBIDI_LIBS)
72         AC_DEFINE(HAVE_FRIBIDI, 1, [has fribidi library])
73         have_fribidi=yes
75 AC_MSG_RESULT([$have_fribidi])
77 #################
78 # Check for SSL #
79 #################
80 AC_MSG_CHECKING(for SSL)
81 AC_MSG_RESULT([])
83 if test "$with_ssl" != "no"; then
85         AC_MSG_CHECKING(for OpenSSL)
86         if test -z "$with_openssl"; then
87                 for ac_dir in $with_openssl /usr/local /usr; do
88                         if test -f "$ac_dir/include/openssl/ssl.h"; then
89                                 with_openssl=$ac_dir
90                                 break;
91                         fi
92                 done
93         fi
95         if test -n "$with_openssl" -a "$with_openssl" != "no"; then
96                 if test "$with_openssl" = "yes"; then 
97                         with_openssl="/usr"
98                 fi
99                 CFLAGS="$CFLAGS -I${with_openssl}"
100                 AC_DEFINE(HAVE_OPENSSL, 1, [use openssl])
101                 AC_CHECK_LIB(crypto, main)
102                 AC_CHECK_LIB(ssl, main)
103                 AC_MSG_RESULT([found in $with_openssl])
104         else
105                 with_ssl="no"
107                 AM_PATH_LIBGNUTLS_EXTRA(0.0.1, [
108                         CXXFLAGS="$CXXFLAGS $LIBGNUTLS_CFLAGS"
109                         LIBS="$LIBS $LIBGNUTLS_LIBS -lgnutls-extra"
110                         AC_DEFINE(HAVE_GNUTLS, 1, [use gnutls]) with_ssl="yes" ])
111                 AC_MSG_RESULT([not found or disabled])
112         fi
113 else 
114         AC_MSG_RESULT([disabled (use --with-ssl=[DIR] to enable)])
117 ###################
118 # Check for gpgme #
119 ###################
120 AC_MSG_CHECKING(for gpgme)
121 GPGME_CFLAGS=""
122 GPGME_CXXFLAGS=""
123 GPGME_LIBS=""
124 have_gpgme=no
126 if true; then
127         AC_MSG_RESULT([])
129         if test -x "$with_gpgme"; then
130                 GPGME_CONFIG= "$with_gpgme"
131         else
132                 AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no)
133         fi
135         if test x$GPGME_CONFIG = xno; then
136                 AC_MSG_ERROR([*** gpgme-config not found])
137         fi
139         save_CFLAGS="$CFLAGS"
140         save_CXXFLAGS="$CXXFLAGS"
141         save_LIBS="$LIBS"
143         GPGME_CFLAGS="`$GPGME_CONFIG --cflags`"
144         GPGME_CXXFLAGS="`$GPGME_CONFIG --cflags`"
145         GPGME_LIBS="`$GPGME_CONFIG --libs`"
146         CFLAGS="$CFLAGS $GPGME_CFLAGS"
147         CXXFLAGS="$CXXFLAGS $GPGME_CXXFLAGS"
148         LIBS="$LIBS $GPGME_LIBS"
150         AC_MSG_CHECKING(for the OpenPGP protocol in gpgme)
151         AC_TRY_RUN([
152                 #include <gpgme.h>
153                 int main() {
154                         gpgme_ctx_t ctx;
155                         if(!gpgme_new(&ctx)) if(!gpgme_set_protocol(ctx, GPGME_PROTOCOL_OpenPGP)) return 0;
156                         return 1;
157                 }
158         ], opengpg_avail=yes, opengpg_avail=no, opengpg_avail=no)
159         AC_MSG_RESULT($opengpg_avail)
161         if test "$opengpg_avail" != "yes"; then
162                 CFLAGS="$save_CFLAGS"
163                 CXXFLAGS="$save_CXXFLAGS"
164                 LIBS="$save_LIBS"
165         fi
166         AC_DEFINE(HAVE_GPGME, 1, [has gpgme library])
167         have_gpgme=yes
170 ##################
171 # Check for curl #
172 ##################
173 AC_MSG_CHECKING(for cURL)
174 AC_MSG_RESULT([])
175 CURL_CFLAGS=""
176 CURL_CXXFLAGS=""
177 CURL_LIBS=""
178 have_curl=no
180 if true; then
181         if test -x "$with_curl"; then
182                 CURL_CONFIG= "$with_curl"
183         else
184                 AC_PATH_PROG(CURL_CONFIG, curl-config, no)
185         fi
187         if test x$CURL_CONFIG = xno; then
188                 AC_MSG_ERROR([*** curl-config not found])
189         fi
191         save_CFLAGS="$CFLAGS"
192         save_CXXFLAGS="$CXXFLAGS"
193         save_LIBS="$LIBS"
195         CURL_CFLAGS="`$CURL_CONFIG --cflags`"
196         CURL_CXXFLAGS="`$CURL_CONFIG --cflags`"
197         CURL_LIBS="`$CURL_CONFIG --libs`"
198         CFLAGS="$CFLAGS $CURL_CFLAGS"
199         CXXFLAGS="$CXXFLAGS $CURL_CXXFLAGS"
200         LIBS="$LIBS $CURL_LIBS"
202         AC_MSG_CHECKING(for SSL support in libcurl)
203         curlssl=`$CURL_CONFIG --feature | grep SSL`
204         if test -z "$curlssl"; then
205                 curlssl=no
206                 AC_MSG_RESULT([no])
207         else
208                 curlssl=yes
209                 AC_MSG_RESULT([yes])
210         fi
212         AC_DEFINE(HAVE_CURL, 1, [has curl library])
213         have_curl=yes
216 #####################
217 # Check for libjpeg #
218 #####################
219 AC_MSG_CHECKING(for libjpeg (for Gadu-Gadu registration))
220 JPEG_LIBS=""
221 have_libjpeg=no
223 if test "x$with_libjpeg" != "xno"; then
224         AC_MSG_RESULT([])
226         AC_CHECK_LIB(jpeg, jpeg_start_decompress,
227         [
228                 AC_CHECK_HEADERS(jpeglib.h,
229                 [
230                         AC_DEFINE(HAVE_LIBJPEG, 1, [define if you have libjpeg])
231                         JPEG_LIBS="-ljpeg $LIBS"
232                         LIBS="$LIBS $JPEG_LIBS"
233                         have_libjpeg=yes
234                 ])
235         ])
238 ####################
239 # Check for others #
240 ####################
241 AM_ICONV_LINK
242 LIBS="$LIBS $LIBICONV"
244 AC_CHECK_LIB(socket, socket)
245 AC_CHECK_LIB(nsl, gethostbyname)
246 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))])
248 AC_TRY_COMPILE([
249     #include <sys/types.h>
250     #include <sys/socket.h>
251 ],[ socklen_t foo; ], ac_cv_c_socklen_t=yes, ac_cv_c_socklen_t=no)
253 if test "$ac_cv_c_socklen_t" = "no"; then
254   AC_DEFINE(socklen_t, int, [Define type of socklen_t for systems missing it])
257 case "$host_os" in
258         darwin*)
259                 LIBS="$LIBS -flat_namespace"
260                 ;;
261 esac
263 AM_CONDITIONAL(BUILD_YAHOO, test "x$build_yahoo" = xyes)
264 AM_CONDITIONAL(BUILD_AIM, test "x$build_aim" = xyes)
265 AM_CONDITIONAL(BUILD_IRC, test "x$build_irc" = xyes)
266 AM_CONDITIONAL(BUILD_JABBER, test "x$build_jabber" = xyes)
267 AM_CONDITIONAL(BUILD_GADU, test "x$build_gg" = xyes)
268 AM_CONDITIONAL(BUILD_MSN, test "x$build_msn" = xyes)
269 AM_CONDITIONAL(BUILD_RSS, test "x$build_rss" = xyes -o "x$build_lj" = xyes)
270 AM_CONDITIONAL(BUILD_LJ, test "x$build_lj" = xyes)
271 AM_CONDITIONAL(HAVE_FRIBIDI, test "x$have_fribidi" = xyes)
273 if test "$build_yahoo" = "yes"; then
274         AC_DEFINE(BUILD_YAHOO, 1, [build with yahoo support])
276 if test "$build_aim" = "yes"; then
277         AC_DEFINE(BUILD_AIM, 1, [build with aim support])
279 if test "$build_irc" = "yes";
280         then AC_DEFINE(BUILD_IRC, 1, [build with irc support])
282 if test "$build_jabber" = "yes"; then
283         if test $have_gpgme = no; then
284                 AC_MSG_WARN([No GPG support in Jabber, since GPGME library not found or its setup not ok])
285         fi
286         AC_DEFINE(BUILD_JABBER, 1, [build with jabber support])
288 if test "$build_gg" = "yes"; then
289         if test $have_libjpeg = no; then
290                 AC_MSG_WARN([No jpeg support in Gadu-Gadu, you will not be able to register??????????])
291         fi
292         AC_DEFINE(BUILD_GADU, 1, [build with gadu-gadu support])
294 if test "$build_msn" = "yes"; then
295         if test $have_curl = no; then
296                 AC_MSG_ERROR([MSN cannot be built without the curl library.])
297         fi
298         if test $curlssl = no; then
299                 AC_MSG_ERROR([MSN requires libcurl built with SSL support.])
300         fi
301         AC_DEFINE(BUILD_MSN, 1, [build with MSN support])
303 if test "$build_rss" = "yes" -o "$build_lj" = "yes"; then
304         AC_DEFINE(BUILD_RSS, 1, [build the integrated rss feeds reader])
306 if test "$build_lj" = "yes"; then
307         AC_DEFINE(BUILD_LJ, 1, [build the integrated livejournal client])
310 ############################
311 # Checks for header files. #
312 ############################
313 AC_FUNC_ALLOCA
314 AC_HEADER_DIRENT
315 AC_HEADER_STDC
316 AC_HEADER_SYS_WAIT
317 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])
318 AC_CHECK_HEADERS([stdint.h sys/types.h],,)
320 AC_LANG_SAVE
321 AC_LANG_CPLUSPLUS
322 AC_CHECK_HEADERS([vector iostream fstream string algorithm list memory iterator exception utility],, AC_MSG_ERROR([You need to have the libstdc++ headers installed]))
323 AC_CHECK_HEADERS([hash_map strstream ext/hash_map sstream],,)
324 AC_LANG_RESTORE
326 ##################################################################
327 # Checks for typedefs, structures, and compiler characteristics. #
328 ##################################################################
329 AC_STRUCT_TIMEZONE
330 AC_HEADER_STDBOOL
331 AC_C_CONST
332 AC_C_INLINE
333 AC_C_RESTRICT
334 AC_TYPE_SIZE_T
335 AC_HEADER_TIME
336 AC_STRUCT_TM
337 AC_C_VOLATILE
338 AC_CHECK_TYPES([ptrdiff_t])
339 AC_TYPE_SIGNAL
341 #################
342 # Substitutions #
343 #################
344 AC_SUBST(FRIBIDI_LIBS)
345 AC_SUBST(FRIBIDI_CFLAGS) 
346 AC_SUBST(FRIBIDI_PC) 
348 AC_SUBST(GPGME_LIBS)
349 AC_SUBST(GPGME_CFLAGS) 
350 AC_SUBST(GPGME_CXXFLAGS) 
352 AC_SUBST(CURL_LIBS)
353 AC_SUBST(CURL_CFLAGS) 
354 AC_SUBST(CURL_CXXFLAGS) 
356 AC_SUBST(JPEG_LIBS)
358 #################################
359 # Checks for library functions. #
360 #################################
361 AC_FUNC_CLOSEDIR_VOID
362 AC_FUNC_ERROR_AT_LINE
363 AC_FUNC_FORK
364 AC_FUNC_LSTAT
365 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
366 AC_FUNC_MALLOC
367 AC_FUNC_MEMCMP
368 AC_FUNC_MKTIME
369 AC_FUNC_MMAP
370 AC_FUNC_REALLOC
371 AC_FUNC_SELECT_ARGTYPES
372 AC_FUNC_STAT
373 AC_FUNC_STRFTIME
374 AC_FUNC_VPRINTF
375 AC_FUNC_WAIT3                                  
376 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])
378 ########################
379 # Create output files. #
380 ########################
381 # also configure other packages
382 AC_CONFIG_SUBDIRS(connwrap firetalk kkconsui kkstrtext kksystr libgadu libicq2000 libjabber libmsn libyahoo2)
384 ALL_LINGUAS="zh_TW.Big5 uk sv ru ro pt_BR pl nl ms it hu fr es de cs bg"
385 AC_CONFIG_FILES([Makefile
386                  misc/Makefile
387                  share/Makefile
388                  src/Makefile
389                  src/hooks/Makefile
390                  intl/Makefile
391                  po/Makefile.in])
393 AC_OUTPUT
395 AC_MSG_RESULT([
396 Build options:
397   Version               $VERSION
398   Install prefix        $prefix
399   Build shared libs     $enable_shared
400   Build static libs     $enable_static
401   CFLAGS                $CFLAGS
402   CPPFLAGS              $CPPFLAGS
404 Protocols and Clients:])
405 if test "x$build_yahoo" = xyes; then AC_MSG_RESULT([  Yahoo]); fi
406 if test "x$build_aim" = xyes; then AC_MSG_RESULT([  AIM]); fi
407 if test "x$build_jabber" = xyes; then AC_MSG_RESULT([  jabber]); fi
408 if test "x$build_gg" = xyes; then AC_MSG_RESULT([  Gadu-Gadu]); fi
409 if test "x$build_msn" = xyes; then AC_MSG_RESULT([  MSN Messenger]); fi
410 if test "x$build_rss" = xyes; then AC_MSG_RESULT([  RSS Reader]); fi
411 if test "x$build_lj" = xyes; then AC_MSG_RESULT([  LiveJournal client]); fi
412 if test "x$have_fribidi" = xyes; then AC_MSG_RESULT([  LiveJournal client]); fi
413 AC_MSG_RESULT([
414 Enjoy!])