Verify in configure that linking with perl's LDFLAGS actually works. If

perl lib dir is set, add 'use lib "/perl/lib/dir"' before each script
automatically.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1287 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-02-22 20:39:35 +00:00 committed by cras
commit 469fde3618
3 changed files with 49 additions and 12 deletions

View file

@ -15,6 +15,7 @@ perl.c: perl-signals-list.h
INCLUDES = $(GLIB_CFLAGS) \
-DSCRIPTDIR=\""$(libdir)/irssi/scripts"\" \
-DPERL_LIB_DIR=\""$(PERL_LIB_DIR)"\" \
$(PERL_CFLAGS) \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/core

View file

@ -72,7 +72,7 @@ static void irssi_perl_start(void)
" my $sub = <FH>;\n"
" close FH;\n"
"\n"
" my $eval = qq{package $package; sub handler { $sub; }};\n"
" my $eval = qq{package $package; %s sub handler { $sub; }};\n"
" {\n"
" # hide our variables within this block\n"
" my ($filename, $package, $sub);\n"
@ -83,6 +83,7 @@ static void irssi_perl_start(void)
" eval {$package->handler;};\n"
" die $@ if $@;\n"
"}\n";
char *code, *use_code;
perl_signals_start();
perl_sources = NULL;
@ -91,7 +92,13 @@ static void irssi_perl_start(void)
perl_construct(my_perl);
perl_parse(my_perl, xs_init, 3, args, NULL);
perl_eval_pv(eval_file_code, TRUE);
use_code = *PERL_LIB_DIR == '\0' ? "" :
"use lib \""PERL_LIB_DIR"\";";
code = g_strdup_printf(eval_file_code, use_code);
perl_eval_pv(code, TRUE);
g_free(code);
perl_common_init();
}