randyk 2003/05/04 12:18:24
Modified: . Makefile.PL
Log:
For Win32,
- don't change things if users set $ENV{APACHE} or use -httpd
in running Makefile.PL
- if neither of these are set, try to find a suitable Apache.exe,
and if found, use this to populate -httpd in @ARGV for Makefile.PL
Revision Changes Path
1.24 +23 -31 httpd-apreq/Makefile.PL
Index: Makefile.PL
===================================================================
RCS file: /home/cvs/httpd-apreq/Makefile.PL,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- Makefile.PL 1 May 2003 00:07:32 -0000 1.23
+++ Makefile.PL 4 May 2003 19:18:23 -0000 1.24
@@ -9,7 +9,9 @@
use constant HAS_APACHE_TEST => eval {require Apache::Test};
use constant WIN32 => ($^O eq "MSWin32") || $ENV{WIN32_TEST};
-win32_setup() if WIN32;
+if (WIN32) {
+ win32_setup() unless ($ENV{APACHE} || grep /^-httpd$/, @ARGV);
+}
# enable 'make test|clean'
if (HAS_APACHE_TEST) {
@@ -132,43 +134,33 @@
}
sub win32_setup {
+ require Win32;
my $apache;
- unless ($ENV{APACHE}) {
- SEARCH: {
- for my $drive ('C'..'G') {
- for my $p ('Apache', 'Program Files/Apache',
- 'Program Files/Apache Group/Apache') {
- if (-e "$drive:/$p/Apache.exe") {
- $apache = "$drive:/$p/Apache.exe";
+ SEARCH: {
+ for my $drive ('C'..'G') {
+ for my $p ('Apache', 'Program Files/Apache',
+ 'Program Files/Apache Group/Apache') {
+ if (-e "$drive:/$p/Apache.exe") {
+ $apache = "$drive:/$p/Apache.exe";
last SEARCH;
- }
}
}
}
- unless (-e $apache) {
- require ExtUtils::MakeMaker;
- ExtUtils::MakeMaker->import('prompt');
- $apache = prompt("Where is your apache.exe located?", $apache);
- }
-
- die "Can't find Apache.exe!" unless -e $apache;
-
- my $vers = qx{"$apache" -v};
- die qq{"$apache" does not appear to be version 1.3}
- unless $vers =~ m!Apache/1.3!;
- $ENV{APACHE} = $apache;
}
- my $test = 't/TEST.PL';
- my $orig = $test . '.orig';
- rename($test, $orig) unless -e $orig;
- open(ORIG, $orig) or die "Cannot open $orig: $!";
- open(NEW, ">$test") or die "Cannot open $test: $!";
- while (<ORIG>) {
- s/(use warnings.*)/$1\n\n\$ENV{APACHE} = "$apache";/;
- print NEW $_;
+ unless (-e $apache) {
+ require ExtUtils::MakeMaker;
+ ExtUtils::MakeMaker->import('prompt');
+ $apache = prompt("Where is your apache.exe located?", $apache);
}
- close ORIG;
- close NEW;
+
+ die "Can't find Apache.exe!" unless -e $apache;
+
+ my $vers = qx{"$apache" -v};
+ die qq{"$apache" does not appear to be version 1.3}
+ unless $vers =~ m!Apache/1.3!;
+ $apache = Win32::GetShortPathName($apache);
+ $apache =~ s!\\!/!g;
+ push @ARGV, '-httpd', $apache;
}
__DATA__