Merge Irssi 0.8.16-rc1
[silc.git] / apps / irssi / configure.in
index 755fb1bf616bceb81fefa43d34500e045da6e83d..aa65967f5c588d9fb3b72ed040d5a4f16c760cbf 100644 (file)
-AC_INIT([SILC-Client], [0.8.11+], [silc-devel@lists.silcnet.org], [silc-client])
+AC_INIT(SILC-Client, 0.8.16-rc1)
+AC_CONFIG_SRCDIR([src])
+AC_CONFIG_AUX_DIR(build-aux)
+AC_PREREQ(2.50)
 
-# we don't want VERSION in our config.h
-if test -n "`grep '^#undef VERSION' config.h.in`"; then
-  grep -v '^#undef VERSION' config.h.in > config.h.in.temp
-  mv -f config.h.in.temp config.h.in
-fi
-
-AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE
+AC_CONFIG_HEADERS([irssi-config.h])
+AM_INIT_AUTOMAKE([1.9 no-define foreign])
 
 AM_MAINTAINER_MODE
 
 AC_ISC_POSIX
 AC_PROG_CC
 AC_PROG_CPP
-AC_STDC_HEADERS
-LT_INIT
-LT_OUTPUT
+AM_PROG_LIBTOOL
 
 AC_PATH_PROG(sedpath, sed)
 AC_PATH_PROG(perlpath, perl)
 
-dnl * --disable-static isn't a good idea, complain if it's used
-if test "x$enable_static" = "xno"; then
-       AC_ERROR([Don't give --disable-static option to configure])
-fi
-
-AC_CHECK_HEADERS(string.h stdlib.h unistd.h dirent.h sys/ioctl.h sys/resource.h)
+AC_CHECK_HEADERS(unistd.h dirent.h sys/ioctl.h sys/resource.h)
 
 # check posix headers..
-AC_CHECK_HEADERS(sys/time.h sys/utsname.h)
+AC_CHECK_HEADERS(sys/time.h sys/utsname.h regex.h)
+
+AC_SYS_LARGEFILE
 
 AC_ARG_WITH(socks,
 [  --with-socks            Build with socks support],
-       if test x$withval = xyes; then
-               want_socks=yes
+       if test x$withval = xno; then
+               want_socks=no
        else
-               if test "x$withval" = xno; then
-                       want_socks=no
-               else
-                       want_socks=yes
-               fi
+               want_socks=yes
        fi,
        want_socks=no)
 
 AC_ARG_WITH(textui,
-[  --with-textui           Build text frontend],
-       if test x$withval = xyes; then
-               want_textui=yes
+[  --without-textui        Build without text frontend],
+       if test x$withval = xno; then
+               want_textui=no
        else
-               if test "x$withval" = xno; then
-                       want_textui=no
-               else
-                       want_textui=yes
-               fi
+               want_textui=yes
        fi,
        want_textui=yes)
 
 AC_ARG_WITH(bot,
 [  --with-bot              Build irssi-bot],
-       if test x$withval = xyes; then
-               want_irssibot=yes
+       if test x$withval = xno; then
+               want_irssibot=no
        else
-               if test "x$withval" = xno; then
-                       want_irssibot=no
-               else
-                       want_irssibot=yes
-               fi
+               want_irssibot=yes
        fi,
        want_irssibot=no)
 
 AC_ARG_WITH(proxy,
 [  --with-proxy            Build irssi-proxy],
-       if test x$withval = xyes; then
-               want_irssiproxy=yes
+       if test x$withval = xno; then
+               want_irssiproxy=no
        else
-               if test "x$withval" = xno; then
-                       want_irssiproxy=no
-               else
-                       want_irssiproxy=yes
-               fi
+               want_irssiproxy=yes
        fi,
        want_irssiproxy=no)
 
 AC_ARG_WITH(terminfo,
-[  --with-terminfo         Use terminfo directly instead of curses],
-       if test x$withval = xyes; then
-               want_terminfo=yes
+[  --without-terminfo      Use curses backend instead of terminfo],
+       if test x$withval = xno; then
+               want_terminfo=no
        else
-               if test "x$withval" = xno; then
-                       want_terminfo=no
-               else
-                       want_terminfo=yes
-               fi
+               want_terminfo=yes
        fi,
        want_terminfo=yes)
 
-AC_ARG_WITH(cuix,
-[  --with-cuix             Use curses ui extended],
-    if test x$withval = xyes; then
-            want_terminfo=no
-            want_cuix=yes
-    fi, want_cuix=no)
-
 AC_ARG_WITH(modules,
 [  --with-modules          Specify what modules to build in binary],
        if test x$withval != xyes -a x$withval != xno; then
@@ -110,7 +75,7 @@ AC_ARG_WITH(modules,
        fi)
 
 if test "x$prefix" != "xNONE"; then
-        prefix=`eval echo $prefix`
+       prefix=`eval echo $prefix`
        PERL_MM_PARAMS="INSTALLDIRS=perl PREFIX=$prefix"
        perl_library_dir="PERL_USE_LIB"
        perl_set_use_lib=yes
@@ -118,37 +83,29 @@ if test "x$prefix" != "xNONE"; then
        perl_prefix_note=yes
 fi
 
-AC_ARG_WITH(glib1,
-[  --with-glib1            Use GLIB 1.2 instead of 2.0 if both exist],
-        if test x$withval = xyes; then
-                want_glib1=yes
-        else
-                if test "x$withval" = xno; then
-                        want_glib1=no
-                else
-                        want_glib1=yes
-                fi
-        fi,
-        want_glib1=no)
+AC_ARG_WITH(gc,
+[  --with-gc               Use garbage collector],
+       if test x$withval = xno; then
+               want_gc=no
+       else
+               want_gc=yes
+       fi,
+       want_gc=no)
 
 AC_ARG_WITH(perl-staticlib,
 [  --with-perl-staticlib   Specify that we want to link perl libraries
-                        statically in irssi, default is no],
-       if test x$withval = xyes; then
-               want_staticperllib=yes
+                          statically in irssi, default is no],
+       if test x$withval = xno; then
+               want_staticperllib=no
        else
-               if test "x$withval" = xno; then
-                       want_staticperllib=no
-               else
-                       want_staticperllib=yes
-               fi
+               want_staticperllib=yes
        fi,
        want_staticperllib=no)
 
 
 AC_ARG_WITH(perl-lib,
 [  --with-perl-lib=[site|vendor|DIR]  Specify where to install the
-                        Perl libraries for irssi, default is site],
+                          Perl libraries for irssi, default is site],
        if test "x$withval" = xyes; then
                want_perl=yes
        elif test "x$withval" = xno; then
@@ -177,8 +134,8 @@ AC_ARG_WITH(perl-lib,
 
 AC_ARG_WITH(perl,
 [  --with-perl[=yes|no|module]  Build with Perl support - also specifies
-                        if it should be built into main irssi binary
-                        (static, default) or as module],
+                          if it should be built into main irssi binary
+                          (static, default) or as module],
        if test x$withval = xyes; then
                want_perl=static
        elif test x$withval = xstatic; then
@@ -220,24 +177,31 @@ AC_ARG_WITH(silc-plugin,
 AM_CONDITIONAL(SILCPLUGIN, test x$silc_plugin = xtrue)
 AC_SUBST(SILC_IRSSIDIR)
 
-AC_ARG_WITH(file-offset-size,
-[  --with-file-offset-size=BITS  Set size of file offsets. Usually 32 or 64.
-                          (default: 64 if available)],
-        preferred_off_t_bits=$withval,
-        preferred_off_t_bits=64)
-
 AC_ARG_ENABLE(ipv6,
-[  --enable-ipv6           Enable IPv6 support],
-       if test x$enableval = xyes; then
+[  --disable-ipv6          Disable IPv6 support],
+       if test x$enableval = xno; then
+               want_ipv6=no
+       else
                want_ipv6=yes
+       fi,
+       want_ipv6=yes)
+
+AC_ARG_ENABLE(dane,
+[  --enable-dane           Enable DANE support],
+       if test x$enableval = xno ; then
+               want_dane=no
        else
-               if test "x$enableval" = xno; then
-                       want_ipv6=no
-               else
-                       want_ipv6=yes
-               fi
+               want_dane=yes
        fi,
-       want_ipv6=no)
+       want_dane=no)
+
+dnl **
+dnl ** SSL Library checks (OpenSSL)
+dnl **
+
+AC_ARG_ENABLE(ssl,
+[  --disable-ssl           Disable Secure Sockets Layer support],,
+       enable_ssl=yes)
 
 dnl **
 dnl ** just some generic stuff...
@@ -253,8 +217,6 @@ case "$host_os" in
 esac
 
 
-AC_CHECK_FUNCS(mkfifo fcntl nl_langinfo)
-
 AC_CHECK_FUNC(socket, [], [
        AC_CHECK_LIB(socket, socket, [
                LIBS="$LIBS -lsocket"
@@ -269,7 +231,7 @@ AC_CHECK_FUNC(inet_addr, [], [
 
 dnl * gcc specific options
 if test "x$ac_cv_prog_gcc" = "xyes"; then
-  CFLAGS="$CFLAGS -Wall"
+  CFLAGS="$CFLAGS -Wall -Wno-deprecated-declarations"
 fi
 
 dnl * socklen_t - AC_CHECK_TYPE() would be _really_ useful if it only would
@@ -288,9 +250,6 @@ AC_DEFINE(socklen_t, int, Define to 'int' if <sys/socket.h> doesn't define.)
 fi
 AC_MSG_RESULT($irssi_cv_type_socklen_t)
 
-dnl * off_t checks, try to make it 64bit
-AC_DEFINE_UNQUOTED(_FILE_OFFSET_BITS, $preferred_off_t_bits)
-
 AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
 AC_CHECK_SIZEOF(long long)
@@ -305,15 +264,15 @@ fi
 if test x$ac_cv_sizeof_off_t = x$ac_cv_sizeof_long; then
   # try to use unsigned long always first
   AC_DEFINE_UNQUOTED(PRIuUOFF_T, "lu")
-  AC_DEFINE(UOFF_T_LONG, [], [UOFF_T_LONG])
+  AC_DEFINE(UOFF_T_LONG)
 elif test x$ac_cv_sizeof_off_t = x$ac_cv_sizeof_int; then
   # next try int
   AC_DEFINE_UNQUOTED(PRIuUOFF_T, "u")
-  AC_DEFINE(UOFF_T_INT, [], [UOFF_T_INT])
+  AC_DEFINE(UOFF_T_INT)
 elif test x$ac_cv_sizeof_off_t = x$ac_cv_sizeof_long_long; then
   # and finally long long
   AC_DEFINE_UNQUOTED(PRIuUOFF_T, "llu")
-  AC_DEFINE(UOFF_T_LONG_LONG, [], [UOFF_T_LONG_LONG])
+  AC_DEFINE(UOFF_T_LONG_LONG)
 else
   AC_ERROR([Couldn't find integer type for off_t])
 fi
@@ -324,6 +283,7 @@ dnl **
 
 if test "x$want_socks" = "xyes"; then
        AC_CHECK_LIB(socks, connect, [
+               AC_DEFINE(HAVE_SOCKS,, Build with socks support)
                LIBS="$LIBS -lsocks"
                AC_CHECK_HEADER(socks.h, [
                        AC_DEFINE(HAVE_SOCKS_H)
@@ -336,192 +296,81 @@ if test "x$want_socks" = "xyes"; then
        ])
 fi
 
-if test "x$want_cuix" = "xyes"; then
-    AC_DEFINE([HAVE_CUIX], [1] ,[Enable cuix support])
-fi
-
 dnl **
 dnl ** fe-text checks
 dnl **
 
-AC_DEFUN(AC_CHECK_GLIBDIR,[
-  AC_MSG_CHECKING([whether GLib is unpacked to irssi dir])
-
-  GLIB_DIR=`for d in *; do test -f $d/glib.h && echo $d; done`
-  if test -n "$GLIB_DIR"; then
-    dnl * glib in irssi directory, use it
-    AC_MSG_RESULT([yes, using it])
-
-    dnl * we have to do this at this point so we know what libs gmodule needs
-    if test ! -f $GLIB_DIR/.libs/libglib.a; then
-      echo
-      echo "configuring GLib ..."
-      echo
-      cd $GLIB_DIR
-      if test ! -f glib-config; then
-        ./configure
-      fi
-      ${MAKE-make}
-      cd ..
-      echo
-    fi
-
-    GLIB_LDEXTRA=`$GLIB_DIR/glib-config --libs gmodule|$sedpath -e 's/-lglib//' -e 's/-lgmodule//' -e 's,-L/usr/local/lib ,,'|$sedpath 's/ \+/ /g'`
-    full_glib_dir="`pwd`/$GLIB_DIR"
-    GLIB_CFLAGS="-I$full_glib_dir -I$full_glib_dir/gmodule"
-    if test -f $full_glib_dir/.libs/libglib.a; then
-      GLIB_LIBS="$full_glib_dir/.libs/libglib.a $GLIB_LDEXTRA"
-      if test -f $full_glib_dir/gmodule/.libs/libgmodule.a; then
-       GLIB_LIBS="$GLIB_LIBS $full_glib_dir/gmodule/.libs/libgmodule.a"
-        AC_DEFINE(HAVE_GMODULE)
-       have_gmodule=yes
-      fi
-    else
-      GLIB_LIBS="$full_glib_dir/libglib.a $GLIB_LDEXTRA"
-      if test -f $full_glib_dir/gmodule/libgmodule.a; then
-       GLIB_LIBS="$GLIB_LIBS $full_glib_dir/gmodule/libgmodule.a"
-        AC_DEFINE(HAVE_GMODULE)
-       have_gmodule=yes
-      fi
-    fi
-    AC_SUBST(GLIB_CFLAGS)
-    AC_SUBST(GLIB_LIBS)
+for try in 1 2; do
+  if test $try = 1; then
+    glib_modules=gmodule
   else
-    AC_MSG_RESULT([no])
+    echo "*** trying without -lgmodule"
+    glib_modules=
   fi
-])
-
-AC_CHECK_GLIBDIR
-
-if test -z "$GLIB_DIR"; then
-  if test "x$want_glib1" = "xyes"; then
-    dnl * check only for glib1
-    checks="1 2"
-  else
-    dnl * check glib2 then glib1
-    checks="3 4 1 2"
+  AM_PATH_GLIB_2_0(2.6.0,,, $glib_modules)
+  if test "$GLIB_LIBS"; then
+    if test $glib_modules = gmodule; then
+      AC_DEFINE(HAVE_GMODULE)
+      have_gmodule=yes
+    fi
+    break
   fi
+done
 
-  for try in $checks; do
-    glib_config_args=
-    if test $try = 1 -o $try = 3; then
-      glib_modules=gmodule
-    else
-      echo "*** trying without -lgmodule"
-      glib_modules=
-    fi
-    if test $try = 1 -o $try = 2; then
-      AM_PATH_GLIB(1.2.0,,, $glib_modules)
-    else
-      AM_PATH_GLIB_2_0(2.0.0,,, $glib_modules)
-    fi
-    if test "$GLIB_LIBS"; then
-      if test $glib_modules = gmodule; then
-        AC_DEFINE(HAVE_GMODULE)
-        have_gmodule=yes
-      fi
-      break
-    fi
-  done
-
-  if test -z "$GLIB_LIBS"; then
-    echo
-    echo "*** If you don't have GLIB, you can get it from ftp://ftp.gtk.org"
-    echo "*** If you can't install GLIB anywhere or if you don't want to,"
-    echo "*** you can just unpack it to Irssi's source directory and"
-    echo "*** Irssi will automatically compile and use it."
-    echo
-
-    glib_url=ftp://ftp.gtk.org/pub/gtk/v2.8/
-    glib_file=glib-2.8.3.tar.gz
-
-    dlcmd=
-    if test -n "`wget --version 2>/dev/null|grep -i wget`"; then
-      dlcmd="wget -c $glib_url$glib_file"
-    elif test -n "`ncftpget --version 2>/dev/null|grep -i ncftp`"; then
-      dlcmd="ncftpget -z $glib_url$glib_file"
-    elif test -n "`lynx --version 2>/dev/null|grep -i lynx`"; then
-      dlcmd="lynx --source $glib_url$glib_file > $glib_file"
-    elif test -n "`curl --version 2>/dev/null|grep -i curl`"; then
-      dlcmd="curl -C - $glib_url$glib_file"
-    fi
-    if test -n "$dlcmd"; then
-      echo "*** I can download GLib for you now. If you don't want to, press CTRL-C now."
-      echo
-      echo "*** Press ENTER to continue"
-      read answer
-      eval $dlcmd
-      if `gunzip $glib_file`; then
-        glib_file=`echo $glib_file|$sedpath s/\.gz$//`
-        if `tar xf $glib_file`; then
-          rm -f $glib_file
-          AC_CHECK_GLIBDIR
-        fi
-      fi
-    fi
+if test -z "$GLIB_LIBS"; then
+  echo
+  echo "*** If you don't have GLIB, you can get it from ftp://ftp.gtk.org/pub/glib/"
+  echo "*** We recommend you get the latest stable GLIB 2 version."
+  echo "*** Compile and install it, and make sure pkg-config finds it,"
+  echo "*** by adding the path where the .pc file is located to PKG_CONFIG_PATH"
+  echo
 
-    if test -z "$GLIB_LIBS"; then
-      AC_ERROR([GLIB is required to build irssi.])
-    fi
-  fi
+  AC_ERROR([GLIB is required to build irssi.])
 fi
 
 LIBS="$LIBS $GLIB_LIBS"
 
-dnl **
-dnl ** Recode
-dnl **
-AC_MSG_CHECKING([if we can use recode, requires GLIB2])
-if test "$glib_config_major_version" = "2"; then
-  AC_DEFINE([HAVE_GLIB2], [], ["HAVE_GLIB2"])
-  AC_MSG_RESULT([yes])
-else
-  AC_MSG_RESULT([no, using glib1])
+have_openssl=no
+if test "$enable_ssl" = "yes"; then
+  PKG_CHECK_MODULES(SSL, openssl, :, :)
+  if test "$SSL_LIBS"; then
+    CFLAGS="$CFLAGS $SSL_CFLAGS"
+    have_openssl=yes
+  else
+    AC_CHECK_LIB(ssl, SSL_read, [
+      AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h, [
+       SSL_LIBS="-lssl -lcrypto"
+       have_openssl=yes
+      ])
+    ],, -lcrypto)
+  fi
+  if test "$have_openssl" = "yes"; then
+    AC_DEFINE(HAVE_OPENSSL,, Build with OpenSSL support)
+    LIBS="$LIBS $SSL_LIBS"
+  fi
 fi
 
 dnl **
-dnl ** check if we can link dynamic libraries to modules
-dnl ** also checks if libraries are built to .libs dir
+dnl ** Garbage Collector
 dnl **
-
-AC_MSG_CHECKING([if we can link dynamic libraries with modules])
-DYNLIB_MODULES=no
-
-dnl ** compile object file
-cat > conftest.c <<EOF
-#include <math.h>
-int modfunc(){return (int)floor(1.2);}
-EOF
-
-if ! ./libtool --tag=CC --mode=compile $CC $CFLAGS -c conftest.c >/dev/null 2>&1 || \
-   ! ./libtool --tag=CC --mode=link $CC $CFLAGS $LDFLAGS -rpath /usr/lib conftest.lo -lm -o libconftest.la >/dev/null 2>&1; then
-  AC_MSG_RESULT([no, error compiling test module])
-else
-  cat > conftest.c <<EOF
-#include <gmodule.h>
-main() {
-GModule *m; int (*modfunc)(void);
-m = g_module_open("libconftest.la", 0);
-if (!m) g_print("error loading: %s", g_module_error());
-else if (!g_module_symbol(m, "modfunc", (gpointer *) &modfunc))
-  g_print("modfunc() symbol not found from module");
-else if (modfunc() == 1) g_print("ok"); else g_print("wrong result?! 1 vs %d", modfunc());
-return 0; }
-EOF
-  $CC $CFLAGS $LDFLAGS conftest.c -o conftest $GLIB_CFLAGS $GLIB_LIBS 2> /dev/null > /dev/null
-  if test ! -s conftest; then
-    AC_MSG_RESULT([no, error compiling test program])
-  else
-    status="`./conftest`"
-    if test "x$status" = "xok"; then
-      DYNLIB_MODULES=yes
-      AC_MSG_RESULT([yes])
-    else
-      AC_MSG_RESULT([no, error running: $status])
-    fi
-  fi
+have_gc=no
+if test "x$want_gc" = xyes; then
+  AC_CHECK_LIB(gc, GC_malloc, [
+    AC_CHECK_HEADER(gc/gc.h, [
+      AC_DEFINE(HAVE_GC_GC_H)
+      AC_DEFINE(USE_GC)
+      LIBS="$LIBS -lgc"
+      have_gc=yes
+    ], [
+      AC_CHECK_HEADER(gc.h, [
+       AC_DEFINE(HAVE_GC_H)
+       AC_DEFINE(USE_GC)
+       LIBS="$LIBS -lgc"
+       have_gc=yes
+      ])
+    ])
+  ])
 fi
-rm -rf conftest conftest.* libconftest.* .libs
 
 dnl **
 dnl ** curses checks
@@ -530,36 +379,42 @@ dnl **
 if test "x$want_textui" = "xyes"; then
        AC_CHECK_CURSES
 
-       TEXTUI_LIBS="$LIBS $CURSES_LIBS"
+       TEXTUI_LIBS="$CURSES_LIBS"
        if test "x$has_curses" = "xtrue"; then
-                       AC_CHECK_FUNC(use_default_colors, AC_DEFINE(HAVE_NCURSES_USE_DEFAULT_COLORS))
-                       AC_CHECK_FUNC(idcok, AC_DEFINE(HAVE_CURSES_IDCOK))
-                       AC_CHECK_FUNC(resizeterm, AC_DEFINE(HAVE_CURSES_RESIZETERM))
-                       AC_CHECK_FUNC(wresize, AC_DEFINE(HAVE_CURSES_WRESIZE))
+               old_libs=$LIBS
+               LIBS="$LIBS $CURSES_LIBS"
+               if test $want_terminfo = no; then
+                       AC_CHECK_FUNC(use_default_colors, AC_DEFINE(HAVE_NCURSES_USE_DEFAULT_COLORS))
+                       AC_CHECK_FUNC(idcok, AC_DEFINE(HAVE_CURSES_IDCOK))
+                       AC_CHECK_FUNC(resizeterm, AC_DEFINE(HAVE_CURSES_RESIZETERM))
+                       AC_CHECK_FUNC(wresize, AC_DEFINE(HAVE_CURSES_WRESIZE))
+               fi
                AC_CHECK_FUNC(setupterm,, [
-                       want_termcap=yes
+                       want_termcap=yes
                ])
+               LIBS=$old_libs
        else
                AC_CHECK_LIB(tinfo, setupterm, [
-                 TEXTUI_LIBS="$LIBS -ltinfo"
+                 TEXTUI_LIBS="-ltinfo"
                  want_terminfo=yes
                ], AC_CHECK_LIB(termlib, tgetent, [
-                 TEXTUI_LIBS="$LIBS -ltermlib"
+                 TEXTUI_LIBS="-ltermlib"
                  want_termcap=yes
                ], AC_CHECK_LIB(termcap, tgetent, [
-                 TEXTUI_LIBS="$LIBS -ltermcap"
+                 TEXTUI_LIBS="-ltermcap"
                  want_termcap=yes
                ], [
                  AC_ERROR(Terminfo/termcap not found - install ncurses-devel package)
                  want_textui=no
                ])))
-        fi
+       fi
        AC_SUBST(TEXTUI_LIBS)
-               if test "x$want_termcap" = "xyes"; then
-                       AC_CHECK_FUNC(tparm,, need_tparm=yes)
+
+       if test "x$want_termcap" = "xyes"; then
+               AC_CHECK_FUNC(tparm,, need_tparm=yes)
        else
                AC_DEFINE(HAVE_TERMINFO)
-               fi
+       fi
 fi
 
 dnl **
@@ -570,23 +425,23 @@ if test "$want_perl" != "no"; then
        AC_MSG_CHECKING(for working Perl support)
 
        if test -z "$perlpath"; then
-                       perl_check_error="perl binary not found"
+               perl_check_error="perl binary not found"
        else
                PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null`
        fi
 
-        if test "x$ac_cv_prog_gcc" = "xyes" -a -z "`echo $host_os|grep 'bsd\|linux'`"; then
-                dnl * several systems have Perl compiled with native compiler
-                dnl * but irssi is being compiled with GCC. Here we try to
-                dnl * fix those command line options a bit so GCC won't
-                dnl * complain about them. Normally there's only few options
-                dnl * that we want to keep:
-                dnl * -Ddefine -Uundef -I/path -fopt -mopt
-                PERL_CFLAGS=`echo $PERL_CFLAGS | $perlpath -pe 's/^(.* )?-[^DUIfm][^ ]+/\1/g; s/^(.* )?\+[^ ]+/\1/g'`
-
-                PERL_EXTRA_OPTS="CCCDLFLAGS=\"-fPIC\""
-                AC_SUBST(PERL_EXTRA_OPTS)
-        fi
+       if test "x$ac_cv_prog_gcc" = "xyes" -a -z "`echo $host_os|grep 'bsd\|linux'`"; then
+               dnl * several systems have Perl compiled with native compiler
+               dnl * but irssi is being compiled with GCC. Here we try to
+               dnl * fix those command line options a bit so GCC won't
+               dnl * complain about them. Normally there's only few options
+               dnl * that we want to keep:
+               dnl * -Ddefine -Uundef -I/path -fopt -mopt
+               PERL_CFLAGS=`echo $PERL_CFLAGS | $perlpath -pe 's/^(.* )?-[^DUIfm][^ ]+/\1/g; s/^(.* )?\+[^ ]+/\1/g'`
+
+               PERL_EXTRA_OPTS="CCCDLFLAGS=\"-fPIC\""
+               AC_SUBST(PERL_EXTRA_OPTS)
+       fi
 
        if test -z "$PERL_CFLAGS"; then
                if test -n "$perl_check_error"; then
@@ -597,36 +452,6 @@ if test "$want_perl" != "no"; then
        else
                PERL_LDFLAGS=`$perlpath -MExtUtils::Embed -e ldopts 2>/dev/null`
 
-               dnl * Perl 5.004 and older use perl_xxx variables while
-               dnl * later use PL_perl_xxx variables ..
-               have_pl_perl=`$perlpath -e 'print $] < 5.005 ? "no" : "yes";'`
-                if test "x$have_pl_perl" = "xyes"; then
-                       AC_DEFINE(HAVE_PL_PERL)
-               fi
-
-               if test "x$DYNLIB_MODULES" = "xno" -a "$want_perl" != "static"; then
-                       dnl * wanted perl as module, won't get it.
-                       want_perl=static
-                       perl_mod_error="Dynamic library dependencies don't work with modules"
-               fi
-
-               if test "$want_perl" != "static"; then
-                       dnl * dynaloader.a -> libperl_dynaloader.la
-                       DYNALOADER_A=`echo $PERL_LDFLAGS | $perlpath -pe 's/^(.* )*([[^ ]]*DynaLoader\.a).*/\2/'`
-               fi
-
-               dnl * don't check libperl.a if dynaloader.a wasn't found..
-               if test -n "$DYNALOADER_A"; then
-                       dnl * find either libperl.a or libperl.so
-                       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 } } };'`
-                       if test -z "$LIBPERL_A"; then
-                               perl_mod_error="Didn't find location of -lperl"
-                               DYNALOADER_A=
-                       elif test "$LIBPERL_A" = "-lperl"; then
-                               LIBPERL_A=
-                       fi
-               fi
-
                dnl * remove all database stuffs
                dnl * nsl is already in ldflags
                dnl * libc is of course linked without needing -lc
@@ -652,7 +477,7 @@ if test "$want_perl" != "no"; then
                dnl * check that perl's ldflags actually work
                echo "main(){perl_alloc(); return 0;}" > conftest.c
                $CC $CFLAGS conftest.c -o conftest $LDFLAGS $PERL_LDFLAGS 2> perl.error.tmp > /dev/null
-               if test ! -s conftest; then
+               if test ! -s conftest -a "x$ignore_perl_errors" = "x"; then
                        perl_check_error="Error linking with perl libraries: $PERL_LDFLAGS: `cat perl.error.tmp`"
                        AC_MSG_RESULT([error linking with perl libraries, building without Perl])
                        want_perl=no
@@ -662,20 +487,7 @@ if test "$want_perl" != "no"; then
        fi
 
        if test "x$want_perl" != "xno"; then
-               if test "x$want_perl" = "xstatic"; then
-                       AC_MSG_RESULT(ok)
-               elif test -z "$DYNALOADER_A"; then
-                       AC_MSG_RESULT([error parsing ldopts, building Perl into irssi binary instead of as module])
-                       want_perl=static
-               else
-                       AC_MSG_RESULT(ok)
-                       PERL_LDFLAGS=`echo $PERL_LDFLAGS | $perlpath -pe 's/^(.* )*[[^ ]]*DynaLoader\.a/\1libperl_dynaloader.la/'`
-                       if test -n "$LIBPERL_A"; then
-                               PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath -e 's/-lperl /libperl_orig.la /' -e 's/-lperl$/libperl_orig.la$/'`
-                       fi
-                       AC_SUBST(LIBPERL_A)
-                       AC_SUBST(DYNALOADER_A)
-               fi
+               AC_MSG_RESULT(ok)
 
                if test "x$want_perl" = "xstatic"; then
                        dnl * building with static perl support
@@ -691,14 +503,12 @@ if test "$want_perl" != "no"; then
                        perl_module_fe_lib=
                        perl_static_lib=libperl_core_static.la
                        perl_static_fe_lib=libfe_perl_static.la
-                       PERL_LIBTOOL='$(SHELL) $(top_builddir)/libtool'
                else
                        dnl * build dynamic library of perl module
                        perl_module_lib=libperl_core.la
                        perl_module_fe_lib=libfe_perl.la
                        perl_static_lib=
                        perl_static_fe_lib=
-                       PERL_LIBTOOL='$(SHELL) $(top_builddir)/libtool'
                fi
 
                if test "x$want_staticperllib" = "xyes"; then
@@ -722,11 +532,10 @@ if test "$want_perl" != "no"; then
                AC_SUBST(perl_static_lib)
                AC_SUBST(perl_module_fe_lib)
                AC_SUBST(perl_static_fe_lib)
-               AC_SUBST(PERL_LIBTOOL)
 
                AC_SUBST(PERL_LINK_FLAGS)
                AC_SUBST(PERL_LINK_LIBS)
-                AC_SUBST(PERL_FE_LINK_LIBS)
+               AC_SUBST(PERL_FE_LINK_LIBS)
 
                AC_SUBST(PERL_LDFLAGS)
                AC_SUBST(PERL_CFLAGS)
@@ -741,13 +550,9 @@ dnl ** check what we want to build
 AM_CONDITIONAL(BUILD_TEXTUI, test "$want_textui" = "yes")
 AM_CONDITIONAL(BUILD_IRSSIBOT, test "$want_irssibot" = "yes")
 AM_CONDITIONAL(BUILD_IRSSIPROXY, test "$want_irssiproxy" = "yes")
-AM_CONDITIONAL(BUILD_PLUGINS, test "$want_plugins" = "yes")
 AM_CONDITIONAL(HAVE_PERL, test "$want_perl" != "no")
-AM_CONDITIONAL(HAVE_STATIC_PERL, test "$want_perl" = "static")
 AM_CONDITIONAL(NEED_TPARM, test "$need_tparm" = "yes")
 AM_CONDITIONAL(USE_CURSES, test "$want_terminfo" != "yes" -a "$want_termcap" != "yes")
-AM_CONDITIONAL(BUILD_SERVERTEST, false)
-AM_CONDITIONAL(USE_CUIX, test "$want_cuix" = "yes")
 
 # move LIBS to PROG_LIBS so they're not tried to be used when linking eg. perl libraries
 PROG_LIBS=$LIBS
@@ -771,7 +576,7 @@ dnl ****************************************
 AC_SUBST(CHAT_MODULES)
 AC_SUBST(silc_MODULES)
 
-CORE_LIBS="../core/libcore.a ../lib-config/libirssi_config.a ../lib-popt/libpopt.a"
+CORE_LIBS="../core/libcore.a ../lib-config/libirssi_config.a"
 FE_COMMON_LIBS=""
 
 CHAT_LIBS=""
@@ -795,25 +600,27 @@ for c in $CHAT_MODULES; do
                fi
        done
 
-       file="$srcdir/src/$c/$c.c"
-        echo "/* this file is automatically generated by configure - don't change */" > $file
+       mkdir -p src/$c
+       file="src/$c/$c.c"
+       echo "/* this file is automatically generated by configure - don't change */" > $file
        echo "void ${c}_core_init(void); void ${c}_core_deinit(void);" >> $file
        if test -n "$module_inits"; then
-               echo "$module_inits" | $sedpath -e 's/()/(void)/g' -e 's/ /void /g' >> $file
-               echo "$module_deinits" | $sedpath -e 's/ *$//' -e 's/()/(void)/g' -e 's/ /void /g' -e 's/^/void /' >> $file
+               echo "$module_inits" | $sedpath -e 's/()/(void)/g' -e 's/ /void /g' >> $file
+               echo "$module_deinits" | $sedpath -e 's/ *$//' -e 's/()/(void)/g' -e 's/ /void /g' -e 's/^/void /' >> $file
        fi
-        echo "void ${c}_init(void) { ${c}_core_init(); $module_inits }" >> $file
-        echo "void ${c}_deinit(void) { $module_deinits ${c}_core_deinit(); }" >> $file
+       echo "void ${c}_init(void) { ${c}_core_init(); $module_inits }" >> $file
+       echo "void ${c}_deinit(void) { $module_deinits ${c}_core_deinit(); }" >> $file
 
        if test -f $srcdir/src/fe-common/$c/module.h; then
-               file="$srcdir/src/fe-common/$c/${c}-modules.c"
-               echo "/* this file is automatically generated by configure - don't change */" > $file
-                if test -n "$fe_module_inits"; then
-                       echo "$fe_module_inits" | $sedpath -e 's/()/(void)/g' -e 's/ /void /g' >> $file
-                       echo "$fe_module_deinits" | $sedpath -e 's/ *$//' -e 's/()/(void)/g' -e 's/ /void /g' -e 's/^/void /' >> $file
+               mkdir -p src/fe-common/$c
+               file="src/fe-common/$c/${c}-modules.c"
+               echo "/* this file is automatically generated by configure - don't change */" > $file
+               if test -n "$fe_module_inits"; then
+                       echo "$fe_module_inits" | $sedpath -e 's/()/(void)/g' -e 's/ /void /g' >> $file
+                       echo "$fe_module_deinits" | $sedpath -e 's/ *$//' -e 's/()/(void)/g' -e 's/ /void /g' -e 's/^/void /' >> $file
                fi
-               echo "void fe_${c}_modules_init(void) { $fe_module_inits }" >> $file
-               echo "void fe_${c}_modules_deinit(void) { $fe_module_deinits }" >> $file
+               echo "void fe_${c}_modules_init(void) { $fe_module_inits }" >> $file
+               echo "void fe_${c}_modules_deinit(void) { $fe_module_deinits }" >> $file
        fi
 done
 
@@ -829,6 +636,7 @@ dnl **
 dnl ** IPv6 support
 dnl **
 
+have_ipv6=no
 if test "x$want_ipv6" = "xyes"; then
        AC_MSG_CHECKING([for IPv6])
        AC_CACHE_VAL(irssi_cv_type_in6_addr,
@@ -839,22 +647,29 @@ if test "x$want_ipv6" = "xyes"; then
        #include <netdb.h>
        #include <arpa/inet.h>],
        [struct in6_addr i;],
-       irssi_cv_type_in6_addr=yes,
-       irssi_cv_type_in6_addr=no,
+       have_ipv6=yes,
        )])
-       if test $irssi_cv_type_in6_addr = yes; then
+       if test $have_ipv6 = yes; then
                AC_DEFINE(HAVE_IPV6)
        fi
-       AC_MSG_RESULT($irssi_cv_type_in6_addr)
+       AC_MSG_RESULT($have_ipv6)
 fi
 
-dnl **
-dnl ** IRSSI_VERSION_DATE and IRSSI_VERSION_TIME
-dnl **
-#VERSION_DATE=`head -1 $srcdir/ChangeLog|sed 's/^\(....\)-\(..\)-\(..\).*/\1\2\3/'`
-#VERSION_TIME=`head -1 $srcdir/ChangeLog|sed -e 's/^[[^ ]]* \(..\):\(..\).*/\1\2/' -e 's/^0*//'`
-#AC_SUBST(VERSION_DATE)
-#AC_SUBST(VERSION_TIME)
+if test "x$want_dane" = "xyes"; then
+       AC_MSG_CHECKING([for DANE])
+       AC_CHECK_LIB(val-threads, val_getdaneinfo,
+       [
+               LIBS="$LIBS -lval-threads -lsres"
+               AC_DEFINE([HAVE_DANE], [], [DANE support])
+               have_dane=yes
+       ], [], [-lssl -lcrypto -lsres -lpthread])
+
+       if test x$have_dane = "xyes" ; then
+               if test x$have_openssl = "xno" ; then
+                       AC_ERROR([SSL is required to build Irssi with DANE support enabled.])
+               fi
+       fi
+fi
 
 #
 # Glue into SILC build system
@@ -862,7 +677,7 @@ dnl **
 INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
 AC_SUBST(INCLUDE_DEFINES_INT)
 
-AC_OUTPUT(
+AC_CONFIG_FILES([
 Makefile
 src/Makefile
 src/core/Makefile
@@ -871,7 +686,6 @@ src/fe-common/core/Makefile
 src/fe-common/silc/Makefile
 src/fe-text/Makefile
 src/lib-config/Makefile
-src/lib-popt/Makefile
 src/silc/Makefile
 src/silc/core/Makefile
 src/perl/Makefile
@@ -885,20 +699,20 @@ docs/Makefile
 docs/help/Makefile
 docs/help/in/Makefile
 irssi-version.h
-stamp.h
-irssi-config)
+irssi-config
+])
+
+AC_OUTPUT
 
 dnl ** for building from objdir
 old_dir=`pwd` && cd $srcdir && whole_dir=`pwd` && cd $old_dir
 if test "x$old_dir" != "x$whole_dir"; then
-       $LN_S $srcdir/irssi-version.h irssi-version.h
-
        if test "x$want_perl" != "xno"; then
                subdirfiles=""
                for i in $whole_dir/src/perl/common $whole_dir/src/perl/irc $whole_dir/src/perl/ui $whole_dir/src/perl/textui; do
                        subdirfiles=`echo $subdirfiles $i/typemap $i/module.h $i/*.pm $i/*.xs`
                done
-               for file in $whole_dir/src/perl/*.[[ch]] $whole_dir/src/perl/libperl_orig.la $whole_dir/src/perl/libperl_dynaloader.la $subdirfiles; do
+               for file in $whole_dir/src/perl/module.h $subdirfiles; do
                        link=`echo $file|$sedpath "s?$whole_dir/??"`
                        rm -f $link
                        $LN_S $file $link
@@ -917,12 +731,11 @@ elif test "x$want_terminfo" = "xyes"; then
 else
        text="yes, using curses"
 fi
-echo "Building text frontend ..... : $text"
-echo "Building irssi bot ......... : $want_irssibot"
-echo "Building irssi proxy ....... : $want_irssiproxy"
-echo "Building with IPv6 support . : $want_ipv6"
+echo "Building text frontend ........... : $text"
+echo "Building irssi bot ............... : $want_irssibot"
+echo "Building irssi proxy ............. : $want_irssiproxy"
 if test "x$have_gmodule" = "xyes"; then
-       echo "Building with module support : yes"
+       echo "Building with module support ..... : yes"
 else
        echo "Building with module support : NO!! /LOAD will not work!"
        echo " - You're missing gmodule (comes with glib) for some reason,"
@@ -930,14 +743,14 @@ else
 fi
 
 if test "x$want_perl" = "xstatic"; then
-       echo "Building with Perl support . : static (in irssi binary)"
+       echo "Building with Perl support ....... : static (in irssi binary)"
 elif test "x$want_perl" = "xmodule"; then
-       echo "Building with Perl support . : module"
+       echo "Building with Perl support ....... : module"
 else
        if test -z "$perl_check_error"; then
-               echo "Building with Perl support . : no"
+               echo "Building with Perl support ....... : no"
        else
-               echo "Building with Perl support . : NO!"
+               echo "Building with Perl support ....... : NO!"
                echo " - $perl_check_error"
        fi
 fi
@@ -959,7 +772,7 @@ if test "x$want_perl" != "xno"; then
        if test -z "$perl_library_dir"; then
                perl_library_dir="(site default - `$perlpath -e 'use Config; print $Config{sitearch}'`)"
        fi
-               echo "Perl library directory ..... : $perl_library_dir"
+       echo "Perl library directory ........... : $perl_library_dir"
        if test "x$perl_prefix_note" = "xyes"; then
                echo "  - NOTE: This was automatically set to the same directory you gave with"
                echo "  --prefix. If you want the perl libraries to install to their 'correct'"
@@ -967,8 +780,15 @@ if test "x$want_perl" != "xno"; then
                echo "  Anyway, installing perl to this directory should work just as well."
        fi
 fi
+echo "Install prefix ................... : $prefix"
+
+echo
 
-echo "Install prefix ............. : $prefix"
+echo "Building with IPv6 support ....... : $have_ipv6"
+echo "Building with SSL support ........ : $have_openssl"
+echo "Building with 64bit DCC support .. : $offt_64bit"
+echo "Building with garbage collector .. : $have_gc"
+echo "Building with DANE support ....... : $have_dane"
 
 echo
-echo "If there was any problems, read the INSTALL file."
+echo "If there are any problems, read the INSTALL file."