]> jfr.im git - irc/irssi/irssi.git/blame - configure.ac
.travis.yml: Coverity stuff.
[irc/irssi/irssi.git] / configure.ac
CommitLineData
cbb931ed 1AC_INIT(irssi, 1.1-head)
871aa6e6 2AC_CONFIG_SRCDIR([src])
7dfb77ed 3AC_CONFIG_AUX_DIR(build-aux)
710fb0c2 4AC_PREREQ(2.50)
770ae459 5
a0400dc3 6AC_CONFIG_HEADERS([irssi-config.h])
13ea2cb6 7AC_CONFIG_MACRO_DIR([m4])
aefa7b47 8AM_INIT_AUTOMAKE([1.9 no-define foreign])
770ae459 9
a66bb95d
AF
10AM_SILENT_RULES([yes])
11
770ae459
TS
12AM_MAINTAINER_MODE
13
770ae459
TS
14AC_PROG_CC
15AC_PROG_CPP
770ae459
TS
16AM_PROG_LIBTOOL
17
64262262
TS
18AC_PATH_PROG(sedpath, sed)
19AC_PATH_PROG(perlpath, perl)
20
aa602a00 21AC_CHECK_HEADERS(unistd.h dirent.h sys/ioctl.h sys/resource.h)
770ae459 22
df10f182 23# check posix headers..
b5a727c8 24AC_CHECK_HEADERS(sys/socket.h sys/time.h sys/utsname.h)
11f2accb 25
47117f1f
EG
26AC_SYS_LARGEFILE
27
770ae459
TS
28AC_ARG_WITH(socks,
29[ --with-socks Build with socks support],
5f37c7d5
EG
30 if test x$withval = xno; then
31 want_socks=no
770ae459 32 else
5f37c7d5 33 want_socks=yes
770ae459
TS
34 fi,
35 want_socks=no)
36
770ae459 37AC_ARG_WITH(textui,
e27de386 38[ --without-textui Build without text frontend],
5f37c7d5
EG
39 if test x$withval = xno; then
40 want_textui=no
770ae459 41 else
5f37c7d5 42 want_textui=yes
770ae459
TS
43 fi,
44 want_textui=yes)
45
5b96b49e
TS
46AC_ARG_WITH(bot,
47[ --with-bot Build irssi-bot],
5f37c7d5
EG
48 if test x$withval = xno; then
49 want_irssibot=no
5b96b49e 50 else
5f37c7d5 51 want_irssibot=yes
5b96b49e 52 fi,
2d1ac305 53 want_irssibot=no)
5b96b49e 54
cf469072
JB
55AC_ARG_WITH(fuzzer,
56[ --with-fuzzer Build irssi-fuzzer],
57 if test x$withval = xno; then
58 want_irssifuzzer=no
59 else
60 want_irssifuzzer=yes
61 fi,
62 want_irssifuzzer=no)
63
64AC_ARG_WITH(fuzzer-lib,
65[ --with-fuzzer-lib Specify path to fuzzer library],
66 fuzzerlibpath="$withval")
67
d5495267
TS
68AC_ARG_WITH(proxy,
69[ --with-proxy Build irssi-proxy],
5f37c7d5
EG
70 if test x$withval = xno; then
71 want_irssiproxy=no
d5495267 72 else
5f37c7d5 73 want_irssiproxy=yes
d5495267
TS
74 fi,
75 want_irssiproxy=no)
76
93173356
TS
77AC_ARG_WITH(modules,
78[ --with-modules Specify what modules to build in binary],
ee8c26ba
TS
79 if test x$withval != xyes -a x$withval != xno; then
80 build_modules="$withval"
81 fi)
770ae459 82
64262262 83if test "x$prefix" != "xNONE"; then
dc8e204b 84 prefix=`eval echo $prefix`
b8d8925e 85 PERL_MM_PARAMS="INSTALLDIRS=perl INSTALL_BASE=$prefix"
857d2055 86 perl_set_use_lib=yes
64262262 87
64262262 88 perl_prefix_note=yes
d3dbd863
TS
89fi
90
ddf1b27c
TS
91AC_ARG_WITH(perl-staticlib,
92[ --with-perl-staticlib Specify that we want to link perl libraries
1539cf81 93 statically in irssi, default is no],
5f37c7d5
EG
94 if test x$withval = xno; then
95 want_staticperllib=no
ddf1b27c 96 else
5f37c7d5 97 want_staticperllib=yes
ddf1b27c
TS
98 fi,
99 want_staticperllib=no)
100
101
64262262 102AC_ARG_WITH(perl-lib,
3376d324 103[ --with-perl-lib=[perl|site|vendor|DIR] Specify where to install the
1539cf81 104 Perl libraries for irssi, default is site],
64262262 105 if test "x$withval" = xyes; then
5e97ea15 106 want_perl=yes
64262262
TS
107 elif test "x$withval" = xno; then
108 want_perl=no
3376d324 109 elif test "x$withval" = xperl; then
110 want_perl=yes
111 perl_prefix_note=no
112 PERL_MM_PARAMS="INSTALLDIRS=perl"
113 perl_set_use_lib=no
64262262
TS
114 elif test "x$withval" = xsite; then
115 want_perl=yes
d92ad715 116 perl_prefix_note=no
a1d3cf99 117 PERL_MM_PARAMS=""
3376d324 118 perl_set_use_lib=no
64262262
TS
119 elif test "x$withval" = xvendor; then
120 want_perl=yes
d92ad715 121 perl_prefix_note=no
64262262
TS
122 if test -z "`$perlpath -v|grep '5\.0'`"; then
123 PERL_MM_PARAMS="INSTALLDIRS=vendor"
a95cb0aa 124 else
3376d324 125 PERL_MM_PARAMS="INSTALLDIRS=perl PREFIX=`$perlpath -e 'use Config; print $Config{prefix}'`"
a95cb0aa 126 fi
3376d324 127 perl_set_use_lib=no
64262262
TS
128 else
129 want_perl=yes
d92ad715 130 perl_prefix_note=no
64262262 131 PERL_MM_PARAMS="INSTALLDIRS=perl LIB=$withval"
857d2055 132 perl_set_use_lib=yes
a95cb0aa
TS
133 fi,
134 want_perl=yes)
135
6c2f9c68 136AC_ARG_WITH(perl,
bac85d3f 137[ --with-perl[=yes|no|module] Build with Perl support - also specifies
1539cf81
TS
138 if it should be built into main irssi binary
139 (static, default) or as module],
6c2f9c68 140 if test x$withval = xyes; then
bac85d3f 141 want_perl=static
6c2f9c68 142 elif test x$withval = xstatic; then
5e97ea15 143 want_perl=static
bac85d3f
TS
144 elif test x$withval = xmodule; then
145 want_perl=module
5e97ea15
TS
146 else
147 want_perl=no
148 fi,
bac85d3f 149 want_perl=static)
5e97ea15 150
96a292d4
AN
151AC_ARG_ENABLE(true-color,
152[ --enable-true-color Build with true color support in terminal],
153 if test x$enableval = xno ; then
154 want_truecolor=no
155 else
156 want_truecolor=yes
157 fi,
158 want_truecolor=no)
159
f5cbbebc
AN
160AC_ARG_ENABLE(gregex,
161[ --disable-gregex Build without GRegex (fall back to regex.h)],
162 if test x$enableval = xno ; then
163 want_gregex=no
164 else
165 want_gregex=yes
166 fi,
167 want_gregex=yes)
168
770ae459
TS
169dnl **
170dnl ** just some generic stuff...
171dnl **
172
7423df6a
TS
173dnl * OS specific options
174case "$host_os" in
175 hpux*)
176 CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
177 ;;
178 *)
179 ;;
180esac
181
bacc22d5 182
0d7b3877 183AC_SEARCH_LIBS([socket], [network socket])
bacc22d5 184
9af3df4e 185AC_SEARCH_LIBS([inet_addr], [nsl])
bacc22d5
TS
186
187dnl * gcc specific options
188if test "x$ac_cv_prog_gcc" = "xyes"; then
189 CFLAGS="$CFLAGS -Wall"
190fi
191
1f9ad64e
FR
192AC_CHECK_TYPE(socklen_t, ,
193 [AC_DEFINE([socklen_t], [int], [Define to 'int' if <sys/socket.h> doesn't define.])], [
194AC_INCLUDES_DEFAULT
195#ifdef HAVE_SYS_SOCKET_H
196# include <sys/socket.h>
197#endif
198])
5fb98c22 199
dc8bd638
TS
200AC_CHECK_SIZEOF(int)
201AC_CHECK_SIZEOF(long)
202AC_CHECK_SIZEOF(long long)
710fb0c2 203AC_CHECK_SIZEOF(off_t)
dc8bd638 204
710fb0c2 205if test $ac_cv_sizeof_off_t = 8; then
dc8bd638
TS
206 offt_64bit=yes
207else
208 offt_64bit=no
209fi
210
710fb0c2 211if test x$ac_cv_sizeof_off_t = x$ac_cv_sizeof_long; then
dc8bd638
TS
212 # try to use unsigned long always first
213 AC_DEFINE_UNQUOTED(PRIuUOFF_T, "lu")
214 AC_DEFINE(UOFF_T_LONG)
710fb0c2 215elif test x$ac_cv_sizeof_off_t = x$ac_cv_sizeof_int; then
dc8bd638
TS
216 # next try int
217 AC_DEFINE_UNQUOTED(PRIuUOFF_T, "u")
218 AC_DEFINE(UOFF_T_INT)
710fb0c2 219elif test x$ac_cv_sizeof_off_t = x$ac_cv_sizeof_long_long; then
dc8bd638
TS
220 # and finally long long
221 AC_DEFINE_UNQUOTED(PRIuUOFF_T, "llu")
222 AC_DEFINE(UOFF_T_LONG_LONG)
223else
224 AC_ERROR([Couldn't find integer type for off_t])
225fi
226
770ae459
TS
227dnl **
228dnl ** check for socks
229dnl **
230
231if test "x$want_socks" = "xyes"; then
232 AC_CHECK_LIB(socks, connect, [
e2502d74 233 AC_DEFINE(HAVE_SOCKS,, Build with socks support)
2ba339a2 234 LIBS="$LIBS -lsocks"
770ae459
TS
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"])
239 ], [
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"
242 ])
243 ])
244fi
245
770ae459 246dnl **
d29ca0b1 247dnl ** fe-text checks
770ae459
TS
248dnl **
249
afa42924
EG
250for try in 1 2; do
251 if test $try = 1; then
a4cd003b 252 glib_modules=gmodule
e66e10af 253 else
a4cd003b
WC
254 echo "*** trying without -lgmodule"
255 glib_modules=
e66e10af 256 fi
560283ba 257 AM_PATH_GLIB_2_0(2.28.0,,, $glib_modules)
a4cd003b
WC
258 if test "$GLIB_LIBS"; then
259 if test $glib_modules = gmodule; then
260 AC_DEFINE(HAVE_GMODULE)
261 have_gmodule=yes
02419703 262 fi
a4cd003b 263 break
972c06ba 264 fi
a4cd003b
WC
265done
266
267if test -z "$GLIB_LIBS"; then
268 echo
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"
663bd7ee
DL
273 echo -n "*** Or alternatively install your distribution's package"
274 if test -f /etc/debian_version; then
275 echo :
276 echo "*** sudo apt-get install libglib2.0-dev"
277 elif test -f /etc/redhat-release; then
278 echo " (glib2-devel)"
279 else
280 echo .
281 fi
a4cd003b
WC
282 echo
283
284 AC_ERROR([GLIB is required to build irssi.])
3a373c21 285fi
770ae459 286
a720c3b5
RR
287LIBS="$LIBS $GLIB_LIBS"
288
289dnl **
290dnl ** OpenSSL checks
291dnl **
292PKG_CHECK_MODULES([OPENSSL], [openssl], [
293 CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
294 LIBS="$LIBS $OPENSSL_LIBS"
295], [
296 AC_CHECK_LIB([ssl], [SSL_library_init], [
297 LIBS="$LIBS -lssl -lcrypto"
298 ], [
299 AC_MSG_ERROR([The OpenSSL library was not found])
300 ])
301])
01ef7837 302
770ae459
TS
303dnl **
304dnl ** curses checks
305dnl **
306
9ee48037 307if test "x$want_textui" != "xno"; then
308
309 TEXTUI_NO_LIBS="$LIBS"
310 LIBS=
c8a19e11 311 AC_SEARCH_LIBS([setupterm], [tinfo ncursesw ncurses terminfo], [want_textui=yes], [
9ee48037 312 AC_ERROR(Terminfo not found - install libncurses-dev or ncurses-devel package)
313 want_textui="no, Terminfo not found"
314 ])
315
316 TEXTUI_LIBS="$LIBS"
fce48d90 317 AC_SUBST(TEXTUI_LIBS)
9ee48037 318 LIBS="$TEXTUI_NO_LIBS"
fce48d90 319
770ae459 320fi
770ae459 321
cf469072
JB
322dnl **
323dnl ** irssifuzzer checks
324dnl **
325
326if 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"
331 fi
332 CFLAGS="$CFLAGS $SANFLAGS"
333 CXXFLAGS="$CXXFLAGS $SANFLAGS"
334
335 AC_MSG_CHECKING(for fuzzer library)
336
337 if test -z "$fuzzerlibpath"; then
338 AC_MSG_RESULT([not found, building without fuzzer front end])
339 want_irssifuzzer=no
340 else
341 FUZZER_LIBS="$fuzzerlibpath"
342 AC_SUBST(FUZZER_LIBS)
343 fi
344fi
345
d304bc65
TS
346dnl **
347dnl ** perl checks
348dnl **
349
5e97ea15 350if test "$want_perl" != "no"; then
469fde36
TS
351 AC_MSG_CHECKING(for working Perl support)
352
e2da644c 353 if test -z "$perlpath"; then
dc8e204b 354 perl_check_error="perl binary not found"
469fde36
TS
355 else
356 PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null`
357 fi
4eb989cc 358
a6f70988 359 if test "x$ac_cv_prog_gcc" = "xyes" -a -z "`echo $host_os|grep 'bsd\|linux'`"; then
ba52d084
TS
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
3376d324 366 PERL_CFLAGS=`echo $PERL_CFLAGS | $perlpath -pe 's/^(.* )?-@<:@^DUIfm@:>@@<:@^ @:>@+/\1/g; s/^(.* )?\+@<:@^ @:>@+/\1/g'`
3182ac0d
TS
367
368 PERL_EXTRA_OPTS="CCCDLFLAGS=\"-fPIC\""
369 AC_SUBST(PERL_EXTRA_OPTS)
ba52d084
TS
370 fi
371
0cd57fb2
TS
372 if test -z "$PERL_CFLAGS"; then
373 if test -n "$perl_check_error"; then
374 perl_check_error="Error getting perl CFLAGS"
375 fi
469fde36 376 AC_MSG_RESULT([not found, building without Perl])
4eb989cc
TS
377 want_perl=no
378 else
d304bc65 379 PERL_LDFLAGS=`$perlpath -MExtUtils::Embed -e ldopts 2>/dev/null`
17bb7faf 380
17bb7faf 381 dnl * remove all database stuffs
17bb7faf 382 dnl * nsl is already in ldflags
02419703
TS
383 dnl * libc is of course linked without needing -lc
384 dnl * -rdynamic must not be in LIBADD line
c258280c 385 for word in -ldb -ldbm -lndbm -lgdbm -lc -rdynamic; do
02419703
TS
386 PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath -e "s/$word //" -e "s/$word$//"`
387 done
4eb989cc 388
02419703
TS
389 case "$host_os" in
390 linux*)
391 PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath -e 's/-lposix //' -e 's/-lposix$//'`
392 ;;
393 hpux*)
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$//'`
397 fi
398 ;;
399 *)
400 ;;
401 esac
17bb7faf 402
469fde36 403 dnl * check that perl's ldflags actually work
beec29c3
DL
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
b97bc4fe 408 if test ! -s conftest -a "x$ignore_perl_errors" = "x"; then
287df1f1 409 perl_check_error="Error linking with perl libraries: $PERL_LDFLAGS: `cat perl.error.tmp`"
469fde36
TS
410 AC_MSG_RESULT([error linking with perl libraries, building without Perl])
411 want_perl=no
412 fi
06127b40 413
287df1f1 414 rm -f perl.error.tmp
469fde36
TS
415 fi
416
417 if test "x$want_perl" != "xno"; then
be57a4e3 418 AC_MSG_RESULT(ok)
edec3faf 419
5e97ea15 420 if test "x$want_perl" = "xstatic"; then
c5add0e0
TS
421 dnl * building with static perl support
422 dnl * all PERL_LDFLAGS linking is done in fe-text
6c2f9c68
TS
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"
5e97ea15
TS
426 PERL_LDFLAGS=
427 AC_DEFINE(HAVE_STATIC_PERL)
c5add0e0
TS
428
429 dnl * build only static library of perl module
abe4ddb5 430 perl_module_lib=
6c2f9c68
TS
431 perl_module_fe_lib=
432 perl_static_lib=libperl_core_static.la
433 perl_static_fe_lib=libfe_perl_static.la
f6a284af 434 else
04cb7cfa 435 dnl * build dynamic library of perl module
abe4ddb5 436 perl_module_lib=libperl_core.la
6c2f9c68 437 perl_module_fe_lib=libfe_perl.la
abe4ddb5 438 perl_static_lib=
6c2f9c68 439 perl_static_fe_lib=
17bb7faf 440 fi
857d2055 441
ddf1b27c
TS
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"
445 PERL_STATIC_LIBS=1
446 else
447 PERL_STATIC_LIBS=0
448 fi
449
3376d324 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"`
857d2055
TS
452 # figure out the correct @INC path - we'll need to do this
453 # through MakeMaker since it's difficult to get it right
454 # otherwise.
3376d324 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
affbf71f 458 perl_INSTALLDIRS=`$am_make -s -f Makefile.test show-INSTALLDIRS`
3376d324 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
465 else
466 perl_library_dir="module default"
467 perl_INSTALL_VAR=INSTALLARCHLIB
468 fi
469 echo 'show-ARCHLIB:' >> Makefile.test
470 echo ' @echo $('"$perl_INSTALL_VAR"')' >> Makefile.test
affbf71f 471 perl_use_lib=`$am_make -s -f Makefile.test show-ARCHLIB`
3376d324 472 rm -f Makefile.test
857d2055 473 if test "x$perl_set_use_lib" = "xyes"; then
3376d324 474 if $perlpath -e 'exit ! grep $_ eq $ARGV@<:@0@:>@, grep /^\//, @INC' "$perl_use_lib"; then
475 perl_library_dir="other path in @INC"
476 perl_set_use_lib=no
477 else
478 perl_library_dir="prepends to @INC with /set perl_use_lib"
479 PERL_USE_LIB="$perl_use_lib"
480 fi
857d2055
TS
481 fi
482
abe4ddb5
TS
483 AC_SUBST(perl_module_lib)
484 AC_SUBST(perl_static_lib)
6c2f9c68
TS
485 AC_SUBST(perl_module_fe_lib)
486 AC_SUBST(perl_static_fe_lib)
f6a284af 487
6c2f9c68 488 AC_SUBST(PERL_LINK_FLAGS)
5807efc5 489 AC_SUBST(PERL_LINK_LIBS)
dc8e204b 490 AC_SUBST(PERL_FE_LINK_LIBS)
5807efc5 491
5e97ea15
TS
492 AC_SUBST(PERL_LDFLAGS)
493 AC_SUBST(PERL_CFLAGS)
64262262
TS
494
495 AC_SUBST(PERL_USE_LIB)
3376d324 496 AC_SUBST(PERL_MM_OPT)
64262262 497 AC_SUBST(PERL_MM_PARAMS)
ddf1b27c 498 AC_SUBST(PERL_STATIC_LIBS)
edec3faf 499 fi
a95cb0aa
TS
500fi
501
4d584944 502dnl ** check what we want to build
accc66c5
TS
503AM_CONDITIONAL(BUILD_TEXTUI, test "$want_textui" = "yes")
504AM_CONDITIONAL(BUILD_IRSSIBOT, test "$want_irssibot" = "yes")
cf469072 505AM_CONDITIONAL(BUILD_IRSSIFUZZER, test "$want_irssifuzzer" = "yes")
d5495267 506AM_CONDITIONAL(BUILD_IRSSIPROXY, test "$want_irssiproxy" = "yes")
5e97ea15 507AM_CONDITIONAL(HAVE_PERL, test "$want_perl" != "no")
b670cec8 508
59e310c7
TS
509# move LIBS to PROG_LIBS so they're not tried to be used when linking eg. perl libraries
510PROG_LIBS=$LIBS
511LIBS=
512AC_SUBST(PROG_LIBS)
513
d29ca0b1
TS
514dnl **
515dnl ** Keep all the libraries here so each frontend doesn't need to
516dnl ** keep track of them all
517dnl **
93d60321
TS
518dnl ** (these could be made configurable)
519
c866a4e2 520CHAT_MODULES="irc"
93d60321 521irc_MODULES="dcc flood notifylist"
0cd57fb2 522if test -n "$build_modules"; then
93173356
TS
523 irc_MODULES="$irc_MODULES $build_modules"
524fi
d29ca0b1 525
93d60321
TS
526dnl ****************************************
527
528AC_SUBST(CHAT_MODULES)
529AC_SUBST(irc_MODULES)
530
ab8da71d 531CORE_LIBS="../core/libcore.a ../lib-config/libirssi_config.a"
2d1ac305 532FE_COMMON_LIBS=""
93d60321
TS
533
534CHAT_LIBS=""
535for c in $CHAT_MODULES; do
d3dbd863
TS
536 module_inits=""
537 module_deinits=""
538 fe_module_inits=""
539 fe_module_deinits=""
af59f544 540 CHAT_LIBS="$CHAT_LIBS ../$c/lib$c.a ../$c/core/lib${c}_core.a"
a147dfc9 541 if test -f $srcdir/src/fe-common/$c/module.h; then
2d1ac305 542 FE_COMMON_LIBS="$FE_COMMON_LIBS../fe-common/$c/libfe_common_$c.a "
d3dbd863 543 fi
93d60321 544 for s in `eval echo \\$${c}_MODULES`; do
fc3918b0 545 CHAT_LIBS="$CHAT_LIBS ../$c/$s/lib${c}_$s.a"
76605ad0
TS
546 module_inits="$module_inits ${c}_${s}_init();"
547 module_deinits="${c}_${s}_deinit(); $module_deinits"
a147dfc9 548 if test -f $srcdir/src/fe-common/$c/$s/module.h; then
fc3918b0 549 FE_COMMON_LIBS="$FE_COMMON_LIBS../fe-common/$c/$s/libfe_${c}_$s.a "
76605ad0
TS
550 fe_module_inits="$fe_module_inits fe_${c}_${s}_init();"
551 fe_module_deinits="fe_${c}_${s}_deinit(); $fe_module_deinits"
552 fi
93d60321 553 done
76605ad0 554
db7e6677
WC
555 mkdir -p src/$c
556 file="src/$c/$c.c"
dc8e204b 557 echo "/* this file is automatically generated by configure - don't change */" > $file
76605ad0 558 echo "void ${c}_core_init(void); void ${c}_core_deinit(void);" >> $file
0cd57fb2 559 if test -n "$module_inits"; then
dc8e204b
EG
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
d3dbd863 562 fi
dc8e204b
EG
563 echo "void ${c}_init(void) { ${c}_core_init(); $module_inits }" >> $file
564 echo "void ${c}_deinit(void) { $module_deinits ${c}_core_deinit(); }" >> $file
76605ad0 565
a147dfc9 566 if test -f $srcdir/src/fe-common/$c/module.h; then
db7e6677 567 mkdir -p src/fe-common/$c
dc8e204b
EG
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
af59f544 573 fi
dc8e204b
EG
574 echo "void fe_${c}_modules_init(void) { $fe_module_inits }" >> $file
575 echo "void fe_${c}_modules_deinit(void) { $fe_module_deinits }" >> $file
d3dbd863 576 fi
93d60321 577done
d29ca0b1 578
2d1ac305
TS
579FE_COMMON_LIBS="$FE_COMMON_LIBS../fe-common/core/libfe_common_core.a"
580
d29ca0b1 581dnl ** common libraries needed by frontends
a38227e0 582COMMON_NOUI_LIBS="$CHAT_LIBS $CORE_LIBS"
66f9ea86 583COMMON_LIBS="$FE_COMMON_LIBS $COMMON_NOUI_LIBS"
93d60321 584AC_SUBST(COMMON_NOUI_LIBS)
d29ca0b1
TS
585AC_SUBST(COMMON_LIBS)
586
9ee48037 587if test "x$want_truecolor" = "xyes"; then
96a292d4
AN
588 AC_DEFINE([TERM_TRUECOLOR], [], [true color support in terminal])
589else
590 want_truecolor=no
591fi
592
f5cbbebc
AN
593if test "x$want_gregex" = "xyes"; then
594 AC_DEFINE([USE_GREGEX], [], [use GRegex for regular expressions])
595else
596 want_gregex=no
597fi
598
3376d324 599AH_TEMPLATE(HAVE_GMODULE)
3376d324 600AH_TEMPLATE(HAVE_SOCKS_H, [misc..])
601AH_TEMPLATE(HAVE_STATIC_PERL)
3376d324 602AH_TEMPLATE(PRIuUOFF_T, [printf()-format for uoff_t, eg. "u" or "lu" or "llu"])
3376d324 603AH_TEMPLATE(UOFF_T_INT, [What type should be used for uoff_t])
604AH_TEMPLATE(UOFF_T_LONG)
605AH_TEMPLATE(UOFF_T_LONG_LONG)
3376d324 606
871aa6e6 607AC_CONFIG_FILES([
770ae459 608Makefile
770ae459 609src/Makefile
d29ca0b1
TS
610src/core/Makefile
611src/irc/Makefile
612src/irc/core/Makefile
613src/irc/dcc/Makefile
614src/irc/notifylist/Makefile
d5495267 615src/irc/proxy/Makefile
d29ca0b1
TS
616src/irc/flood/Makefile
617src/fe-common/Makefile
618src/fe-common/core/Makefile
619src/fe-common/irc/Makefile
620src/fe-common/irc/dcc/Makefile
d29ca0b1 621src/fe-common/irc/notifylist/Makefile
cf469072 622src/fe-fuzz/Makefile
d29ca0b1
TS
623src/fe-none/Makefile
624src/fe-text/Makefile
770ae459 625src/lib-config/Makefile
d29ca0b1 626src/perl/Makefile
391a419a 627src/perl/common/Makefile.PL
d5495267 628src/perl/irc/Makefile.PL
308c1347 629src/perl/ui/Makefile.PL
0cd57fb2 630src/perl/textui/Makefile.PL
3d690fd3 631scripts/Makefile
0b7ebb6a 632scripts/examples/Makefile
673bd9d7
TS
633docs/Makefile
634docs/help/Makefile
d9f9b64c 635docs/help/in/Makefile
2aa6b6bf 636irssi-config
871aa6e6
EG
637])
638
639AC_OUTPUT
accc66c5 640
f6a284af 641dnl ** for building from objdir
550df275
TS
642old_dir=`pwd` && cd $srcdir && whole_dir=`pwd` && cd $old_dir
643if test "x$old_dir" != "x$whole_dir"; then
0fcfd37b 644 $LN_S $srcdir/irssi-version.h irssi-version.h
550df275
TS
645 if test "x$want_perl" != "xno"; then
646 subdirfiles=""
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
857d2055 648 subdirfiles=`echo $subdirfiles $i/typemap $i/module.h $i/*.pm $i/*.xs`
550df275 649 done
be57a4e3 650 for file in $whole_dir/src/perl/module.h $subdirfiles; do
02419703 651 link=`echo $file|$sedpath "s?$whole_dir/??"`
c5add0e0
TS
652 rm -f $link
653 $LN_S $file $link
7755aae2 654 done
edec3faf
TS
655 fi
656fi
657
accc66c5
TS
658echo
659
9ee48037 660echo "Building text frontend ........... : $want_textui"
dc8bd638
TS
661echo "Building irssi bot ............... : $want_irssibot"
662echo "Building irssi proxy ............. : $want_irssiproxy"
a4acb08a 663if test "x$have_gmodule" = "xyes"; then
dc8bd638 664 echo "Building with module support ..... : yes"
a4acb08a
TS
665else
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."
669fi
02419703 670
5e97ea15 671if test "x$want_perl" = "xstatic"; then
dc8bd638 672 echo "Building with Perl support ....... : static (in irssi binary)"
bac85d3f 673elif test "x$want_perl" = "xmodule"; then
dc8bd638 674 echo "Building with Perl support ....... : module"
5e97ea15 675else
0cd57fb2 676 if test -z "$perl_check_error"; then
dc8bd638 677 echo "Building with Perl support ....... : no"
469fde36 678 else
dc8bd638 679 echo "Building with Perl support ....... : NO!"
469fde36 680 echo " - $perl_check_error"
663bd7ee
DL
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"
685 fi
469fde36 686 fi
5e97ea15
TS
687fi
688
02419703 689if test "x$want_perl" != "xno" -a "x$perl_mod_error" != "x"; then
d304bc65
TS
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"
06127b40
TS
693
694 if test -f /etc/debian_version; then
663bd7ee 695 echo " - Try: sudo apt-get install libperl-dev"
06127b40 696 fi
d304bc65
TS
697fi
698
bac85d3f 699if test "x$want_perl" != "xno"; then
3376d324 700 echo "Perl library directory ........... : ($perl_library_dir - $perl_use_lib)"
64262262
TS
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."
a055127c
TS
706 fi
707fi
dc8bd638 708echo "Install prefix ................... : $prefix"
accc66c5 709
1539cf81
TS
710echo
711
dc8bd638 712echo "Building with 64bit DCC support .. : $offt_64bit"
96a292d4 713echo "Building with true color support.. : $want_truecolor"
f5cbbebc 714echo "Building with GRegex ............. : $want_gregex"
1539cf81 715
0b232291 716echo
b1effeb5 717echo "If there are any problems, read the INSTALL file."