1 # Copyright (C) 2001-2003, The Perl Foundation.
6 config/auto/snprintf.pm - Test for snprintf
10 Tests if snprintf is present and if it's C99 compliant.
14 package auto
::snprintf
;
19 use base
qw(Parrot::Configure::Step);
24 $data{description
} = q{Testing snprintf};
30 my ( $self, $conf ) = @_;
32 my $res = _probe_for_snprintf
($conf);
34 $self->_evaluate_snprintf($conf, $res);
39 sub _probe_for_snprintf
{
41 $conf->cc_gen('config/auto/snprintf/test.in');
43 my $res = $conf->cc_run() or die "Can't run the snprintf testing program: $!";
48 sub _evaluate_snprintf
{
49 my ($self, $conf, $res) = @_;
50 if ( $res =~ /snprintf/ ) {
51 $conf->data->set( HAS_SNPRINTF
=> 1 );
53 if ( $res =~ /^C99 snprintf/ ) {
54 $conf->data->set( HAS_C99_SNPRINTF
=> 1 );
56 elsif ( $res =~ /^old snprintf/ ) {
57 $conf->data->set( HAS_OLD_SNPRINTF
=> 1 );
59 print " ($res) " if $conf->options->get('verbose');
67 # cperl-indent-level: 4
70 # vim: expandtab shiftwidth=4: