X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Makefile.PL;h=1af2ae870c9cb66f18790ff2bfd16ba9dc5835b9;hb=f04b35b97b754cddb0e780e41cf4be57a65963b8;hp=846e489b82688f75755b1c758e242488c6c03817;hpb=b1a1df91b1e35312c5b2e18b7b780c6525b475be;p=perl%2Fmodules%2FScalar-Vec-Util.git diff --git a/Makefile.PL b/Makefile.PL index 846e489..1af2ae8 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -16,7 +16,11 @@ sub validate_exe { @candidates = $name; } else { (my $base, @args) = split ' ', $name; - @candidates = map File::Spec->catfile($_, $base), File::Spec->path; + for my $path_entry (File::Spec->path) { + my ($vol, $dir, $file) = File::Spec->splitpath($path_entry, 1); + next if defined $file and length $file; + push @candidates, File::Spec->catpath($vol, $dir, $base); + } } for my $path (@candidates) { @@ -61,11 +65,29 @@ sub check_exe { return $exe; } -my $cc = check_exe('C compiler', 'CC', 'cc', 'CC'); +my ($pp, $skip_arg); +for my $i (0 .. $#ARGV) { + my $arg = $ARGV[$i]; + if ($arg =~ /^PP=(.*)/) { + my $val = $1; + if (do { no warnings 'numeric'; int $val } or $val =~ /^(?:y|yes)$/i) { + print "Forcing the pure-Perl implementation from the arguments passed to Makefile.PL.\n"; + $pp = 1; + $skip_arg = $i; + last; + } + } +} +if (defined $skip_arg) { + splice @ARGV, $skip_arg, 1; +} -my $ld; -if (defined $cc) { - $ld = check_exe('linker', 'LD', 'ld', 'LD'); +my ($cc, $ld); +unless ($pp) { + $cc = check_exe('C compiler', 'CC', 'cc', 'CC'); + if (defined $cc) { + $ld = check_exe('linker', 'LD', 'ld', 'LD'); + } } sub is_little_endian { @@ -111,6 +133,7 @@ if (defined $cc and defined $ld) { $PARAMS{C} = [ ]; $PARAMS{XS} = { }; $PARAMS{OBJECT} = ''; + print "Falling back to the pure-Perl implementation.\n"; } $PARAMS{DEFINE} = join ' ', @DEFINES if @DEFINES;