From 0f49b66e64b3a0a81e1c572af72b45cdc8b452d4 Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kitenet.net>
Date: Thu, 29 Sep 2011 15:37:31 -0400
Subject: [PATCH] setting OPTIMIZE could in theory lead to breakage, so make it
 v9

---
 Debian/Debhelper/Buildsystem/perl_makemaker.pm | 2 +-
 debian/changelog                               | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Debian/Debhelper/Buildsystem/perl_makemaker.pm b/Debian/Debhelper/Buildsystem/perl_makemaker.pm
index a9c7fac..722a12a 100644
--- a/Debian/Debhelper/Buildsystem/perl_makemaker.pm
+++ b/Debian/Debhelper/Buildsystem/perl_makemaker.pm
@@ -46,7 +46,7 @@ sub configure {
 	# This prevents  Module::Install from interactive behavior.
 	$ENV{PERL_AUTOINSTALL}="--skipdeps";
 
-	if ($ENV{CFLAGS}) {
+	if ($ENV{CFLAGS} && ! compat(8)) {
 		push @flags, "OPTIMIZE=$ENV{CFLAGS}";
 	}
 
diff --git a/debian/changelog b/debian/changelog
index 1c4f2c9..c2ec5e0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,8 @@ debhelper (8.9.8) UNRELEASED; urgency=low
   * Clarify description of dh_auto_* -- params. Closes: #642786
   * Mention in debhelper(7) that buildsystem options are typically passed
     to dh. Closes: #643069
+  * perl_makemaker: Pass CFLAGS to Makefile.PL using OPTIMIZE. Closes: #643702
+    (v9 only)
 
  -- Joey Hess <joeyh@debian.org>  Mon, 12 Sep 2011 13:35:52 -0400
 
-- 
2.39.5