6 use ExtUtils::MakeMaker;
7 BEGIN { if ( $^O eq 'cygwin' ) {
8 require ExtUtils::MM_Cygwin;
9 require ExtUtils::MM_Win32;
10 if ( ! defined(&ExtUtils::MM_Cygwin::maybe_command) ) {
11 *ExtUtils::MM_Cygwin::maybe_command = sub {
12 my ($self, $file) = @_;
13 if ($file =~ m{^/cygdrive/}i and ExtUtils::MM_Win32->can('maybe_command')) {
14 ExtUtils::MM_Win32->maybe_command($file);
16 ExtUtils::MM_Unix->maybe_command($file);
23 for my $i (0..$#ARGV) {
24 if ($ARGV[$i] =~ /^PUREPERL_ONLY=(.*)/) {
31 my $mymeta_works = eval { ExtUtils::MakeMaker->VERSION('6.5707'); 1 };
32 my $mymeta = $mymeta_works || eval { ExtUtils::MakeMaker->VERSION('6.5702'); 1 };
37 'Sub::Exporter::Progressive' => '0.001006',
38 ( (defined ${^GLOBAL_PHASE} or $pureperl or !can_xs() )
40 : ('Devel::GlobalDestruction::XS' => 0)
44 my %WriteMakefileArgs = (
45 NAME => 'Devel::GlobalDestruction',
46 VERSION_FROM => 'lib/Devel/GlobalDestruction.pm',
48 INSTALLDIRS => 'site',
50 MIN_PERL_VERSION => '5.006',
51 PREREQ_PM => \%RUN_DEPS,
52 CONFIGURE_REQUIRES => { 'ExtUtils::CBuilder' => 0.27 },
55 homepage => 'http://search.cpan.org/dist/Devel-GlobalDestruction',
56 repository => 'git://git.shadowcat.co.uk/p5sagit/Devel-GlobalDestruction.git',
57 bugtracker => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Devel-GlobalDestruction',
59 requires => \%RUN_DEPS,
61 ($mymeta and !$mymeta_works) ? ( 'NO_MYMETA' => 1 ) : (),
64 unless ( eval { ExtUtils::MakeMaker->VERSION('6.56') } ) {
65 my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
66 my $pp = $WriteMakefileArgs{PREREQ_PM};
67 for my $mod ( keys %$br ) {
68 if ( exists $pp->{$mod} ) {
69 $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
72 $pp->{$mod} = $br->{$mod};
77 if (eval { require Devel::GlobalDestruction }
78 && Devel::GlobalDestruction->VERSION < 0.10) {
86 $(NOECHO) $(RM_F) ' . $self->quote_literal(
87 $self->catfile('$(DESTINSTALLSITEARCH)', 'Devel', 'GlobalDestruction.pm')
88 ) . "\n" . $self->SUPER::install;
92 delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
93 unless eval { ExtUtils::MakeMaker->VERSION('6.52') };
95 WriteMakefile(%WriteMakefileArgs);
97 # can we locate a (the) C compiler
99 my @chunks = split(/ /, $Config::Config{cc}) or return;
101 # $Config{cc} may contain args; try to find out the program part
103 return can_run("@chunks") || (pop(@chunks), next);
109 # check if we can run some command
113 return $cmd if -x $cmd;
114 if (my $found_cmd = MM->maybe_command($cmd)) {
119 for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
121 my $abs = File::Spec->catfile($dir, $cmd);
122 return $abs if (-x $abs or $abs = MM->maybe_command($abs));
128 # Can our C compiler environment build XS files
130 # Do we have the configure_requires checker?
132 eval "require ExtUtils::CBuilder; ExtUtils::CBuilder->VERSION(0.27)";
134 # They don't obey configure_requires, so it is
135 # someone old and delicate. Try to avoid hurting
136 # them by falling back to an older simpler test.
140 # Do we have a working C compiler
141 my $builder = ExtUtils::CBuilder->new(
144 unless ( $builder->have_compiler ) {
145 # No working C compiler
149 # Write a C file representative of what XS becomes
151 my ( $FH, $tmpfile ) = File::Temp::tempfile(
161 int main(int argc, char **argv) {
172 # Can the C compiler access the same headers XS does
177 $object = $builder->compile(
180 @libs = $builder->link(
182 module_name => 'sanexs',
185 my $result = $@ ? 0 : 1;
187 # Clean up all the build files
188 foreach ( $tmpfile, $object, @libs ) {
189 next unless defined $_;