--- 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 @@ -1,42 +1,43 @@ #!/usr/bin/perl -w BEGIN { unshift @INC, 't/lib'; } chdir 't'; BEGIN { use Test::More; if( $^O =~ /^VMS|os2|MacOS|MSWin32|cygwin|beos|netware$/i ) { plan skip_all => 'Non-Unix platform'; } else { - plan tests => 113; + plan tests => 115; } } BEGIN { use_ok( 'ExtUtils::MM_Unix' ); } use strict; use File::Spec; +use Config; my $class = 'ExtUtils::MM_Unix'; # only one of the following can be true # test should be removed if MM_Unix ever stops handling other OS than Unix my $os = ($ExtUtils::MM_Unix::Is{OS2} || 0) + ($ExtUtils::MM_Unix::Is{Win32} || 0) + ($ExtUtils::MM_Unix::Is{Dos} || 0) + ($ExtUtils::MM_Unix::Is{VMS} || 0); cmp_ok ( $os, '<=', 1, 'There can be only one (or none)'); is($ExtUtils::MM_Unix::VERSION, $ExtUtils::MakeMaker::VERSION, 'MM_Unix has a $VERSION'); # when the following calls like canonpath, catdir etc are replaced by # File::Spec calls, the test's become a bit pointless foreach ( qw( xx/ ./xx/ xx/././xx xx///xx) ) { is ($class->canonpath($_), File::Spec->canonpath($_), "canonpath $_"); } @@ -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' ); }