From: Vincent Pit Date: Tue, 7 Apr 2015 15:47:32 +0000 (-0300) Subject: Allow forcing the PP implementaton by passing PP=1 to Makefile.PL X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=3dc124b585a4104cb5b4d0723fd62fac2e45b2c0;p=perl%2Fmodules%2FScalar-Vec-Util.git Allow forcing the PP implementaton by passing PP=1 to Makefile.PL --- diff --git a/Makefile.PL b/Makefile.PL index 846e489..e519c64 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -61,11 +61,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 +129,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;