--- ExtUtils-MakeMaker-7.34/lib/ExtUtils/MM_Unix.pm.App 2018-03-20 10:36:52.338549918 +0200 +++ ExtUtils-MakeMaker-7.34/lib/ExtUtils/MM_Unix.pm 2018-03-20 10:36:52.340549897 +0200 @@ -252,41 +252,45 @@ foreach my $line (@o){ chomp $line; if ($line =~ /(.*?)=\s*(.*)\s*$/){ $cflags{$1} = $2; print " $1 = $2\n" if $Verbose; } else { print "Unrecognised result from hint: '$line'\n"; } } } if ($optdebug) { $cflags{optimize} = $optdebug; } for (qw(ccflags optimize perltype)) { $cflags{$_} ||= ''; $cflags{$_} =~ s/^\s+//; $cflags{$_} =~ s/\s+/ /g; $cflags{$_} =~ s/\s+$//; - $self->{uc $_} ||= $cflags{$_}; + if (/ccflags/ && $self->{uc $_}) { + $self->{uc $_} = "$cflags{$_} " . $self->{uc $_}; + } else { + $self->{uc $_} ||= $cflags{$_}; + } } if ($self->{POLLUTE}) { $self->{CCFLAGS} .= ' -DPERL_POLLUTE '; } for my $x (@ccextraflags) { next unless exists $cflags{$x}; $self->{CCFLAGS} .= $cflags{$x} =~ m!^\s! ? $cflags{$x} : ' ' . $cflags{$x}; } my $pollute = ''; if ($Config{usemymalloc} and not $Config{bincompat5005} and not $Config{ccflags} =~ /-DPERL_POLLUTE_MALLOC\b/ and $self->{PERL_MALLOC_OK}) { $pollute = '$(PERL_MALLOC_DEF)'; } return $self->{CFLAGS} = qq{ CCFLAGS = $self->{CCFLAGS} --- ExtUtils-MakeMaker-7.34/t/MM_Unix.t.App 2018-01-16 12:25:57.000000000 +0200 +++ ExtUtils-MakeMaker-7.34/t/MM_Unix.t 2018-03-20 10:38:58.425231808 +0200 @@ -12,7 +12,7 @@ BEGIN { plan skip_all => 'Non-Unix platform'; } else { - plan tests => 114; + plan tests => 116; } } @@ -21,6 +21,7 @@ BEGIN { use_ok( 'ExtUtils::MM_Unix' ); } use strict; use warnings; use File::Spec; +use Config; my $class = 'ExtUtils::MM_Unix'; @@ -206,29 +207,32 @@ ############################################################################### $t->init_linker; foreach (qw/ EXPORT_LIST PERL_ARCHIVE PERL_ARCHIVE_AFTER /) { ok( exists $t->{$_}, "$_ was defined" ); is( $t->{$_}, '', "$_ is empty on Unix"); } { $t->{CCFLAGS} = '-DMY_THING'; $t->{LIBPERL_A} = 'libperl.a'; $t->{LIB_EXT} = '.a'; local $t->{NEEDS_LINKING} = 1; $t->cflags(); # Brief bug where CCFLAGS was being blown away like( $t->{CCFLAGS}, qr/\-DMY_THING/, 'cflags retains CCFLAGS' ); + + like( $t->{CCFLAGS}, "/\Q$Config{ccflags}\E/", 'cflags does not override $Config{ccflags} with CCFLAGS' ); + like( $t->{CCFLAGS}, '/ -DMY_THING$/', 'cflags appends CCFLAGS to $Config{ccflags}' ); } { my @targv = ("var=don't forget about spaces and single quotes"); local @ARGV = @targv; my $t = bless { NAME => "Foo", FULLPERL => $0, DIR => [] }, $class; $t->makeaperl( TARGET => "Tgt" ); is_deeply( \@ARGV, \@targv, 'ARGV is not polluted by makeaperl' ); }