File Coverage

File:config/auto/timespec.pm
Coverage:100.0%

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

config/auto/timespec.pm - Timespec detection

=head1 DESCRIPTION

Determining if the system has C<struct timespec> defined.

=cut
12
13package auto::timespec;
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
22sub _init {
23
2
    my $self = shift;
24
2
    my %data;
25
2
    $data{description} = q{Does your system has timespec};
26
2
    $data{result} = q{};
27
2
    return \%data;
28}
29
30sub runstep {
31
2
    my ( $self, $conf ) = @_;
32
33
2
    $conf->cc_gen('config/auto/timespec/test_c.in');
34
2
2
    eval { $conf->cc_build(); };
35
2
    my $fail_message = $@;
36
2
    $self->_handle_timespec($conf, $fail_message);
37
2
    $conf->cc_clean();
38
39
2
    return 1;
40}
41
42sub _handle_timespec {
43
4
    my ($self, $conf, $fail_message) = @_;
44
4
    if ($fail_message) {
45
1
        $conf->data->set( HAS_TIMESPEC => 0 );
46
1
        $self->set_result('no');
47    }
48    else {
49
3
        $conf->data->set( HAS_TIMESPEC => 1 );
50
3
        $self->set_result('yes');
51    }
52}
53
541;
55
56# Local Variables:
57# mode: cperl
58# cperl-indent-level: 4
59# fill-column: 100
60# End:
61# vim: expandtab shiftwidth=4:
62