perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject [Patch WIN32 apxs]
Date Fri, 22 Jul 2005 22:02:48 GMT
For users of Randy's apxs win32 (v 0.2) here's my gross hack to get
it working again for 2.1-dev, 2.2.  The binary has changed from
apache.exe to httpd.exe, causing some pain.  However, it's specific,
I started generic but ran out of time (libapr-1.dll for example.)

Sorry for the crosspost, expect a few on each list to be most
interested in this.

Would like to see this in httpd 2.2 final.  It looks like a wee bit
of overkill, and apr / apr-util / httpd really should each deposit
their own droppings in bin/, build/.  Just no time to refactor this
week (hmmm... vacation time ahead ;-)

Bill

diff -u3 apxs/Configure.pl apxs-win32/Configure.pl
--- apxs/Configure.pl	Tue Mar 16 17:42:30 2004
+++ apxs-win32/Configure.pl	Fri Jul 22 13:14:04 2005
@@ -13,8 +13,9 @@
     die 'This script is intended for Win32' unless $^O =~ /Win32/i;
 }
 
-my ($apache, $help);
+my ($apache, $progname, $help);
 GetOptions( 'with-apache2=s' => \$apache,
+	    'with-apache-prog=s' => \$progname,
 	    'help' => \$help,
 	    ) or usage($0);
 usage($0) if $help;
@@ -22,7 +23,10 @@
 my @path_ext;
 path_ext();
 $apache ||= search(); 
+$progname ||= "Apache.exe";
 
+push @ARGV, "--with-apache-prog=$progname";
+
 for my $file (qw(apxs_win32.pl apr_win32.pl apu_win32.pl) ) {
     push @ARGV, "--with-apache2=$apache";
     unless (my $return = do $file) {
@@ -34,10 +38,20 @@
 
 sub search {
     my $apache;
-    if (my $bin = which('Apache')) {
-        (my $candidate = dirname($bin)) =~ s!bin$!!;
-        if (-d $candidate and check($candidate)) {
+    my $candidate;
+    my $bin;
+    if ($bin = which('Apache.exe')) {
+        ($candidate = dirname($bin)) =~ s!bin$!!;
+        if (-d $candidate and check($candidate, "Apache.exe")) {
+            $apache = $candidate;
+            $progname = "Apache.exe";
+        }
+    }
+    elsif ($bin = which('httpd.exe')) {
+        ($candidate = dirname($bin)) =~ s!bin$!!;
+        if (-d $candidate and check($candidate, "httpd.exe")) {
             $apache = $candidate;
+            $progname = "httpd.exe";
         }
     }
     unless ($apache and -d $apache) {
diff -u3 apxs/README apxs-win32/README
--- apxs/README	Fri Jul 22 14:56:33 2005
+++ apxs-win32/README	Tue Mar 16 22:36:36 2004
@@ -10,14 +10,3 @@
 Randy Kobes <randy@theoryx5.uwinnipeg.ca>
 March 17, 2004
 
-
-If you are building for Apache 2.1-dev/2.2, you will discover
-that it's now httpd.exe, not Apache.exe.
-
-   perl Configure.pl --with-apache-prog=httpd.exe
-
-will provide the results you hoped for.
-
-Bill Rowe <wrowe rowe-clan.net>
-July 22, 2005
-
diff -u3 apxs/apr_win32.pl apxs-win32/apr_win32.pl
--- apxs/apr_win32.pl	Tue Mar 16 21:55:52 2004
+++ apxs-win32/apr_win32.pl	Fri Jul 22 12:13:28 2005
@@ -45,7 +45,7 @@
 		     $prefix);
 }
 die "Can't find a suitable Apache2 installation!" 
-    unless (-d $prefix and check($prefix));
+    unless (-d $prefix and check_apr($prefix));
 
 $prefix = Win32::GetShortPathName($prefix);
 
diff -u3 apxs/apu_win32.pl apxs-win32/apu_win32.pl
--- apxs/apu_win32.pl	Tue Mar 16 21:56:52 2004
+++ apxs-win32/apu_win32.pl	Fri Jul 22 12:13:47 2005
@@ -45,7 +45,7 @@
 		     $prefix);
 }
 die "Can't find a suitable Apache2 installation!" 
-    unless (-d $prefix and check($prefix));
+    unless (-d $prefix and check_apu($prefix));
 
 $prefix = Win32::GetShortPathName($prefix);
 
diff -u3 apxs/apxs_win32 apxs-win32/apxs_win32
--- apxs/apxs_win32	Tue Mar 16 22:25:16 2004
+++ apxs-win32/apxs_win32	Fri Jul 22 13:18:24 2005
@@ -687,7 +687,7 @@
 
 #   the used tools
 APXS=apxs
-APACHECTL=Apache.exe -k
+APACHECTL=$progname -k
 
 #   additional defines, includes and libraries
 #DEFS=-Dmy_define=my_value
diff -u3 apxs/apxs_win32.pl apxs-win32/apxs_win32.pl
--- apxs/apxs_win32.pl	Tue Mar 16 22:13:44 2004
+++ apxs-win32/apxs_win32.pl	Fri Jul 22 13:16:45 2005
@@ -7,8 +7,9 @@
 use ExtUtils::MakeMaker;
 use File::Spec::Functions;
 require 'util.pl';
-my ($apache, $help);
+my ($apache, $progname, $help);
 GetOptions( 'with-apache2=s' => \$apache,
+	    'with-apache-prog=s' => \$progname,
 	    'help' => \$help,
 	    ) or usage($0);
 usage($0) if $help;
@@ -18,7 +19,7 @@
 		     $apache);
 }
 die "Can't find a suitable Apache2 installation!" 
