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);
26 ExtUtils::MakeMaker::parse_args(
28 Text::ParseWords::shellwords($ENV{PERL_MM_OPT} || ''),
31 return $tmp->{ARGS} || {};
34 my $mymeta_works = eval { ExtUtils::MakeMaker->VERSION('6.5707'); 1 };
35 my $mymeta = $mymeta_works || eval { ExtUtils::MakeMaker->VERSION('6.5702'); 1 };
40 'Sub::Exporter::Progressive' => '0.001011',
41 ( (defined ${^GLOBAL_PHASE} or parse_args()->{PUREPERL_ONLY} or !can_xs() )
43 : ('Devel::GlobalDestruction::XS' => 0)
47 my %WriteMakefileArgs = (
48 NAME => 'Devel::GlobalDestruction',
49 VERSION_FROM => 'lib/Devel/GlobalDestruction.pm',
51 INSTALLDIRS => 'site',
53 MIN_PERL_VERSION => '5.006',
54 PREREQ_PM => \%RUN_DEPS,
55 CONFIGURE_REQUIRES => { 'ExtUtils::CBuilder' => 0.27 },
58 homepage => 'http://search.cpan.org/dist/Devel-GlobalDestruction',
59 repository => 'git://git.shadowcat.co.uk/p5sagit/Devel-GlobalDestruction.git',
60 bugtracker => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Devel-GlobalDestruction',
62 requires => \%RUN_DEPS,
64 ($mymeta and !$mymeta_works) ? ( 'NO_MYMETA' => 1 ) : (),
67 unless ( eval { ExtUtils::MakeMaker->VERSION('6.56') } ) {
68 my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
69 my $pp = $WriteMakefileArgs{PREREQ_PM};
70 for my $mod ( keys %$br ) {
71 if ( exists $pp->{$mod} ) {
72 $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
75 $pp->{$mod} = $br->{$mod};
80 if (eval { require Devel::GlobalDestruction }
81 && Devel::GlobalDestruction->VERSION < 0.10) {
89 $(NOECHO) $(RM_F) ' . $self->quote_literal(
90 $self->catfile('$(DESTINSTALLSITEARCH)', 'Devel', 'GlobalDestruction.pm')
91 ) . "\n" . $self->SUPER::install;
95 delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
96 unless eval { ExtUtils::MakeMaker->VERSION('6.52') };
98 WriteMakefile(%WriteMakefileArgs);
100 # can we locate a (the) C compiler
102 my @chunks = split(/ /, $Config::Config{cc}) or return;
104 # $Config{cc} may contain args; try to find out the program part
106 return can_run("@chunks") || (pop(@chunks), next);
112 # check if we can run some command
116 return $cmd if -x $cmd;
117 if (my $found_cmd = MM->maybe_command($cmd)) {
122 for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
124 my $abs = File::Spec->catfile($dir, $cmd);
125 return $abs if (-x $abs or $abs = MM->maybe_command($abs));
131 # Can our C compiler environment build XS files
133 # Do we have the configure_requires checker?
135 eval "require ExtUtils::CBuilder; ExtUtils::CBuilder->VERSION(0.27)";
137 # They don't obey configure_requires, so it is
138 # someone old and delicate. Try to avoid hurting
139 # them by falling back to an older simpler test.
143 # Do we have a working C compiler
144 my $builder = ExtUtils::CBuilder->new(
147 unless ( $builder->have_compiler ) {
148 # No working C compiler
152 # Write a C file representative of what XS becomes
154 my ( $FH, $tmpfile ) = File::Temp::tempfile(
164 int main(int argc, char **argv) {
175 # Can the C compiler access the same headers XS does
180 $object = $builder->compile(
183 @libs = $builder->link(
185 module_name => 'sanexs',
188 my $result = $@ ? 0 : 1;
190 # Clean up all the build files
191 foreach ( $tmpfile, $object, @libs ) {
192 next unless defined $_;