On Monday 19 March 2007 12:22, Andy Dougherty wrote: > I found the ticket that introduced this failing behavior, so I'm resending > my message below with a fixed-up subject line to enter into RT. In brief, > this patch incorrectly assumes that all compilers accept a '-h', '--help', > or '/?' switch. Any compiler that doesn't is deemed 'not found', and > there is no way to override it. Extending the list of options to try is > not a sensible forward-looking portable strategy.
I realize this patch precludes cross-compilation at the moment, but does it work better for you, Andy? -- c
=== config/inter/progs.pm ================================================================== --- config/inter/progs.pm (revision 2436) +++ config/inter/progs.pm (local) @@ -21,7 +21,7 @@ use base qw(Parrot::Configure::Step::Base); -use Parrot::Configure::Step ':inter'; +use Parrot::Configure::Step ':inter', ':auto'; $description = 'Determining what C compiler and linker to use'; @@ -69,10 +69,6 @@ $cc = prompt( "What C compiler do you want to use?", $cc ) if $ask; - if ($first_working->($cc) eq 'echo') { - warn "No compiler found (tried '$cc')\n"; - exit 1; - } $conf->data->set( cc => $cc ); $link = integrate( $conf->data->get('link'), $conf->options->get('link') ); @@ -135,9 +131,34 @@ $ccwarn = integrate( $conf->data->get('ccwarn'), $conf->options->get('ccwarn') ); $conf->data->set( ccwarn => $ccwarn ); + test_compiler( $cc ); + return $self; } +sub test_compiler +{ + my $cc = shift; + + if ( open( my $out_fh, '>', 'test.c' ) ) { + print {$out_fh} <<END_C; +int main() { + return 0; +} +END_C + + unless ( eval { cc_build(); 1 } ) { + warn "Compilation failed with '$cc'\n"; + exit 1; + } + + unless ( eval { cc_run(); 1 } ) { + warn $@ if $@; + exit 1; + } + } +} + 1; # Local Variables: