| File: | config/auto/glibc.pm |
| Coverage: | 96.1% |
| line | stmt | bran | cond | sub | code |
|---|---|---|---|---|---|
| 1 | # Copyright (C) 2008, Parrot Foundation. | ||||
| 2 | # $Id: glibc.pm 36833 2009-02-17 20:09:26Z allison $ | ||||
| 3 | |||||
| 4 - 12 | =head1 NAME config/auto/glibc.pm - find GNU libc =head1 DESCRIPTION Discovers GNU libc, if it exists. =cut | ||||
| 13 | |||||
| 14 | package auto::glibc; | ||||
| 15 | |||||
| 16 | 81 81 81 | use strict; | |||
| 17 | 81 81 81 | use warnings; | |||
| 18 | |||||
| 19 | 81 81 81 | use base qw(Parrot::Configure::Step); | |||
| 20 | |||||
| 21 | 81 81 81 | use Parrot::Configure::Utils ':auto'; | |||
| 22 | |||||
| 23 | |||||
| 24 | sub _init { | ||||
| 25 | 82 | my $self = shift; | |||
| 26 | 82 | my %data; | |||
| 27 | 82 | $data{description} = q{Is GNU libc installed}; | |||
| 28 | 82 | $data{result} = q{}; | |||
| 29 | 82 | return \%data; | |||
| 30 | } | ||||
| 31 | |||||
| 32 | sub runstep { | ||||
| 33 | 81 | my ( $self, $conf ) = @_; | |||
| 34 | |||||
| 35 | 81 | my $test = $self->_probe_for_glibc($conf); | |||
| 36 | |||||
| 37 | 81 | $self->_evaluate_glibc($conf, $test); | |||
| 38 | |||||
| 39 | 81 | return 1; | |||
| 40 | } | ||||
| 41 | |||||
| 42 | sub _probe_for_glibc { | ||||
| 43 | 81 | my ( $self, $conf ) = @_; | |||
| 44 | 81 | my %glibc; | |||
| 45 | 81 | $conf->cc_gen("config/auto/glibc/test_c.in"); | |||
| 46 | 81 81 | eval { $conf->cc_build(); }; | |||
| 47 | 81 | if ( !$@ ) { | |||
| 48 | 81 | %glibc = eval $conf->cc_run() or die "Can't run the test program: $!"; | |||
| 49 | } | ||||
| 50 | 81 | $conf->cc_clean(); | |||
| 51 | 81 | return \%glibc; | |||
| 52 | } | ||||
| 53 | |||||
| 54 | sub _evaluate_glibc { | ||||
| 55 | 83 | my ( $self, $conf, $test ) = @_; | |||
| 56 | |||||
| 57 | 83 | if ( defined $test->{glibc} ) { | |||
| 58 | 82 | $self->set_result("yes"); | |||
| 59 | 82 | $conf->data->set( glibc => $test->{glibc} ); | |||
| 60 | } | ||||
| 61 | else { | ||||
| 62 | 1 | $self->set_result("no"); | |||
| 63 | 1 | $conf->data->set( glibc => undef ); | |||
| 64 | } | ||||
| 65 | 83 | return 1; | |||
| 66 | } | ||||
| 67 | |||||
| 68 | 1; | ||||
| 69 | |||||
| 70 | # Local Variables: | ||||
| 71 | # mode: cperl | ||||
| 72 | # cperl-indent-level: 4 | ||||
| 73 | # fill-column: 100 | ||||
| 74 | # End: | ||||
| 75 | # vim: expandtab shiftwidth=4: | ||||