summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8490780)
raw | patch | inline | side by side (parent: 8490780)
author | Sebastian Harl <sh@tokkee.org> | |
Mon, 2 Feb 2009 11:28:43 +0000 (11:28 +0000) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Thu, 5 Feb 2009 20:10:25 +0000 (21:10 +0100) |
Configure now checks for a broken Perl_load_module() definition as introduced
in Perl 5.10 which incorrectly uses __attribute__nonnull__(3). If that has been
detected, the perl plugin will now be built using -Wno-nonnull, thus ignoring
the warning / error produced by the nonnull attribute.
References: #41
Resolves: #42
in Perl 5.10 which incorrectly uses __attribute__nonnull__(3). If that has been
detected, the perl plugin will now be built using -Wno-nonnull, thus ignoring
the warning / error produced by the nonnull attribute.
References: #41
Resolves: #42
configure.in | patch | blob | history | |
src/Makefile.am | patch | blob | history |
diff --git a/configure.in b/configure.in
index c86b71148e27c0844091b4a16f71818129806cde..18a83b08aafa6ec61f0d209e1e12bf31fbefd883 100644 (file)
--- a/configure.in
+++ b/configure.in
CFLAGS=$SAVE_CFLAGS
LDFLAGS=$SAVE_LDFLAGS
fi
+
+if test "x$with_libperl" = "xyes"
+then
+ SAVE_CFLAGS=$CFLAGS
+ SAVE_LDFLAGS=$LDFLAGS
+ # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
+ # (see issues #41 and #42)
+ CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
+ LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
+
+ AC_CACHE_CHECK([for broken Perl_load_module()],
+ [have_broken_perl_load_module],
+ AC_LINK_IFELSE(
+ AC_LANG_PROGRAM(
+ [[
+#define PERL_NO_GET_CONTEXT
+#include <EXTERN.h>
+#include <perl.h>
+#include <XSUB.h>
+ ]],
+ [[
+ dTHX;
+ load_module (PERL_LOADMOD_NOIMPORT,
+ newSVpv ("Collectd::Plugin::FooBar", 24),
+ Nullsv);
+ ]]),
+ [have_broken_perl_load_module="no"],
+ [have_broken_perl_load_module="yes"]
+ )
+ )
+
+ AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
+ test "x$have_broken_perl_load_module" = "xyes")
+
+ CFLAGS=$SAVE_CFLAGS
+ LDFLAGS=$SAVE_LDFLAGS
+fi
# }}}
# --with-libpq {{{
diff --git a/src/Makefile.am b/src/Makefile.am
index 26db76db24cfcb2ad0788679584d5d16b53d207a..935ed7b5b2b007c040214924953334a757ce428d 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
perl_la_CFLAGS = $(AM_CFLAGS) \
$(PERL_CFLAGS) \
-DXS_VERSION=\"$(VERSION)\" -DVERSION=\"$(VERSION)\"
+# Work-around for issues #41 and #42 - Perl 5.10 incorrectly introduced
+# __attribute__nonnull__(3) for Perl_load_module().
+if HAVE_BROKEN_PERL_LOAD_MODULE
+perl_la_CFLAGS += -Wno-nonnull
+endif
perl_la_LDFLAGS = -module -avoid-version \
$(PERL_LDFLAGS)
collectd_LDADD += "-dlopen" perl.la