From 279cb26adc135669eb9f525bccee92aede997e3a Mon Sep 17 00:00:00 2001
From: Reini Urban <rurban@cpanel.net>
Date: Fri, 27 Sep 2013 12:13:35 -0500
Subject: [PATCH] fix [88936] out of memory with -g3 since 2.062

change -g3 to -g with gcc
---
 Makefile.PL | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Makefile.PL b/Makefile.PL
index d8c060d..aba7abc 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -6,6 +6,7 @@ require 5.006 ;
 use private::MakeUtil;
 use ExtUtils::MakeMaker 5.16 ;
 use ExtUtils::Install (); # only needed to check for version
+use Config;
 
 my $ZLIB_LIB ;
 my $ZLIB_INCLUDE ;
@@ -14,6 +15,10 @@ my $OLD_ZLIB = '' ;
 my $WALL = '' ;
 my $GZIP_OS_CODE = -1 ;
 my $USE_PPPORT_H = ($ENV{PERL_CORE}) ? '' : '-DUSE_PPPORT_H';
+my $OPTIMIZE = $Config{'optimize'};
+if ($Config{'gccversion'} and $OPTIMIZE =~ /-g3/) {
+  $OPTIMIZE =~ s/-g3/-g/; # [88936] out of memory with -g3 since 2.062
+}
 
 #$WALL = ' -pedantic ' if $Config{'cc'} =~ /gcc/ ;
 #$WALL = ' -Wall -Wno-comment ' if $Config{'cc'} =~ /gcc/ ;
@@ -81,7 +86,8 @@ WriteMakefile(
         ? zlib_files($ZLIB_LIB)
         : (LIBS => [ "-L$ZLIB_LIB -lz " ])
     ),
-      
+    OPTIMIZE => $OPTIMIZE,
+
     INSTALLDIRS => ($] >= 5.009 && $] < 5.011 ? 'perl' : 'site'),
 
     META_MERGE => {
-- 
1.8.4.rc3