mod_perl

 view release on metacpan or  search on metacpan

lib/Apache2/Build.pm  view on Meta::CPAN

# please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package Apache2::Build;

use 5.006;
use strict;
use warnings;

use Config;
use Cwd ();
use File::Spec::Functions qw(catfile catdir canonpath rel2abs devnull
                             catpath splitpath);
use File::Basename;
use ExtUtils::Embed ();
use File::Copy ();

BEGIN {				# check for a sane ExtUtils::Embed
    unless ($ENV{MP_USE_MY_EXTUTILS_EMBED}) {
	my ($version, $path)=(ExtUtils::Embed->VERSION,
			      $INC{q{ExtUtils/Embed.pm}});
	my $msg=<<"EOF";
I have found ExtUtils::Embed $version at

  $path

This is probably not the right one for this perl version. Please make sure
there is only one version of this module installed and that it is the one
that comes with this perl version.

If you insist on using the ExtUtils::Embed as is set the environment
variable MP_USE_MY_EXTUTILS_EMBED=1 and try again.

EOF
	if (eval {require Module::CoreList}) {
	    my $req=$Module::CoreList::version{$]}->{q/ExtUtils::Embed/};
	    die "Please repair your Module::CoreList" unless $req;
	    unless ($version eq $req) {
		$msg.=("Details: expecting ExtUtils::Embed $req ".
		       "(according to Module::CoreList)\n\n");
		die $msg;
	    }
	}
	else {
	    my $req=$Config{privlib}.'/ExtUtils/Embed.pm';
	    unless ($path eq $req) {
		$msg.="Details: expecting ExtUtils::Embed at $req\n\n";
		die $msg;
	    }
	}
    }
}

use constant IS_MOD_PERL_BUILD => grep 
    { -e "$_/Makefile.PL" && -e "$_/lib/mod_perl2.pm" } qw(. ..);

use constant AIX     => $^O eq 'aix';
use constant DARWIN  => $^O eq 'darwin';
use constant CYGWIN  => $^O eq 'cygwin';
use constant IRIX    => $^O eq 'irix';
use constant HPUX    => $^O eq 'hpux';
use constant OPENBSD => $^O eq 'openbsd';
use constant WIN32   => $^O eq 'MSWin32';

use constant MSVC => WIN32() && ($Config{cc} eq 'cl');
use constant DMAKE => WIN32() && ($Config{make} eq 'dmake');

use constant REQUIRE_ITHREADS => grep { $^O eq $_ } qw(MSWin32);
use constant PERL_HAS_ITHREADS =>
    $Config{useithreads} && ($Config{useithreads} eq 'define');
use constant BUILD_APREXT => WIN32() || CYGWIN();

use ModPerl::Code ();
use ModPerl::BuildOptions ();
use Apache::TestTrace;
use Apache::TestConfig ();

our $VERSION = '0.01';
our $AUTOLOAD;

sub AUTOLOAD {
    my $self = shift;
    my $name = uc ((split '::', $AUTOLOAD)[-1]);
    unless ($name =~ /^MP_/) {
        die "no such method: $AUTOLOAD";
    }
    unless ($self->{$name}) {
        return wantarray ? () : undef;
    }
    return wantarray ? (split /\s+/, $self->{$name}) : $self->{$name};
}



( run in 1.152 second using v1.01-cache-2.11-cpan-71847e10f99 )