Hi !
Fixes following issues:
a) perl.c does not compile with threaded perl
at all.
b) using dSP; before perl-init (great idea !)
causes segfault at least on threaded perl 5.8.0
This patch should not have side effects
even for old Perls without thread support
so apply it blindly :)
please cc me if you have comments, i'm not
subscribed.
If your name is Mark Baker: would be cool
if exim and exim-perl deb's would exists
I hate to maintain a separate tree results
in putting exim on hold which blocks perl.
I suggest to split up the stuff
in exim-base, exim-default, exim-perl and eximon
where exim-default and exim-perl only contain
the binary (both should maybe Provides: exim, mail-transport-agent)
because I guess that some packages depend explicitly on exim.
Would you accept a related patch (sid ?) if I promise to support
the perl part (which is quite easy, not too much more than a
editme-perl-diff) ? I use my exim-perl stuff on ia32/axp/sparc64.
--- exim-3.36.orig/src/perl.c
+++ exim-3.36/src/perl.c
@@ -4,6 +4,7 @@
/* Copyright (c) 1998 Malcolm Beattie */
/* Modified by PH to get rid of the "na" usage, March 1999 */
+/* Threaded perl support added by stefan@???, Nov 2002 */
/* This Perl add-on can be distributed under the same terms as Exim itself. */
/* See the file NOTICE for conditions of use and distribution. */
@@ -27,7 +28,19 @@
#define ERRSV (GvSV(errgv))
#endif
-extern void boot_DynaLoader(CV *cv);
+/* some people like very old perl versions */
+/* so avoid any build side-effects */
+
+#ifndef pTHX
+# define pTHX
+# define pTHX_
+#endif
+#ifndef EXTERN_C
+# define EXTERN_C extern
+#endif
+
+
+EXTERN_C void boot_DynaLoader(pTHX_ CV *cv);
static PerlInterpreter *interp_perl = 0;
@@ -49,7 +62,7 @@
expand_string_message);
}
-static void xs_init(void)
+static void xs_init(pTHX)
{
char *file = __FILE__;
newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
@@ -59,7 +72,6 @@
char *
init_perl(char *startup_code)
{
- dSP;
/***
static int argc = 3;
static char *argv[4] = { "exim-perl", "-e", "0", 0 };
@@ -74,12 +86,15 @@
perl_construct(interp_perl);
perl_parse(interp_perl, xs_init, argc, argv, 0);
perl_run(interp_perl);
- sv = newSVpv(startup_code, 0);
- PUSHMARK(SP);
- perl_eval_sv(sv, G_SCALAR|G_DISCARD|G_KEEPERR);
- SvREFCNT_dec(sv);
- if (SvTRUE(ERRSV)) return SvPV(ERRSV, len);
- return 0;
+ {
+ dSP;
+ sv = newSVpv(startup_code, 0);
+ PUSHMARK(SP);
+ perl_eval_sv(sv, G_SCALAR|G_DISCARD|G_KEEPERR);
+ SvREFCNT_dec(sv);
+ if (SvTRUE(ERRSV)) return SvPV(ERRSV, len);
+ return 0;
+ }
}
void
--
ciao -
Stefan