1 AC_INIT(SILC-Client, 0.8.16-rc1)
2 AC_CONFIG_SRCDIR([src])
3 AC_CONFIG_AUX_DIR(build-aux)
6 AC_CONFIG_HEADERS([irssi-config.h])
7 AM_INIT_AUTOMAKE([1.9 no-define foreign])
16 AC_PATH_PROG(sedpath, sed)
17 AC_PATH_PROG(perlpath, perl)
19 AC_CHECK_HEADERS(unistd.h dirent.h sys/ioctl.h sys/resource.h)
21 # check posix headers..
22 AC_CHECK_HEADERS(sys/time.h sys/utsname.h regex.h)
27 [ --with-socks Build with socks support],
28 if test x$withval = xno; then
36 [ --without-textui Build without text frontend],
37 if test x$withval = xno; then
45 [ --with-bot Build irssi-bot],
46 if test x$withval = xno; then
54 [ --with-proxy Build irssi-proxy],
55 if test x$withval = xno; then
63 [ --without-terminfo Use curses backend instead of terminfo],
64 if test x$withval = xno; then
72 [ --with-modules Specify what modules to build in binary],
73 if test x$withval != xyes -a x$withval != xno; then
74 build_modules="$withval"
77 if test "x$prefix" != "xNONE"; then
78 prefix=`eval echo $prefix`
79 PERL_MM_PARAMS="INSTALLDIRS=perl PREFIX=$prefix"
80 perl_library_dir="PERL_USE_LIB"
87 [ --with-gc Use garbage collector],
88 if test x$withval = xno; then
95 AC_ARG_WITH(perl-staticlib,
96 [ --with-perl-staticlib Specify that we want to link perl libraries
97 statically in irssi, default is no],
98 if test x$withval = xno; then
101 want_staticperllib=yes
103 want_staticperllib=no)
106 AC_ARG_WITH(perl-lib,
107 [ --with-perl-lib=[site|vendor|DIR] Specify where to install the
108 Perl libraries for irssi, default is site],
109 if test "x$withval" = xyes; then
111 elif test "x$withval" = xno; then
113 elif test "x$withval" = xsite; then
117 elif test "x$withval" = xvendor; then
120 if test -z "`$perlpath -v|grep '5\.0'`"; then
121 PERL_MM_PARAMS="INSTALLDIRS=vendor"
123 PERL_MM_PARAMS="INSTALLDIRS=perl PREFIX=`perl -e 'use Config; print $Config{prefix}'`"
125 perl_library_dir="(vendor default - `$perlpath -e 'use Config; print $Config{archlib}'`)"
129 PERL_MM_PARAMS="INSTALLDIRS=perl LIB=$withval"
130 perl_library_dir="PERL_USE_LIB"
136 [ --with-perl[=yes|no|module] Build with Perl support - also specifies
137 if it should be built into main irssi binary
138 (static, default) or as module],
139 if test x$withval = xyes; then
141 elif test x$withval = xstatic; then
143 elif test x$withval = xmodule; then
150 # Irssi SILC Plugin support
154 AC_MSG_CHECKING(whether to compile SILC Plugin for Irssi)
155 AC_ARG_WITH(silc-plugin,
156 [[ --with-silc-plugin[=DIR] Compile the SILC Plugin for Irssi, specify
157 Irssi location [/usr/lib/irssi]]],
167 SILC_IRSSIDIR="/usr/lib/irssi/modules"
172 SILC_IRSSIDIR="$withval/modules"
177 AM_CONDITIONAL(SILCPLUGIN, test x$silc_plugin = xtrue)
178 AC_SUBST(SILC_IRSSIDIR)
181 [ --disable-ipv6 Disable IPv6 support],
182 if test x$enableval = xno; then
190 [ --enable-dane Enable DANE support],
191 if test x$enableval = xno ; then
199 dnl ** SSL Library checks (OpenSSL)
203 [ --disable-ssl Disable Secure Sockets Layer support],,
207 dnl ** just some generic stuff...
210 dnl * OS specific options
213 CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
220 AC_CHECK_FUNC(socket, [], [
221 AC_CHECK_LIB(socket, socket, [
222 LIBS="$LIBS -lsocket"
226 AC_CHECK_FUNC(inet_addr, [], [
227 AC_CHECK_LIB(nsl, inet_addr, [
232 dnl * gcc specific options
233 if test "x$ac_cv_prog_gcc" = "xyes"; then
234 CFLAGS="$CFLAGS -Wall -Wno-deprecated-declarations"
237 dnl * socklen_t - AC_CHECK_TYPE() would be _really_ useful if it only would
238 dnl * accept header files where to find the typedef..
239 AC_MSG_CHECKING([for socklen_t])
240 AC_CACHE_VAL(irssi_cv_type_socklen_t,
242 #include <sys/types.h>
243 #include <sys/socket.h>],
245 irssi_cv_type_socklen_t=yes,
246 irssi_cv_type_socklen_t=no,
248 if test $irssi_cv_type_socklen_t = no; then
249 AC_DEFINE(socklen_t, int, Define to 'int' if <sys/socket.h> doesn't define.)
251 AC_MSG_RESULT($irssi_cv_type_socklen_t)
254 AC_CHECK_SIZEOF(long)
255 AC_CHECK_SIZEOF(long long)
256 AC_CHECK_SIZEOF(off_t)
258 if test $ac_cv_sizeof_off_t = 8; then
264 if test x$ac_cv_sizeof_off_t = x$ac_cv_sizeof_long; then
265 # try to use unsigned long always first
266 AC_DEFINE_UNQUOTED(PRIuUOFF_T, "lu")
267 AC_DEFINE(UOFF_T_LONG)
268 elif test x$ac_cv_sizeof_off_t = x$ac_cv_sizeof_int; then
270 AC_DEFINE_UNQUOTED(PRIuUOFF_T, "u")
271 AC_DEFINE(UOFF_T_INT)
272 elif test x$ac_cv_sizeof_off_t = x$ac_cv_sizeof_long_long; then
273 # and finally long long
274 AC_DEFINE_UNQUOTED(PRIuUOFF_T, "llu")
275 AC_DEFINE(UOFF_T_LONG_LONG)
277 AC_ERROR([Couldn't find integer type for off_t])
281 dnl ** check for socks
284 if test "x$want_socks" = "xyes"; then
285 AC_CHECK_LIB(socks, connect, [
286 AC_DEFINE(HAVE_SOCKS,, Build with socks support)
288 AC_CHECK_HEADER(socks.h, [
289 AC_DEFINE(HAVE_SOCKS_H)
290 CFLAGS="$CFLAGS -DSOCKS"
291 AC_MSG_RESULT(["socks5 library found, building with it"])
293 AC_MSG_RESULT(["socks4 library found, building with it"])
294 CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dgetpeername=Rgetpeername -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
300 dnl ** fe-text checks
304 if test $try = 1; then
307 echo "*** trying without -lgmodule"
310 AM_PATH_GLIB_2_0(2.6.0,,, $glib_modules)
311 if test "$GLIB_LIBS"; then
312 if test $glib_modules = gmodule; then
313 AC_DEFINE(HAVE_GMODULE)
320 if test -z "$GLIB_LIBS"; then
322 echo "*** If you don't have GLIB, you can get it from ftp://ftp.gtk.org/pub/glib/"
323 echo "*** We recommend you get the latest stable GLIB 2 version."
324 echo "*** Compile and install it, and make sure pkg-config finds it,"
325 echo "*** by adding the path where the .pc file is located to PKG_CONFIG_PATH"
328 AC_ERROR([GLIB is required to build irssi.])
331 LIBS="$LIBS $GLIB_LIBS"
334 if test "$enable_ssl" = "yes"; then
335 PKG_CHECK_MODULES(SSL, openssl, :, :)
336 if test "$SSL_LIBS"; then
337 CFLAGS="$CFLAGS $SSL_CFLAGS"
340 AC_CHECK_LIB(ssl, SSL_read, [
341 AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h, [
342 SSL_LIBS="-lssl -lcrypto"
347 if test "$have_openssl" = "yes"; then
348 AC_DEFINE(HAVE_OPENSSL,, Build with OpenSSL support)
349 LIBS="$LIBS $SSL_LIBS"
354 dnl ** Garbage Collector
357 if test "x$want_gc" = xyes; then
358 AC_CHECK_LIB(gc, GC_malloc, [
359 AC_CHECK_HEADER(gc/gc.h, [
360 AC_DEFINE(HAVE_GC_GC_H)
365 AC_CHECK_HEADER(gc.h, [
379 if test "x$want_textui" = "xyes"; then
382 TEXTUI_LIBS="$CURSES_LIBS"
383 if test "x$has_curses" = "xtrue"; then
385 LIBS="$LIBS $CURSES_LIBS"
386 if test $want_terminfo = no; then
387 AC_CHECK_FUNC(use_default_colors, AC_DEFINE(HAVE_NCURSES_USE_DEFAULT_COLORS))
388 AC_CHECK_FUNC(idcok, AC_DEFINE(HAVE_CURSES_IDCOK))
389 AC_CHECK_FUNC(resizeterm, AC_DEFINE(HAVE_CURSES_RESIZETERM))
390 AC_CHECK_FUNC(wresize, AC_DEFINE(HAVE_CURSES_WRESIZE))
392 AC_CHECK_FUNC(setupterm,, [
397 AC_CHECK_LIB(tinfo, setupterm, [
398 TEXTUI_LIBS="-ltinfo"
400 ], AC_CHECK_LIB(termlib, tgetent, [
401 TEXTUI_LIBS="-ltermlib"
403 ], AC_CHECK_LIB(termcap, tgetent, [
404 TEXTUI_LIBS="-ltermcap"
407 AC_ERROR(Terminfo/termcap not found - install ncurses-devel package)
411 AC_SUBST(TEXTUI_LIBS)
413 if test "x$want_termcap" = "xyes"; then
414 AC_CHECK_FUNC(tparm,, need_tparm=yes)
416 AC_DEFINE(HAVE_TERMINFO)
424 if test "$want_perl" != "no"; then
425 AC_MSG_CHECKING(for working Perl support)
427 if test -z "$perlpath"; then
428 perl_check_error="perl binary not found"
430 PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null`
433 if test "x$ac_cv_prog_gcc" = "xyes" -a -z "`echo $host_os|grep 'bsd\|linux'`"; then
434 dnl * several systems have Perl compiled with native compiler
435 dnl * but irssi is being compiled with GCC. Here we try to
436 dnl * fix those command line options a bit so GCC won't
437 dnl * complain about them. Normally there's only few options
438 dnl * that we want to keep:
439 dnl * -Ddefine -Uundef -I/path -fopt -mopt
440 PERL_CFLAGS=`echo $PERL_CFLAGS | $perlpath -pe 's/^(.* )?-[^DUIfm][^ ]+/\1/g; s/^(.* )?\+[^ ]+/\1/g'`
442 PERL_EXTRA_OPTS="CCCDLFLAGS=\"-fPIC\""
443 AC_SUBST(PERL_EXTRA_OPTS)
446 if test -z "$PERL_CFLAGS"; then
447 if test -n "$perl_check_error"; then
448 perl_check_error="Error getting perl CFLAGS"
450 AC_MSG_RESULT([not found, building without Perl])
453 PERL_LDFLAGS=`$perlpath -MExtUtils::Embed -e ldopts 2>/dev/null`
455 dnl * remove all database stuffs
456 dnl * nsl is already in ldflags
457 dnl * libc is of course linked without needing -lc
458 dnl * -rdynamic must not be in LIBADD line
459 for word in -ldb -ldbm -lndbm -lgdbm -lc -rdynamic; do
460 PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath -e "s/$word //" -e "s/$word$//"`
465 PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath -e 's/-lposix //' -e 's/-lposix$//'`
468 if test "x$ac_cv_prog_gcc" = "xyes"; then
469 PERL_CFLAGS=`echo $PERL_CFLAGS | $sedpath -e 's/-Ae //' -e 's/-Ae$//'`
470 PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath -e 's/-Ae //' -e 's/-Ae$//'`
477 dnl * check that perl's ldflags actually work
478 echo "main(){perl_alloc(); return 0;}" > conftest.c
479 $CC $CFLAGS conftest.c -o conftest $LDFLAGS $PERL_LDFLAGS 2> perl.error.tmp > /dev/null
480 if test ! -s conftest -a "x$ignore_perl_errors" = "x"; then
481 perl_check_error="Error linking with perl libraries: $PERL_LDFLAGS: `cat perl.error.tmp`"
482 AC_MSG_RESULT([error linking with perl libraries, building without Perl])
489 if test "x$want_perl" != "xno"; then
492 if test "x$want_perl" = "xstatic"; then
493 dnl * building with static perl support
494 dnl * all PERL_LDFLAGS linking is done in fe-text
495 PERL_LINK_FLAGS="$PERL_LDFLAGS"
496 PERL_LINK_LIBS="../perl/libperl_core_static.la"
497 PERL_FE_LINK_LIBS="../perl/libfe_perl_static.la"
499 AC_DEFINE(HAVE_STATIC_PERL)
501 dnl * build only static library of perl module
504 perl_static_lib=libperl_core_static.la
505 perl_static_fe_lib=libfe_perl_static.la
507 dnl * build dynamic library of perl module
508 perl_module_lib=libperl_core.la
509 perl_module_fe_lib=libfe_perl.la
514 if test "x$want_staticperllib" = "xyes"; then
515 PERL_MM_PARAMS="$PERL_MM_PARAMS LINKTYPE=static"
516 PERL_LINK_LIBS="$PERL_LINK_LIBS ../perl/common/blib/arch/auto/Irssi/Irssi.a ../perl/irc/blib/arch/auto/Irssi/Irc/Irc.a ../perl/ui/blib/arch/auto/Irssi/UI/UI.a ../perl/textui/blib/arch/auto/Irssi/TextUI/TextUI.a"
522 # figure out the correct @INC path - we'll need to do this
523 # through MakeMaker since it's difficult to get it right
525 if test "x$perl_set_use_lib" = "xyes"; then
526 perl -e 'use ExtUtils::MakeMaker; WriteMakefile("NAME" => "test", "MAKEFILE" => "Makefile.test");' $PERL_MM_PARAMS >/dev/null
527 PERL_USE_LIB=`perl -e 'open(F, "Makefile.test"); while (<F>) { chomp; if (/^(\w+) = (.*$)/) { $keys{$1} = $2; } }; $key = $keys{INSTALLARCHLIB}; while ($key =~ /\\$\((\w+)\)/) { $value = $keys{$1}; $key =~ s/\\$\($1\)/$value/; }; print $key;'`
531 AC_SUBST(perl_module_lib)
532 AC_SUBST(perl_static_lib)
533 AC_SUBST(perl_module_fe_lib)
534 AC_SUBST(perl_static_fe_lib)
536 AC_SUBST(PERL_LINK_FLAGS)
537 AC_SUBST(PERL_LINK_LIBS)
538 AC_SUBST(PERL_FE_LINK_LIBS)
540 AC_SUBST(PERL_LDFLAGS)
541 AC_SUBST(PERL_CFLAGS)
543 AC_SUBST(PERL_USE_LIB)
544 AC_SUBST(PERL_MM_PARAMS)
545 AC_SUBST(PERL_STATIC_LIBS)
549 dnl ** check what we want to build
550 AM_CONDITIONAL(BUILD_TEXTUI, test "$want_textui" = "yes")
551 AM_CONDITIONAL(BUILD_IRSSIBOT, test "$want_irssibot" = "yes")
552 AM_CONDITIONAL(BUILD_IRSSIPROXY, test "$want_irssiproxy" = "yes")
553 AM_CONDITIONAL(HAVE_PERL, test "$want_perl" != "no")
554 AM_CONDITIONAL(NEED_TPARM, test "$need_tparm" = "yes")
555 AM_CONDITIONAL(USE_CURSES, test "$want_terminfo" != "yes" -a "$want_termcap" != "yes")
557 # move LIBS to PROG_LIBS so they're not tried to be used when linking eg. perl libraries
563 dnl ** Keep all the libraries here so each frontend doesn't need to
564 dnl ** keep track of them all
566 dnl ** (these could be made configurable)
570 if test -n "$build_modules"; then
571 silc_MODULES="$silc_MODULES $build_modules"
574 dnl ****************************************
576 AC_SUBST(CHAT_MODULES)
577 AC_SUBST(silc_MODULES)
579 CORE_LIBS="../core/libcore.a ../lib-config/libirssi_config.a"
583 for c in $CHAT_MODULES; do
588 CHAT_LIBS="$CHAT_LIBS ../$c/lib$c.a ../$c/core/lib${c}_core.a"
589 if test -f $srcdir/src/fe-common/$c/module.h; then
590 FE_COMMON_LIBS="$FE_COMMON_LIBS../fe-common/$c/libfe_common_$c.a "
592 for s in `eval echo \\$${c}_MODULES`; do
593 CHAT_LIBS="$CHAT_LIBS ../$c/$s/lib${c}_$s.a"
594 module_inits="$module_inits ${c}_${s}_init();"
595 module_deinits="${c}_${s}_deinit(); $module_deinits"
596 if test -f $srcdir/src/fe-common/$c/$s/module.h; then
597 FE_COMMON_LIBS="$FE_COMMON_LIBS../fe-common/$c/$s/libfe_${c}_$s.a "
598 fe_module_inits="$fe_module_inits fe_${c}_${s}_init();"
599 fe_module_deinits="fe_${c}_${s}_deinit(); $fe_module_deinits"
605 echo "/* this file is automatically generated by configure - don't change */" > $file
606 echo "void ${c}_core_init(void); void ${c}_core_deinit(void);" >> $file
607 if test -n "$module_inits"; then
608 echo "$module_inits" | $sedpath -e 's/()/(void)/g' -e 's/ /void /g' >> $file
609 echo "$module_deinits" | $sedpath -e 's/ *$//' -e 's/()/(void)/g' -e 's/ /void /g' -e 's/^/void /' >> $file
611 echo "void ${c}_init(void) { ${c}_core_init(); $module_inits }" >> $file
612 echo "void ${c}_deinit(void) { $module_deinits ${c}_core_deinit(); }" >> $file
614 if test -f $srcdir/src/fe-common/$c/module.h; then
615 mkdir -p src/fe-common/$c
616 file="src/fe-common/$c/${c}-modules.c"
617 echo "/* this file is automatically generated by configure - don't change */" > $file
618 if test -n "$fe_module_inits"; then
619 echo "$fe_module_inits" | $sedpath -e 's/()/(void)/g' -e 's/ /void /g' >> $file
620 echo "$fe_module_deinits" | $sedpath -e 's/ *$//' -e 's/()/(void)/g' -e 's/ /void /g' -e 's/^/void /' >> $file
622 echo "void fe_${c}_modules_init(void) { $fe_module_inits }" >> $file
623 echo "void fe_${c}_modules_deinit(void) { $fe_module_deinits }" >> $file
627 FE_COMMON_LIBS="$FE_COMMON_LIBS../fe-common/core/libfe_common_core.a"
629 dnl ** common libraries needed by frontends
630 COMMON_NOUI_LIBS="$CHAT_LIBS $CORE_LIBS"
631 COMMON_LIBS="$FE_COMMON_LIBS $COMMON_NOUI_LIBS"
632 AC_SUBST(COMMON_NOUI_LIBS)
633 AC_SUBST(COMMON_LIBS)
640 if test "x$want_ipv6" = "xyes"; then
641 AC_MSG_CHECKING([for IPv6])
642 AC_CACHE_VAL(irssi_cv_type_in6_addr,
644 #include <sys/types.h>
645 #include <sys/socket.h>
646 #include <netinet/in.h>
648 #include <arpa/inet.h>],
649 [struct in6_addr i;],
652 if test $have_ipv6 = yes; then
655 AC_MSG_RESULT($have_ipv6)
658 if test "x$want_dane" = "xyes"; then
659 AC_MSG_CHECKING([for DANE])
660 AC_CHECK_LIB(val-threads, val_getdaneinfo,
662 LIBS="$LIBS -lval-threads -lsres"
663 AC_DEFINE([HAVE_DANE], [], [DANE support])
665 ], [], [-lssl -lcrypto -lsres -lpthread])
667 if test x$have_dane = "xyes" ; then
668 if test x$have_openssl = "xno" ; then
669 AC_ERROR([SSL is required to build Irssi with DANE support enabled.])
675 # Glue into SILC build system
677 INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
678 AC_SUBST(INCLUDE_DEFINES_INT)
684 src/fe-common/Makefile
685 src/fe-common/core/Makefile
686 src/fe-common/silc/Makefile
688 src/lib-config/Makefile
690 src/silc/core/Makefile
692 src/perl/common/Makefile.PL
693 src/perl/ui/Makefile.PL
694 src/perl/textui/Makefile.PL
695 src/perl/silc/Makefile.PL
697 scripts/examples/Makefile
700 docs/help/in/Makefile
707 dnl ** for building from objdir
708 old_dir=`pwd` && cd $srcdir && whole_dir=`pwd` && cd $old_dir
709 if test "x$old_dir" != "x$whole_dir"; then
710 if test "x$want_perl" != "xno"; then
712 for i in $whole_dir/src/perl/common $whole_dir/src/perl/irc $whole_dir/src/perl/ui $whole_dir/src/perl/textui; do
713 subdirfiles=`echo $subdirfiles $i/typemap $i/module.h $i/*.pm $i/*.xs`
715 for file in $whole_dir/src/perl/module.h $subdirfiles; do
716 link=`echo $file|$sedpath "s?$whole_dir/??"`
725 if test "x$want_textui" = "xno"; then
727 elif test "x$want_termcap" = "xyes"; then
728 text="yes, using termcap"
729 elif test "x$want_terminfo" = "xyes"; then
730 text="yes, using terminfo"
732 text="yes, using curses"
734 echo "Building text frontend ........... : $text"
735 echo "Building irssi bot ............... : $want_irssibot"
736 echo "Building irssi proxy ............. : $want_irssiproxy"
737 if test "x$have_gmodule" = "xyes"; then
738 echo "Building with module support ..... : yes"
740 echo "Building with module support : NO!! /LOAD will not work!"
741 echo " - You're missing gmodule (comes with glib) for some reason,"
742 echo " or it doesn't work in your system."
745 if test "x$want_perl" = "xstatic"; then
746 echo "Building with Perl support ....... : static (in irssi binary)"
747 elif test "x$want_perl" = "xmodule"; then
748 echo "Building with Perl support ....... : module"
750 if test -z "$perl_check_error"; then
751 echo "Building with Perl support ....... : no"
753 echo "Building with Perl support ....... : NO!"
754 echo " - $perl_check_error"
758 if test "x$want_perl" != "xno" -a "x$perl_mod_error" != "x"; then
759 echo " - NOTE: Perl support will be compiled statically to irssi, not as"
760 echo " a module as requested. Reason:"
761 echo " $perl_mod_error"
763 if test -f /etc/debian_version; then
764 echo " - Try: apt-get install libperl-dev"
768 if test "x$want_perl" != "xno"; then
769 if test "$perl_library_dir" = "PERL_USE_LIB"; then
770 perl_library_dir=$PERL_USE_LIB
772 if test -z "$perl_library_dir"; then
773 perl_library_dir="(site default - `$perlpath -e 'use Config; print $Config{sitearch}'`)"
775 echo "Perl library directory ........... : $perl_library_dir"
776 if test "x$perl_prefix_note" = "xyes"; then
777 echo " - NOTE: This was automatically set to the same directory you gave with"
778 echo " --prefix. If you want the perl libraries to install to their 'correct'"
779 echo " path, you'll need to give --with-perl-lib=site option to configure."
780 echo " Anyway, installing perl to this directory should work just as well."
783 echo "Install prefix ................... : $prefix"
787 echo "Building with IPv6 support ....... : $have_ipv6"
788 echo "Building with SSL support ........ : $have_openssl"
789 echo "Building with 64bit DCC support .. : $offt_64bit"
790 echo "Building with garbage collector .. : $have_gc"
791 echo "Building with DANE support ....... : $have_dane"
794 echo "If there are any problems, read the INSTALL file."