From: Sebastian Harl Date: Tue, 10 Feb 2009 20:31:17 +0000 (+0100) Subject: perl plugin, configure: Check for struct mgvtbl.svt_local. X-Git-Tag: collectd-4.6.0~41 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=388dfe0e1f32cf379f30ac6486e4926e8461fcc5;p=collectd.git perl plugin, configure: Check for struct mgvtbl.svt_local. This member has been introduced in Perl 5.10 (I guess). To be able to correctly (statically) initialize the magic tables used to access global variables, we now check for its existence and then initialize the structs accordingly. --- diff --git a/configure.in b/configure.in index 3c57a591..d8cee585 100644 --- a/configure.in +++ b/configure.in @@ -1986,6 +1986,33 @@ then fi AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE, test "x$have_broken_perl_load_module" = "xyes") + +if test "x$with_libperl" = "xyes" +then + SAVE_CFLAGS=$CFLAGS + SAVE_LDFLAGS=$LDFLAGS + CFLAGS="$CFLAGS $PERL_CFLAGS" + LDFLAGS="$LDFLAGS $PERL_LDFLAGS" + + AC_CHECK_MEMBER( + [struct mgvtbl.svt_local], + [have_struct_mgvtbl_svt_local="yes"], + [have_struct_mgvtbl_svt_local="no"], + [ +#include +#include +#include + ]) + + if test "x$have_struct_mgvtbl_svt_local" = "xyes" + then + AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1, + [Define if Perl's struct mgvtbl has member svt_local.]) + fi + + CFLAGS=$SAVE_CFLAGS + LDFLAGS=$SAVE_LDFLAGS +fi # }}} # --with-libpq {{{ diff --git a/src/perl.c b/src/perl.c index 9413d2cb..27abc623 100644 --- a/src/perl.c +++ b/src/perl.c @@ -1576,8 +1576,18 @@ static int g_iv_set (pTHX_ SV *var, MAGIC *mg) return 0; } /* static int g_iv_set (pTHX_ SV *, MAGIC *) */ -static MGVTBL g_pv_vtbl = { g_pv_get, g_pv_set, NULL, NULL, NULL, NULL, NULL }; -static MGVTBL g_iv_vtbl = { g_iv_get, g_iv_set, NULL, NULL, NULL, NULL, NULL }; +static MGVTBL g_pv_vtbl = { + g_pv_get, g_pv_set, NULL, NULL, NULL, NULL, NULL +#if HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL + , NULL +#endif +}; +static MGVTBL g_iv_vtbl = { + g_iv_get, g_iv_set, NULL, NULL, NULL, NULL, NULL +#if HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL + , NULL +#endif +}; /* bootstrap the Collectd module */ static void xs_init (pTHX)