httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <ra...@theoryx5.uwinnipeg.ca>
Subject Re: [win32] Makefile.PL fixes
Date Fri, 02 May 2003 06:16:50 GMT
On Fri, 2 May 2003, Stas Bekman wrote:

[ .. ]
> In any case it's probably simpler to:
> 
> if (WIN32 and exists $ENV{APACHE}) {
>    $ENV{APACHE} =~ s!\\!/!g;
>    push @ARGV, '-httpd', $ENV{APACHE};
> }
> 
> somewhere on the top... before Apache::TestMM::filter_args(); is called.

This is much better - thanks! In fact, it's probably better not
to (silently) do anything if the user has either set APACHE or
used -httpd. The following pushes an appropriate -httpd onto
@ARGV if a Win32 user has neither set APACHE nor used -httpd - an
advantage of this is that this no longer messes with TEST.PL, as
the generated TEST contains the info to the Apache.exe binary.

=================================================================
Index: Makefile.PL
===================================================================
RCS file: /home/cvs/httpd-apreq/Makefile.PL,v
retrieving revision 1.23
diff -u -r1.23 Makefile.PL
--- Makefile.PL	1 May 2003 00:07:32 -0000	1.23
+++ Makefile.PL	2 May 2003 06:19:33 -0000
@@ -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__

==================================================================

-- 
best regards,
randy


Mime
View raw message