cvs commit: ponie/perl/lib/ExtUtils/t Embed.t

[email protected] (Nicholas Clark) 2 May 2004 22:05:49 -0000
Newsgroups perl.ponie.changes
Message-ID <[email protected]>
cvsuser     04/05/02 15:05:49

  Modified:    perl/lib/ExtUtils/t Embed.t
  Log:
  Part 2 of fixing ExtUtils/t/Embed.t - split the compile-and-link (with
  $Config{cc}) into a compile with $Config{cc} and a link with the new-fangled
  $Config{link}
  
  Now passes on OS X. Which just leaves me needing a big enough LART to make
  OS X warm to the idea of execve while multiple threads are running.
  
  Revision  Changes    Path
  1.2       +25 -18    ponie/perl/lib/ExtUtils/t/Embed.t
  
  Index: Embed.t
  ===================================================================
  RCS file: /cvs/public/ponie/perl/lib/ExtUtils/t/Embed.t,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- Embed.t	9 Sep 2003 11:59:24 -0000	1.1
  +++ Embed.t	2 May 2004 22:05:49 -0000	1.2
  @@ -19,6 +19,7 @@
   $| = 1;
   print "1..9\n";
   my $cc = $Config{'cc'};
  +my $link = $Config{'link'} || $cc;
   my $cl  = ($^O eq 'MSWin32' && $cc eq 'cl');
   my $borl  = ($^O eq 'MSWin32' && $cc eq 'bcc32');
   my $skip_exe = $^O eq 'os2' && $Config{ldflags} =~ /(?<!\S)-Zexe\b/;
  @@ -29,11 +30,11 @@
   my $lib = File::Spec->updir;
   my $libperl_copied;
   my $testlib;
  +my @cmd0;
   my @cmd;
  -my (@cmd2) if $^O eq 'VMS';
   
   if ($^O eq 'VMS') {
  -    push(@cmd,$cc,"/Obj=$obj");
  +    push(@cmd0,$cc,"/Obj=$obj");
       my (@incs) = ($inc);
       my $crazy = ccopts();
       if ($crazy =~ s#/inc[^=/]*=([\w\$\_\-\.\[\]\:]+)##i) {
  @@ -43,29 +44,33 @@
           push(@incs,$1);
       }
       $crazy =~ s#/Obj[^=/]*=[\w\$\_\-\.\[\]\:]+##i;
  -    push(@cmd,"/Include=(".join(',',@incs).")");
  -    push(@cmd,$crazy);
  -    push(@cmd,"embed_test.c");
  +    push(@cmd0,"/Include=(".join(',',@incs).")");
  +    push(@cmd0,$crazy);
  +    push(@cmd0,"embed_test.c");
   
  -    push(@cmd2,$Config{'ld'}, $Config{'ldflags'}, "/exe=$exe"); 
  -    push(@cmd2,"$obj,[-]perlshr.opt/opt,[-]perlshr_attr.opt/opt");
  +    push(@cmd,$Config{'ld'}, $Config{'ldflags'}, "/exe=$exe"); 
  +    push(@cmd,"$obj,[-]perlshr.opt/opt,[-]perlshr_attr.opt/opt");
   
   } else {
  +  push @cmd0, $cc;
      if ($cl) {
  -    push(@cmd,$cc,"-Fe$exe");
  +    push(@cmd,$link,"-Fe$exe");
      }
      elsif ($borl) {
  -    push(@cmd,$cc,"-o$exe");
  +    push(@cmd,$link,"-o$exe");
      }
      else {
  -    push(@cmd,$cc,'-o' => $exe);
  +    push(@cmd,$link,'-o' => $exe);
      }
  -   push(@cmd,"-I$inc",ccopts(),'embed_test.c');
  +   # Messy hacks to do this as a 2 stage (.c -> .o then link the .o)
  +   push @cmd, $obj;
  +
  +   push(@cmd0, '-o', $obj, "-I$inc",ccopts(), '-c', 'embed_test.c');
      if ($^O eq 'MSWin32') {
       $inc = File::Spec->catdir($inc,'win32');
  -    push(@cmd,"-I$inc");
  +    push(@cmd0,"-I$inc");
       $inc = File::Spec->catdir($inc,'include');
  -    push(@cmd,"-I$inc");
  +    push(@cmd0,"-I$inc");
       if ($cc eq 'cl') {
   	push(@cmd,'-link',"-libpath:$lib",$Config{'libperl'},$Config{'libs'});
       }
  @@ -116,16 +121,18 @@
   }
   my $status;
   # On OS/2 the linker will always emit an empty line to STDOUT; filter these
  -my $cmd = join ' ', @cmd;
  +my $cmd = join ' ', @cmd0;
   chomp($cmd); # where is the newline coming from? ldopts()?
  -print "# $cmd\n";
  +print "# cmd0: $cmd\n";
   my @out = `$cmd`;
   $status = $?;
   print "# $_\n" foreach @out;
   
  -if ($^O eq 'VMS' && !$status) {
  -  print "# @cmd2\n";
  -  $status = system(join(' ',@cmd2)); 
  +if (@cmd && !$status) {
  +  $cmd = join ' ', @cmd;
  +  chomp $cmd; # Pesky ldopts has \n
  +  print "# cmd: $cmd\n";
  +  $status = system($cmd);
   }
   print (($status? 'not ': '')."ok 1\n");