Subject: | Use $Config{cc} instead of $Config{ccname} to be able to compile XS on clang-only FreeBSD boxes (and possibly in other cases) |
Date: | Wed, 10 Jul 2013 15:50:55 +0200 |
To: | bug-NetAddr-IP [...] rt.cpan.org |
From: | Anton Berezin <GRUBER [...] cpan.org> |
Hi,
According to perlembed(1), one has to use $Config{cc} in order to determine
what compiler to run:
You'll have to choose the appropriate compiler (cc, gcc, et al.) for
your machine: "perl -MConfig -e 'print $Config{cc}'" will tell you what
to use.
Lite/Util/Makefile.PL uses $Config{ccname}, which tells us what kind of
compiler it is, but not its name.
In particular, it so happens, that on recent FreeBSD boxes that switched
away from gcc in favor of clang, ccname might still contain "gcc", while no
actual executable named "gcc" is present. This makes the module to build
and install pure Perl version, which is very often not what is desired.
The patch:
--- ./Lite/Util/Makefile.PL.orig 2013-07-10 15:38:50.000000000 +0200
+++ ./Lite/Util/Makefile.PL 2013-07-10 15:38:55.000000000 +0200
@@ -205,7 +205,7 @@ sub test_cc {
return;
}
- my $CC = $ENV{CC} || $Config{ccname};
+ my $CC = $ENV{CC} || $Config{cc};
my $command = qq|$CC compile.c -o compile.output|;
print F <<'EOF';
Cheers,
\Anton.
--
Our society can survive even a large amount of irrational regulation.
-- John McCarthy