make sure we pickup the correct config.h ... -- Blair Zajac blair orcaware.com
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Sun, 15 Jan 2006 13:31:12 +0000 (13:31 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Sun, 15 Jan 2006 13:31:12 +0000 (13:31 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@748 a5681a0c-68f1-0310-ab6d-d61299d08faa

bindings/perl-shared/RRDs.xs

index f7e5360..76f86b8 100644 (file)
@@ -10,7 +10,25 @@ extern "C" {
 }
 #endif
 
+/*
+ * rrd_tool.h includes config.h, but at least on Ubuntu Breezy Badger
+ * 5.10 with gcc 4.0.2, the C preprocessor picks up Perl's config.h
+ * which is included from the Perl includes and never reads rrdtool's
+ * config.h.  Without including rrdtool's config.h, this module does
+ * not compile, so include it here with an explicit path.
+ *
+ * Because rrdtool's config.h redefines VERSION which is originally
+ * set via Perl's Makefile.PL and passed down to the C compiler's
+ * command line, save the original value and reset it after the
+ * includes.
+ */
+#define VERSION_SAVED VERSION
+#undef VERSION
+#include "../../config.h"
 #include "../../src/rrd_tool.h"
+#undef VERSION
+#define VERSION VERSION_SAVED
+#undef VERSION_SAVED
 
 /* perl 5.004 compatibility */
 #if PERLPATCHLEVEL < 5