/
isreg.pm
78 lines (59 loc) · 1.49 KB
/
isreg.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Copyright (C) 2001-2003, Parrot Foundation.
# $Id$
=head1 NAME
config/auto/isreg - S_ISREG
=head1 DESCRIPTION
Determines if the C library has a working C<S_ISREG>.
=cut
package auto::isreg;
use strict;
use warnings;
use base qw(Parrot::Configure::Step);
use Parrot::Configure::Utils ':auto';
sub _init {
my $self = shift;
my %data;
$data{description} = q{Does your C library have a working S_ISREG};
$data{result} = q{};
return \%data;
}
sub runstep {
my ( $self, $conf ) = @_;
my $errormsg = _first_probe_for_isreg($conf);
if (! $errormsg) {
$errormsg = _second_probe_for_isreg($conf);
}
$conf->cc_clean();
$self->_evaluate_isreg($conf, $errormsg);
return 1;
}
sub _first_probe_for_isreg {
my $conf = shift;
my $errormsg;
$conf->cc_gen('config/auto/isreg/test_c.in');
eval { $conf->cc_build(); };
$errormsg = 1 if $@;
return $errormsg;
}
sub _second_probe_for_isreg {
my $conf = shift;
my $ccrunfailure;
$ccrunfailure++ if ( $conf->cc_run() !~ /ok/ );
return $ccrunfailure;
}
sub _evaluate_isreg {
my ($self, $conf, $anyerror) = @_;
my $test;
$test = (! defined $anyerror) ? 1 : 0;
$conf->data->set( isreg => $test );
print( $test ? " (Yep) " : " (no) " ) if $conf->options->get('verbose');
$self->set_result( $test ? 'yes' : 'no' );
return 1;
}
1;
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4: