| 1 | #line 1 |
| 2 | package Module::Install::Canscip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/; |
| 3 | |
| 4 | use strictscip-perl cpan Icon-FamFamFam-Silk 0.002001003 strict/; |
| 5 | use Configscip-perl cpan Icon-FamFamFam-Silk 0.002001003 Config/ (); |
| 6 | use File::Specscip-perl cpan Icon-FamFamFam-Silk 0.002001003 File/Spec/ (); |
| 7 | use ExtUtils::MakeMakerscip-perl cpan Icon-FamFamFam-Silk 0.002001003 ExtUtils/MakeMaker/ (); |
| 8 | use Module::Install::Basescip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Base/ (); |
| 9 | |
| 10 | use varsscip-perl cpan Icon-FamFamFam-Silk 0.002001003 vars/ qw{$VERSION @ISA $ISCORE}; |
| 11 | BEGIN { |
| 12 | $VERSIONscip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/$VERSION. = '1.02'; |
| 13 | @ISAscip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/`@ISA`. = 'Module::Install::Base'; |
| 14 | $ISCOREscip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/$ISCORE. = 1; |
| 15 | } |
| 16 | |
| 17 | # check if we can load some module |
| 18 | ### Upgrade this to not have to load the module if possible |
| 19 | sub can_usescip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/can_use(). { |
| 20 | my ($self, $mod, $ver) = @_scip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/`@_`.; |
| 21 | $mod =~ s{::|\\}{/}g; |
| 22 | $mod .= '.pm' unless $mod =~ /\.pm$/i; |
| 23 | |
| 24 | my $pkg = $mod; |
| 25 | $pkg =~ s{/}{::}g; |
| 26 | $pkg =~ s{\.pm$}{}i; |
| 27 | |
| 28 | local $@scip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/`$@`.; |
| 29 | eval { requirescip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/require(). $mod; $pkg->VERSIONscip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/VERSION().($ver || 0); 1 }; |
| 30 | } |
| 31 | |
| 32 | # check if we can run some command |
| 33 | sub can_runscip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/can_run(). { |
| 34 | my ($self, $cmd) = @_scip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/`@_`.; |
| 35 | |
| 36 | my $_cmd = $cmd; |
| 37 | return $_cmd if (-x $_cmd or $_cmd = MM->maybe_commandscip-perl cpan Icon-FamFamFam-Silk 0.002001003 MM/maybe_command().($_cmd)); |
| 38 | |
| 39 | for my $dir ((splitscip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/split(). /$Config::Config{path_sep}/, $ENVscip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/`%ENV`.{PATH}), '.') { |
| 40 | next if $dir eq ''; |
| 41 | my $abs = File::Spec->catfilescip-perl cpan Icon-FamFamFam-Silk 0.002001003 File/Spec/catfile().($dir, $_scip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/`@_`.[1]); |
| 42 | return $abs if (-x $abs or $abs = MM->maybe_commandscip-perl cpan Icon-FamFamFam-Silk 0.002001003 MM/maybe_command().($abs)); |
| 43 | } |
| 44 | |
| 45 | return; |
| 46 | } |
| 47 | |
| 48 | # can we locate a (the) C compiler |
| 49 | sub can_ccscip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/can_cc(). { |
| 50 | my $self = shiftscip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/shift().; |
| 51 | my @chunks = splitscip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/split().(/ /, $Config::Configscip-perl cpan Icon-FamFamFam-Silk 0.002001003 Config/`%Config`.{cc}) or return; |
| 52 | |
| 53 | # $Config{cc} may contain args; try to find out the program part |
| 54 | while (@chunks) { |
| 55 | return $self->can_runscip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/can_run().("@chunks") || (popscip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/pop().(@chunks), next); |
| 56 | } |
| 57 | |
| 58 | return; |
| 59 | } |
| 60 | |
| 61 | # Fix Cygwin bug on maybe_command(); |
| 62 | if ( $^Oscip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/`$^O`. eq 'cygwin' ) { |
| 63 | requirescip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/require(). ExtUtils::MM_Cygwin; |
| 64 | requirescip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/require(). ExtUtils::MM_Win32; |
| 65 | if ( ! definedscip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/defined().(&ExtUtils::MM_Cygwin::maybe_commandscip-perl cpan Icon-FamFamFam-Silk 0.002001003 ExtUtils/MM_Cygwin/maybe_command().) ) { |
| 66 | *ExtUtils::MM_Cygwin::maybe_command = sub { |
| 67 | my ($self, $file) = @_scip-perl cpan Icon-FamFamFam-Silk 0.002001003 Module/Install/Can/`@_`.; |
| 68 | if ($file =~ m{^/cygdrive/}i and ExtUtils::MM_Win32->canscip-perl cpan Icon-FamFamFam-Silk 0.002001003 ExtUtils/MM_Win32/can().('maybe_command')) { |
| 69 | ExtUtils::MM_Win32->maybe_commandscip-perl cpan Icon-FamFamFam-Silk 0.002001003 ExtUtils/MM_Win32/maybe_command().($file); |
| 70 | } else { |
| 71 | ExtUtils::MM_Unix->maybe_commandscip-perl cpan Icon-FamFamFam-Silk 0.002001003 ExtUtils/MM_Unix/maybe_command().($file); |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | 1; |
| 78 | |
| 79 | __END__ |
| 80 | |
| 81 | #line 156 |