File Coverage

File:config/auto/glibc.pm
Coverage:96.1%

linestmtbrancondsubcode
1# Copyright (C) 2008, Parrot Foundation.
2
3 - 11
=head1 NAME

config/auto/glibc.pm - find GNU libc

=head1 DESCRIPTION

Discovers GNU libc, if it exists.

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