This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to ExtUtils::MakeMaker 6.25
[perl5.git] / lib / ExtUtils / MM.pm
CommitLineData
f6d6199c
MS
1package ExtUtils::MM;
2
3use strict;
4use Config;
5use vars qw(@ISA $VERSION);
6$VERSION = 0.04;
7
8require ExtUtils::Liblist;
9require ExtUtils::MakeMaker;
10
11@ISA = qw(ExtUtils::Liblist ExtUtils::MakeMaker);
12
13=head1 NAME
14
15ExtUtils::MM - OS adjusted ExtUtils::MakeMaker subclass
16
17=head1 SYNOPSIS
18
19 require ExtUtils::MM;
20 my $mm = MM->new(...);
21
22=head1 DESCRIPTION
23
24B<FOR INTERNAL USE ONLY>
25
26ExtUtils::MM is a subclass of ExtUtils::MakeMaker which automatically
27chooses the appropriate OS specific subclass for you
28(ie. ExtUils::MM_Unix, etc...).
29
30It also provides a convenient alias via the MM class (I didn't want
31MakeMaker modules outside of ExtUtils/).
32
33This class might turn out to be a temporary solution, but MM won't go
34away.
35
36=cut
37
38{
39 # Convenient alias.
40 package MM;
41 use vars qw(@ISA);
42 @ISA = qw(ExtUtils::MM);
43 sub DESTROY {}
44}
45
46my %Is = ();
5dca256e
RGS
47$Is{VMS} = $^O eq 'VMS';
48$Is{OS2} = $^O eq 'os2';
49$Is{MacOS} = $^O eq 'MacOS';
f6d6199c
MS
50if( $^O eq 'MSWin32' ) {
51 Win32::IsWin95() ? $Is{Win95} = 1 : $Is{Win32} = 1;
52}
5dca256e
RGS
53$Is{UWIN} = $^O =~ /^uwin(-nt)?$/;
54$Is{Cygwin} = $^O eq 'cygwin';
55$Is{NW5} = $Config{osname} eq 'NetWare'; # intentional
56$Is{BeOS} = $^O =~ /beos/i; # XXX should this be that loose?
57$Is{DOS} = $^O eq 'dos';
f6d6199c
MS
58if( $Is{NW5} ) {
59 $^O = 'NetWare';
60 delete $Is{Win32};
61}
5dca256e 62$Is{Unix} = !grep { $_ } values %Is;
f6d6199c 63
5dca256e 64map { delete $Is{$_} unless $Is{$_} } keys %Is;
f6d6199c
MS
65_assert( keys %Is == 1 );
66my($OS) = keys %Is;
67
68
69my $class = "ExtUtils::MM_$OS";
70eval "require $class" unless $INC{"ExtUtils/MM_$OS.pm"};
71die $@ if $@;
72unshift @ISA, $class;
73
74
75sub _assert {
76 my $sanity = shift;
77 die sprintf "Assert failed at %s line %d\n", (caller)[1,2] unless $sanity;
78 return;
79}