Merge Irssi 0.8.16-rc1
[silc.git] / apps / irssi / configure.in
1 AC_INIT(SILC-Client, 0.8.16-rc1)
2 AC_CONFIG_SRCDIR([src])
3 AC_CONFIG_AUX_DIR(build-aux)
4 AC_PREREQ(2.50)
5
6 AC_CONFIG_HEADERS([irssi-config.h])
7 AM_INIT_AUTOMAKE([1.9 no-define foreign])
8
9 AM_MAINTAINER_MODE
10
11 AC_ISC_POSIX
12 AC_PROG_CC
13 AC_PROG_CPP
14 AM_PROG_LIBTOOL
15
16 AC_PATH_PROG(sedpath, sed)
17 AC_PATH_PROG(perlpath, perl)
18
19 AC_CHECK_HEADERS(unistd.h dirent.h sys/ioctl.h sys/resource.h)
20
21 # check posix headers..
22 AC_CHECK_HEADERS(sys/time.h sys/utsname.h regex.h)
23
24 AC_SYS_LARGEFILE
25
26 AC_ARG_WITH(socks,
27 [  --with-socks            Build with socks support],
28         if test x$withval = xno; then
29                 want_socks=no
30         else
31                 want_socks=yes
32         fi,
33         want_socks=no)
34
35 AC_ARG_WITH(textui,
36 [  --without-textui        Build without text frontend],
37         if test x$withval = xno; then
38                 want_textui=no
39         else
40                 want_textui=yes
41         fi,
42         want_textui=yes)
43
44 AC_ARG_WITH(bot,
45 [  --with-bot              Build irssi-bot],
46         if test x$withval = xno; then
47                 want_irssibot=no
48         else
49                 want_irssibot=yes
50         fi,
51         want_irssibot=no)
52
53 AC_ARG_WITH(proxy,
54 [  --with-proxy            Build irssi-proxy],
55         if test x$withval = xno; then
56                 want_irssiproxy=no
57         else
58                 want_irssiproxy=yes
59         fi,
60         want_irssiproxy=no)
61
62 AC_ARG_WITH(terminfo,
63 [  --without-terminfo      Use curses backend instead of terminfo],
64         if test x$withval = xno; then
65                 want_terminfo=no
66         else
67                 want_terminfo=yes
68         fi,
69         want_terminfo=yes)
70
71 AC_ARG_WITH(modules,
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"
75         fi)
76
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"
81         perl_set_use_lib=yes
82
83         perl_prefix_note=yes
84 fi
85
86 AC_ARG_WITH(gc,
87 [  --with-gc               Use garbage collector],
88         if test x$withval = xno; then
89                 want_gc=no
90         else
91                 want_gc=yes
92         fi,
93         want_gc=no)
94
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
99                 want_staticperllib=no
100         else
101                 want_staticperllib=yes
102         fi,
103         want_staticperllib=no)
104
105
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
110                 want_perl=yes
111         elif test "x$withval" = xno; then
112                 want_perl=no
113         elif test "x$withval" = xsite; then
114                 want_perl=yes
115                 perl_prefix_note=no
116                 PERL_MM_PARAMS=""
117         elif test "x$withval" = xvendor; then
118                 want_perl=yes
119                 perl_prefix_note=no
120                 if test -z "`$perlpath -v|grep '5\.0'`"; then
121                         PERL_MM_PARAMS="INSTALLDIRS=vendor"
122                 else
123                         PERL_MM_PARAMS="INSTALLDIRS=perl PREFIX=`perl -e 'use Config; print $Config{prefix}'`"
124                 fi
125                 perl_library_dir="(vendor default - `$perlpath -e 'use Config; print $Config{archlib}'`)"
126         else
127                 want_perl=yes
128                 perl_prefix_note=no
129                 PERL_MM_PARAMS="INSTALLDIRS=perl LIB=$withval"
130                 perl_library_dir="PERL_USE_LIB"
131                 perl_set_use_lib=yes
132         fi,
133         want_perl=yes)
134
135 AC_ARG_WITH(perl,
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
140                 want_perl=static
141         elif test x$withval = xstatic; then
142                 want_perl=static
143         elif test x$withval = xmodule; then
144                 want_perl=module
145         else
146                 want_perl=no
147         fi,
148         want_perl=static)
149
150 # Irssi SILC Plugin support
151 #
152 SILC_IRSSIDIR=
153 silc_plugin=false
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]]],
158   [
159     case "${withval}" in
160       no)
161         AC_MSG_RESULT(no)
162         silc_plugin=false
163         ;;
164       yes)
165         AC_MSG_RESULT(yes)
166         silc_plugin=true
167         SILC_IRSSIDIR="/usr/lib/irssi/modules"
168        ;;
169       *)
170         AC_MSG_RESULT(yes)
171         silc_plugin=true
172         SILC_IRSSIDIR="$withval/modules"
173         ;;
174     esac
175   ])
176
177 AM_CONDITIONAL(SILCPLUGIN, test x$silc_plugin = xtrue)
178 AC_SUBST(SILC_IRSSIDIR)
179
180 AC_ARG_ENABLE(ipv6,
181 [  --disable-ipv6          Disable IPv6 support],
182         if test x$enableval = xno; then
183                 want_ipv6=no
184         else
185                 want_ipv6=yes
186         fi,
187         want_ipv6=yes)
188
189 AC_ARG_ENABLE(dane,
190 [  --enable-dane           Enable DANE support],
191         if test x$enableval = xno ; then
192                 want_dane=no
193         else
194                 want_dane=yes
195         fi,
196         want_dane=no)
197
198 dnl **
199 dnl ** SSL Library checks (OpenSSL)
200 dnl **
201
202 AC_ARG_ENABLE(ssl,
203 [  --disable-ssl           Disable Secure Sockets Layer support],,
204         enable_ssl=yes)
205
206 dnl **
207 dnl ** just some generic stuff...
208 dnl **
209
210 dnl * OS specific options
211 case "$host_os" in
212   hpux*)
213     CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
214     ;;
215   *)
216     ;;
217 esac
218
219
220 AC_CHECK_FUNC(socket, [], [
221         AC_CHECK_LIB(socket, socket, [
222                 LIBS="$LIBS -lsocket"
223         ])
224 ])
225
226 AC_CHECK_FUNC(inet_addr, [], [
227         AC_CHECK_LIB(nsl, inet_addr, [
228                 LIBS="$LIBS -lnsl"
229         ])
230 ])
231
232 dnl * gcc specific options
233 if test "x$ac_cv_prog_gcc" = "xyes"; then
234   CFLAGS="$CFLAGS -Wall -Wno-deprecated-declarations"
235 fi
236
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,
241 [AC_TRY_COMPILE([
242 #include <sys/types.h>
243 #include <sys/socket.h>],
244 [socklen_t t;],
245 irssi_cv_type_socklen_t=yes,
246 irssi_cv_type_socklen_t=no,
247 )])
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.)
250 fi
251 AC_MSG_RESULT($irssi_cv_type_socklen_t)
252
253 AC_CHECK_SIZEOF(int)
254 AC_CHECK_SIZEOF(long)
255 AC_CHECK_SIZEOF(long long)
256 AC_CHECK_SIZEOF(off_t)
257
258 if test $ac_cv_sizeof_off_t = 8; then
259   offt_64bit=yes
260 else
261   offt_64bit=no
262 fi
263
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
269   # next try int
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)
276 else
277   AC_ERROR([Couldn't find integer type for off_t])
278 fi
279
280 dnl **
281 dnl ** check for socks
282 dnl **
283
284 if test "x$want_socks" = "xyes"; then
285         AC_CHECK_LIB(socks, connect, [
286                 AC_DEFINE(HAVE_SOCKS,, Build with socks support)
287                 LIBS="$LIBS -lsocks"
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"])
292                 ], [
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"
295                 ])
296         ])
297 fi
298
299 dnl **
300 dnl ** fe-text checks
301 dnl **
302
303 for try in 1 2; do
304   if test $try = 1; then
305     glib_modules=gmodule
306   else
307     echo "*** trying without -lgmodule"
308     glib_modules=
309   fi
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)
314       have_gmodule=yes
315     fi
316     break
317   fi
318 done
319
320 if test -z "$GLIB_LIBS"; then
321   echo
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"
326   echo
327
328   AC_ERROR([GLIB is required to build irssi.])
329 fi
330
331 LIBS="$LIBS $GLIB_LIBS"
332
333 have_openssl=no
334 if test "$enable_ssl" = "yes"; then
335   PKG_CHECK_MODULES(SSL, openssl, :, :)
336   if test "$SSL_LIBS"; then
337     CFLAGS="$CFLAGS $SSL_CFLAGS"
338     have_openssl=yes
339   else
340     AC_CHECK_LIB(ssl, SSL_read, [
341       AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h, [
342         SSL_LIBS="-lssl -lcrypto"
343         have_openssl=yes
344       ])
345     ],, -lcrypto)
346   fi
347   if test "$have_openssl" = "yes"; then
348     AC_DEFINE(HAVE_OPENSSL,, Build with OpenSSL support)
349     LIBS="$LIBS $SSL_LIBS"
350   fi
351 fi
352
353 dnl **
354 dnl ** Garbage Collector
355 dnl **
356 have_gc=no
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)
361       AC_DEFINE(USE_GC)
362       LIBS="$LIBS -lgc"
363       have_gc=yes
364     ], [
365       AC_CHECK_HEADER(gc.h, [
366         AC_DEFINE(HAVE_GC_H)
367         AC_DEFINE(USE_GC)
368         LIBS="$LIBS -lgc"
369         have_gc=yes
370       ])
371     ])
372   ])
373 fi
374
375 dnl **
376 dnl ** curses checks
377 dnl **
378
379 if test "x$want_textui" = "xyes"; then
380         AC_CHECK_CURSES
381
382         TEXTUI_LIBS="$CURSES_LIBS"
383         if test "x$has_curses" = "xtrue"; then
384                 old_libs=$LIBS
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))
391                 fi
392                 AC_CHECK_FUNC(setupterm,, [
393                         want_termcap=yes
394                 ])
395                 LIBS=$old_libs
396         else
397                 AC_CHECK_LIB(tinfo, setupterm, [
398                   TEXTUI_LIBS="-ltinfo"
399                   want_terminfo=yes
400                 ], AC_CHECK_LIB(termlib, tgetent, [
401                   TEXTUI_LIBS="-ltermlib"
402                   want_termcap=yes
403                 ], AC_CHECK_LIB(termcap, tgetent, [
404                   TEXTUI_LIBS="-ltermcap"
405                   want_termcap=yes
406                 ], [
407                   AC_ERROR(Terminfo/termcap not found - install ncurses-devel package)
408                   want_textui=no
409                 ])))
410         fi
411         AC_SUBST(TEXTUI_LIBS)
412
413         if test "x$want_termcap" = "xyes"; then
414                 AC_CHECK_FUNC(tparm,, need_tparm=yes)
415         else
416                 AC_DEFINE(HAVE_TERMINFO)
417         fi
418 fi
419
420 dnl **
421 dnl ** perl checks
422 dnl **
423
424 if test "$want_perl" != "no"; then
425         AC_MSG_CHECKING(for working Perl support)
426
427         if test -z "$perlpath"; then
428                 perl_check_error="perl binary not found"
429         else
430                 PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null`
431         fi
432
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'`
441
442                 PERL_EXTRA_OPTS="CCCDLFLAGS=\"-fPIC\""
443                 AC_SUBST(PERL_EXTRA_OPTS)
444         fi
445
446         if test -z "$PERL_CFLAGS"; then
447                 if test -n "$perl_check_error"; then
448                         perl_check_error="Error getting perl CFLAGS"
449                 fi
450                 AC_MSG_RESULT([not found, building without Perl])
451                 want_perl=no
452         else
453                 PERL_LDFLAGS=`$perlpath -MExtUtils::Embed -e ldopts 2>/dev/null`
454
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$//"`
461                 done
462
463                 case "$host_os" in
464                   linux*)
465                     PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath -e 's/-lposix //' -e 's/-lposix$//'`
466                     ;;
467                   hpux*)
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$//'`
471                     fi
472                     ;;
473                   *)
474                     ;;
475                 esac
476
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])
483                         want_perl=no
484                 fi
485
486                 rm -f perl.error.tmp
487         fi
488
489         if test "x$want_perl" != "xno"; then
490                 AC_MSG_RESULT(ok)
491
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"
498                         PERL_LDFLAGS=
499                         AC_DEFINE(HAVE_STATIC_PERL)
500
501                         dnl * build only static library of perl module
502                         perl_module_lib=
503                         perl_module_fe_lib=
504                         perl_static_lib=libperl_core_static.la
505                         perl_static_fe_lib=libfe_perl_static.la
506                 else
507                         dnl * build dynamic library of perl module
508                         perl_module_lib=libperl_core.la
509                         perl_module_fe_lib=libfe_perl.la
510                         perl_static_lib=
511                         perl_static_fe_lib=
512                 fi
513
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"
517                         PERL_STATIC_LIBS=1
518                 else
519                         PERL_STATIC_LIBS=0
520                 fi
521
522                 # figure out the correct @INC path - we'll need to do this
523                 # through MakeMaker since it's difficult to get it right
524                 # otherwise.
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;'`
528                         rm -f Makefile.test
529                 fi
530
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)
535
536                 AC_SUBST(PERL_LINK_FLAGS)
537                 AC_SUBST(PERL_LINK_LIBS)
538                 AC_SUBST(PERL_FE_LINK_LIBS)
539
540                 AC_SUBST(PERL_LDFLAGS)
541                 AC_SUBST(PERL_CFLAGS)
542
543                 AC_SUBST(PERL_USE_LIB)
544                 AC_SUBST(PERL_MM_PARAMS)
545                 AC_SUBST(PERL_STATIC_LIBS)
546         fi
547 fi
548
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")
556
557 # move LIBS to PROG_LIBS so they're not tried to be used when linking eg. perl libraries
558 PROG_LIBS=$LIBS
559 LIBS=
560 AC_SUBST(PROG_LIBS)
561
562 dnl **
563 dnl ** Keep all the libraries here so each frontend doesn't need to
564 dnl ** keep track of them all
565 dnl **
566 dnl ** (these could be made configurable)
567
568 CHAT_MODULES="silc"
569 silc_MODULES=""
570 if test -n "$build_modules"; then
571         silc_MODULES="$silc_MODULES $build_modules"
572 fi
573
574 dnl ****************************************
575
576 AC_SUBST(CHAT_MODULES)
577 AC_SUBST(silc_MODULES)
578
579 CORE_LIBS="../core/libcore.a ../lib-config/libirssi_config.a"
580 FE_COMMON_LIBS=""
581
582 CHAT_LIBS=""
583 for c in $CHAT_MODULES; do
584         module_inits=""
585         module_deinits=""
586         fe_module_inits=""
587         fe_module_deinits=""
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 "
591         fi
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"
600                 fi
601         done
602
603         mkdir -p src/$c
604         file="src/$c/$c.c"
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
610         fi
611         echo "void ${c}_init(void) { ${c}_core_init(); $module_inits }" >> $file
612         echo "void ${c}_deinit(void) { $module_deinits ${c}_core_deinit(); }" >> $file
613
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
621                 fi
622                 echo "void fe_${c}_modules_init(void) { $fe_module_inits }" >> $file
623                 echo "void fe_${c}_modules_deinit(void) { $fe_module_deinits }" >> $file
624         fi
625 done
626
627 FE_COMMON_LIBS="$FE_COMMON_LIBS../fe-common/core/libfe_common_core.a"
628
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)
634
635 dnl **
636 dnl ** IPv6 support
637 dnl **
638
639 have_ipv6=no
640 if test "x$want_ipv6" = "xyes"; then
641         AC_MSG_CHECKING([for IPv6])
642         AC_CACHE_VAL(irssi_cv_type_in6_addr,
643         [AC_TRY_COMPILE([
644         #include <sys/types.h>
645         #include <sys/socket.h>
646         #include <netinet/in.h>
647         #include <netdb.h>
648         #include <arpa/inet.h>],
649         [struct in6_addr i;],
650         have_ipv6=yes,
651         )])
652         if test $have_ipv6 = yes; then
653                 AC_DEFINE(HAVE_IPV6)
654         fi
655         AC_MSG_RESULT($have_ipv6)
656 fi
657
658 if test "x$want_dane" = "xyes"; then
659         AC_MSG_CHECKING([for DANE])
660         AC_CHECK_LIB(val-threads, val_getdaneinfo,
661         [
662                 LIBS="$LIBS -lval-threads -lsres"
663                 AC_DEFINE([HAVE_DANE], [], [DANE support])
664                 have_dane=yes
665         ], [], [-lssl -lcrypto -lsres -lpthread])
666
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.])
670                 fi
671         fi
672 fi
673
674 #
675 # Glue into SILC build system
676 #
677 INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
678 AC_SUBST(INCLUDE_DEFINES_INT)
679
680 AC_CONFIG_FILES([
681 Makefile
682 src/Makefile
683 src/core/Makefile
684 src/fe-common/Makefile
685 src/fe-common/core/Makefile
686 src/fe-common/silc/Makefile
687 src/fe-text/Makefile
688 src/lib-config/Makefile
689 src/silc/Makefile
690 src/silc/core/Makefile
691 src/perl/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
696 scripts/Makefile
697 scripts/examples/Makefile
698 docs/Makefile
699 docs/help/Makefile
700 docs/help/in/Makefile
701 irssi-version.h
702 irssi-config
703 ])
704
705 AC_OUTPUT
706
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
711                 subdirfiles=""
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`
714                 done
715                 for file in $whole_dir/src/perl/module.h $subdirfiles; do
716                         link=`echo $file|$sedpath "s?$whole_dir/??"`
717                         rm -f $link
718                         $LN_S $file $link
719                 done
720         fi
721 fi
722
723 echo
724
725 if test "x$want_textui" = "xno"; then
726         text=no
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"
731 else
732         text="yes, using curses"
733 fi
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"
739 else
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."
743 fi
744
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"
749 else
750         if test -z "$perl_check_error"; then
751                 echo "Building with Perl support ....... : no"
752         else
753                 echo "Building with Perl support ....... : NO!"
754                 echo " - $perl_check_error"
755         fi
756 fi
757
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"
762
763         if test -f /etc/debian_version; then
764                 echo " - Try: apt-get install libperl-dev"
765         fi
766 fi
767
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
771         fi
772         if test -z "$perl_library_dir"; then
773                 perl_library_dir="(site default - `$perlpath -e 'use Config; print $Config{sitearch}'`)"
774         fi
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."
781         fi
782 fi
783 echo "Install prefix ................... : $prefix"
784
785 echo
786
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"
792
793 echo
794 echo "If there are any problems, read the INSTALL file."