This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update ExtUtils-MakeMaker to CPAN version 6.94
[perl5.git] / cpan / ExtUtils-MakeMaker / lib / ExtUtils / MM.pm
CommitLineData
f6d6199c
MS
1package ExtUtils::MM;
2
3use strict;
7292dc67 4use ExtUtils::MakeMaker::Config;
a592ba15 5
a8509e91 6our $VERSION = '6.94';
f6d6199c
MS
7
8require ExtUtils::Liblist;
9require ExtUtils::MakeMaker;
a592ba15 10our @ISA = qw(ExtUtils::Liblist ExtUtils::MakeMaker);
f6d6199c
MS
11
12=head1 NAME
13
14ExtUtils::MM - OS adjusted ExtUtils::MakeMaker subclass
15
16=head1 SYNOPSIS
17
18 require ExtUtils::MM;
19 my $mm = MM->new(...);
20
21=head1 DESCRIPTION
22
23B<FOR INTERNAL USE ONLY>
24
25ExtUtils::MM is a subclass of ExtUtils::MakeMaker which automatically
26chooses the appropriate OS specific subclass for you
27(ie. ExtUils::MM_Unix, etc...).
28
29It also provides a convenient alias via the MM class (I didn't want
30MakeMaker modules outside of ExtUtils/).
31
32This class might turn out to be a temporary solution, but MM won't go
33away.
34
35=cut
36
37{
38 # Convenient alias.
39 package MM;
a592ba15 40 our @ISA = qw(ExtUtils::MM);
f6d6199c
MS
41 sub DESTROY {}
42}
43
c8d65f10
RGS
44sub _is_win95 {
45 # miniperl might not have the Win32 functions available and we need
46 # to run in miniperl.
75e3c8a3
DM
47 my $have_win32 = eval { require Win32 };
48 return $have_win32 && defined &Win32::IsWin95 ? Win32::IsWin95()
49 : ! defined $ENV{SYSTEMROOT};
c8d65f10
RGS
50}
51
f6d6199c 52my %Is = ();
5dca256e
RGS
53$Is{VMS} = $^O eq 'VMS';
54$Is{OS2} = $^O eq 'os2';
55$Is{MacOS} = $^O eq 'MacOS';
f6d6199c 56if( $^O eq 'MSWin32' ) {
c8d65f10 57 _is_win95() ? $Is{Win95} = 1 : $Is{Win32} = 1;
f6d6199c 58}
5dca256e
RGS
59$Is{UWIN} = $^O =~ /^uwin(-nt)?$/;
60$Is{Cygwin} = $^O eq 'cygwin';
61$Is{NW5} = $Config{osname} eq 'NetWare'; # intentional
1487aac6 62$Is{BeOS} = ($^O =~ /beos/i or $^O eq 'haiku');
5dca256e 63$Is{DOS} = $^O eq 'dos';
f6d6199c
MS
64if( $Is{NW5} ) {
65 $^O = 'NetWare';
66 delete $Is{Win32};
67}
7292dc67
RGS
68$Is{VOS} = $^O eq 'vos';
69$Is{QNX} = $^O eq 'qnx';
70$Is{AIX} = $^O eq 'aix';
a592ba15 71$Is{Darwin} = $^O eq 'darwin';
7292dc67 72
5dca256e 73$Is{Unix} = !grep { $_ } values %Is;
f6d6199c 74
5dca256e 75map { delete $Is{$_} unless $Is{$_} } keys %Is;
f6d6199c
MS
76_assert( keys %Is == 1 );
77my($OS) = keys %Is;
78
79
80my $class = "ExtUtils::MM_$OS";
a592ba15 81eval "require $class" unless $INC{"ExtUtils/MM_$OS.pm"}; ## no critic
f6d6199c
MS
82die $@ if $@;
83unshift @ISA, $class;
84
85
86sub _assert {
87 my $sanity = shift;
88 die sprintf "Assert failed at %s line %d\n", (caller)[1,2] unless $sanity;
89 return;
90}