From: Jarkko Hietaniemi Date: Thu, 8 Nov 2001 15:13:15 +0000 (+0000) Subject: The MakeMaker argument () quoting patch that sneaked X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fa048ccd3675cf90652c8154be797442eaa09f9b;p=p5sagit%2Fp5-mst-13.2.git The MakeMaker argument () quoting patch that sneaked in at #12883 didn't handle make macros like this $(...). Leaning toothpicks, we've got them. p4raw-id: //depot/perl@12902 --- diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm index 8b236fc..83b113b 100644 --- a/lib/ExtUtils/MM_Unix.pm +++ b/lib/ExtUtils/MM_Unix.pm @@ -220,6 +220,7 @@ sub ExtUtils::MM_Unix::postamble ; sub ExtUtils::MM_Unix::ppd ; sub ExtUtils::MM_Unix::prefixify ; sub ExtUtils::MM_Unix::processPL ; +sub ExtUtils::MM_Unix::quote_paren ; sub ExtUtils::MM_Unix::realclean ; sub ExtUtils::MM_Unix::replace_manpage_separator ; sub ExtUtils::MM_Unix::static ; @@ -397,8 +398,8 @@ sub cflags { $pollute = '$(PERL_MALLOC_DEF)'; } - $self->{CCFLAGS} =~ s/([()])/\\$1/g; - $self->{OPTIMIZE} =~ s/([()])/\\$1/g; + $self->{CCFLAGS} = quote_paren($self->{CCFLAGS}); + $self->{OPTIMIZE} = quote_paren($self->{CCFLAGS}); return $self->{CFLAGS} = qq{ CCFLAGS = $self->{CCFLAGS} @@ -505,8 +506,7 @@ sub const_config { foreach $m (@{$self->{CONFIG}}){ # SITE*EXP macros are defined in &constants; avoid duplicates here next if $once_only{$m} or $m eq 'sitelibexp' or $m eq 'sitearchexp'; - $self->{uc $m} =~ s/([()])/\\$1/g; - push @m, "\U$m\E = ".$self->{uc $m}."\n"; + push @m, uc($m) , ' = ' , quote_paren($self->{uc $m}), "\n"; $once_only{$m} = 1; } join('', @m); @@ -3160,6 +3160,22 @@ $target :: $plfile join "", @m; } +=item quote_paren + +Backslashes parentheses C<()> in command line arguments. +Doesn't handle recursive Makefile C<$(...)> constructs, +but handles simple ones. + +=cut + +sub quote_paren { + local $_ = shift; + s/\$\((.+?)\)/\$\\\\($1\\\\)/g; # protect $(...) + s/(?