12 if ($^O =~ /cygwin/i) {
15 plan skip_all => "This is not cygwin";
24 use_ok( 'ExtUtils::MM_Cygwin' );
27 my $path = File::Spec->canonpath('/a/../../c');
28 is( MM->canonpath('/a/../../c'), $path,
29 'canonpath() method should work just like the one in File::Spec' );
31 # test cflags, with the fake package below
33 CFLAGS => 'fakeflags',
37 # with CFLAGS set, it should be returned
38 is( $MM->cflags(), 'fakeflags',
39 'cflags() should return CFLAGS member data, if set' );
43 # ExtUtils::MM_Cygwin::cflags() calls this, fake the output
45 local $SIG{__WARN__} = sub {
46 warn @_ unless $_[0] =~ /^Subroutine .* redefined/;
48 *ExtUtils::MM_Unix::cflags = sub { return $_[1] };
51 # respects the config setting, should ignore whitespace around equal sign
52 my $ccflags = $Config{useshrplib} eq 'true' ? ' -DUSEIMPORTLIB' : '';
54 local $MM->{NEEDS_LINKING} = 1;
61 like( $MM->{CFLAGS}, qr/OPTIMIZE = opt/, '... should set OPTIMIZE' );
62 like( $MM->{CFLAGS}, qr/PERLTYPE = pt/, '... should set PERLTYPE' );
63 like( $MM->{CFLAGS}, qr/CCFLAGS = $ccflags/, '... should set CCFLAGS' );
70 MAKEFILE => 'Makefile',
72 unlike( $MM->manifypods(), qr/foo/,
73 'manifypods() should return without PODS values set' );
75 $MM->{MAN3PODS} = { foo => 'foo.1' };
76 my $res = $MM->manifypods();
77 like( $res, qr/pure_all.*foo.*foo.1/s, '... should add MAN3PODS targets' );
82 my $libperl = $Config{libperl} || 'libperl.a';
83 $libperl =~ s/\.a/.dll.a/ if $] >= 5.006002;
84 $libperl = "\$(PERL_INC)/$libperl";
90 is( $MM->{PERL_ARCHIVE}, $libperl, 'PERL_ARCHIVE' );
91 is( $MM->{PERL_ARCHIVE_AFTER}, $after, 'PERL_ARCHIVE_AFTER' );
92 is( $MM->{EXPORT_LIST}, $export, 'EXPORT_LIST' );
95 # Tests for correct handling of maybe_command in /cygdrive/*
96 # and c:/*. $ENV{COMSPEC}, if it exists, should always be executable.
98 skip "Needs Cygwin::win_to_posix_path()", 2 unless defined &Cygwin::win_to_posix_path;
101 my $comspec = $ENV{COMSPEC};
102 skip(q[$ENV{COMSPEC} does not exist], 1) unless $comspec;
104 $comspec = Cygwin::win_to_posix_path($comspec);
106 ok(MM->maybe_command($comspec), qq{'$comspec' should be executable"});
109 # 'C:/' should *never* be executable, it's a directory.
111 my $cdrive = Cygwin::win_to_posix_path("C:/");
113 ok(!MM->maybe_command($cdrive), qq{'$cdrive' should never be executable});
117 # Our copy of Perl (with a unix-path) should always be executable.
118 ok(MM->maybe_command($Config{perlpath}), qq{'$Config{perlpath}' should be executable});
124 bless(\(my $scalar), $_[0]);