OS/390 cleanable gunk.
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / MM_Unix.pm
index 7392012..da84461 100644 (file)
@@ -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,6 +398,9 @@ sub cflags {
        $pollute = '$(PERL_MALLOC_DEF)';
     }
 
+    $self->{CCFLAGS}  = quote_paren($self->{CCFLAGS});
+    $self->{OPTIMIZE} = quote_paren($self->{CCFLAGS});
+
     return $self->{CFLAGS} = qq{
 CCFLAGS = $self->{CCFLAGS}
 OPTIMIZE = $self->{OPTIMIZE}
@@ -455,7 +459,7 @@ EOT
                         *$(OBJ_EXT) *$(LIB_EXT) perl.exe perl perl$(EXE_EXT)
                         $(BOOTSTRAP) $(BASEEXT).bso
                         $(BASEEXT).def lib$(BASEEXT).def
-                        $(BASEEXT).exp
+                        $(BASEEXT).exp $(BASEEXT).x
                        ]);
     push @m, "\t-$self->{RM_RF} @otherfiles\n";
     # See realclean and ext/utils/make_ext for usage of Makefile.old
@@ -502,7 +506,8 @@ 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';
-       push @m, "\U$m\E = ".$self->{uc $m}."\n";
+       $self->{uc $m} = quote_paren($self->{uc $m});
+       push @m, uc($m) , ' = ' , $self->{uc $m}, "\n";
        $once_only{$m} = 1;
     }
     join('', @m);
@@ -1796,7 +1801,7 @@ usually solves this kind of problem.
     $self->{INST_SCRIPT} ||= $self->catdir($self->curdir,'blib','script');
 
     # The user who requests an installation directory explicitly
-    # should not have to tell us a architecture installation directory
+    # should not have to tell us an architecture installation directory
     # as well. We look if a directory exists that is named after the
     # architecture. If not we take it as a sign that it should be the
     # same as the requested installation directory. Otherwise we take
@@ -2787,7 +2792,6 @@ sub parse_version {
        next if $inpod || /^\s*#/;
        chop;
        # next unless /\$(([\w\:\']*)\bVERSION)\b.*\=/;
-       next if /^\s*?\#/;
        next unless /([\$*])(([\w\:\']*)\bVERSION)\b.*\=/;
        my $eval = qq{
            package ExtUtils::MakeMaker::_version;
@@ -3065,15 +3069,36 @@ destination and autosplits them. See L<ExtUtils::Install/DESCRIPTION>
 
 =cut
 
+sub _pm_to_blib_flush {
+    my ($self, $autodir, $rr, $ra, $rl) = @_;
+    $$rr .= 
+q{     }.$self->{NOECHO}.q[$(PERLRUNINST) -MExtUtils::Install \
+       -e "pm_to_blib({qw{].qq[@$ra].q[}},'].$autodir.q{','$(PM_FILTER)')"
+};
+    @$ra = ();
+    $$rl = 0;
+}
+
 sub pm_to_blib {
     my $self = shift;
     my($autodir) = $self->catdir('$(INST_LIB)','auto');
-    return q{
+    my $r = q{
 pm_to_blib: $(TO_INST_PM)
-       }.$self->{NOECHO}.q{$(PERLRUNINST) -MExtUtils::Install \
-        -e "pm_to_blib({qw{$(PM_TO_BLIB)}},'}.$autodir.q{','$(PM_FILTER)')"
-       }.$self->{NOECHO}.q{$(TOUCH) $@
 };
+    my %pm_to_blib = %{$self->{PM}};
+    my @a;
+    my $l;
+    while (my ($pm, $blib) = each %pm_to_blib) {
+       my $la = length $pm;
+       my $lb = length $blib;
+       if ($l + $la + $lb + @a / 2 > 200) { # limit line length
+           _pm_to_blib_flush($self, $autodir, \$r, \@a, \$l);
+        }
+        push @a, $pm, $blib;
+       $l += $la + $lb;
+    }
+    _pm_to_blib_flush($self, $autodir, \$r, \@a, \$l);
+    return $r.q{       }.$self->{NOECHO}.q{$(TOUCH) $@};
 }
 
 =item post_constants (o)
@@ -3157,6 +3182,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/(?<!\\)([()])/\\$1/g;            # quote unprotected
+    s/\$\\\\\((.+?)\\\\\)/\$($1)/g;    # unprotect $(...)
+    return $_;
+}
+
 =item realclean (o)
 
 Defines the realclean target.