Algorithm-Classifier-IsolationForest

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

use 5.006;
use strict;
use warnings;
use ExtUtils::MakeMaker;

# ---------------------------------------------------------------------------
# Install-time C build support.
#
# When Inline::C is usable at configure time (and IF_NO_C isn't set), the
# generated Makefile gains a rule that compiles the Inline::C backend once
# during `make` and installs the shared object with the distribution, so
# users never pay the first-load compile and need neither a C compiler nor
# the Inline modules at run time.
#
# The IF_* environment variables (IF_OPT, IF_ARCH, IF_NATIVE, IF_NO_OPENMP)
# are captured *now* -- set them when running `perl Makefile.PL`, not
# `make` -- and recorded in the generated
# Algorithm::Classifier::IsolationForest::BuildFlags module.  At run time
# those recorded values are the defaults: a process requesting the same
# flags loads the prebuilt object via XSLoader; one requesting different
# flags (or setting IF_RUNTIME_BUILD=1) falls back to the classic runtime
# Inline::C build under _Inline/.  Validation mirrors the module's own,
# since these values reach a compiler command line.
# ---------------------------------------------------------------------------
my $if_opt = '-O3';
if ( defined $ENV{IF_OPT} ) {
	if ( $ENV{IF_OPT} =~ /\A-O[0123sgz]\z/ ) {
		$if_opt = $ENV{IF_OPT};
	} else {
		warn "Makefile.PL: ignoring invalid IF_OPT value '$ENV{IF_OPT}' "
			. "(expected one of -O0 -O1 -O2 -O3 -Os -Og -Oz); using $if_opt\n";
	}
}
my $if_arch = '';
if ( defined $ENV{IF_ARCH} ) {
	if ( $ENV{IF_ARCH} eq '' or $ENV{IF_ARCH} eq 'none' ) {
		$if_arch = '';    # explicit opt-out, same as the module's handling
	} elsif ( $ENV{IF_ARCH} =~ /\A[A-Za-z0-9_.+=-]+\z/ ) {
		$if_arch = $ENV{IF_ARCH};
	} else {
		warn "Makefile.PL: ignoring invalid IF_ARCH value '$ENV{IF_ARCH}'\n";
	}
} elsif ( $ENV{IF_NATIVE} ) {
	$if_arch = 'native';
}
my $if_no_openmp = $ENV{IF_NO_OPENMP} ? 1 : 0;

# The install-time build needs Inline::C at make time and a Makefile rule
# syntax (env assignment prefixing the command) that nmake doesn't grok;
# without it the module simply keeps its historic behaviour of compiling
# at first load when Inline::C is present then.
my $prebuilt
	= ( !$ENV{IF_NO_C} && $^O ne 'MSWin32' && eval { require Inline; Inline->VERSION('0.44'); require Inline::C; 1 } )
	? 1
	: 0;

# Record the captured configuration where the module can read it at load
# time.  Generated before WriteMakefile so ExtUtils::MakeMaker's lib/ scan
# picks it up for blib and install.  Not in MANIFEST: it is per-install
# state, never shipped.
my $bf_path = 'lib/Algorithm/Classifier/IsolationForest/BuildFlags.pm';
open my $bf_fh, '>', $bf_path
	or die "Makefile.PL: can't write $bf_path: $!";
print $bf_fh <<"BUILDFLAGS";
package Algorithm::Classifier::IsolationForest::BuildFlags;

# AUTOGENERATED by Makefile.PL -- do not edit and do not add to MANIFEST.
# Records per-install C build configuration; regenerate by re-running
# `perl Makefile.PL` (with IF_* environment variables as desired).

use strict;
use warnings;

=head1 NAME

Algorithm::Classifier::IsolationForest::BuildFlags - C build flags captured at configure time

=head1 DESCRIPTION



( run in 1.483 second using v1.01-cache-2.11-cpan-995e09ba956 )