1 # Copyright (C) 2008, The Perl Foundation.
6 config/auto/pcre.pm - Probe for pcre library
10 Determines whether the platform supports pcre library.
20 use base
qw(Parrot::Configure::Step);
22 use Parrot
::Configure
::Utils
':auto';
27 $data{description
} = q{Does your platform support pcre};
33 my ( $self, $conf ) = @_;
35 my ( $verbose, $without ) = $conf->options->get(
43 $conf->data->set( has_pcre
=> 0 );
44 $self->set_result('no');
48 my $cc = $conf->data->get('cc');
49 my $libs = $conf->data->get('libs');
50 my $linkflags = $conf->data->get('linkflags');
51 my $ccflags = $conf->data->get('ccflags');
53 my $osname = $conf->data->get_p5('OSNAME');
55 $self->_add_to_libs( {
59 win32_nongcc
=> 'pcre.lib',
63 # On OS X check the presence of the pcre headers in the standard
64 # Fink/macports locations.
65 $self->_handle_darwin_for_fink ($conf, $osname, 'pcre.h');
66 $self->_handle_darwin_for_macports($conf, $osname, 'pcre.h');
68 $conf->cc_gen('config/auto/pcre/pcre.in');
69 eval { $conf->cc_build() };
72 my $test = $conf->cc_run();
73 $has_pcre = $self->_evaluate_cc_run($test, $verbose);
76 # The Parrot::Configure settings might have changed while class ran
77 $self->_recheck_settings($conf, $libs, $ccflags, $linkflags, $verbose);
79 $conf->data->set( HAS_PCRE
=> $has_pcre);
84 sub _evaluate_cc_run
{
86 my ($test, $verbose) = @_;
88 if ( $test =~ /pcre (\d+\.\d+)/ ) {
89 my $pcre_version = $1;
91 print " (yes, $pcre_version) " if $verbose;
92 $self->set_result("yes, $pcre_version");
101 # cperl-indent-level: 4
104 # vim: expandtab shiftwidth=4: