4 if( $ENV{PERL_CORE} ) {
18 if ($^O =~ /cygwin/i) {
21 plan skip_all => "This is not cygwin";
30 use_ok( 'ExtUtils::MM_Cygwin' );
33 my $path = File::Spec->canonpath('/a/../../c');
34 is( MM->canonpath('/a/../../c'), $path,
35 'canonpath() method should work just like the one in File::Spec' );
37 # test cflags, with the fake package below
39 CFLAGS => 'fakeflags',
43 # with CFLAGS set, it should be returned
44 is( $MM->cflags(), 'fakeflags',
45 'cflags() should return CFLAGS member data, if set' );
49 # ExtUtils::MM_Cygwin::cflags() calls this, fake the output
51 local $SIG{__WARN__} = sub {
52 warn @_ unless $_[0] =~ /^Subroutine .* redefined/;
54 *ExtUtils::MM_Unix::cflags = sub { return $_[1] };
57 # respects the config setting, should ignore whitespace around equal sign
58 my $ccflags = $Config{useshrplib} eq 'true' ? ' -DUSEIMPORTLIB' : '';
60 local $MM->{NEEDS_LINKING} = 1;
67 like( $MM->{CFLAGS}, qr/OPTIMIZE = opt/, '... should set OPTIMIZE' );
68 like( $MM->{CFLAGS}, qr/PERLTYPE = pt/, '... should set PERLTYPE' );
69 like( $MM->{CFLAGS}, qr/CCFLAGS = $ccflags/, '... should set CCFLAGS' );
76 MAKEFILE => 'Makefile',
78 unlike( $MM->manifypods(), qr/foo/,
79 'manifypods() should return without PODS values set' );
81 $MM->{MAN3PODS} = { foo => 'foo.1' };
82 my $res = $MM->manifypods();
83 like( $res, qr/pure_all.*foo.*foo.1/s, '... should add MAN3PODS targets' );
88 my $libperl = $Config{libperl} || 'libperl.a';
89 $libperl =~ s/\.a/.dll.a/ if $] >= 5.006002;
90 $libperl = "\$(PERL_INC)/$libperl";
96 is( $MM->{PERL_ARCHIVE}, $libperl, 'PERL_ARCHIVE' );
97 is( $MM->{PERL_ARCHIVE_AFTER}, $after, 'PERL_ARCHIVE_AFTER' );
98 is( $MM->{EXPORT_LIST}, $export, 'EXPORT_LIST' );
101 # Tests for correct handling of maybe_command in /cygdrive/*
102 # and c:/*. $ENV{COMSPEC}, if it exists, should always be executable.
105 my $comspec = $ENV{COMSPEC};
107 skip("\$ENV{COMSPEC} does not exist", 3) unless $comspec;
109 # Convert into cygwin-flavoured '/cygdrive/c/...' path.
110 # Is there a better way than direct munging? A File::*
113 $comspec =~ s{^(\w):} {/cygdrive/\l$1}x;
114 $comspec =~ s{\\ } {/}gx;
116 ok(MM->maybe_command($comspec),"$comspec should be executable");
118 # /cygdrive/c should *never* be executable, it's a directory.
120 ok(! MM->maybe_command(q{/cygdrive/c}),
121 qq{/cygdrive/c should never be executable}
124 # Our copy of Perl (with a unix-path) should always be executable.
126 ok(MM->maybe_command($Config{perlpath}),
127 qq{$Config{perlpath} should be executable}
135 bless(\(my $scalar), $_[0]);