Merged silc_1_1_branch to trunk.
[silc.git] / apps / irssi / configure.in
index 79e9eeec9537db4a1a4ffe4e9010795a61d8f8d8..109e5b2cf11e94d6845595b5422f7c7fa72e886b 100644 (file)
@@ -1,4 +1,4 @@
-AC_INIT(src)
+AC_INIT([SILC-Client], [0.8.11+], [silc-devel@lists.silcnet.org], [silc-client])
 
 # we don't want VERSION in our config.h
 if test -n "`grep '^#undef VERSION' config.h.in`"; then
@@ -7,7 +7,7 @@ if test -n "`grep '^#undef VERSION' config.h.in`"; then
 fi
 
 AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(Irssi-SILC, 0.8.1)
+AM_INIT_AUTOMAKE
 
 AM_MAINTAINER_MODE
 
@@ -28,7 +28,7 @@ fi
 AC_CHECK_HEADERS(string.h stdlib.h unistd.h dirent.h sys/ioctl.h sys/resource.h)
 
 # check posix headers..
-AC_CHECK_HEADERS(sys/time.h sys/utsname.h regex.h)
+AC_CHECK_HEADERS(sys/time.h sys/utsname.h)
 
 AC_ARG_WITH(socks,
 [  --with-socks            Build with socks support],
@@ -95,6 +95,13 @@ AC_ARG_WITH(terminfo,
        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,6 +117,19 @@ 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(perl-staticlib,
 [  --with-perl-staticlib   Specify that we want to link perl libraries
                         statically in irssi, default is no],
@@ -169,13 +189,41 @@ AC_ARG_WITH(perl,
        fi,
        want_perl=static)
 
-AC_ARG_WITH(tests,
-[  --with-tests           Run all the tests],
-       if test x$withval != xno; then
-               TEST_DIR=test
-       fi,
-       TEST_DIR=)
-AC_SUBST(TEST_DIR)
+# Irssi SILC Plugin support
+#
+SILC_IRSSIDIR=
+silc_plugin=false
+AC_MSG_CHECKING(whether to compile SILC Plugin for Irssi)
+AC_ARG_WITH(silc-plugin,
+  [[  --with-silc-plugin[=DIR] Compile the SILC Plugin for Irssi, specify
+                           Irssi location [/usr/lib/irssi]]],
+  [
+    case "${withval}" in
+      no)
+        AC_MSG_RESULT(no)
+        silc_plugin=false
+        ;;
+      yes)
+        AC_MSG_RESULT(yes)
+        silc_plugin=true
+       SILC_IRSSIDIR="/usr/lib/irssi/modules"
+       ;;
+      *)
+        AC_MSG_RESULT(yes)
+        silc_plugin=true
+        SILC_IRSSIDIR="$withval/modules"
+        ;;
+    esac
+  ])
+
+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],
@@ -215,7 +263,7 @@ AC_CHECK_FUNC(socket, [], [
 AC_CHECK_FUNC(inet_addr, [], [
        AC_CHECK_LIB(nsl, inet_addr, [
                LIBS="$LIBS -lnsl"
-       ], -lsocket)
+       ])
 ])
 
 dnl * gcc specific options
@@ -239,6 +287,36 @@ 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)
+AC_CHECK_SIZEOF(off_t)
+
+if test $ac_cv_sizeof_off_t = 8; then
+  offt_64bit=yes
+else
+  offt_64bit=no
+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])
+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])
+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])
+else
+  AC_ERROR([Couldn't find integer type for off_t])
+fi
+
 dnl **
 dnl ** check for socks
 dnl **
@@ -257,6 +335,10 @@ 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 **
@@ -311,16 +393,36 @@ AC_DEFUN(AC_CHECK_GLIBDIR,[
 AC_CHECK_GLIBDIR
 
 if test -z "$GLIB_DIR"; then
-  AM_PATH_GLIB(1.2.0,,, gmodule)
-  if test -z "$GLIB_LIBS"; then
-    echo "*** trying without -lgmodule"
-    glib_config_args=
-    AM_PATH_GLIB(1.2.0)
+  if test "x$want_glib1" = "xyes"; then
+    dnl * check only for glib1
+    checks="1 2"
   else
-    AC_DEFINE(HAVE_GMODULE)
-    have_gmodule=yes
+    dnl * check glib2 then glib1
+    checks="3 4 1 2"
   fi
 
+  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"
@@ -329,18 +431,18 @@ if test -z "$GLIB_DIR"; then
     echo "*** Irssi will automatically compile and use it."
     echo
 
-    dnl * I think it's pretty safe to assume GLib 1.2.9 since the next
-    dnl * will be 2.0 (or 1.4?) and it's not sure if irssi compiles
-    dnl * with it (yea, just a few weeks after I put this text for 1.2.8
-    dnl * the 1.2.9 came :) .. and then .10
-    glib_file=glib-1.2.10.tar.gz
+    glib_url=ftp://ftp.gtk.org/pub/gtk/v2.8/
+    glib_file=glib-2.8.3.tar.gz
 
     dlcmd=
-    if test -n "`ncftpget 2>/dev/null|grep -i ncftp`"; then
-      dlcmd="ncftpget ftp://ftp.gtk.org/pub/gtk/v1.2/$glib_file"
-    fi
-    if test -n "`wget 2>/dev/null|grep -i wget`"; then
-      dlcmd="wget http://irssi.org/files/$glib_file"
+    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."
@@ -349,11 +451,11 @@ if test -z "$GLIB_DIR"; then
       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
+        glib_file=`echo $glib_file|$sedpath s/\.gz$//`
+        if `tar xf $glib_file`; then
+          rm -f $glib_file
+          AC_CHECK_GLIBDIR
+        fi
       fi
     fi
 
@@ -365,6 +467,17 @@ 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])
+fi
+
 dnl **
 dnl ** check if we can link dynamic libraries to modules
 dnl ** also checks if libraries are built to .libs dir
@@ -428,7 +541,7 @@ dnl **
 if test "x$want_textui" = "xyes"; then
        AC_CHECK_CURSES
 
-       LIBS="$LIBS $CURSES_LIBS"
+       TEXTUI_LIBS="$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))
@@ -439,20 +552,20 @@ if test "x$want_textui" = "xyes"; then
                ])
        else
                AC_CHECK_LIB(tinfo, setupterm, [
-                 LIBS="$LIBS -ltinfo"
+                 TEXTUI_LIBS="$LIBS -ltinfo"
                  want_terminfo=yes
                ], AC_CHECK_LIB(termlib, tgetent, [
-                 LIBS="$LIBS -ltermlib"
+                 TEXTUI_LIBS="$LIBS -ltermlib"
                  want_termcap=yes
                ], AC_CHECK_LIB(termcap, tgetent, [
-                 LIBS="$LIBS -ltermcap"
+                 TEXTUI_LIBS="$LIBS -ltermcap"
                  want_termcap=yes
                ], [
-                 AC_MSG_WARN(Terminfo/termcap not found)
+                 AC_ERROR(Terminfo/termcap not found - install ncurses-devel package)
                  want_textui=no
-                 curses_error=yes
                ])))
         fi
