Upgrade to ExtUtils::MakeMaker 6.52
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / Embed.t
index 1c82cd9..2aece54 100644 (file)
@@ -31,11 +31,14 @@ my $libperl_copied;
 my $testlib;
 my @cmd;
 my (@cmd2) if $^O eq 'VMS';
-
+# Don't use ccopts() here as we may want to overwrite an existing
+# perl with a new one with inconsistent header files, meaning
+# the usual value for perl_inc(), which is used by ccopts(),
+# will be wrong.
 if ($^O eq 'VMS') {
     push(@cmd,$cc,"/Obj=$obj");
     my (@incs) = ($inc);
-    my $crazy = ccopts();
+    my $crazy = ccflags();
     if ($crazy =~ s#/inc[^=/]*=([\w\$\_\-\.\[\]\:]+)##i) {
         push(@incs,$1);
     }
@@ -60,7 +63,14 @@ if ($^O eq 'VMS') {
    else {
     push(@cmd,$cc,'-o' => $exe);
    }
-   push(@cmd,"-I$inc",ccopts(),'embed_test.c');
+   if ($^O eq 'dec_osf' && !defined $Config{usedl}) {
+       # The -non_shared is needed in case of -Uusedl or otherwise
+       # the test application will try to use libperl.so
+       # instead of libperl.a.
+       push @cmd, "-non_shared";
+   }
+
+   push(@cmd,"-I$inc",ccflags(),'embed_test.c');
    if ($^O eq 'MSWin32') {
     $inc = File::Spec->catdir($inc,'win32');
     push(@cmd,"-I$inc");
@@ -73,7 +83,9 @@ if ($^O eq 'VMS') {
        push(@cmd,"-L$lib",File::Spec->catfile($lib,$Config{'libperl'}),$Config{'libc'});
     }
    }
-   else { # Not MSWin32.
+   elsif ($^O eq 'os390' && $Config{usedl}) {
+    # Nothing for OS/390 (z/OS) dynamic.
+   } else { # Not MSWin32 or OS/390 (z/OS) dynamic.
     push(@cmd,"-L$lib",'-lperl');
     local $SIG{__WARN__} = sub {
        warn $_[0] unless $_[0] =~ /No library found for .*perl/
@@ -93,10 +105,8 @@ if ($^O eq 'VMS') {
         s!-bE:(\S+)!-bE:$perl_exp!;
     }
    }
-   elsif ($^O eq 'cygwin') { # Cygwin needs the shared libperl copied
-     my $v_e_r_s = $Config{version};
-     $v_e_r_s =~ tr/./_/;
-     system("cp ../cygperl$v_e_r_s.dll ./");    # for test 1
+   elsif ($^O eq 'cygwin') { # Cygwin needs no special treatment like below
+       ;
    }
    elsif ($Config{'libperl'} !~ /\Alibperl\./) {
      # Everyone needs libperl copied if it's not found by '-lperl'.
@@ -125,7 +135,7 @@ print "# $_\n" foreach @out;
 
 if ($^O eq 'VMS' && !$status) {
   print "# @cmd2\n";
-  $status = system(join(' ',@cmd2)); 
+  $status = system(join(' ',@cmd2));
 }
 print (($status? 'not ': '')."ok 1\n");
 
@@ -135,13 +145,13 @@ print "# embed_test = $embed_test\n";
 $status = system($embed_test);
 print (($status? 'not ':'')."ok 9 # system returned $status\n");
 unlink($exe,"embed_test.c",$obj);
+unlink("$exe.manifest") if $cl and $Config{'ccversion'} =~ /^(\d+)/ and $1 >= 14;
 unlink("$exe$Config{exe_ext}") if $skip_exe;
 unlink("embed_test.map","embed_test.lis") if $^O eq 'VMS';
 unlink(glob("./*.dll")) if $^O eq 'cygwin';
 unlink($testlib)              if $libperl_copied;
 
-# gcc -g -I.. -L../ -o perl_test perl_test.c -lperl `../perl -I../lib -MExtUtils::Embed -I../ -e ccopts -e ldopts`
-
+# gcc -g -I.. -L../ -o perl_test perl_test.c -lperl `../perl -I../lib -MExtUtils::Embed -I../ -e ccflags -e ldopts`
 __END__
 
 /* perl_test.c */
@@ -151,15 +161,19 @@ __END__
 
 #define my_puts(a) if(puts(a) < 0) exit(666)
 
-static char *cmds[] = { "perl","-e", "$|=1; print qq[ok 5\\n]", NULL };
+static const 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)
-{
+#ifdef NO_ENV_ARRAY_IN_MAIN
+int main(int argc, char **argv) {
+    char **env;
+#else
+int main(int argc, char **argv, char **env) {
+#endif
     PerlInterpreter *my_perl;
 #ifdef PERL_GLOBAL_STRUCT
     dVAR;
@@ -168,8 +182,10 @@ int main(int argc, char **argv, char **env)
     my_vars = my_plvarsp = plvarsp;
 #  endif
 #endif /* PERL_GLOBAL_STRUCT */
-    
-    PERL_SYS_INIT3(&argc,&argv,&env);
+
+    (void)argc; /* PERL_SYS_INIT3 may #define away their use */
+    (void)argv;
+    PERL_SYS_INIT3(&argc, &argv, &env);
 
     my_perl = perl_alloc();
 
@@ -179,7 +195,7 @@ int main(int argc, char **argv, char **env)
 
     my_puts("ok 3");
 
-    perl_parse(my_perl, NULL, (sizeof(cmds)/sizeof(char *))-1, cmds, env);
+    perl_parse(my_perl, NULL, (sizeof(cmds)/sizeof(char *))-1, (char **)cmds, env);
 
     my_puts("ok 4");