1#!perl 2# -*- cperl -*- 3use Config; 4use File::Copy; 5if ($^O eq 'MSWin32') 6 { 7 my $file; 8 chmod(0666,'Makefile'); 9 chmod(0666,'jconfig.h'); 10 if ($Config{'cc'} =~ /gcc/) 11 { 12 copy("jconfig.v32","jconfig.h") || 13 die "Cannot copy jconfig.v32 to jconfig.h:$!"; 14 $file = 'makefile.mingw32'; 15 } 16 elsif ($Config{'cc'} =~ /bcc/) 17 { 18 copy("jconfig.b32","jconfig.h") || 19 die "Cannot copy jconfig.b32 to jconfig.h:$!"; 20 $file = 'makefile.b32'; 21 } 22 else 23 { 24 copy("jconfig.v32","jconfig.h") || 25 die "Cannot copy jconfig.v32 to jconfig.h:$!"; 26 $file = 'makefile.v32'; 27 warn "Assuming ".$Config{'cc'}." is visual C of some kind\n"; 28 } 29 copy($file,"Makefile") 30 || die "Cannot copy $file to Makefile:$!"; 31 } 32else 33 { 34 $ENV{CC} = $Config{cc}; 35 local $ENV{CFLAGS} = "$Config{ccflags} $Config{cccdlflags}"; 36 local $ENV{LDFLAGS} = "$Config{ccflags} $Config{ldflags}"; 37 system(sh => "./configure"); 38 } 39 40my $seen_empty_rule; 41open my $fh, '<', 'Makefile' or die "Error opening Makefile: $!"; 42while(<$fh>) 43 { 44 if (/# Empty rule needed/) 45 { 46 $seen_empty_rule = 1; 47 last; 48 } 49 } 50if (!$seen_empty_rule) 51 { 52 open my $ofh, '>>', 'Makefile' or die "Error appending to Makefile: $!"; 53 print $ofh <<'EOF'; 54 55# Empty rules needed since ExtUtils::MakeMaker 7.18 (see https://rt.cpan.org/Ticket/Display.html?id=117800) 56test_dynamic: 57 58subdirs-test_dynamic: 59 60EOF 61 close $ofh or die "Error closing Makefile: $!"; 62} 63 641; 65