--enable-perl=[yes|no|static]

Allows building perl support either as loadable irssi module or
statically linked to irssi binary.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@716 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-10-03 22:57:14 +00:00 committed by cras
parent 391a419a1f
commit 5e97ea1549
7 changed files with 143 additions and 63 deletions

View File

@ -9,6 +9,7 @@
#undef HAVE_POPT_H #undef HAVE_POPT_H
#undef HAVE_SOCKS_H #undef HAVE_SOCKS_H
#undef HAVE_PL_PERL #undef HAVE_PL_PERL
#undef HAVE_STATIC_PERL
/* macros/curses checks */ /* macros/curses checks */
#undef HAS_CURSES #undef HAS_CURSES

View File

@ -17,25 +17,25 @@ AC_CHECK_HEADERS(string.h stdlib.h unistd.h dirent.h sys/ioctl.h libintl.h)
AC_ARG_WITH(socks, AC_ARG_WITH(socks,
[ --with-socks Build with socks support], [ --with-socks Build with socks support],
if test x$withval = xyes; then if test x$withval = xyes; then
want_socks=yes want_socks=yes
else else
if test "x$withval" = xno; then if test "x$withval" = xno; then
want_socks=no want_socks=no
else else
want_socks=yes want_socks=yes
fi fi
fi, fi,
want_socks=no) want_socks=no)
AC_ARG_WITH(textui, AC_ARG_WITH(textui,
[ --with-textui Build text frontend], [ --with-textui Build text frontend],
if test x$withval = xyes; then if test x$withval = xyes; then
want_textui=yes want_textui=yes
else else
if test "x$withval" = xno; then if test "x$withval" = xno; then
want_textui=no want_textui=no
else else
want_textui=yes want_textui=yes
fi fi
fi, fi,
want_textui=yes) want_textui=yes)
@ -43,12 +43,12 @@ AC_ARG_WITH(textui,
AC_ARG_WITH(bot, AC_ARG_WITH(bot,
[ --with-bot Build irssi-bot], [ --with-bot Build irssi-bot],
if test x$withval = xyes; then if test x$withval = xyes; then
want_irssibot=yes want_irssibot=yes
else else
if test "x$withval" = xno; then if test "x$withval" = xno; then
want_irssibot=no want_irssibot=no
else else
want_irssibot=yes want_irssibot=yes
fi fi
fi, fi,
want_irssibot=no) want_irssibot=no)
@ -56,12 +56,12 @@ AC_ARG_WITH(bot,
AC_ARG_WITH(proxy, AC_ARG_WITH(proxy,
[ --with-proxy Build irssi-proxy], [ --with-proxy Build irssi-proxy],
if test x$withval = xyes; then if test x$withval = xyes; then
want_irssiproxy=yes want_irssiproxy=yes
else else
if test "x$withval" = xno; then if test "x$withval" = xno; then
want_irssiproxy=no want_irssiproxy=no
else else
want_irssiproxy=yes want_irssiproxy=yes
fi fi
fi, fi,
want_irssiproxy=no) want_irssiproxy=no)
@ -77,30 +77,43 @@ else
PERL_LIB_DIR="$prefix" PERL_LIB_DIR="$prefix"
fi fi
AC_ARG_ENABLE(perl, AC_ARG_ENABLE(perl-path,
[ --enable-perl[=dir] Enable Perl scripting, you can specify the Perl libraries installation path], [ --enable-perl-path=dir Specify where to install the Perl libraries for irssi],
if test x$enableval = xyes; then if test x$enableval = xyes; then
want_perl=yes want_perl=yes
else else
if test "x$enableval" = xno; then if test "x$enableval" = xno; then
want_perl=no want_perl=no
else else
want_perl=yes want_perl=yes
PERL_LIB_DIR="$enableval" PERL_LIB_DIR="$enableval"
perl_lib_dir_given=yes perl_lib_dir_given=yes
fi fi
fi, fi,
want_perl=yes) want_perl=yes)
AC_ARG_ENABLE(perl,
[ --enable-perl[=yes|no|static] Build with Perl support - also specifies
if it should be built into main irssi binary
(static) or as module (default)],
if test x$enableval = xyes; then
want_perl=yes
elif test x$enableval = xstatic; then
want_perl=static
else
want_perl=no
fi,
want_perl=yes)
AC_ARG_WITH(servertest, AC_ARG_WITH(servertest,
[ --with-servertest Build servertest], [ --with-servertest Build servertest],
if test x$withval = xyes; then if test x$withval = xyes; then
want_servertest=yes want_servertest=yes
else else
if test "x$withval" = xno; then if test "x$withval" = xno; then
want_servertest=no want_servertest=no
else else
want_servertest=yes want_servertest=yes
fi fi
fi, fi,
want_servertest=no) want_servertest=no)
@ -110,24 +123,24 @@ AC_ARG_ENABLE(memdebug,
if test x$enableval = xyes; then if test x$enableval = xyes; then
want_memdebug=yes want_memdebug=yes
else else
if test "x$enableval" = xno; then if test "x$enableval" = xno; then
want_memdebug=no want_memdebug=no
else else
want_memdebug=yes want_memdebug=yes
fi fi
fi, fi,
want_memdebug=no) want_memdebug=no)
AC_ARG_ENABLE(ipv6, AC_ARG_ENABLE(ipv6,
[ --enable-ipv6 Enable IPv6 support], [ --enable-ipv6 Enable IPv6 support],
if test x$enableval = xyes; then if test x$enableval = xyes; then
want_ipv6=yes want_ipv6=yes
else else
if test "x$enableval" = xno; then if test "x$enableval" = xno; then
want_ipv6=no want_ipv6=no
else else
want_ipv6=yes want_ipv6=yes
fi fi
fi, fi,
want_ipv6=no) want_ipv6=no)
@ -190,11 +203,10 @@ dnl **
AM_PATH_GLIB(1.2.0,,, gmodule) AM_PATH_GLIB(1.2.0,,, gmodule)
if test "x$GLIB_LIBS" = "x"; then if test "x$GLIB_LIBS" = "x"; then
AC_ERROR([GLib is required to build Irssi]) AC_ERROR([GLib is required to build irssi])
fi fi
PROG_LIBS="$PROG_LIBS $GLIB_LIBS" PROG_LIBS="$PROG_LIBS $GLIB_LIBS"
AC_SUBST(PROG_LIBS)
dnl ** dnl **
dnl ** curses checks dnl ** curses checks
@ -237,7 +249,7 @@ else
fi fi
AC_PATH_PROG(sedpath, sed) AC_PATH_PROG(sedpath, sed)
if test "$want_perl" = "yes"; then if test "$want_perl" != "no"; then
AC_PATH_PROG(perlpath, perl) AC_PATH_PROG(perlpath, perl)
AC_MSG_CHECKING(for Perl compile flags) AC_MSG_CHECKING(for Perl compile flags)
@ -246,7 +258,12 @@ if test "$want_perl" = "yes"; then
AC_MSG_RESULT([not found, building without Perl.]) AC_MSG_RESULT([not found, building without Perl.])
want_perl=no want_perl=no
else else
PERL_LDFLAGS="`$perlpath -MExtUtils::Embed -e ldopts` " PERL_LDFLAGS="`$perlpath -MExtUtils::Embed -e ldopts` 2>/dev/null"
if test "$want_perl" != "static"; then
dnl * find libperl.a so we could
libperl_a=`echo $PERL_LDFLAGS|$perlpath -e 'foreach (split(/ /, <STDIN>)) { if (/^-L(.*)/ && -f $1."/libperl.a") { print $1."/libperl.a" } };'`
fi
dnl * Perl 5.004 and older use perl_xxx variables while dnl * Perl 5.004 and older use perl_xxx variables while
dnl * later use PL_perl_xxx variables .. dnl * later use PL_perl_xxx variables ..
@ -255,9 +272,11 @@ if test "$want_perl" = "yes"; then
AC_DEFINE(HAVE_PL_PERL) AC_DEFINE(HAVE_PL_PERL)
fi fi
dnl * dynaloader.a -> libperl_dynaloader.la dnl * don't check dynaloader if libperl.a wasn't found..
dynaloader=`echo $PERL_LDFLAGS | $sedpath 's/.* \([[^ ]]*\.a\).*/\1/'` if test "x$libperl_a" != "x"; then
PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath 's/ [[^ ]]*\.a/ libperl_dynaloader.la/'` dnl * dynaloader.a -> libperl_dynaloader.la
dynaloader=`echo $PERL_LDFLAGS | $sedpath 's/.* \([[^ ]]*\.a\).*/\1/'`
fi
dnl * remove all database stuffs dnl * remove all database stuffs
PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath 's/-ldb //'` PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath 's/-ldb //'`
@ -277,16 +296,26 @@ if test "$want_perl" = "yes"; then
dnl * must not be in LIBADD line dnl * must not be in LIBADD line
PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath 's/-rdynamic //'` PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath 's/-rdynamic //'`
if test "x$dynaloader" = "x"; then if test "x$want_perl" = "xstatic"; then
AC_MSG_RESULT([error parsing ldopts, building without Perl.]) AC_MSG_RESULT(ok)
want_perl=no elif test "x$dynaloader" = "x"; then
AC_MSG_RESULT([error parsing ldopts, building Perl into irssi binary instead of as module])
want_perl=static
else else
AC_MSG_RESULT(ok) AC_MSG_RESULT(ok)
PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath 's/ [[^ ]]*\.a/ libperl_dynaloader.la/'`
AC_SUBST(PERL_CFLAGS) PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath 's/ -lperl/ libperl_orig.la/'`
AC_SUBST(PERL_LDFLAGS)
AC_SUBST(PERL_LIB_DIR)
fi fi
if test "x$want_perl" = "xstatic"; then
PERL_LDFLAGS="../perl/.libs/libperl.a $PERL_LDFLAGS"
PROG_LIBS="$PROG_LIBS $PERL_LDFLAGS"
PERL_LDFLAGS=
AC_DEFINE(HAVE_STATIC_PERL)
fi
AC_SUBST(PERL_LDFLAGS)
AC_SUBST(PERL_CFLAGS)
AC_SUBST(PERL_LIB_DIR)
fi fi
fi fi
@ -296,7 +325,9 @@ AM_CONDITIONAL(BUILD_IRSSIBOT, test "$want_irssibot" = "yes")
AM_CONDITIONAL(BUILD_IRSSIPROXY, test "$want_irssiproxy" = "yes") AM_CONDITIONAL(BUILD_IRSSIPROXY, test "$want_irssiproxy" = "yes")
AM_CONDITIONAL(BUILD_PLUGINS, test "$want_plugins" = "yes") AM_CONDITIONAL(BUILD_PLUGINS, test "$want_plugins" = "yes")
AM_CONDITIONAL(BUILD_SERVERTEST, test "$want_servertest" = "yes") AM_CONDITIONAL(BUILD_SERVERTEST, test "$want_servertest" = "yes")
AM_CONDITIONAL(HAVE_PERL, test "$want_perl" = "yes") AM_CONDITIONAL(HAVE_PERL, test "$want_perl" != "no")
AC_SUBST(PROG_LIBS)
dnl ** dnl **
dnl ** Keep all the libraries here so each frontend doesn't need to dnl ** Keep all the libraries here so each frontend doesn't need to
@ -433,8 +464,8 @@ irssi.spec
irssi-version.h irssi-version.h
irssi-config) irssi-config)
dnl ** for building from objdir dnl ** for building from objdir + linking perl libraries so libtool finds them
if test "x$want_perl" = "xyes"; then if test "x$want_perl" != "xno"; then
old_dir=`pwd` && cd $srcdir && whole_dir=`pwd` && cd $old_dir old_dir=`pwd` && cd $srcdir && whole_dir=`pwd` && cd $old_dir
if test "x$old_dir" != "x$whole_dir"; then if test "x$old_dir" != "x$whole_dir"; then
@ -442,11 +473,14 @@ if test "x$want_perl" = "xyes"; then
ln -sf $file `echo $file|sed "s?$whole_dir/??"` ln -sf $file `echo $file|sed "s?$whole_dir/??"`
done done
fi fi
if test ! -d src/perl/.libs; then
mkdir -p src/perl/.libs dnl * building as module
fi if test "x$want_perl" = "xyes"; then
if test ! -L src/perl/.libs/DynaLoader.a; then if test ! -d src/perl/.libs; then
ln -s $dynaloader src/perl/.libs/DynaLoader.a mkdir -p src/perl/.libs
fi
ln -sf $dynaloader src/perl/.libs/DynaLoader.a
ln -sf $libperl_a src/perl/.libs/libperl_orig.a
fi fi
fi fi
@ -463,7 +497,14 @@ fi
echo "Building irssi bot ......... : $want_irssibot" echo "Building irssi bot ......... : $want_irssibot"
echo "Building irssi proxy ....... : $want_irssiproxy" echo "Building irssi proxy ....... : $want_irssiproxy"
echo "Building with IPv6 support . : $want_ipv6" echo "Building with IPv6 support . : $want_ipv6"
echo "Building with Perl support . : $want_perl" if test "x$want_perl" = "xstatic"; then
echo "Building with Perl support . : static (in irssi binary)"
elif test "x$want_perl" = "xyes"; then
echo "Building with Perl support . : module"
else
echo "Building with Perl support . : no"
fi
if test "x$want_perl" = "xyes"; then if test "x$want_perl" = "xyes"; then
if test "x$PERL_LIB_DIR" = "x"; then if test "x$PERL_LIB_DIR" = "x"; then
echo "Perl library directory ..... : (default - usually /usr/local/lib/perl_site)" echo "Perl library directory ..... : (default - usually /usr/local/lib/perl_site)"

View File

@ -40,6 +40,11 @@
#include <signal.h> #include <signal.h>
#ifdef HAVE_STATIC_PERL
void perl_init(void);
void perl_deinit(void);
#endif
void irc_init(void); void irc_init(void);
void irc_deinit(void); void irc_deinit(void);
@ -105,6 +110,9 @@ static void textui_finish_init(void)
fe_common_core_finish_init(); fe_common_core_finish_init();
fe_common_irc_finish_init(); fe_common_irc_finish_init();
#ifdef HAVE_STATIC_PERL
perl_init();
#endif
signal_emit("irssi init finished", 0); signal_emit("irssi init finished", 0);
screen_refresh_thaw(); screen_refresh_thaw();
@ -127,6 +135,10 @@ static void textui_deinit(void)
gui_entry_deinit(); gui_entry_deinit();
deinit_screen(); deinit_screen();
#ifdef HAVE_STATIC_PERL
perl_deinit();
#endif
theme_unregister(); theme_unregister();
fe_common_irc_deinit(); fe_common_irc_deinit();

View File

@ -1,9 +1,9 @@
moduledir = $(libdir)/irssi/modules moduledir = $(libdir)/irssi/modules
module_LTLIBRARIES = libirssi_perl.la module_LTLIBRARIES = libperl.la
libirssi_perl_la_LDFLAGS = -avoid-version libperl_la_LDFLAGS = -avoid-version
irssi-perl.c: perl-signals.h perl.c: perl-signals.h
INCLUDES = $(GLIB_CFLAGS) \ INCLUDES = $(GLIB_CFLAGS) \
-DSCRIPTDIR=\""$(libdir)/irssi/scripts"\" \ -DSCRIPTDIR=\""$(libdir)/irssi/scripts"\" \
@ -11,8 +11,8 @@ INCLUDES = $(GLIB_CFLAGS) \
-I$(top_srcdir)/src \ -I$(top_srcdir)/src \
-I$(top_srcdir)/src/core -I$(top_srcdir)/src/core
libirssi_perl_la_SOURCES = \ libperl_la_SOURCES = \
irssi-perl.c \ perl.c \
perl-common.c \ perl-common.c \
xsinit.c xsinit.c
@ -54,6 +54,7 @@ IRC_SOURCES = \
EXTRA_DIST = \ EXTRA_DIST = \
libperl_dynaloader.la \ libperl_dynaloader.la \
libperl_orig.la \
get-signals.pl \ get-signals.pl \
$(CORE_SOURCES) \ $(CORE_SOURCES) \
$(IRC_SOURCES) $(IRC_SOURCES)
@ -63,9 +64,9 @@ noinst_HEADERS = \
perl-common.h perl-common.h
all-local: all-local:
for dir in core irc; do cd $$dir && if [ ! -f Makefile ]; then if [ "x$(PERL_LIB_DIR)" = "x" ]; then $(perlpath) Makefile.PL; else $(perlpath) Makefile.PL LIB=$(PERL_LIB_DIR); fi; fi && $(MAKE) && cd ..; done for dir in common irc; do cd $$dir && if [ ! -f Makefile ]; then if [ "x$(PERL_LIB_DIR)" = "x" ]; then $(perlpath) Makefile.PL; else $(perlpath) Makefile.PL LIB=$(PERL_LIB_DIR); fi; fi && $(MAKE) && cd ..; done
install-exec-local: install-exec-local:
for dir in core irc; do cd $$dir && make install && cd ..; done for dir in common irc; do cd $$dir && make install && cd ..; done
libirssi_perl_la_LIBADD = $(PERL_LDFLAGS) libperl_la_LIBADD = $(PERL_LDFLAGS)

View File

@ -1,4 +1,4 @@
#include "../core/module.h" #include "../common/module.h"
#include "irc-servers.h" #include "irc-servers.h"
#include "irc-channels.h" #include "irc-channels.h"

25
src/perl/libperl_orig.la Normal file
View File

@ -0,0 +1,25 @@
# libsilc.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.3.5 (1.385.2.206 2000/05/27 11:12:27)
# The name that we can dlopen(3).
dlname=''
# Names of this library.
library_names=''
# The name of the static archive.
old_library='libperl_orig.a'
# Libraries that this one depends upon.
dependency_libs=''
# Version information for libsilc.
current=0
age=0
revision=0
# Is this an already installed library?
installed=no
# Directory that this library needs to be installed in:
libdir=''

View File

@ -666,7 +666,7 @@ static void irssi_perl_autorun(void)
g_free(path); g_free(path);
} }
void irssi_perl_init(void) void perl_init(void)
{ {
perl_common_init(); perl_common_init();
@ -681,7 +681,7 @@ void irssi_perl_init(void)
irssi_perl_autorun(); irssi_perl_autorun();
} }
void irssi_perl_deinit(void) void perl_deinit(void)
{ {
irssi_perl_stop(); irssi_perl_stop();
perl_common_deinit(); perl_common_deinit();