imported irssi.
[silc.git] / apps / irssi / configure.in
1 AC_INIT(src)
2
3 AM_CONFIG_HEADER(config.h)
4 AM_INIT_AUTOMAKE(Irssi SILC, 0.7.98.3)
5
6 AM_MAINTAINER_MODE
7
8 AC_ISC_POSIX
9 AC_PROG_CC
10 AC_PROG_CPP
11 AC_STDC_HEADERS
12 AC_ARG_PROGRAM
13 AM_PROG_LIBTOOL
14
15 dnl * ahem.. :) we don't want static libraries for modules
16 if test "x$lt_target" = "x"; then
17         if test "$target" = "NONE"; then
18                 lt_target="$host"
19         else
20                 lt_target="$target"
21         fi
22 fi
23 dnl * --disable-static isn't a good idea, complain if it's used
24 if test "x$enable_static" = "xno"; then
25         AC_ERROR([Don't give --disable-static option to configure])
26 fi
27
28 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
29 $libtool_flags --disable-static --output=libtool-shared --no-verify $ac_aux_dir/ltmain.sh $lt_target \
30 || { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
31 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
32 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
33 || { echo "configure: error: libtool configure failed" 1>&2; exit 1; }
34
35 AC_CHECK_HEADERS(string.h stdlib.h unistd.h dirent.h sys/ioctl.h libintl.h)
36
37 # check posix headers..
38 AC_CHECK_HEADERS(sys/time.h sys/utsname.h regex.h)
39
40 AC_ARG_WITH(big5,
41 [  --with-big5             Build with tr-Chinese Big5 support],
42         if test x$withval = xyes; then
43                 want_big5=yes
44         else
45                 if test "x$withval" = xno; then
46                         want_big5=no
47                 else
48                         want_big5=yes
49                 fi
50         fi,
51         want_big5=no)
52
53 AC_ARG_WITH(socks,
54 [  --with-socks            Build with socks support],
55         if test x$withval = xyes; then
56                 want_socks=yes
57         else
58                 if test "x$withval" = xno; then
59                         want_socks=no
60                 else
61                         want_socks=yes
62                 fi
63         fi,
64         want_socks=no)
65
66 AC_ARG_WITH(textui,
67 [  --with-textui           Build text frontend],
68         if test x$withval = xyes; then
69                 want_textui=yes
70         else
71                 if test "x$withval" = xno; then
72                         want_textui=no
73                 else
74                         want_textui=yes
75                 fi
76         fi,
77         want_textui=yes)
78
79 AC_ARG_WITH(bot,
80 [  --with-bot              Build irssi-bot],
81         if test x$withval = xyes; then
82                 want_irssibot=yes
83         else
84                 if test "x$withval" = xno; then
85                         want_irssibot=no
86                 else
87                         want_irssibot=yes
88                 fi
89         fi,
90         want_irssibot=no)
91
92 AC_ARG_WITH(proxy,
93 [  --with-proxy            Build irssi-proxy],
94         if test x$withval = xyes; then
95                 want_irssiproxy=yes
96         else
97                 if test "x$withval" = xno; then
98                         want_irssiproxy=no
99                 else
100                         want_irssiproxy=yes
101                 fi
102         fi,
103         want_irssiproxy=no)
104
105
106 AC_ARG_WITH(modules,
107 [  --with-modules          Specify what modules to build in binary],
108         if test x$withval != xyes -a x$withval != xno; then
109                 build_modules="$withval"
110         fi)
111
112 if test "x$prefix" = "xNONE"; then
113         PERL_LIB_DIR=""
114 else
115         PERL_LIB_DIR="$prefix"
116 fi
117
118 AC_ARG_ENABLE(perl-path,
119 [  --enable-perl-path=dir  Specify where to install the Perl libraries for irssi],
120         if test x$enableval = xyes; then
121                 want_perl=yes
122         else
123                 if test "x$enableval" = xno; then
124                         want_perl=no
125                 else
126                         want_perl=yes
127                         PERL_LIB_DIR="$enableval"
128                         perl_lib_dir_given=yes
129                 fi
130         fi,
131         want_perl=yes)
132
133 AC_ARG_ENABLE(perl,
134 [  --enable-perl[=yes|no|static]  Build with Perl support - also specifies
135                           if it should be built into main irssi binary
136                           (static) or as module (default)],
137         if test x$enableval = xyes; then
138                 want_perl=yes
139         elif test x$enableval = xstatic; then
140                 want_perl=static
141         else
142                 want_perl=no
143         fi,
144         want_perl=yes)
145
146 AC_ARG_WITH(tests,
147 [  --with-tests           Run all the tests],
148         if test x$withval != xno; then
149                 TEST_DIR=test
150         fi,
151         TEST_DIR=)
152 AC_SUBST(TEST_DIR)
153
154 AC_ARG_ENABLE(curses-windows,
155 [  --enable-curses-windows Use curses windows],
156         if test x$enableval != xno; then
157                 AC_DEFINE(USE_CURSES_WINDOWS)
158         fi,
159         AC_DEFINE(USE_CURSES_WINDOWS))
160
161 AC_ARG_ENABLE(memdebug,
162 [  --enable-memdebug       Enable memory debugging],
163         if test x$enableval = xyes; then
164                 want_memdebug=yes
165         else
166                 if test "x$enableval" = xno; then
167                         want_memdebug=no
168                 else
169                         want_memdebug=yes
170                 fi
171         fi,
172         want_memdebug=no)
173
174 AC_ARG_ENABLE(ipv6,
175 [  --enable-ipv6           Enable IPv6 support],
176         if test x$enableval = xyes; then
177                 want_ipv6=yes
178         else
179                 if test "x$enableval" = xno; then
180                         want_ipv6=no
181                 else
182                         want_ipv6=yes
183                 fi
184         fi,
185         want_ipv6=no)
186
187 dnl **
188 dnl ** just some generic stuff...
189 dnl **
190
191 AC_CHECK_FUNCS(mkfifo fcntl)
192
193 AC_CHECK_LIB(socket, socket, [
194         PROG_LIBS="$PROG_LIBS -lsocket"
195 ])
196
197 AC_CHECK_LIB(nsl, inet_addr, [
198         PROG_LIBS="$PROG_LIBS -lnsl"
199 ], -lsocket)
200
201 dnl * gcc specific options
202 if test "x$ac_cv_prog_gcc" = "xyes"; then
203   CFLAGS="$CFLAGS -Wall"
204 fi
205
206 dnl * OS specific options
207 case "$host_os" in
208   hpux*)
209     CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
210     ;;
211   *)
212     ;;
213 esac
214
215 dnl * socklen_t - AC_CHECK_TYPE() would be _really_ useful if it only would
216 dnl * accept header files where to find the typedef..
217 AC_MSG_CHECKING([for socklen_t])
218 AC_CACHE_VAL(irssi_cv_type_socklen_t,
219 [AC_TRY_COMPILE([
220 #include <sys/types.h>
221 #include <sys/socket.h>],
222 [socklen_t t;],
223 irssi_cv_type_socklen_t=yes,
224 irssi_cv_type_socklen_t=no,
225 )])
226 if test $irssi_cv_type_socklen_t = no; then
227 AC_DEFINE(socklen_t, int, Define to 'int' if <sys/socket.h> doesn't define.)
228 fi
229 AC_MSG_RESULT($irssi_cv_type_socklen_t)
230
231 dnl **
232 dnl ** check for socks
233 dnl **
234
235 if test "x$want_socks" = "xyes"; then
236         AC_CHECK_LIB(socks, connect, [
237                 PROG_LIBS="$PROG_LIBS -lsocks"
238                 AC_CHECK_HEADER(socks.h, [
239                         AC_DEFINE(HAVE_SOCKS_H)
240                         CFLAGS="$CFLAGS -DSOCKS"
241                         AC_MSG_RESULT(["socks5 library found, building with it"])
242                 ], [
243                         AC_MSG_RESULT(["socks4 library found, building with it"])
244                         CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dgetpeername=Rgetpeername -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
245                 ])
246         ])
247 fi
248
249 dnl **
250 dnl ** fe-text checks
251 dnl **
252
253 AC_PATH_PROG(sedpath, sed)
254
255 AC_DEFUN(AC_CHECK_GLIBDIR,[
256   AC_MSG_CHECKING([whether GLib is unpacked to irssi dir])
257
258   GLIB_DIR=`for d in *; do test -f $d/glib.h && echo $d; done`
259   if test "x$GLIB_DIR" != "x"; then
260     dnl * glib in irssi directory, use it
261     AC_MSG_RESULT([yes, using it])
262
263     dnl * we have to do this at this point so we know what libs gmodule needs
264     if test ! -f $GLIB_DIR/.libs/libglib.a; then
265       echo
266       echo "configuring GLib ..."
267       echo
268       cd $GLIB_DIR
269       if test ! -f glib-config; then
270         ./configure
271       fi
272       ${MAKE-make}
273       cd ..
274       echo
275     fi
276
277     GLIB_LDEXTRA=`$GLIB_DIR/glib-config --libs gmodule|$sedpath -e 's/-lglib//' -e 's/-lgmodule//' -e 's,-L/usr/local/lib ,,'|$sedpath 's/ \+/ /g'`
278     full_glib_dir="`pwd`/$GLIB_DIR"
279     GLIB_CFLAGS="-I$full_glib_dir -I$full_glib_dir/gmodule"
280     if test -f $full_glib_dir/.libs/libglib.a; then
281       GLIB_LIBS="$full_glib_dir/.libs/libglib.a $GLIB_LDEXTRA"
282       if test -f $full_glib_dir/gmodule/.libs/libgmodule.a; then
283         GLIB_LIBS="$GLIB_LIBS $full_glib_dir/gmodule/.libs/libgmodule.a"
284         AC_DEFINE(HAVE_GMODULE)
285       fi
286     else
287       GLIB_LIBS="$full_glib_dir/libglib.a $GLIB_LDEXTRA"
288       if test -f $full_glib_dir/gmodule/libgmodule.a; then
289         GLIB_LIBS="$GLIB_LIBS $full_glib_dir/gmodule/libgmodule.a"
290         AC_DEFINE(HAVE_GMODULE)
291       fi
292     fi
293     AC_SUBST(GLIB_CFLAGS)
294     AC_SUBST(GLIB_LIBS)
295   else
296     AC_MSG_RESULT([no])
297   fi
298 ])
299
300 AC_CHECK_GLIBDIR
301
302 if test "x$GLIB_DIR" = "x"; then
303   AM_PATH_GLIB(1.2.0,,, gmodule)
304   if test "x$GLIB_LIBS" = "x"; then
305     echo "*** trying without -lgmodule"
306     glib_config_args=
307     AM_PATH_GLIB(1.2.0)
308   else
309     AC_DEFINE(HAVE_GMODULE)
310   fi
311
312   if test "x$GLIB_LIBS" = "x"; then
313     echo
314     echo "*** If you don't have GLIB, you can get it from ftp://ftp.gtk.org"
315     echo "*** If you can't install GLIB anywhere or if you don't want to,"
316     echo "*** you can just unpack it to Irssi's source directory and"
317     echo "*** Irssi will automatically compile and use it."
318     echo
319
320     dnl * I think it's pretty safe to assume GLib 1.2.9 since the next
321     dnl * will be 2.0 (or 1.4?) and it's not sure if irssi compiles
322     dnl * with it (yea, just a few weeks after I put this text for 1.2.8
323     dnl * the 1.2.9 came :) .. and then .10
324     glib_file=glib-1.2.10.tar.gz
325
326     dlcmd=
327     if test "x`ncftpget 2>/dev/null|grep -i ncftp`" != "x"; then
328       dlcmd="ncftpget ftp://ftp.gtk.org/pub/gtk/v1.2/$glib_file"
329     fi
330     if test "x`wget 2>/dev/null|grep -i wget`" != "x"; then
331       dlcmd="wget http://irssi.org/files/$glib_file"
332     fi
333     if test "x$dlcmd" != "x"; then
334       echo "*** I can download GLib for you now. If you don't want to, press CTRL-C now."
335       read answer
336       eval $dlcmd
337       if `gunzip $glib_file`; then
338         glib_file=`echo $glib_file|$sedpath s/\.gz$//`
339         if `tar xf $glib_file`; then
340           rm -f $glib_file
341           AC_CHECK_GLIBDIR
342         fi
343       fi
344     fi
345
346     if test "x$GLIB_LIBS" = "x"; then
347       AC_ERROR([GLIB is required to build irssi.])
348     fi
349   fi
350 fi
351
352 PROG_LIBS="$PROG_LIBS $GLIB_LIBS"
353
354 dnl **
355 dnl ** check if we can link dynamic libraries to modules
356 dnl ** also checks if libraries are built to .libs dir
357 dnl **
358
359 AC_MSG_CHECKING([if we can link dynamic libraries with modules])
360 DYNLIB_MODULES=no
361
362 dnl ** compile object file
363 cat > conftest.c <<EOF
364 #include <math.h>
365 int modfunc(void){return (int)floor(1.2);}
366 EOF
367
368 ./libtool --mode=compile $CC $CFLAGS -c conftest.c 2> /dev/null > /dev/null
369 if test ! -s conftest.lo; then
370   AC_ERROR([error compiling test module])
371 fi
372
373 dnl ** link to library
374 ./libtool --mode=link $CC $CFLAGS $LDFLAGS -rpath /usr/lib conftest.lo -lm -o libconftest.la > /dev/null
375 if test ! -s .libs/libconftest.a; then
376   AC_ERROR([error, can't even find .a library])
377 fi
378
379 dnl ** check if dynamic linking worked
380 libfile=`grep '^library_names' libconftest.la|$sedpath "s/library_names='\(.*\)'.*/\1/"|$sedpath 's/.* \([[^ ]]*\)$/\1/'`
381 if test ! -s .libs/$libfile; then
382   AC_MSG_RESULT([no, error linking test module])
383 else
384   cat > conftest.c <<EOF
385 #include <gmodule.h>
386 main() {
387 GModule *m; int (*modfunc)(void);
388 m = g_module_open(".libs/$libfile", 0);
389 if (!m) g_print("error loading: %s", g_module_error());
390 else if (!g_module_symbol(m, "modfunc", (gpointer *) &modfunc))
391   g_print("modfunc() symbol not found from module");
392 else if (modfunc() == 1) g_print("ok"); else g_print("wrong result?! 1 vs %d", modfunc());
393 return 0; }
394 EOF
395   $CC $CFLAGS conftest.c -o conftest $GLIB_CFLAGS $GLIB_LIBS 2> /dev/null > /dev/null
396   if test ! -s conftest; then
397     AC_MSG_RESULT([no, error compiling test program])
398   else
399     status="`./conftest`"
400     if test "x$status" = "xok"; then
401       DYNLIB_MODULES=yes
402       AC_MSG_RESULT([yes])
403     else
404       AC_MSG_RESULT([no, error running: $status])
405     fi
406   fi
407 fi
408 rm -rf conftest conftest.* libconftest.* .libs
409
410 dnl **
411 dnl ** curses checks
412 dnl **
413
414 if test "x$want_textui" = "xyes"; then
415         AC_CHECK_CURSES
416
417         if test "x$has_ncurses" != "x"; then
418                 AC_CHECK_LIB(ncurses, use_default_colors, [
419                         AC_DEFINE(HAVE_NCURSES_USE_DEFAULT_COLORS)
420                 ],, $CURSES_LIBS)
421                 AC_CHECK_LIB(ncurses, idcok, [
422                         AC_DEFINE(HAVE_CURSES_IDCOK)
423                 ],, $CURSES_LIBS)
424                 AC_CHECK_LIB(ncurses, resizeterm, [
425                         AC_DEFINE(HAVE_CURSES_RESIZETERM)
426                 ],, $CURSES_LIBS)
427                 AC_CHECK_LIB(ncurses, wresize, [
428                         AC_DEFINE(HAVE_CURSES_WRESIZE)
429                 ],, $CURSES_LIBS)
430         elif test "x$has_curses" = "xtrue"; then
431                 AC_CHECK_LIB(curses, idcok, [
432                         AC_DEFINE(HAVE_CURSES_IDCOK)
433                 ],, $CURSES_LIBS)
434                 AC_CHECK_LIB(curses, resizeterm, [
435                         AC_DEFINE(HAVE_CURSES_RESIZETERM)
436                 ],, $CURSES_LIBS)
437                 AC_CHECK_LIB(curses, wresize, [
438                         AC_DEFINE(HAVE_CURSES_WRESIZE)
439                 ],, $CURSES_LIBS)
440         else
441                 want_textui=no
442                 curses_error=yes
443         fi
444 else
445         has_curses=false
446 fi
447
448 dnl **
449 dnl ** perl checks
450 dnl **
451
452 if test "$want_perl" != "no"; then
453         AC_PATH_PROG(perlpath, perl)
454         AC_MSG_CHECKING(for working Perl support)
455
456         if test "x$perlpath" = "x"; then
457                 perl_check_error="perl binary not found"
458         else
459                 PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null`
460         fi
461
462         if test "x$PERL_CFLAGS" = "x"; then
463                 perl_check_error="Error getting perl CFLAGS"
464                 AC_MSG_RESULT([not found, building without Perl])
465                 want_perl=no
466         else
467                 PERL_LDFLAGS=`$perlpath -MExtUtils::Embed -e ldopts 2>/dev/null`
468
469                 dnl * Perl 5.004 and older use perl_xxx variables while
470                 dnl * later use PL_perl_xxx variables ..
471                 have_pl_perl=`$perlpath -e 'print $] < 5.005 ? "no" : "yes";'`
472                 if test "x$have_pl_perl" = "xyes"; then
473                         AC_DEFINE(HAVE_PL_PERL)
474                 fi
475
476                 if test "x$DYNLIB_MODULES" = "xno" -a "$want_perl" != "static"; then
477                         dnl * wanted perl as module, won't get it.
478                         want_perl=static
479                         perl_mod_error="Dynamic library dependencies don't work with modules"
480                 fi
481
482                 if test "$want_perl" != "static"; then
483                         dnl * dynaloader.a -> libperl_dynaloader.la
484                         DYNALOADER_A=`echo $PERL_LDFLAGS | $perlpath -pe 's/^(.* )*([[^ ]]*DynaLoader\.a).*/\2/'`
485                 fi
486
487                 dnl * don't check libperl.a if dynaloader.a wasn't found..
488                 if test "x$DYNALOADER_A" != "x"; then
489                         dnl * find either libperl.a or libperl.so
490                         LIBPERL_A=`echo "$PERL_LDFLAGS -L/usr/lib"|$perlpath -e 'foreach (split(/ /, <STDIN>)) { if (/^-L(.*)/) { my $dir=$1; if (\`ls $dir/libperl.so* 2>/dev/null\`) { print "-lperl"; last; }; if (-e "$dir/libperl.a") { print "$dir/libperl.a"; last } } };'`
491                         if test "x$LIBPERL_A" = "x"; then
492                                 perl_mod_error="Didn't find location of -lperl"
493                                 DYNALOADER_A=
494                         elif test "$LIBPERL_A" = "-lperl"; then
495                                 LIBPERL_A=
496                         fi
497                 fi
498
499                 dnl * remove all database stuffs
500                 dnl * nsl is already in ldflags
501                 dnl * libc is of course linked without needing -lc
502                 dnl * -rdynamic must not be in LIBADD line
503                 for word in -ldb -ldbm -lndbm -lgdbm -lc -rdynamic; do
504                   PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath -e "s/$word //" -e "s/$word$//"`
505                 done
506
507                 case "$host_os" in
508                   linux*)
509                     PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath -e 's/-lposix //' -e 's/-lposix$//'`
510                     ;;
511                   hpux*)
512                     if test "x$ac_cv_prog_gcc" = "xyes"; then
513                       PERL_CFLAGS=`echo $PERL_CFLAGS | $sedpath -e 's/-Ae //' -e 's/-Ae$//'`
514                       PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath -e 's/-Ae //' -e 's/-Ae$//'`
515                     fi
516                     ;;
517                   *)
518                     ;;
519                 esac
520
521                 dnl * check that perl's ldflags actually work
522                 AC_CACHE_VAL(irssi_cv_lib_perl_works, [
523                         echo "main(){perl_alloc(); return 0;}" > conftest.c
524                         $CC $CFLAGS conftest.c -o conftest $LDFLAGS $PERL_LDFLAGS 2> /dev/null > /dev/null
525                         if test -s conftest; then
526                                 irssi_cv_lib_perl_works=yes
527                         else
528                                 irssi_cv_lib_perl_works=no
529                         fi
530                 ])
531
532                 if test "x$irssi_cv_lib_perl_works" = "xno"; then
533                         perl_check_error="Error linking with perl libraries: $PERL_LDFLAGS"
534                         AC_MSG_RESULT([error linking with perl libraries, building without Perl])
535                         want_perl=no
536                 fi
537         fi
538
539         if test "x$want_perl" != "xno"; then
540                 if test "x$want_perl" = "xstatic"; then
541                         AC_MSG_RESULT(ok)
542                 elif test "x$DYNALOADER_A" = "x"; then
543                         AC_MSG_RESULT([error parsing ldopts, building Perl into irssi binary instead of as module])
544                         want_perl=static
545                 else
546                         AC_MSG_RESULT(ok)
547                         PERL_LDFLAGS=`echo $PERL_LDFLAGS | $perlpath -pe 's/^(.* )*[[^ ]]*DynaLoader\.a/\1libperl_dynaloader.la/'`
548                         if test "x$LIBPERL_A" != "x"; then
549                                 PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath -e 's/-lperl /libperl_orig.la /' -e 's/-lperl$/libperl_orig.la$/'`
550                         fi
551                         AC_SUBST(LIBPERL_A)
552                         AC_SUBST(DYNALOADER_A)
553                 fi
554
555                 if test "x$want_perl" = "xstatic"; then
556                         dnl * building with static perl support
557                         dnl * all PERL_LDFLAGS linking is done in fe-text
558                         PERL_LDFLAGS="../perl/libperl_static.la $PERL_LDFLAGS"
559                         PERL_LINK_LIBS="$PERL_LDFLAGS"
560                         PERL_FE_LINK_LIBS="../perl/libfe_perl_static.la"
561                         PERL_LDFLAGS=
562                         AC_DEFINE(HAVE_STATIC_PERL)
563
564                         dnl * build only static library of perl module
565                         perl_module_lib=
566                         perl_module_fe_lib=
567                         perl_static_lib=libperl_static.la
568                         perl_static_fe_lib=libfe_perl_static.la
569                         PERL_LIBTOOL='$(SHELL) $(top_builddir)/libtool'
570                 else
571                         dnl * build dynamic library of perl module,
572                         dnl * use libtool-shared to prevent creating of
573                         dnl * libperl.a
574                         perl_module_lib=libperl_core.la
575                         perl_module_fe_lib=libfe_perl.la
576                         perl_static_lib=
577                         perl_static_fe_lib=
578                         PERL_LIBTOOL='$(SHELL) $(top_builddir)/libtool-shared'
579                 fi
580                 AC_SUBST(perl_module_lib)
581                 AC_SUBST(perl_static_lib)
582                 AC_SUBST(perl_module_fe_lib)
583                 AC_SUBST(perl_static_fe_lib)
584                 AC_SUBST(PERL_LIBTOOL)
585
586                 AC_SUBST(PERL_LINK_LIBS)
587                 AC_SUBST(PERL_FE_LINK_LIBS)
588
589                 AC_SUBST(PERL_LDFLAGS)
590                 AC_SUBST(PERL_CFLAGS)
591                 AC_SUBST(PERL_LIB_DIR)
592         fi
593 fi
594
595 dnl ** check what we want to build
596 AM_CONDITIONAL(BUILD_TEXTUI, test "$want_textui" = "yes")
597 AM_CONDITIONAL(BUILD_IRSSIBOT, test "$want_irssibot" = "yes")
598 AM_CONDITIONAL(BUILD_IRSSIPROXY, test "$want_irssiproxy" = "yes")
599 AM_CONDITIONAL(BUILD_PLUGINS, test "$want_plugins" = "yes")
600 AM_CONDITIONAL(BUILD_SERVERTEST, test "x$TEST_DIR" != "x")
601 AM_CONDITIONAL(HAVE_PERL, test "$want_perl" != "no")
602 AM_CONDITIONAL(HAVE_STATIC_PERL, test "$want_perl" = "static")
603
604 AC_SUBST(PROG_LIBS)
605
606 dnl **
607 dnl ** Keep all the libraries here so each frontend doesn't need to
608 dnl ** keep track of them all
609 dnl **
610 dnl ** (these could be made configurable)
611
612 CHAT_MODULES="silc"
613 silc_MODULES=""
614 if test "x$build_modules" != "x"; then
615         silc_MODULES="$silc_MODULES $build_modules"
616 fi
617 #PROG_LIBS="$PROG_LIBS -lsilc"
618
619 dnl ****************************************
620
621 AC_SUBST(CHAT_MODULES)
622 AC_SUBST(silc_MODULES)
623
624 CORE_LIBS="../core/libcore.a ../lib-config/libirssi_config.a ../lib-popt/libpopt.a"
625 FE_COMMON_LIBS=""
626
627 CHAT_LIBS=""
628 for c in $CHAT_MODULES; do
629         module_inits=""
630         module_deinits=""
631         fe_module_inits=""
632         fe_module_deinits=""
633         CHAT_LIBS="$CHAT_LIBS ../$c/lib$c.a ../$c/core/lib${c}_core.a"
634         if test -f $srcdir/src/fe-common/$c/module.h; then
635                 FE_COMMON_LIBS="$FE_COMMON_LIBS../fe-common/$c/libfe_common_$c.a "
636         fi
637         for s in `eval echo \\$${c}_MODULES`; do
638                 CHAT_LIBS="$CHAT_LIBS ../$c/$s/.libs/lib${c}_$s.a"
639                 module_inits="$module_inits ${c}_${s}_init();"
640                 module_deinits="${c}_${s}_deinit(); $module_deinits"
641                 if test -f $srcdir/src/fe-common/$c/$s/module.h; then
642                         FE_COMMON_LIBS="$FE_COMMON_LIBS../fe-common/$c/$s/.libs/libfe_${c}_$s.a "
643                         fe_module_inits="$fe_module_inits fe_${c}_${s}_init();"
644                         fe_module_deinits="fe_${c}_${s}_deinit(); $fe_module_deinits"
645                 fi
646         done
647
648         file="$srcdir/src/$c/$c.c"
649         echo "/* this file is automatically generated by configure - don't change */" > $file
650         echo "void ${c}_core_init(void); void ${c}_core_deinit(void);" >> $file
651         if test "x$module_inits" != "x"; then
652                 echo "$module_inits" | $sedpath -e 's/()/(void)/g' -e 's/ /void /g' >> $file
653                 echo "$module_deinits" | $sedpath -e 's/ *$//' -e 's/()/(void)/g' -e 's/ /void /g' -e 's/^/void /' >> $file
654         fi
655         echo "void ${c}_init(void) { ${c}_core_init(); $module_inits }" >> $file
656         echo "void ${c}_deinit(void) { $module_deinits ${c}_core_deinit(); }" >> $file
657
658         if test -f $srcdir/src/fe-common/$c/module.h; then
659                 file="$srcdir/src/fe-common/$c/${c}-modules.c"
660                 echo "/* this file is automatically generated by configure - don't change */" > $file
661                 if test "x$fe_module_inits" != "x"; then
662                         echo "$fe_module_inits" | $sedpath -e 's/()/(void)/g' -e 's/ /void /g' >> $file
663                         echo "$fe_module_deinits" | $sedpath -e 's/ *$//' -e 's/()/(void)/g' -e 's/ /void /g' -e 's/^/void /' >> $file
664                 fi
665                 echo "void fe_${c}_modules_init(void) { $fe_module_inits }" >> $file
666                 echo "void fe_${c}_modules_deinit(void) { $fe_module_deinits }" >> $file
667         fi
668 done
669
670 FE_COMMON_LIBS="$FE_COMMON_LIBS../fe-common/core/libfe_common_core.a"
671
672 dnl ** common libraries needed by frontends
673 COMMON_NOUI_LIBS="$CHAT_LIBS $CORE_LIBS $INTLLIBS"
674 COMMON_LIBS="$FE_COMMON_LIBS $COMMON_NOUI_LIBS"
675 AC_SUBST(COMMON_NOUI_LIBS)
676 AC_SUBST(COMMON_LIBS)
677
678 dnl **
679 dnl ** memory debugging
680 dnl **
681
682 if test "x$want_memdebug" = "xyes"; then
683         AC_DEFINE(MEM_DEBUG)
684 fi
685 AM_CONDITIONAL(BUILD_MEMDEBUG, test "x$want_memdebug" = "xyes")
686
687 dnl **
688 dnl ** tr-Chinese Big5 support
689 dnl **
690
691 if test "x$want_big5" = "xyes"; then
692         AC_DEFINE(WANT_BIG5)
693 fi
694
695 dnl **
696 dnl ** IPv6 support
697 dnl **
698
699 if test "x$want_ipv6" = "xyes"; then
700         AC_DEFINE(HAVE_IPV6)
701 fi
702
703 AC_OUTPUT(
704 Makefile
705 src/Makefile
706 src/core/Makefile
707 src/fe-common/Makefile
708 src/fe-common/core/Makefile
709 src/fe-common/silc/Makefile
710 src/fe-text/Makefile
711 src/lib-config/Makefile
712 src/lib-popt/Makefile
713 src/silc/Makefile
714 src/silc/core/Makefile
715 docs/Makefile
716 docs/help/Makefile
717 docs/help/in/Makefile
718 stamp.h
719 irssi.spec
720 irssi-version.h
721 irssi-config)
722
723 dnl ** for building from objdir
724 if test "x$want_perl" != "xno"; then
725         old_dir=`pwd` && cd $srcdir && whole_dir=`pwd` && cd $old_dir
726
727         if test "x$old_dir" != "x$whole_dir"; then
728                 for file in $whole_dir/src/perl/*.[[ch]] $whole_dir/src/perl/libperl_orig.la $whole_dir/src/perl/libperl_dynaloader.la $whole_dir/src/perl/common/typemap $whole_dir/src/perl/common/module.h $whole_dir/src/perl/common/*.xs $whole_dir/src/perl/irc/typemap $whole_dir/src/perl/irc/module.h $whole_dir/src/perl/irc/*.xs; do
729                         link=`echo $file|$sedpath "s?$whole_dir/??"`
730                         rm -f $link
731                         $LN_S $file $link
732                 done
733         fi
734 fi
735
736 echo
737
738 if test "x$curses_error" != "xyes"; then
739         echo "Building text frontend ..... : $want_textui"
740 else
741         echo "Building text frontend ..... : NO!!"
742         echo " - Because curses was not found, specify the path to it with"
743         echo "   --with-curses=/dir and make sure you have the curses headers"
744         echo "   installed (usually in ncurses-devel package)"
745 fi
746 echo "Building irssi bot ......... : $want_irssibot"
747 echo "Building irssi proxy ....... : $want_irssiproxy"
748 echo "Building with IPv6 support . : $want_ipv6"
749
750 if test "x$want_perl" = "xstatic"; then
751         echo "Building with Perl support . : static (in irssi binary)"
752 elif test "x$want_perl" = "xyes"; then
753         echo "Building with Perl support . : module"
754 else
755         if test "x$perl_check_error" = "x"; then
756                 echo "Building with Perl support . : no"
757         else
758                 echo "Building with Perl support . : NO!"
759                 echo " - $perl_check_error"
760         fi
761 fi
762
763 if test "x$want_perl" != "xno" -a "x$perl_mod_error" != "x"; then
764         echo " - NOTE: Perl support will be compiled statically to irssi, not as"
765         echo "   a module as requested. Reason:"
766         echo "   $perl_mod_error"
767 fi
768
769 if test "x$want_perl" = "xyes"; then
770         if test "x$PERL_LIB_DIR" = "x"; then
771                 echo "Perl library directory ..... : (default - usually /usr/local/lib/perl_site)"
772         else
773                 echo "Perl library directory ..... : $PERL_LIB_DIR"
774                 if test "x$perl_lib_dir_given" != "xyes"; then
775                         echo " - NOTE: This was automatically set to the same directory you gave with"
776                         echo "   --prefix. If you want the perl libraries to install to their 'correct'"
777                         echo "   path, you'll need to give --enable-perl-path= (nothing after '=') option"
778                         echo "   to configure. Anyway, installing perl to this directory should work"
779                         echo "   just as well.."
780                 fi
781         fi
782 fi
783 echo "Install prefix ............. : $prefix"
784