1 AC_INIT(irssi, 1.1-head)
2 AC_CONFIG_SRCDIR([src])
3 AC_CONFIG_AUX_DIR(build-aux)
6 AC_CONFIG_HEADERS([irssi-config.h])
7 AC_CONFIG_MACRO_DIR([m4])
8 AM_INIT_AUTOMAKE([1.9 no-define foreign])
10 AM_SILENT_RULES([yes])
18 AC_PATH_PROG(sedpath, sed)
19 AC_PATH_PROG(perlpath, perl)
21 AC_CHECK_HEADERS(unistd.h dirent.h sys/ioctl.h sys/resource.h)
23 # check posix headers..
24 AC_CHECK_HEADERS(sys/socket.h sys/time.h sys/utsname.h)
29 [ --with-socks Build with socks support],
30 if test x$withval = xno; then
38 [ --without-textui Build without text frontend],
39 if test x$withval = xno; then
47 [ --with-bot Build irssi-bot],
48 if test x$withval = xno; then
56 [ --with-fuzzer Build irssi-fuzzer],
57 if test x$withval = xno; then
64 AC_ARG_WITH(fuzzer-lib,
65 [ --with-fuzzer-lib Specify path to fuzzer library],
66 fuzzerlibpath="$withval")
69 [ --with-proxy Build irssi-proxy],
70 if test x$withval = xno; then
78 [ --with-modules Specify what modules to build in binary],
79 if test x$withval != xyes -a x$withval != xno; then
80 build_modules="$withval"
83 if test "x$prefix" != "xNONE"; then
84 prefix=`eval echo $prefix`
85 PERL_MM_PARAMS="INSTALLDIRS=perl INSTALL_BASE=$prefix"
91 AC_ARG_WITH(perl-staticlib,
92 [ --with-perl-staticlib Specify that we want to link perl libraries
93 statically in irssi, default is no],
94 if test x$withval = xno; then
97 want_staticperllib=yes
99 want_staticperllib=no)
102 AC_ARG_WITH(perl-lib,
103 [ --with-perl-lib=[perl|site|vendor|DIR] Specify where to install the
104 Perl libraries for irssi, default is site],
105 if test "x$withval" = xyes; then
107 elif test "x$withval" = xno; then
109 elif test "x$withval" = xperl; then
112 PERL_MM_PARAMS="INSTALLDIRS=perl"
114 elif test "x$withval" = xsite; then
119 elif test "x$withval" = xvendor; then
122 if test -z "`$perlpath -v|grep '5\.0'`"; then
123 PERL_MM_PARAMS="INSTALLDIRS=vendor"
125 PERL_MM_PARAMS="INSTALLDIRS=perl PREFIX=`$perlpath -e 'use Config; print $Config{prefix}'`"
131 PERL_MM_PARAMS="INSTALLDIRS=perl LIB=$withval"
137 [ --with-perl[=yes|no|module] Build with Perl support - also specifies
138 if it should be built into main irssi binary
139 (static, default) or as module],
140 if test x$withval = xyes; then
142 elif test x$withval = xstatic; then
144 elif test x$withval = xmodule; then
151 AC_ARG_ENABLE(true-color,
152 [ --enable-true-color Build with true color support in terminal],
153 if test x$enableval = xno ; then
160 AC_ARG_ENABLE(gregex,
161 [ --disable-gregex Build without GRegex (fall back to regex.h)],
162 if test x$enableval = xno ; then
170 dnl ** just some generic stuff...
173 dnl * OS specific options
176 CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
183 AC_SEARCH_LIBS([socket], [network socket])
185 AC_SEARCH_LIBS([inet_addr], [nsl])
187 dnl * gcc specific options
188 if test "x$ac_cv_prog_gcc" = "xyes"; then
189 CFLAGS="$CFLAGS -Wall"
192 AC_CHECK_TYPE(socklen_t, ,
193 [AC_DEFINE([socklen_t], [int], [Define to 'int' if <sys/socket.h> doesn't define.])], [
195 #ifdef HAVE_SYS_SOCKET_H
196 # include <sys/socket.h>
201 AC_CHECK_SIZEOF(long)
202 AC_CHECK_SIZEOF(long long)
203 AC_CHECK_SIZEOF(off_t)
205 if test $ac_cv_sizeof_off_t = 8; then
211 if test x$ac_cv_sizeof_off_t = x$ac_cv_sizeof_long; then
212 # try to use unsigned long always first
213 AC_DEFINE_UNQUOTED(PRIuUOFF_T, "lu")
214 AC_DEFINE(UOFF_T_LONG)
215 elif test x$ac_cv_sizeof_off_t = x$ac_cv_sizeof_int; then
217 AC_DEFINE_UNQUOTED(PRIuUOFF_T, "u")
218 AC_DEFINE(UOFF_T_INT)
219 elif test x$ac_cv_sizeof_off_t = x$ac_cv_sizeof_long_long; then
220 # and finally long long
221 AC_DEFINE_UNQUOTED(PRIuUOFF_T, "llu")
222 AC_DEFINE(UOFF_T_LONG_LONG)
224 AC_ERROR([Couldn't find integer type for off_t])
228 dnl ** check for socks
231 if test "x$want_socks" = "xyes"; then
232 AC_CHECK_LIB(socks, connect, [
233 AC_DEFINE(HAVE_SOCKS,, Build with socks support)
235 AC_CHECK_HEADER(socks.h, [
236 AC_DEFINE(HAVE_SOCKS_H)
237 CFLAGS="$CFLAGS -DSOCKS"
238 AC_MSG_RESULT(["socks5 library found, building with it"])
240 AC_MSG_RESULT(["socks4 library found, building with it"])
241 CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dgetpeername=Rgetpeername -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
247 dnl ** fe-text checks
251 if test $try = 1; then
254 echo "*** trying without -lgmodule"
257 AM_PATH_GLIB_2_0(2.28.0,,, $glib_modules)
258 if test "$GLIB_LIBS"; then
259 if test $glib_modules = gmodule; then
260 AC_DEFINE(HAVE_GMODULE)
267 if test -z "$GLIB_LIBS"; then
269 echo "*** If you don't have GLIB, you can get it from ftp://ftp.gtk.org/pub/glib/"
270 echo "*** We recommend you get the latest stable GLIB 2 version."
271 echo "*** Compile and install it, and make sure pkg-config finds it,"
272 echo "*** by adding the path where the .pc file is located to PKG_CONFIG_PATH"
273 echo -n "*** Or alternatively install your distribution's package"
274 if test -f /etc/debian_version; then
276 echo "*** sudo apt-get install libglib2.0-dev"
277 elif test -f /etc/redhat-release; then
278 echo " (glib2-devel)"
284 AC_ERROR([GLIB is required to build irssi.])
287 LIBS="$LIBS $GLIB_LIBS"
290 dnl ** OpenSSL checks
292 PKG_CHECK_MODULES([OPENSSL], [openssl], [
293 CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
294 LIBS="$LIBS $OPENSSL_LIBS"
296 AC_CHECK_LIB([ssl], [SSL_library_init], [
297 LIBS="$LIBS -lssl -lcrypto"
299 AC_MSG_ERROR([The OpenSSL library was not found])
307 if test "x$want_textui" != "xno"; then
309 TEXTUI_NO_LIBS="$LIBS"
311 AC_SEARCH_LIBS([setupterm], [tinfo ncursesw ncurses terminfo], [want_textui=yes], [
312 AC_ERROR(Terminfo not found - install libncurses-dev or ncurses-devel package)
313 want_textui="no, Terminfo not found"
317 AC_SUBST(TEXTUI_LIBS)
318 LIBS="$TEXTUI_NO_LIBS"
323 dnl ** irssifuzzer checks
326 if test "$want_irssifuzzer" != "no"; then
327 dnl * we need to build with -fsanitize-coverage=trace-pc-guard
328 dnl * otherwise fuzzer won't be very successful at finding bugs :)
329 if test -z "$SANFLAGS"; then
330 SANFLAGS="-g -fsanitize=address -fsanitize-coverage=trace-pc-guard"
332 CFLAGS="$CFLAGS $SANFLAGS"
333 CXXFLAGS="$CXXFLAGS $SANFLAGS"
335 AC_MSG_CHECKING(for fuzzer library)
337 if test -z "$fuzzerlibpath"; then
338 AC_MSG_RESULT([not found, building without fuzzer front end])
341 FUZZER_LIBS="$fuzzerlibpath"
342 AC_SUBST(FUZZER_LIBS)
350 if test "$want_perl" != "no"; then
351 AC_MSG_CHECKING(for working Perl support)
353 if test -z "$perlpath"; then
354 perl_check_error="perl binary not found"
356 PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null`
359 if test "x$ac_cv_prog_gcc" = "xyes" -a -z "`echo $host_os|grep 'bsd\|linux'`"; then
360 dnl * several systems have Perl compiled with native compiler
361 dnl * but irssi is being compiled with GCC. Here we try to
362 dnl * fix those command line options a bit so GCC won't
363 dnl * complain about them. Normally there's only few options
364 dnl * that we want to keep:
365 dnl * -Ddefine -Uundef -I/path -fopt -mopt
366 PERL_CFLAGS=`echo $PERL_CFLAGS | $perlpath -pe 's/^(.* )?-@<:@^DUIfm@:>@@<:@^ @:>@+/\1/g; s/^(.* )?\+@<:@^ @:>@+/\1/g'`
368 PERL_EXTRA_OPTS="CCCDLFLAGS=\"-fPIC\""
369 AC_SUBST(PERL_EXTRA_OPTS)
372 if test -z "$PERL_CFLAGS"; then
373 if test -n "$perl_check_error"; then
374 perl_check_error="Error getting perl CFLAGS"
376 AC_MSG_RESULT([not found, building without Perl])
379 PERL_LDFLAGS=`$perlpath -MExtUtils::Embed -e ldopts 2>/dev/null`
381 dnl * remove all database stuffs
382 dnl * nsl is already in ldflags
383 dnl * libc is of course linked without needing -lc
384 dnl * -rdynamic must not be in LIBADD line
385 for word in -ldb -ldbm -lndbm -lgdbm -lc -rdynamic; do
386 PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath -e "s/$word //" -e "s/$word$//"`
391 PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath -e 's/-lposix //' -e 's/-lposix$//'`
394 if test "x$ac_cv_prog_gcc" = "xyes"; then
395 PERL_CFLAGS=`echo $PERL_CFLAGS | $sedpath -e 's/-Ae //' -e 's/-Ae$//'`
396 PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath -e 's/-Ae //' -e 's/-Ae$//'`
403 dnl * check that perl's ldflags actually work
404 echo "#include <EXTERN.h>" > conftest.c
405 echo "#include <perl.h>" >> conftest.c
406 echo "int main(){perl_alloc(); return 0;}" >> conftest.c
407 $CC $CFLAGS $PERL_CFLAGS conftest.c -o conftest $LDFLAGS $PERL_LDFLAGS 2> perl.error.tmp > /dev/null
408 if test ! -s conftest -a "x$ignore_perl_errors" = "x"; then
409 perl_check_error="Error linking with perl libraries: $PERL_LDFLAGS: `cat perl.error.tmp`"
410 AC_MSG_RESULT([error linking with perl libraries, building without Perl])
417 if test "x$want_perl" != "xno"; then
420 if test "x$want_perl" = "xstatic"; then
421 dnl * building with static perl support
422 dnl * all PERL_LDFLAGS linking is done in fe-text
423 PERL_LINK_FLAGS="$PERL_LDFLAGS"
424 PERL_LINK_LIBS="../perl/libperl_core_static.la"
425 PERL_FE_LINK_LIBS="../perl/libfe_perl_static.la"
427 AC_DEFINE(HAVE_STATIC_PERL)
429 dnl * build only static library of perl module
432 perl_static_lib=libperl_core_static.la
433 perl_static_fe_lib=libfe_perl_static.la
435 dnl * build dynamic library of perl module
436 perl_module_lib=libperl_core.la
437 perl_module_fe_lib=libfe_perl.la
442 if test "x$want_staticperllib" = "xyes"; then
443 PERL_MM_PARAMS="$PERL_MM_PARAMS LINKTYPE=static"
444 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"
450 # remove any prefix from PERL_MM_OPT
451 PERL_MM_OPT=`perl -MText::ParseWords -e 'sub qu{$_=shift;s{^(.*?)=(.*)$}{($a,$b)=($1,$2);$b=~s/"/\\\\"/g;qq{$a="$b"}}ge if /@<:@\s"@:>@/;$_} local $,=" "; print map qu($_), grep !/^(INSTALL_BASE|PREFIX)=/, shellwords(@ARGV)' "$PERL_MM_OPT"`
452 # figure out the correct @INC path - we'll need to do this
453 # through MakeMaker since it's difficult to get it right
455 $perlpath -MExtUtils::MakeMaker -e 'WriteMakefile(NAME => "test", MAKEFILE => "Makefile.test", FIRST_MAKEFILE => "/dev/null", NO_META => 1, NO_MYMETA => 1);' $PERL_MM_PARAMS >/dev/null
456 echo 'show-INSTALLDIRS:' >> Makefile.test
457 echo ' @echo $(INSTALLDIRS)' >> Makefile.test
458 perl_INSTALLDIRS=`$am_make -s -f Makefile.test show-INSTALLDIRS`
459 if test "x$perl_INSTALLDIRS" = "xsite"; then
460 perl_library_dir="site default"
461 perl_INSTALL_VAR=INSTALLSITEARCH
462 elif test "x$perl_INSTALLDIRS" = "xvendor"; then
463 perl_library_dir="vendor default"
464 perl_INSTALL_VAR=INSTALLVENDORARCH
466 perl_library_dir="module default"
467 perl_INSTALL_VAR=INSTALLARCHLIB
469 echo 'show-ARCHLIB:' >> Makefile.test
470 echo ' @echo $('"$perl_INSTALL_VAR"')' >> Makefile.test
471 perl_use_lib=`$am_make -s -f Makefile.test show-ARCHLIB`
473 if test "x$perl_set_use_lib" = "xyes"; then
474 if $perlpath -e 'exit ! grep $_ eq $ARGV@<:@0@:>@, grep /^\//, @INC' "$perl_use_lib"; then
475 perl_library_dir="other path in @INC"
478 perl_library_dir="prepends to @INC with /set perl_use_lib"
479 PERL_USE_LIB="$perl_use_lib"
483 AC_SUBST(perl_module_lib)
484 AC_SUBST(perl_static_lib)
485 AC_SUBST(perl_module_fe_lib)
486 AC_SUBST(perl_static_fe_lib)
488 AC_SUBST(PERL_LINK_FLAGS)
489 AC_SUBST(PERL_LINK_LIBS)
490 AC_SUBST(PERL_FE_LINK_LIBS)
492 AC_SUBST(PERL_LDFLAGS)
493 AC_SUBST(PERL_CFLAGS)
495 AC_SUBST(PERL_USE_LIB)
496 AC_SUBST(PERL_MM_OPT)
497 AC_SUBST(PERL_MM_PARAMS)
498 AC_SUBST(PERL_STATIC_LIBS)
502 dnl ** check what we want to build
503 AM_CONDITIONAL(BUILD_TEXTUI, test "$want_textui" = "yes")
504 AM_CONDITIONAL(BUILD_IRSSIBOT, test "$want_irssibot" = "yes")
505 AM_CONDITIONAL(BUILD_IRSSIFUZZER, test "$want_irssifuzzer" = "yes")
506 AM_CONDITIONAL(BUILD_IRSSIPROXY, test "$want_irssiproxy" = "yes")
507 AM_CONDITIONAL(HAVE_PERL, test "$want_perl" != "no")
509 # move LIBS to PROG_LIBS so they're not tried to be used when linking eg. perl libraries
515 dnl ** Keep all the libraries here so each frontend doesn't need to
516 dnl ** keep track of them all
518 dnl ** (these could be made configurable)
521 irc_MODULES="dcc flood notifylist"
522 if test -n "$build_modules"; then
523 irc_MODULES="$irc_MODULES $build_modules"
526 dnl ****************************************
528 AC_SUBST(CHAT_MODULES)
529 AC_SUBST(irc_MODULES)
531 CORE_LIBS="../core/libcore.a ../lib-config/libirssi_config.a"
535 for c in $CHAT_MODULES; do
540 CHAT_LIBS="$CHAT_LIBS ../$c/lib$c.a ../$c/core/lib${c}_core.a"
541 if test -f $srcdir/src/fe-common/$c/module.h; then
542 FE_COMMON_LIBS="$FE_COMMON_LIBS../fe-common/$c/libfe_common_$c.a "
544 for s in `eval echo \\$${c}_MODULES`; do
545 CHAT_LIBS="$CHAT_LIBS ../$c/$s/lib${c}_$s.a"
546 module_inits="$module_inits ${c}_${s}_init();"
547 module_deinits="${c}_${s}_deinit(); $module_deinits"
548 if test -f $srcdir/src/fe-common/$c/$s/module.h; then
549 FE_COMMON_LIBS="$FE_COMMON_LIBS../fe-common/$c/$s/libfe_${c}_$s.a "
550 fe_module_inits="$fe_module_inits fe_${c}_${s}_init();"
551 fe_module_deinits="fe_${c}_${s}_deinit(); $fe_module_deinits"
557 echo "/* this file is automatically generated by configure - don't change */" > $file
558 echo "void ${c}_core_init(void); void ${c}_core_deinit(void);" >> $file
559 if test -n "$module_inits"; then
560 echo "$module_inits" | $sedpath -e 's/()/(void)/g' -e 's/ /void /g' >> $file
561 echo "$module_deinits" | $sedpath -e 's/ *$//' -e 's/()/(void)/g' -e 's/ /void /g' -e 's/^/void /' >> $file
563 echo "void ${c}_init(void) { ${c}_core_init(); $module_inits }" >> $file
564 echo "void ${c}_deinit(void) { $module_deinits ${c}_core_deinit(); }" >> $file
566 if test -f $srcdir/src/fe-common/$c/module.h; then
567 mkdir -p src/fe-common/$c
568 file="src/fe-common/$c/${c}-modules.c"
569 echo "/* this file is automatically generated by configure - don't change */" > $file
570 if test -n "$fe_module_inits"; then
571 echo "$fe_module_inits" | $sedpath -e 's/()/(void)/g' -e 's/ /void /g' >> $file
572 echo "$fe_module_deinits" | $sedpath -e 's/ *$//' -e 's/()/(void)/g' -e 's/ /void /g' -e 's/^/void /' >> $file
574 echo "void fe_${c}_modules_init(void) { $fe_module_inits }" >> $file
575 echo "void fe_${c}_modules_deinit(void) { $fe_module_deinits }" >> $file
579 FE_COMMON_LIBS="$FE_COMMON_LIBS../fe-common/core/libfe_common_core.a"
581 dnl ** common libraries needed by frontends
582 COMMON_NOUI_LIBS="$CHAT_LIBS $CORE_LIBS"
583 COMMON_LIBS="$FE_COMMON_LIBS $COMMON_NOUI_LIBS"
584 AC_SUBST(COMMON_NOUI_LIBS)
585 AC_SUBST(COMMON_LIBS)
587 if test "x$want_truecolor" = "xyes"; then
588 AC_DEFINE([TERM_TRUECOLOR], [], [true color support in terminal])
593 if test "x$want_gregex" = "xyes"; then
594 AC_DEFINE([USE_GREGEX], [], [use GRegex for regular expressions])
599 AH_TEMPLATE(HAVE_GMODULE)
600 AH_TEMPLATE(HAVE_SOCKS_H, [misc..])
601 AH_TEMPLATE(HAVE_STATIC_PERL)
602 AH_TEMPLATE(PRIuUOFF_T, [printf()-format for uoff_t, eg. "u" or "lu" or "llu"])
603 AH_TEMPLATE(UOFF_T_INT, [What type should be used for uoff_t])
604 AH_TEMPLATE(UOFF_T_LONG)
605 AH_TEMPLATE(UOFF_T_LONG_LONG)
612 src/irc/core/Makefile
614 src/irc/notifylist/Makefile
615 src/irc/proxy/Makefile
616 src/irc/flood/Makefile
617 src/fe-common/Makefile
618 src/fe-common/core/Makefile
619 src/fe-common/irc/Makefile
620 src/fe-common/irc/dcc/Makefile
621 src/fe-common/irc/notifylist/Makefile
625 src/lib-config/Makefile
627 src/perl/common/Makefile.PL
628 src/perl/irc/Makefile.PL
629 src/perl/ui/Makefile.PL
630 src/perl/textui/Makefile.PL
632 scripts/examples/Makefile
635 docs/help/in/Makefile
641 dnl ** for building from objdir
642 old_dir=`pwd` && cd $srcdir && whole_dir=`pwd` && cd $old_dir
643 if test "x$old_dir" != "x$whole_dir"; then
644 $LN_S $srcdir/irssi-version.h irssi-version.h
645 if test "x$want_perl" != "xno"; then
647 for i in $whole_dir/src/perl/common $whole_dir/src/perl/irc $whole_dir/src/perl/ui $whole_dir/src/perl/textui; do
648 subdirfiles=`echo $subdirfiles $i/typemap $i/module.h $i/*.pm $i/*.xs`
650 for file in $whole_dir/src/perl/module.h $subdirfiles; do
651 link=`echo $file|$sedpath "s?$whole_dir/??"`
660 echo "Building text frontend ........... : $want_textui"
661 echo "Building irssi bot ............... : $want_irssibot"
662 echo "Building irssi proxy ............. : $want_irssiproxy"
663 if test "x$have_gmodule" = "xyes"; then
664 echo "Building with module support ..... : yes"
666 echo "Building with module support : NO!! /LOAD will not work!"
667 echo " - You're missing gmodule (comes with glib) for some reason,"
668 echo " or it doesn't work in your system."
671 if test "x$want_perl" = "xstatic"; then
672 echo "Building with Perl support ....... : static (in irssi binary)"
673 elif test "x$want_perl" = "xmodule"; then
674 echo "Building with Perl support ....... : module"
676 if test -z "$perl_check_error"; then
677 echo "Building with Perl support ....... : no"
679 echo "Building with Perl support ....... : NO!"
680 echo " - $perl_check_error"
681 if test -f /etc/debian_version; then
682 echo " - Try: sudo apt-get install libperl-dev"
683 elif test -f /etc/redhat-release; then
684 echo " - Try installing perl-devel"
689 if test "x$want_perl" != "xno" -a "x$perl_mod_error" != "x"; then
690 echo " - NOTE: Perl support will be compiled statically to irssi, not as"
691 echo " a module as requested. Reason:"
692 echo " $perl_mod_error"
694 if test -f /etc/debian_version; then
695 echo " - Try: sudo apt-get install libperl-dev"
699 if test "x$want_perl" != "xno"; then
700 echo "Perl library directory ........... : ($perl_library_dir - $perl_use_lib)"
701 if test "x$perl_prefix_note" = "xyes"; then
702 echo " - NOTE: This was automatically set to the same directory you gave with"
703 echo " --prefix. If you want the perl libraries to install to their 'correct'"
704 echo " path, you'll need to give --with-perl-lib=site option to configure."
705 echo " Anyway, installing perl to this directory should work just as well."
708 echo "Install prefix ................... : $prefix"
712 echo "Building with 64bit DCC support .. : $offt_64bit"
713 echo "Building with true color support.. : $want_truecolor"
714 echo "Building with GRegex ............. : $want_gregex"
717 echo "If there are any problems, read the INSTALL file."