mirror of
https://github.com/irssi/irssi.git
synced 2024-10-27 05:20:20 -04:00
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:
parent
e2ff4550ea
commit
469fde3618
49
configure.in
49
configure.in
@ -392,11 +392,17 @@ dnl **
|
|||||||
|
|
||||||
if test "$want_perl" != "no"; 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 working Perl support)
|
||||||
|
|
||||||
|
if test "x$perlpath" = "x"; then
|
||||||
|
perl_check_error="perl binary not found"
|
||||||
|
else
|
||||||
|
PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null`
|
||||||
|
fi
|
||||||
|
|
||||||
PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null`
|
|
||||||
if test "x$PERL_CFLAGS" = "x"; then
|
if test "x$PERL_CFLAGS" = "x"; then
|
||||||
AC_MSG_RESULT([not found, building without Perl.])
|
perl_check_error="Error getting perl CFLAGS"
|
||||||
|
AC_MSG_RESULT([not found, building without Perl])
|
||||||
want_perl=no
|
want_perl=no
|
||||||
else
|
else
|
||||||
PERL_LDFLAGS=`$perlpath -MExtUtils::Embed -e ldopts 2>/dev/null`
|
PERL_LDFLAGS=`$perlpath -MExtUtils::Embed -e ldopts 2>/dev/null`
|
||||||
@ -449,6 +455,25 @@ if test "$want_perl" != "no"; 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\( \|$\)//'`
|
||||||
|
|
||||||
|
dnl * check that perl's ldflags actually work
|
||||||
|
AC_CACHE_VAL(irssi_cv_lib_perl_works, [
|
||||||
|
echo "main(){return 0;}" > conftest.c
|
||||||
|
$CC $CFLAGS $LDFLAGS $PERL_LDFLAGS conftest.c -o conftest 2> /dev/null > /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
|
||||||
|
perl_check_error="Error linking with perl libraries: $PERL_LDFLAGS"
|
||||||
|
AC_MSG_RESULT([error linking with perl libraries, building without Perl])
|
||||||
|
want_perl=no
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$want_perl" != "xno"; then
|
||||||
if test "x$want_perl" = "xstatic"; then
|
if test "x$want_perl" = "xstatic"; then
|
||||||
AC_MSG_RESULT(ok)
|
AC_MSG_RESULT(ok)
|
||||||
elif test "x$DYNALOADER_A" = "x"; then
|
elif test "x$DYNALOADER_A" = "x"; then
|
||||||
@ -686,7 +711,12 @@ if test "x$want_perl" = "xstatic"; then
|
|||||||
elif test "x$want_perl" = "xyes"; then
|
elif test "x$want_perl" = "xyes"; then
|
||||||
echo "Building with Perl support . : module"
|
echo "Building with Perl support . : module"
|
||||||
else
|
else
|
||||||
echo "Building with Perl support . : no"
|
if test "x$perl_check_error" = "x"; then
|
||||||
|
echo "Building with Perl support . : no"
|
||||||
|
else
|
||||||
|
echo "Building with Perl support . : NO!"
|
||||||
|
echo " - $perl_check_error"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$perl_mod_error" != "x"; then
|
if test "x$perl_mod_error" != "x"; then
|
||||||
@ -701,12 +731,11 @@ if test "x$want_perl" = "xyes"; then
|
|||||||
else
|
else
|
||||||
echo "Perl library directory ..... : $PERL_LIB_DIR"
|
echo "Perl library directory ..... : $PERL_LIB_DIR"
|
||||||
if test "x$perl_lib_dir_given" != "xyes"; then
|
if test "x$perl_lib_dir_given" != "xyes"; then
|
||||||
echo " - NOTE: This is automatically set to the same directory you gave with"
|
echo " - NOTE: This was automatically set to the same directory you gave with"
|
||||||
echo " --prefix. Irssi's perl scripts do not work unless you also add"
|
echo " --prefix. If you want the perl libraries to install to their 'correct'"
|
||||||
echo " this directory to @INC (or do some other magic)."
|
echo " path, you'll need to give --enable-perl= (nothing after '=') option"
|
||||||
echo " *OR* what you might want to do instead, is to simply give --enable-perl="
|
echo " to configure. Anyway, installing perl to this directory should work"
|
||||||
echo " (nothing after '=') option to configure, and make install will install"
|
echo " just as well.."
|
||||||
echo " the Perl libraries to defaut directory."
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -15,6 +15,7 @@ perl.c: perl-signals-list.h
|
|||||||
|
|
||||||
INCLUDES = $(GLIB_CFLAGS) \
|
INCLUDES = $(GLIB_CFLAGS) \
|
||||||
-DSCRIPTDIR=\""$(libdir)/irssi/scripts"\" \
|
-DSCRIPTDIR=\""$(libdir)/irssi/scripts"\" \
|
||||||
|
-DPERL_LIB_DIR=\""$(PERL_LIB_DIR)"\" \
|
||||||
$(PERL_CFLAGS) \
|
$(PERL_CFLAGS) \
|
||||||
-I$(top_srcdir)/src \
|
-I$(top_srcdir)/src \
|
||||||
-I$(top_srcdir)/src/core
|
-I$(top_srcdir)/src/core
|
||||||
|
@ -72,7 +72,7 @@ static void irssi_perl_start(void)
|
|||||||
" my $sub = <FH>;\n"
|
" my $sub = <FH>;\n"
|
||||||
" close FH;\n"
|
" close FH;\n"
|
||||||
"\n"
|
"\n"
|
||||||
" my $eval = qq{package $package; sub handler { $sub; }};\n"
|
" my $eval = qq{package $package; %s sub handler { $sub; }};\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" # hide our variables within this block\n"
|
" # hide our variables within this block\n"
|
||||||
" my ($filename, $package, $sub);\n"
|
" my ($filename, $package, $sub);\n"
|
||||||
@ -83,6 +83,7 @@ static void irssi_perl_start(void)
|
|||||||
" eval {$package->handler;};\n"
|
" eval {$package->handler;};\n"
|
||||||
" die $@ if $@;\n"
|
" die $@ if $@;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
char *code, *use_code;
|
||||||
|
|
||||||
perl_signals_start();
|
perl_signals_start();
|
||||||
perl_sources = NULL;
|
perl_sources = NULL;
|
||||||
@ -91,7 +92,13 @@ static void irssi_perl_start(void)
|
|||||||
perl_construct(my_perl);
|
perl_construct(my_perl);
|
||||||
|
|
||||||
perl_parse(my_perl, xs_init, 3, args, NULL);
|
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();
|
perl_common_init();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user