Update of /cvsroot/module-build/Module-Build/t/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20993/t/lib
Modified Files:
MBTest.pm
Log Message:
Changes from Yitzchak to make us core-able
Index: MBTest.pm
===================================================================
RCS file: /cvsroot/module-build/Module-Build/t/lib/MBTest.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- MBTest.pm 29 Dec 2005 03:04:22 -0000 1.2
+++ MBTest.pm 9 Jan 2006 01:18:15 -0000 1.3
@@ -13,6 +13,19 @@
# Make sure none of our tests load the users ~/.modulebuildrc file
$ENV{MODULEBUILDRC} = 'NONE';
+
+ if ($ENV{PERL_CORE}) {
+ # We change directories, so expand @INC to absolute paths
+ # Also add .
+ @INC = (map(File::Spec->rel2abs($_), @INC), ".");
+
+ # we are in 't', go up a level so we don't create t/t/_tmp
+ chdir '..' or die "Couldn't chdir to ..";
+
+ # make sure children get @INC pointing to uninstalled files
+ require Cwd;
+ $ENV{PERL5LIB} = File::Spec->catdir(Cwd::cwd(), 'lib');
+ }
}
use Exporter;
@@ -28,7 +41,7 @@
# We have a few extra exports, but Test::More has a special import()
# that won't take extra additions.
-my @extra_exports = qw(stdout_of stderr_of slurp find_in_path);
+my @extra_exports = qw(stdout_of stderr_of slurp find_in_path check_compiler);
push @EXPORT, @extra_exports;
__PACKAGE__->export(scalar caller, @extra_exports);
@@ -74,4 +87,19 @@
return;
}
+# returns ($have_c_compiler, $C_support_feature);
+sub check_compiler {
+ return (1,1) if $ENV{PERL_CORE};
+
+ local $SIG{__WARN__} = sub {};
+
+ my $mb = Module::Build->current;
+ $mb->verbose( 0 );
+
+ my $have_c_compiler;
+ stderr_of( sub {$have_c_compiler = $mb->have_c_compiler} );
+
+ return ($have_c_compiler, $mb->feature('C_support'));
+}
+
1;
|