Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Detecting C compiler in Makefile.PL

1 view
Skip to first unread message

Jens Thoms Toerring

unread,
May 12, 2008, 5:27:57 PM5/12/08
to
Hello,

a CPAN module of mine that needs a C compiler for installation
fails in some of the tests since the C compiler isn't found. The
offending lines are

if ( system $Config{cc}, qw( -o cc_test cc_test.c ) ) {
unlink 'cc_test.c';
die "Can't run C compiler '$Config{cc}'\n";
}

where 'cc_test.c' is a simple program that gets created
automatically just for this test.

The problem is that on one of the testers machines $Config{cc}
is set to 'ccache cc' and system() obviously does not like the
space in the name of the program it's supposed to execute.

Now I probably can get around that by using a line like

if ( system split /\s+/, $Config{cc}, qw( -o cc_test cc_test.c ) ) {

or something similar but it looks ugly and I suspect that there
is a better method to invoke the correct C compiler. Does anybody
have an idea?
Thanks and regards, Jens
--
\ Jens Thoms Toerring ___ j...@toerring.de
\__________________________ http://toerring.de

smallpond

unread,
May 12, 2008, 8:52:59 PM5/12/08
to


system fails because you are passing part as a string and
part as a list. Just pass a single string and let system
do the parsing.

if (system "$Config{cc} -o cc_test cc_test.c")

--S

Jens Thoms Toerring

unread,
May 14, 2008, 5:53:52 PM5/14/08
to
smallpond <smal...@juno.com> wrote:
> On May 12, 5:27 pm, j...@toerring.de (Jens Thoms Toerring) wrote:
> > a CPAN module of mine that needs a C compiler for installation
> > fails in some of the tests since the C compiler isn't found. The
> > offending lines are
> >
> > if ( system $Config{cc}, qw( -o cc_test cc_test.c ) ) {
> > unlink 'cc_test.c';
> > die "Can't run C compiler '$Config{cc}'\n";
> > }
> >
> > where 'cc_test.c' is a simple program that gets created
> > automatically just for this test.

> system fails because you are passing part as a string and


> part as a list. Just pass a single string and let system
> do the parsing.

> if (system "$Config{cc} -o cc_test cc_test.c")

Thank you, I will try it that way. Looks like it's the simplest
method to get it to work.
Best regards, Jens

0 new messages