hv_fetchs() support
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / Embed.t
index 1340fcd..010d05a 100644 (file)
@@ -20,6 +20,7 @@ $| = 1;
 print "1..9\n";
 my $cc = $Config{'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/;
 my $exe = 'embed_test';
 $exe .= $Config{'exe_ext'} unless $skip_exe;   # Linker will auto-append it
@@ -53,6 +54,9 @@ if ($^O eq 'VMS') {
    if ($cl) {
     push(@cmd,$cc,"-Fe$exe");
    }
+   elsif ($borl) {
+    push(@cmd,$cc,"-o$exe");
+   }
    else {
     push(@cmd,$cc,'-o' => $exe);
    }
@@ -63,23 +67,24 @@ if ($^O eq 'VMS') {
     $inc = File::Spec->catdir($inc,'include');
     push(@cmd,"-I$inc");
     if ($cc eq 'cl') {
-       push(@cmd,'-link',"-libpath:$lib",$Config{'libperl'},$Config{'libc'});
+       push(@cmd,'-link',"-libpath:$lib",$Config{'libperl'},$Config{'libs'});
     }
     else {
        push(@cmd,"-L$lib",File::Spec->catfile($lib,$Config{'libperl'}),$Config{'libc'});
     }
    }
-   else {
+   else { # Not MSWin32.
     push(@cmd,"-L$lib",'-lperl');
-   }
-   {
     local $SIG{__WARN__} = sub {
-       warn $_[0] unless $_[0] =~ /No library found for -lperl/
+       warn $_[0] unless $_[0] =~ /No library found for .*perl/
     };
     push(@cmd, '-Zlinker', '/PM:VIO')  # Otherwise puts a warning to STDOUT!
        if $^O eq 'os2' and $Config{ldflags} =~ /(?<!\S)-Zomf\b/;
     push(@cmd,ldopts());
    }
+   if ($borl) {
+     @cmd = ($cmd[0],(grep{/^-[LI]/}@cmd[1..$#cmd]),(grep{!/^-[LI]/}@cmd[1..$#cmd]));
+   }
 
    if ($^O eq 'aix') { # AIX needs an explicit symbol export list.
     my ($perl_exp) = grep { -f } qw(perl.exp ../perl.exp);
@@ -97,7 +102,7 @@ if ($^O eq 'VMS') {
      # Everyone needs libperl copied if it's not found by '-lperl'.
      $testlib = $Config{'libperl'};
      my $srclib = $testlib;
-     $testlib =~ s/^[^.]+/libperl/;
+     $testlib =~ s/.+(?=\.[^.]*)/libperl/;
      $testlib = File::Spec::->catfile($lib, $testlib);
      $srclib = File::Spec::->catfile($lib, $srclib);
      if (-f $srclib) {
@@ -128,7 +133,7 @@ my $embed_test = File::Spec->catfile(File::Spec->curdir, $exe);
 $embed_test = "run/nodebug $exe" if $^O eq 'VMS';
 print "# embed_test = $embed_test\n";
 $status = system($embed_test);
-print (($status? 'not ':'')."ok 9 # $status\n");
+print (($status? 'not ':'')."ok 9 # system returned $status\n");
 unlink($exe,"embed_test.c",$obj);
 unlink("$exe$Config{exe_ext}") if $skip_exe;
 unlink("embed_test.map","embed_test.lis") if $^O eq 'VMS';
@@ -146,11 +151,29 @@ __END__
 
 #define my_puts(a) if(puts(a) < 0) exit(666)
 
-static char *cmds[] = { "perl","-e", "print qq[ok 5\\n]", NULL };
+static char *cmds[] = { "perl","-e", "$|=1; print qq[ok 5\\n]", NULL };
+
+#ifdef PERL_GLOBAL_STRUCT_PRIVATE
+static struct perl_vars *my_plvarsp;
+struct perl_vars* Perl_GetVarsPrivate(void) { return my_plvarsp; }
+#endif
 
 int main(int argc, char **argv, char **env)
 {
-    PerlInterpreter *my_perl = perl_alloc();
+    PerlInterpreter *my_perl;
+#ifdef PERL_GLOBAL_STRUCT
+    dVAR;
+    struct perl_vars *plvarsp = init_global_struct();
+#  ifdef PERL_GLOBAL_STRUCT_PRIVATE
+    my_vars = my_plvarsp = plvarsp;
+#  endif
+#endif /* PERL_GLOBAL_STRUCT */
+
+    (void)argc; /* PERL_SYS_INIT3 may #define away their use */
+    (void)argv;
+    PERL_SYS_INIT3(&argc,&argv,&env);
+
+    my_perl = perl_alloc();
 
     my_puts("ok 2");
 
@@ -174,11 +197,13 @@ int main(int argc, char **argv, char **env)
 
     perl_free(my_perl);
 
+#ifdef PERL_GLOBAL_STRUCT
+    free_global_struct(plvarsp);
+#endif /* PERL_GLOBAL_STRUCT */
+
     my_puts("ok 8");
 
+    PERL_SYS_TERM();
+
     return 0;
 }
-
-
-
-