Click here to get back home

Detecting C compiler in Makefile.PL

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Detecting C compiler in Makefile.PL Jens Thoms Toerring 05-12-2008
Get Chitika Premium
Posted by Jens Thoms Toerring on May 12, 2008, 5:27 pm
Please log in for more thread options
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, qw( -o cc_test cc_test.c ) ) {
unlink 'cc_test.c';
die "Can't run C compiler '$Config'\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
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, 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 ___ jt@toerring.de
\__________________________ http://toerring.de

Posted by smallpond on May 12, 2008, 8:52 pm
Please log in for more thread options
On May 12, 5:27 pm, j...@toerring.de (Jens Thoms Toerring) wrote:
> 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, qw( -o cc_test cc_test.c ) ) {
> unlink 'cc_test.c';
> die "Can't run C compiler '$Config'\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
> 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, 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


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 -o cc_test cc_test.c")

--S

Posted by Jens Thoms Toerring on May 14, 2008, 5:53 pm
Please log in for more thread options
> 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, qw( -o cc_test cc_test.c ) ) {
> > unlink 'cc_test.c';
> > die "Can't run C compiler '$Config'\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 -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
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de

Similar ThreadsPosted
5.8.8 build fails - no Makefile February 18, 2006, 1:40 pm
combine perl and makefile April 21, 2006, 8:10 am
makefile syntax to exclude files February 21, 2006, 9:23 am
Installing extra data files with a Makefile.PL? October 15, 2004, 6:43 pm
Makefile - perl script syntax error August 24, 2005, 5:58 pm
Makefile.PL- install modules on home directory October 11, 2005, 9:17 am
Makefile.PL requires parameters for Sendmail::Milter August 17, 2006, 7:07 am
makefile shows wrong perl version May 10, 2007, 4:32 pm
Is there a PERL compiler? July 27, 2004, 7:40 pm
compiler optimization October 30, 2004, 3:41 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap