7 # So we can get the return value of system()
12 use ExtUtils::CBuilder;
15 # TEST does not like extraneous output
16 my $quiet = $ENV{PERL_CORE} && !$ENV{HARNESS_ACTIVE};
17 my ($source_file, $object_file, $lib_file);
19 my $b = ExtUtils::CBuilder->new(quiet => $quiet);
22 if ( ! $b->have_cplusplus ) {
23 plan skip_all => "no compiler available for testing";
29 ok $b, "created EU::CB object";
31 ok $b->have_cplusplus, "have_cplusplus";
33 $source_file = File::Spec->catfile('t', 'cplust.cc');
35 open my $FH, '>', $source_file or die "Can't create $source_file: $!";
36 print $FH "class Bogus { public: int boot_cplust() { return 1; } };\n";
39 ok -e $source_file, "source file '$source_file' created";
41 $object_file = $b->object_file($source_file);
44 is $object_file, $b->compile(source => $source_file, 'C++' => 1);
46 $lib_file = $b->lib_file($object_file, module_name => 'cplust');
49 my ($lib, @temps) = $b->link(objects => $object_file,
50 module_name => 'cplust');
52 $_ = File::Spec->rel2abs($_) for $lib_file, $lib;
55 for ($source_file, $object_file, $lib_file) {
61 1 while unlink 'CPLUST.LIS';
62 1 while unlink 'CPLUST.OPT';