]>
Commit | Line | Data |
---|---|---|
cbb931ed | 1 | AC_INIT(irssi, 1.1-head) |
871aa6e6 | 2 | AC_CONFIG_SRCDIR([src]) |
7dfb77ed | 3 | AC_CONFIG_AUX_DIR(build-aux) |
710fb0c2 | 4 | AC_PREREQ(2.50) |
770ae459 | 5 | |
a0400dc3 | 6 | AC_CONFIG_HEADERS([irssi-config.h]) |
13ea2cb6 | 7 | AC_CONFIG_MACRO_DIR([m4]) |
aefa7b47 | 8 | AM_INIT_AUTOMAKE([1.9 no-define foreign]) |
770ae459 | 9 | |
a66bb95d AF |
10 | AM_SILENT_RULES([yes]) |
11 | ||
770ae459 TS |
12 | AM_MAINTAINER_MODE |
13 | ||
770ae459 TS |
14 | AC_PROG_CC |
15 | AC_PROG_CPP | |
770ae459 TS |
16 | AM_PROG_LIBTOOL |
17 | ||
64262262 TS |
18 | AC_PATH_PROG(sedpath, sed) |
19 | AC_PATH_PROG(perlpath, perl) | |
20 | ||
aa602a00 | 21 | AC_CHECK_HEADERS(unistd.h dirent.h sys/ioctl.h sys/resource.h) |
770ae459 | 22 | |
df10f182 | 23 | # check posix headers.. |
b5a727c8 | 24 | AC_CHECK_HEADERS(sys/socket.h sys/time.h sys/utsname.h) |
11f2accb | 25 | |
47117f1f EG |
26 | AC_SYS_LARGEFILE |
27 | ||
770ae459 TS |
28 | AC_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 | 37 | AC_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 |
46 | AC_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 |
55 | AC_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 | ||
64 | AC_ARG_WITH(fuzzer-lib, | |
65 | [ --with-fuzzer-lib Specify path to fuzzer library], | |
66 | fuzzerlibpath="$withval") | |
67 | ||
d5495267 TS |
68 | AC_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 |
77 | AC_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 | 83 | if 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 |
89 | fi |
90 | ||
ddf1b27c TS |
91 | AC_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 | 102 | AC_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 | 136 | AC_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 |
151 | AC_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 |
160 | AC_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 |
169 | dnl ** |
170 | dnl ** just some generic stuff... | |
171 | dnl ** | |
172 | ||
7423df6a TS |
173 | dnl * OS specific options |
174 | case "$host_os" in | |
175 | hpux*) | |
176 | CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" | |
177 | ;; | |
178 | *) | |
179 | ;; | |
180 | esac | |
181 | ||
bacc22d5 | 182 | |
0d7b3877 | 183 | AC_SEARCH_LIBS([socket], [network socket]) |
bacc22d5 | 184 | |
9af3df4e | 185 | AC_SEARCH_LIBS([inet_addr], [nsl]) |
bacc22d5 TS |
186 | |
187 | dnl * gcc specific options | |
188 | if test "x$ac_cv_prog_gcc" = "xyes"; then | |
189 | CFLAGS="$CFLAGS -Wall" | |
190 | fi | |
191 | ||
1f9ad64e FR |
192 | AC_CHECK_TYPE(socklen_t, , |
193 | [AC_DEFINE([socklen_t], [int], [Define to 'int' if <sys/socket.h> doesn't define.])], [ | |
194 | AC_INCLUDES_DEFAULT | |
195 | #ifdef HAVE_SYS_SOCKET_H | |
196 | # include <sys/socket.h> | |
197 | #endif | |
198 | ]) | |
5fb98c22 | 199 | |
dc8bd638 TS |
200 | AC_CHECK_SIZEOF(int) |
201 | AC_CHECK_SIZEOF(long) | |
202 | AC_CHECK_SIZEOF(long long) | |
710fb0c2 | 203 | AC_CHECK_SIZEOF(off_t) |
dc8bd638 | 204 | |
710fb0c2 | 205 | if test $ac_cv_sizeof_off_t = 8; then |
dc8bd638 TS |
206 | offt_64bit=yes |
207 | else | |
208 | offt_64bit=no | |
209 | fi | |
210 | ||
710fb0c2 | 211 | if 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 | 215 | elif 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 | 219 | elif 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) | |
223 | else | |
224 | AC_ERROR([Couldn't find integer type for off_t]) | |
225 | fi | |
226 | ||
770ae459 TS |
227 | dnl ** |
228 | dnl ** check for socks | |
229 | dnl ** | |
230 | ||
231 | if 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 | ]) | |
244 | fi | |
245 | ||
770ae459 | 246 | dnl ** |
d29ca0b1 | 247 | dnl ** fe-text checks |
770ae459 TS |
248 | dnl ** |
249 | ||
afa42924 EG |
250 | for 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 |
265 | done |
266 | ||
267 | if 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 | 285 | fi |
770ae459 | 286 | |
a720c3b5 RR |
287 | LIBS="$LIBS $GLIB_LIBS" |
288 | ||
289 | dnl ** | |
290 | dnl ** OpenSSL checks | |
291 | dnl ** | |
292 | PKG_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 |
303 | dnl ** |
304 | dnl ** curses checks | |
305 | dnl ** | |
306 | ||
9ee48037 | 307 | if 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 | 320 | fi |
770ae459 | 321 | |
cf469072 JB |
322 | dnl ** |
323 | dnl ** irssifuzzer checks | |
324 | dnl ** | |
325 | ||
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" | |
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 | |
344 | fi | |
345 | ||
d304bc65 TS |
346 | dnl ** |
347 | dnl ** perl checks | |
348 | dnl ** | |
349 | ||
5e97ea15 | 350 | if 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 |
500 | fi |
501 | ||
4d584944 | 502 | dnl ** check what we want to build |
accc66c5 TS |
503 | AM_CONDITIONAL(BUILD_TEXTUI, test "$want_textui" = "yes") |
504 | AM_CONDITIONAL(BUILD_IRSSIBOT, test "$want_irssibot" = "yes") | |
cf469072 | 505 | AM_CONDITIONAL(BUILD_IRSSIFUZZER, test "$want_irssifuzzer" = "yes") |
d5495267 | 506 | AM_CONDITIONAL(BUILD_IRSSIPROXY, test "$want_irssiproxy" = "yes") |
5e97ea15 | 507 | AM_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 |
510 | PROG_LIBS=$LIBS | |
511 | LIBS= | |
512 | AC_SUBST(PROG_LIBS) | |
513 | ||
d29ca0b1 TS |
514 | dnl ** |
515 | dnl ** Keep all the libraries here so each frontend doesn't need to | |
516 | dnl ** keep track of them all | |
517 | dnl ** | |
93d60321 TS |
518 | dnl ** (these could be made configurable) |
519 | ||
c866a4e2 | 520 | CHAT_MODULES="irc" |
93d60321 | 521 | irc_MODULES="dcc flood notifylist" |
0cd57fb2 | 522 | if test -n "$build_modules"; then |
93173356 TS |
523 | irc_MODULES="$irc_MODULES $build_modules" |
524 | fi | |
d29ca0b1 | 525 | |
93d60321 TS |
526 | dnl **************************************** |
527 | ||
528 | AC_SUBST(CHAT_MODULES) | |
529 | AC_SUBST(irc_MODULES) | |
530 | ||
ab8da71d | 531 | CORE_LIBS="../core/libcore.a ../lib-config/libirssi_config.a" |
2d1ac305 | 532 | FE_COMMON_LIBS="" |
93d60321 TS |
533 | |
534 | CHAT_LIBS="" | |
535 | for 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 | 577 | done |
d29ca0b1 | 578 | |
2d1ac305 TS |
579 | FE_COMMON_LIBS="$FE_COMMON_LIBS../fe-common/core/libfe_common_core.a" |
580 | ||
d29ca0b1 | 581 | dnl ** common libraries needed by frontends |
a38227e0 | 582 | COMMON_NOUI_LIBS="$CHAT_LIBS $CORE_LIBS" |
66f9ea86 | 583 | COMMON_LIBS="$FE_COMMON_LIBS $COMMON_NOUI_LIBS" |
93d60321 | 584 | AC_SUBST(COMMON_NOUI_LIBS) |
d29ca0b1 TS |
585 | AC_SUBST(COMMON_LIBS) |
586 | ||
9ee48037 | 587 | if test "x$want_truecolor" = "xyes"; then |
96a292d4 AN |
588 | AC_DEFINE([TERM_TRUECOLOR], [], [true color support in terminal]) |
589 | else | |
590 | want_truecolor=no | |
591 | fi | |
592 | ||
f5cbbebc AN |
593 | if test "x$want_gregex" = "xyes"; then |
594 | AC_DEFINE([USE_GREGEX], [], [use GRegex for regular expressions]) | |
595 | else | |
596 | want_gregex=no | |
597 | fi | |
598 | ||
3376d324 | 599 | AH_TEMPLATE(HAVE_GMODULE) |
3376d324 | 600 | AH_TEMPLATE(HAVE_SOCKS_H, [misc..]) |
601 | AH_TEMPLATE(HAVE_STATIC_PERL) | |
3376d324 | 602 | AH_TEMPLATE(PRIuUOFF_T, [printf()-format for uoff_t, eg. "u" or "lu" or "llu"]) |
3376d324 | 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) | |
3376d324 | 606 | |
871aa6e6 | 607 | AC_CONFIG_FILES([ |
770ae459 | 608 | Makefile |
770ae459 | 609 | src/Makefile |
d29ca0b1 TS |
610 | src/core/Makefile |
611 | src/irc/Makefile | |
612 | src/irc/core/Makefile | |
613 | src/irc/dcc/Makefile | |
614 | src/irc/notifylist/Makefile | |
d5495267 | 615 | src/irc/proxy/Makefile |
d29ca0b1 TS |
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 | |
d29ca0b1 | 621 | src/fe-common/irc/notifylist/Makefile |
cf469072 | 622 | src/fe-fuzz/Makefile |
d29ca0b1 TS |
623 | src/fe-none/Makefile |
624 | src/fe-text/Makefile | |
770ae459 | 625 | src/lib-config/Makefile |
d29ca0b1 | 626 | src/perl/Makefile |
391a419a | 627 | src/perl/common/Makefile.PL |
d5495267 | 628 | src/perl/irc/Makefile.PL |
308c1347 | 629 | src/perl/ui/Makefile.PL |
0cd57fb2 | 630 | src/perl/textui/Makefile.PL |
3d690fd3 | 631 | scripts/Makefile |
0b7ebb6a | 632 | scripts/examples/Makefile |
673bd9d7 TS |
633 | docs/Makefile |
634 | docs/help/Makefile | |
d9f9b64c | 635 | docs/help/in/Makefile |
2aa6b6bf | 636 | irssi-config |
871aa6e6 EG |
637 | ]) |
638 | ||
639 | AC_OUTPUT | |
accc66c5 | 640 | |
f6a284af | 641 | dnl ** for building from objdir |
550df275 TS |
642 | old_dir=`pwd` && cd $srcdir && whole_dir=`pwd` && cd $old_dir |
643 | if 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 |
656 | fi | |
657 | ||
accc66c5 TS |
658 | echo |
659 | ||
9ee48037 | 660 | echo "Building text frontend ........... : $want_textui" |
dc8bd638 TS |
661 | echo "Building irssi bot ............... : $want_irssibot" |
662 | echo "Building irssi proxy ............. : $want_irssiproxy" | |
a4acb08a | 663 | if test "x$have_gmodule" = "xyes"; then |
dc8bd638 | 664 | echo "Building with module support ..... : yes" |
a4acb08a TS |
665 | else |
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." | |
669 | fi | |
02419703 | 670 | |
5e97ea15 | 671 | if test "x$want_perl" = "xstatic"; then |
dc8bd638 | 672 | echo "Building with Perl support ....... : static (in irssi binary)" |
bac85d3f | 673 | elif test "x$want_perl" = "xmodule"; then |
dc8bd638 | 674 | echo "Building with Perl support ....... : module" |
5e97ea15 | 675 | else |
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 |
687 | fi |
688 | ||
02419703 | 689 | if 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 |
697 | fi |
698 | ||
bac85d3f | 699 | if 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 |
707 | fi | |
dc8bd638 | 708 | echo "Install prefix ................... : $prefix" |
accc66c5 | 709 | |
1539cf81 TS |
710 | echo |
711 | ||
dc8bd638 | 712 | echo "Building with 64bit DCC support .. : $offt_64bit" |
96a292d4 | 713 | echo "Building with true color support.. : $want_truecolor" |
f5cbbebc | 714 | echo "Building with GRegex ............. : $want_gregex" |
1539cf81 | 715 | |
0b232291 | 716 | echo |
b1effeb5 | 717 | echo "If there are any problems, read the INSTALL file." |