1 | package ExtUtils::MM;
|
---|
2 |
|
---|
3 | use strict;
|
---|
4 | use ExtUtils::MakeMaker::Config;
|
---|
5 | use vars qw(@ISA $VERSION);
|
---|
6 | $VERSION = '0.05';
|
---|
7 |
|
---|
8 | require ExtUtils::Liblist;
|
---|
9 | require ExtUtils::MakeMaker;
|
---|
10 |
|
---|
11 | @ISA = qw(ExtUtils::Liblist ExtUtils::MakeMaker);
|
---|
12 |
|
---|
13 | =head1 NAME
|
---|
14 |
|
---|
15 | ExtUtils::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 |
|
---|
24 | B<FOR INTERNAL USE ONLY>
|
---|
25 |
|
---|
26 | ExtUtils::MM is a subclass of ExtUtils::MakeMaker which automatically
|
---|
27 | chooses the appropriate OS specific subclass for you
|
---|
28 | (ie. ExtUils::MM_Unix, etc...).
|
---|
29 |
|
---|
30 | It also provides a convenient alias via the MM class (I didn't want
|
---|
31 | MakeMaker modules outside of ExtUtils/).
|
---|
32 |
|
---|
33 | This class might turn out to be a temporary solution, but MM won't go
|
---|
34 | away.
|
---|
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 |
|
---|
46 | my %Is = ();
|
---|
47 | $Is{VMS} = $^O eq 'VMS';
|
---|
48 | $Is{OS2} = $^O eq 'os2';
|
---|
49 | $Is{MacOS} = $^O eq 'MacOS';
|
---|
50 | if( $^O eq 'MSWin32' ) {
|
---|
51 | Win32::IsWin95() ? $Is{Win95} = 1 : $Is{Win32} = 1;
|
---|
52 | }
|
---|
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';
|
---|
58 | if( $Is{NW5} ) {
|
---|
59 | $^O = 'NetWare';
|
---|
60 | delete $Is{Win32};
|
---|
61 | }
|
---|
62 | $Is{VOS} = $^O eq 'vos';
|
---|
63 | $Is{QNX} = $^O eq 'qnx';
|
---|
64 | $Is{AIX} = $^O eq 'aix';
|
---|
65 |
|
---|
66 | $Is{Unix} = !grep { $_ } values %Is;
|
---|
67 |
|
---|
68 | map { delete $Is{$_} unless $Is{$_} } keys %Is;
|
---|
69 | _assert( keys %Is == 1 );
|
---|
70 | my($OS) = keys %Is;
|
---|
71 |
|
---|
72 |
|
---|
73 | my $class = "ExtUtils::MM_$OS";
|
---|
74 | eval "require $class" unless $INC{"ExtUtils/MM_$OS.pm"};
|
---|
75 | die $@ if $@;
|
---|
76 | unshift @ISA, $class;
|
---|
77 |
|
---|
78 |
|
---|
79 | sub _assert {
|
---|
80 | my $sanity = shift;
|
---|
81 | die sprintf "Assert failed at %s line %d\n", (caller)[1,2] unless $sanity;
|
---|
82 | return;
|
---|
83 | }
|
---|