5 unshift @INC, '../lib';
11 open(my $fh,">embed_test.c") || die "Cannot open embed_test.c:$!";
17 my $cc = $Config{'cc'};
18 my $cl = ($^O eq 'MSWin32' && $cc eq 'cl');
19 my $exe = 'embed_test' . $Config{'exe_ext'};
20 my $inc = File::Spec->catdir($INC[0],"..");
21 my $lib = File::Spec->catdir($INC[0],"..");
24 push(@cmd,$cc,"-Fe$exe");
27 push(@cmd,$cc,'-o' => $exe);
29 push(@cmd,"-I$inc",ccopts(),'embed_test.c');
30 if ($^O eq 'MSWin32') {
31 $inc = File::Spec->catdir($inc,'win32');
33 $inc = File::Spec->catdir($inc,'include');
36 push(@cmd,'-link',"-libpath:$lib",$Config{'libperl'},$Config{'libc'});
39 push(@cmd,"-L$lib",File::Spec->catfile($lib,$Config{'libperl'}),$Config{'libc'});
43 push(@cmd,"-L$lib",'-lperl');
47 print "# @cmd"; # where is the newline coming from? ldopts()?
48 print "not " if system(join(' ',@cmd));
51 my $embed_test = File::Spec->catfile(File::Spec->curdir, "embed_test");
53 print "not " if system($embed_test);
56 unlink($exe,"embed_test.c");
58 # gcc -g -I.. -L../ -o perl_test perl_test.c -lperl `../perl -I../lib -MExtUtils::Embed -I../ -e ccopts -e ldopts`
67 #define my_puts(a) if(puts(a) < 0) exit(666)
69 char *cmds[] = { "perl","-e", "print qq[ok 5\\n]", NULL };
71 int main(int argc, char **argv, char **env)
73 PerlInterpreter *my_perl = perl_alloc();
77 perl_construct(my_perl);
81 perl_parse(my_perl, NULL, (sizeof(cmds)/sizeof(char *))-1, cmds, env);
91 perl_destruct(my_perl);