From 432969a3a96790f92ea0097795a36cfbf264999d Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sat, 9 Dec 2006 20:26:06 +0200 Subject: [PATCH] Bug 788: Define n_a variables if the POPpx macro of Perl needs them. The configure script checks whether it is possible to compile a use of POPpx without an n_a variable; if not, the source code then defines those variables. This is slower than including Perl's patchlevel.h and comparing the version numbers to 5.8.8 but I expect this to be more reliable as well. --- configure.in | 16 +++++++++++++++- src/scripting/perl/hooks.c | 9 +++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 6e4851ad..eba8a7a3 100644 --- a/configure.in +++ b/configure.in @@ -783,6 +783,21 @@ if test "$enable_perl" = "yes"; then cf_result=yes, cf_result=no) fi +if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi + +AC_MSG_CHECKING([whether POPpx works without an n_a variable]) +AC_TRY_COMPILE([ +#include +#include +extern PerlInterpreter *my_perl; +], + [dSP; (void) POPpx;], + [AC_MSG_RESULT([yes]) +AC_DEFINE([CONFIG_PERL_POPPX_WITHOUT_N_A], [1], + [Define if using Perl 5.8.8 or later, where the "POPpx" macro +no longer needs an "n_a" variable like it did in 5.8.7])], + [AC_MSG_RESULT([no])]) + if test "$cf_result" != "yes"; then EL_RESTORE_FLAGS else @@ -793,7 +808,6 @@ else AC_SUBST(PERL_CFLAGS) fi -if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi dnl =================================================================== dnl Check for Python dnl =================================================================== diff --git a/src/scripting/perl/hooks.c b/src/scripting/perl/hooks.c index 9a833124..487945fa 100644 --- a/src/scripting/perl/hooks.c +++ b/src/scripting/perl/hooks.c @@ -44,6 +44,9 @@ do_script_hook_goto_url(struct session *ses, unsigned char **url) if (SvTRUE(ERRSV)) count = 0; /* FIXME: error message ? */ SPAGAIN; if (count == 1) { +#ifndef CONFIG_PERL_POPPX_WITHOUT_N_A + STRLEN n_a; /* Used by POPpx macro. */ +#endif unsigned char *new_url = POPpx; if (new_url) { @@ -89,6 +92,9 @@ do_script_hook_follow_url(unsigned char **url) if (SvTRUE(ERRSV)) count = 0; /* FIXME: error message ? */ SPAGAIN; if (count == 1) { +#ifndef CONFIG_PERL_POPPX_WITHOUT_N_A + STRLEN n_a; /* Used by POPpx macro. */ +#endif unsigned char *new_url = POPpx; if (new_url) { @@ -185,6 +191,9 @@ do_script_hook_get_proxy(unsigned char **new_proxy_url, unsigned char *url) (void) POPs; mem_free_set(new_proxy_url, NULL); } else { +#ifndef CONFIG_PERL_POPPX_WITHOUT_N_A + STRLEN n_a; /* Used by POPpx macro. */ +#endif unsigned char *new_url = POPpx; mem_free_set(new_proxy_url, stracpy(new_url));