5 unshift @INC, '../lib';
12 print "1..0 # not on VMS\n";
15 open(my $fh,">embed_test.c") || die "Cannot open embed_test.c:$!";
21 my $cc = $Config{'cc'};
22 my $cl = ($^O eq 'MSWin32' && $cc eq 'cl');
23 my $exe = 'embed_test' . $Config{'exe_ext'};
24 my $inc = File::Spec->catdir($INC[0],"..");
25 my $lib = File::Spec->catdir($INC[0],"..");
28 push(@cmd,$cc,"-Fe$exe");
31 push(@cmd,$cc,'-o' => $exe);
33 push(@cmd,"-I$inc",ccopts(),'embed_test.c');
34 if ($^O eq 'MSWin32') {
35 $inc = File::Spec->catdir($inc,'win32');
37 $inc = File::Spec->catdir($inc,'include');
40 push(@cmd,'-link',"-libpath:$lib",$Config{'libperl'},$Config{'libc'});
43 push(@cmd,"-L$lib",File::Spec->catfile($lib,$Config{'libperl'}),$Config{'libc'});
47 push(@cmd,"-L$lib",'-lperl');
50 local $SIG{__WARN__} = sub {
51 warn $_[0] unless $_[0] =~ /No library found for -lperl/
56 if ($^O eq 'aix') { # AIX needs an explicit symbol export list.
57 my ($perl_exp) = grep { -f } qw(perl.exp ../perl.exp);
58 die "where is perl.exp?\n" unless defined $perl_exp;
60 s!-bE:(\S+)!-bE:$perl_exp!;
64 print "# @cmd"; # where is the newline coming from? ldopts()?
65 print "not " if system(join(' ',@cmd));
68 my $embed_test = File::Spec->catfile(File::Spec->curdir, "embed_test");
70 print "not " if system($embed_test);
73 unlink($exe,"embed_test.c");
75 # gcc -g -I.. -L../ -o perl_test perl_test.c -lperl `../perl -I../lib -MExtUtils::Embed -I../ -e ccopts -e ldopts`
84 #define my_puts(a) if(puts(a) < 0) exit(666)
86 char *cmds[] = { "perl","-e", "print qq[ok 5\\n]", NULL };
88 int main(int argc, char **argv, char **env)
90 PerlInterpreter *my_perl = perl_alloc();
94 perl_construct(my_perl);
98 perl_parse(my_perl, NULL, (sizeof(cmds)/sizeof(char *))-1, cmds, env);
108 perl_destruct(my_perl);