6 chdir '../lib/ExtUtils/CBuilder'
7 or die "Can't chdir to lib/ExtUtils/CBuilder: $!";
16 # So we can get the return value of system()
21 use ExtUtils::CBuilder;
24 # TEST doesn't like extraneous output
25 my $quiet = $ENV{PERL_CORE} && !$ENV{HARNESS_ACTIVE};
26 my ($source_file, $object_file, $lib_file);
28 my $b = ExtUtils::CBuilder->new(quiet => $quiet);
31 if ( ! $b->have_compiler ) {
32 plan skip_all => "no compiler available for testing";
38 ok $b, "created EU::CB object";
40 ok $b->have_compiler, "have_compiler";
42 $source_file = File::Spec->catfile('t', 'compilet.c');
45 open FH, "> $source_file" or die "Can't create $source_file: $!";
46 print FH "int boot_compilet(void) { return 1; }\n";
49 ok -e $source_file, "source file '$source_file' created";
51 $object_file = $b->object_file($source_file);
54 is $object_file, $b->compile(source => $source_file);
56 $lib_file = $b->lib_file($object_file);
59 my ($lib, @temps) = $b->link(objects => $object_file,
60 module_name => 'compilet');
64 for ($source_file, $object_file, $lib_file) {
70 1 while unlink 'COMPILET.LIS';
71 1 while unlink 'COMPILET.OPT';
74 my @words = $b->split_like_shell(' foo bar');
77 skip "MSWindows", 3 if $^O =~ m/MSWin/;
79 is( $words[0], 'foo' );
80 is( $words[1], 'bar' );