From: Nick Ing-Simmons Date: Sun, 28 Oct 2001 11:05:35 +0000 (+0000) Subject: Fixup Embed.t for Win32/VC++ X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1091dea485b700b0121770b0cbb0ffa417266d9e;p=p5sagit%2Fp5-mst-13.2.git Fixup Embed.t for Win32/VC++ p4raw-id: //depot/perlio@12730 --- diff --git a/lib/ExtUtils/Embed.t b/lib/ExtUtils/Embed.t index 618fb9c..fb66102 100644 --- a/lib/ExtUtils/Embed.t +++ b/lib/ExtUtils/Embed.t @@ -6,6 +6,7 @@ BEGIN { } use Config; use ExtUtils::Embed; +use File::Spec; open(my $fh,">embed_test.c") || die "Cannot open embed_test.c:$!"; print $fh ; @@ -13,11 +14,38 @@ close($fh); $| = 1; print "1..9\n"; -my @cmd = ($Config{'cc'},-o => 'embed_test',"-I$INC[0]/..", - ccopts(), - 'embed_test.c',"-L$INC[0]/..",'-lperl',ldopts() - ); -#print "#@cmd\n"; +my $cc = $Config{'cc'}; +my $cl = ($^O eq 'MSWin32' && $cc eq 'cl'); +my $exe = 'embedtest' . $Config{'exe_ext'}; +my $inc = File::Spec->catdir($INC[0],".."); +my $lib = File::Spec->catdir($INC[0],".."); +my @cmd; +if ($cl) { + push(@cmd,$cc,"-Fe$exe"); +} +else { + push(@cmd,$cc,'-o' => $exe); +} +push(@cmd,"-I$inc",ccopts(),'embed_test.c'); +if ($^O eq 'MSWin32') { + $inc = File::Spec->catdir($inc,'win32'); + push(@cmd,"-I$inc"); + $inc = File::Spec->catdir($inc,'include'); + push(@cmd,"-I$inc"); + if ($cc eq 'cl') { + push(@cmd,'-link',"-libpath:$lib",$Config{'libperl'},$Config{'libc'}); + } + else { + push(@cmd,"-L$lib",'-lperl',$Config{'libc'}); + } +} +else { + push(@cmd,"-L$lib",'-lperl'); +} +push(@cmd,ldopts()); + + +print "#@cmd\n"; print "not " if system(join(' ',@cmd)); print "ok 1\n"; print "not " if system("embed_test");