mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-08 14:48:32 -04:00
DBD-SQLite: added a code to look for a compiler from Module::Install::Can
This commit is contained in:
parent
e761e1af79
commit
cf9c4c5498
1 changed files with 50 additions and 0 deletions
50
Makefile.PL
50
Makefile.PL
|
@ -58,6 +58,56 @@ if ( $@ or DBI->VERSION < $DBI_required ) {
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# See if we have a C compiler
|
||||||
|
# The following code is adapted from Module::Install::Can
|
||||||
|
{
|
||||||
|
# Fix Cygwin bug on maybe_command();
|
||||||
|
if ( $^O eq 'cygwin' ) {
|
||||||
|
require ExtUtils::MM_Cygwin;
|
||||||
|
require ExtUtils::MM_Win32;
|
||||||
|
if ( ! defined(&ExtUtils::MM_Cygwin::maybe_command) ) {
|
||||||
|
*ExtUtils::MM_Cygwin::maybe_command = sub {
|
||||||
|
my ($self, $file) = @_;
|
||||||
|
if ($file =~ m{^/cygdrive/}i and ExtUtils::MM_Win32->can('maybe_command')) {
|
||||||
|
ExtUtils::MM_Win32->maybe_command($file);
|
||||||
|
} else {
|
||||||
|
ExtUtils::MM_Unix->maybe_command($file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub can_run {
|
||||||
|
my $cmd = shift;
|
||||||
|
my $_cmd = $cmd;
|
||||||
|
return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd));
|
||||||
|
|
||||||
|
for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
|
||||||
|
next if $dir eq '';
|
||||||
|
my $abs = File::Spec->catfile($dir, $_[1]);
|
||||||
|
return $abs if (-x $abs or $abs = MM->maybe_command($abs));
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub can_cc {
|
||||||
|
my @chunks = split(/ /, $Config::Config{cc}) or return;
|
||||||
|
|
||||||
|
# $Config{cc} may contain args; try to find out the program part
|
||||||
|
while (@chunks) {
|
||||||
|
return can_run("@chunks") || (pop(@chunks), next);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
unless (can_cc()) {
|
||||||
|
print "We can't locate a C compiler from your Config.pm.\n";
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Determine if we are going to use the provided SQLite code, or an already-
|
# Determine if we are going to use the provided SQLite code, or an already-
|
||||||
# installed copy. To this end, look for two command-line parameters:
|
# installed copy. To this end, look for two command-line parameters:
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Reference in a new issue