| File: | config/auto/cpu/i386/auto.pm |
| Coverage: | 82.5% |
| line | stmt | bran | cond | sub | code |
|---|---|---|---|---|---|
| 1 | # Copyright (C) 2001-2006, Parrot Foundation. | ||||
| 2 | # $Id: auto.pm 43441 2010-01-13 12:36:52Z jkeenan $ | ||||
| 3 | |||||
| 4 - 15 | =head1 NAME config/auto/cpu/i386/auto.pm =head1 DESCRIPTION Test for cmpxchg ASM functionality. Creates these Config entries TEMP_generated => 'files ...' for inclusion in platform.c or platform.h i386_has_gcc_cmpxchg_c => 1 =cut | ||||
| 16 | |||||
| 17 | package auto::cpu::i386::auto; | ||||
| 18 | |||||
| 19 | 80 80 80 | use strict; | |||
| 20 | 80 80 80 | use warnings; | |||
| 21 | |||||
| 22 | sub runstep { | ||||
| 23 | 80 | my ( $self, $conf ) = @_; | |||
| 24 | |||||
| 25 | 80 | my $verbose = $conf->options->get('verbose'); | |||
| 26 | |||||
| 27 | 80 | my @files = qw( test_gcc_cmpxchg_c.in ); | |||
| 28 | 80 | for my $f (@files) { | |||
| 29 | 80 | print " $f " if $verbose; | |||
| 30 | 80 | my ($suffix) = $f =~ /test_(\w+)/; | |||
| 31 | 80 | my $path_f = "config/auto/cpu/i386/$f"; | |||
| 32 | 80 | $conf->cc_gen($path_f); | |||
| 33 | 80 80 | eval { $conf->cc_build("-DPARROT_CONFIG_TEST") }; | |||
| 34 | 80 | if ($@) { | |||
| 35 | 0 | print " $@ " if $verbose; | |||
| 36 | } | ||||
| 37 | else { | ||||
| 38 | 80 | if ( $conf->cc_run() =~ /ok/ ) { | |||
| 39 | 80 | _handle_cc_run_ok($conf, $suffix, $path_f, $verbose); | |||
| 40 | } | ||||
| 41 | } | ||||
| 42 | 80 | $conf->cc_clean(); | |||
| 43 | } | ||||
| 44 | 80 | return; | |||
| 45 | } | ||||
| 46 | |||||
| 47 | sub _handle_cc_run_ok { | ||||
| 48 | 80 | my ($conf, $suffix, $path_f, $verbose) = @_; | |||
| 49 | 80 | $conf->data->set( | |||
| 50 | "i386_has_$suffix" => '1', | ||||
| 51 | "HAS_i386_$suffix" => '1', | ||||
| 52 | ); | ||||
| 53 | 80 | print " (\U$suffix) " if ($verbose); | |||
| 54 | 80 | $conf->data->add( ' ', TEMP_generated => $path_f ); | |||
| 55 | } | ||||
| 56 | |||||
| 57 | 1; | ||||
| 58 | |||||
| 59 | # Local Variables: | ||||
| 60 | # mode: cperl | ||||
| 61 | # cperl-indent-level: 4 | ||||
| 62 | # fill-column: 100 | ||||
| 63 | # End: | ||||
| 64 | # vim: expandtab shiftwidth=4: | ||||