+       AC_SUBST(TEXTUI_LIBS)
                if test "x$want_termcap" = "xyes"; then
                        AC_CHECK_FUNC(tparm,, need_tparm=yes)
        else
@@ -473,6 +586,19 @@ if test "$want_perl" != "no"; then
                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 -z "$PERL_CFLAGS"; then
                if test -n "$perl_check_error"; then
                        perl_check_error="Error getting perl CFLAGS"
@@ -535,21 +661,14 @@ if test "$want_perl" != "no"; then
                esac
 
                dnl * check that perl's ldflags actually work
-               AC_CACHE_VAL(irssi_cv_lib_perl_works, [
-                       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
-                               irssi_cv_lib_perl_works=yes
-                       else
-                               irssi_cv_lib_perl_works=no
-                       fi
-               ])
-
-               if test "x$irssi_cv_lib_perl_works" = "xno"; then
+               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
                        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
                fi
+
                rm -f perl.error.tmp
        fi
 
@@ -634,11 +753,12 @@ 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(BUILD_SERVERTEST, test -n "$TEST_DIR")
 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
@@ -711,7 +831,7 @@ done
 FE_COMMON_LIBS="$FE_COMMON_LIBS../fe-common/core/libfe_common_core.a"
 
 dnl ** common libraries needed by frontends
-COMMON_NOUI_LIBS="$CHAT_LIBS $CORE_LIBS $INTLLIBS"
+COMMON_NOUI_LIBS="$CHAT_LIBS $CORE_LIBS"
 COMMON_LIBS="$FE_COMMON_LIBS $COMMON_NOUI_LIBS"
 AC_SUBST(COMMON_NOUI_LIBS)
 AC_SUBST(COMMON_LIBS)
@@ -769,13 +889,14 @@ src/perl/Makefile
 src/perl/common/Makefile.PL
 src/perl/ui/Makefile.PL
 src/perl/textui/Makefile.PL
+src/perl/silc/Makefile.PL
 scripts/Makefile
+scripts/examples/Makefile
 docs/Makefile
 docs/help/Makefile
 docs/help/in/Makefile
 irssi-version.h
 stamp.h
-irssi.spec
 irssi-config)
 
 dnl ** for building from objdir
@@ -798,23 +919,16 @@ fi
 
 echo
 
-if test "x$curses_error" != "xyes"; then
-       if test "x$want_textui" = "xno"; then
-               text=no
-       elif test "x$want_termcap" = "xyes"; then
-               text="yes, using termcap"
-       elif test "x$want_terminfo" = "xyes"; then
-               text="yes, using terminfo"
-       else
-               text="yes, using curses"
-       fi
-       echo "Building text frontend ..... : $text"
+if test "x$want_textui" = "xno"; then
+       text=no
+elif test "x$want_termcap" = "xyes"; then
+       text="yes, using termcap"
+elif test "x$want_terminfo" = "xyes"; then
+       text="yes, using terminfo"
 else
-       echo "Building text frontend ..... : NO!!"
-       echo " - Because curses was not found, specify the path to it with"
-       echo "   --with-curses=/dir and make sure you have the curses headers"
-       echo "   installed (usually in ncurses-devel package)"
+       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"
@@ -843,6 +957,10 @@ if test "x$want_perl" != "xno" -a "x$perl_mod_error" != "x"; then
        echo " - NOTE: Perl support will be compiled statically to irssi, not as"
        echo "   a module as requested. Reason:"
        echo "   $perl_mod_error"
+
+       if test -f /etc/debian_version; then
+               echo " - Try: apt-get install libperl-dev"
+       fi
 fi
 
 if test "x$want_perl" != "xno"; then
@@ -863,3 +981,5 @@ fi
 
 echo "Install prefix ............. : $prefix"
 
+echo
+echo "If there was any problems, read the INSTALL file."