Ticket #110: autom4te.diff

File autom4te.diff, 2.0 KB (added by Silvan Scherrer, 8 years ago)

adding response file to autom4te

  • autom4te

    old new  
    4141use Autom4te::General;
    4242use Autom4te::XFile;
    4343use File::Basename;
     44use File::Temp;
    4445use strict;
    4546
    4647# Data directory.
     
    6465my $tcache;
    6566my $ocache;
    6667my $icache_file;
     68my $response_fh;
    6769
    6870my $flock_implemented = 'yes';
    6971
     
    231233{
    232234  my (@file) = @_;
    233235  my @res;
     236
     237  if ($^O eq 'os2')
     238    {
     239      # On OS/2, there is a 32K limit on the program arguments size but
     240      # the options may grow more. Use a response file.
     241
     242      $response_fh = new File::Temp(UNLINK => 1);
     243    }
     244
    234245  foreach my $file (@file)
    235246    {
    236247      my $arg = shell_quote ($file);
    237248      if ($file =~ /\.m4f$/)
    238249        {
    239           $arg = "--reload-state=$arg";
     250        if ($^O eq 'os2')
     251          {
     252            $arg = "--reload-state=$arg" ."\n";
     253          }
     254        else
     255          {
     256            $arg = "--reload-state=$arg";
     257          }
    240258          # If the user downgraded M4 from 1.6 to 1.4.x after freezing
    241259          # the file, then we ensure the frozen __m4_version__ will
    242260          # not cause m4_init to make the wrong decision about the
    243261          # current M4 version.
    244           $arg .= " --undefine=__m4_version__"
    245             unless grep {/__m4_version__/} @m4_builtin;
     262        if ($^O eq 'os2')
     263          {
     264            $arg .= "--undefine=__m4_version__"
     265              unless grep {/__m4_version__/} @m4_builtin;
     266          }
     267        else
     268          {
     269            $arg .= "  --undefine=__m4_version__"
     270              unless grep {/__m4_version__/} @m4_builtin;
     271          }
    246272        }
    247       push @res, $arg;
     273        if ($^O eq 'os2')
     274          {
     275            # remove leading and trailing '
     276            $arg =~ s/'//g;
     277            print $response_fh $arg . "\n";
     278          }
     279         else
     280          {
     281            push @res, $arg;
     282          }
    248283    }
     284
     285  if ($^O eq 'os2')
     286    {
     287      $response_fh->flush;
     288      push @res, "\@$response_fh";
     289    }
     290
    249291  return join ' ', @res;
    250292}
    251293