-    unless (-d $apache and check($apache));
+    unless (-d $apache and check_httpd($apache, $progname));
 
 $apache = Win32::GetShortPathName($apache);
 
@@ -166,7 +167,7 @@
 ab_LTFLAGS =
 checkgid_LTFLAGS =
 APACHECTL_ULIMIT =
-progname = Apache.exe
+progname = httpd.exe
 MPM_LIB = server/mpm/winnt/
 OS = win32
 OS_DIR = win32
diff -u3 apxs/util.pl apxs-win32/util.pl
--- apxs/util.pl	Wed Aug 20 22:59:52 2003
+++ apxs-win32/util.pl	Fri Jul 22 13:19:56 2005
@@ -3,11 +3,13 @@
     print <<"END";
 
  Usage: perl $script [--with-apache2=C:\Path\to\Apache2]
+        perl $script [--with-apache-prog=httpd.exe]
         perl $script --help
 
 Options:
 
   --with-apache2=C:\Path\to\Apache2 : specify the top-level Apache2 directory
+  --with-apache-prog=Apache.exe     : specify the Apache2 program name
   --help                            : print this help message
 
 With no options specified, an attempt will be made to find a suitable 
@@ -17,15 +19,37 @@
     exit;
 }
 
-sub check {
-    my $apache = shift;
+sub check_httpd {
+    (my $apache, my $progname) = @_;
     die qq{No libhttpd library found under $apache/lib}
         unless -e qq{$apache/lib/libhttpd.lib};
     die qq{No httpd header found under $apache/include}
         unless -e qq{$apache/include/httpd.h};
-    my $vers = qx{"$apache/bin/Apache.exe" -v};
-    die qq{"$apache" does not appear to be version 2.0}
-        unless $vers =~ m!Apache/2.0!;
+    my $vers = qx{"$apache/bin/$progname" -v};
+    die qq{"$apache" does not appear to be version 2}
+        unless $vers =~ m!Apache/2!;
+    return 1;
+}
+
+sub check_apr {
+    (my $prefix) = @_;
+    die qq{No libapr-1.lib library found under $prefix/lib}
+        unless -e qq{$prefix/lib/libapr-1.lib};
+    die qq{No apr.h header found under $prefix/include}
+        unless -e qq{$prefix/include/apr.h};
+    die qq{"libapr-1.dll" not found in $prefix}
+        unless -e qq{$prefix/bin/libapr-1.dll};
+    return 1;
+}
+
+sub check_apu {
+    (my $prefix) = @_;
+    die qq{No libaprutil-1.lib library found under $prefix/lib}
+        unless -e qq{$prefix/lib/libaprutil-1.lib};
+    die qq{No apu.h header found under $prefix/include}
+        unless -e qq{$prefix/include/apu.h};
+    die qq{"libaprutil-1.dll" not found in $prefix}
+        unless -e qq{$prefix/bin/libaprutil-1.dll};
     return 1;
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message