From: Vincent Pit Date: Sat, 23 Apr 2011 16:05:16 +0000 (+0200) Subject: Make Makefile.PL honour CC= arguments X-Git-Tag: v0.07~16 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FScalar-Vec-Util.git;a=commitdiff_plain;h=2654b60d8ddf2eb25c51e22634461ec65616bb98 Make Makefile.PL honour CC= arguments --- diff --git a/Makefile.PL b/Makefile.PL index 7b55ee5..0a72457 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -12,28 +12,36 @@ BEGIN { die 'OS unsupported' if $@; } -# Inspired from Module::Install::Can -print "Checking for a valid C compiler in the PATH... "; -my @ccs = ($Config{cc}); -unshift @ccs, $ENV{CC} if $ENV{CC}; my $cc; +for (@ARGV) { + if (/^CC=(.*)/) { + $cc = $1; + last; + } +} +if (defined $cc) { + print "Forcing the use of $cc as the C compiler.\n"; +} else { + # Inspired from Module::Install::Can + print "Checking for a valid C compiler in the PATH... "; + my @ccs = ($Config{cc}); + unshift @ccs, $ENV{CC} if $ENV{CC}; CC: -for my $c (@ccs) { - for my $dir (split /$Config{path_sep}/, $ENV{PATH}) { - my $abs = File::Spec->catfile($dir, $c); - if (-x $abs or MM->maybe_command($abs)) { - $cc = $c; - last CC; + for my $c (@ccs) { + for my $dir (split /$Config{path_sep}/, $ENV{PATH}) { + my $abs = File::Spec->catfile($dir, $c); + if (-x $abs or MM->maybe_command($abs)) { + $cc = $c; + print $cc, "\n"; + last CC; + } } } + print "none\n" unless defined $cc; } + my @C; -if ($cc) { - push @C, 'Util.c'; - print $cc, "\n"; -} else { - print "none\n"; -} +push @C, 'Util.c' if defined $cc; my @DEFINES;