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;