Return-Path: Delivered-To: apmail-httpd-apreq-cvs-archive@httpd.apache.org Received: (qmail 81226 invoked by uid 500); 21 Aug 2003 03:09:22 -0000 Mailing-List: contact apreq-cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: apreq-dev@httpd.apache.org List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list apreq-cvs@httpd.apache.org Received: (qmail 81209 invoked by uid 500); 21 Aug 2003 03:09:21 -0000 Delivered-To: apmail-httpd-apreq-2-cvs@apache.org Received: (qmail 81203 invoked from network); 21 Aug 2003 03:09:21 -0000 Received: from minotaur.apache.org (209.237.227.194) by daedalus.apache.org with SMTP; 21 Aug 2003 03:09:21 -0000 Received: (qmail 14659 invoked by uid 1220); 21 Aug 2003 03:09:34 -0000 Date: 21 Aug 2003 03:09:34 -0000 Message-ID: <20030821030934.14658.qmail@minotaur.apache.org> From: randyk@apache.org To: httpd-apreq-2-cvs@apache.org Subject: cvs commit: httpd-apreq-2/win32 Configure.pl X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N randyk 2003/08/20 20:09:34 Modified: win32 Configure.pl Log: Some cleanup, and better searching for Apache-related binaries. Revision Changes Path 1.14 +32 -32 httpd-apreq-2/win32/Configure.pl Index: Configure.pl =================================================================== RCS file: /home/cvs/httpd-apreq-2/win32/Configure.pl,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- Configure.pl 20 Aug 2003 07:53:10 -0000 1.13 +++ Configure.pl 21 Aug 2003 03:09:34 -0000 1.14 @@ -58,7 +58,10 @@ print $make $_ while (); -my $apxs = dirname(which('apxs')) || fetch_apxs(); +my $apxs = which('apxs'); +unless ($apxs) { + $apxs = fetch_apxs() ? which('apxs') : ''; +} my $test = << 'END'; TEST: $(LIBAPREQ) $(MOD) @@ -83,13 +86,13 @@ if ($apxs) { $test .= << "END"; cd env - $^X t/TEST.PL -apxs $apxs/apxs + \$(PERL) t/TEST.PL -apxs $apxs cd \$(APREQ_HOME) END - $clean .= << "END"; + $clean .= << 'END'; cd env - $^X t/TEST.PL -clean - cd \$(APREQ_HOME) + $(PERL) t/TEST.PL -clean + cd $(APREQ_HOME) END } @@ -165,38 +168,23 @@ sub search { my $apache; - SEARCH: { - my $candidate; - if (my $bin = which('Apache')) { - ($candidate = $bin) =~ s!bin$!!; - if (-d $candidate and check($candidate)) { - $apache = $candidate; - last SEARCH; - } - } - my @drives = drives(); - last SEARCH unless (@drives > 0); - for my $drive (@drives) { - for ('Apache2', 'Program Files/Apache2', - 'Program Files/Apache Group/Apache2') { - $candidate = File::Spec->catpath($drive, $_); - if (-d $candidate and check($candidate)) { - $apache = $candidate; - last SEARCH; - } - } + if (my $bin = which('Apache')) { + (my $candidate = dirname($bin)) =~ s!bin$!!; + if (-d $candidate and check($candidate)) { + $apache = $candidate; } } - unless (-d $apache) { + unless ($apache and -d $apache) { $apache = prompt("Please give the path to your Apache2 installation:", $apache); } die "Can't find a suitable Apache2 installation!" - unless (-d $apache and check($apache)); + unless ($apache and -d $apache and check($apache)); $apache = Win32::GetShortPathName($apache); $apache =~ s!\\!/!g; - my $ans = prompt(qq{Use "$apache" for your Apache2 directory?}, 'yes'); + $apache =~ s!/$!!; + my $ans = prompt(qq{\nUse "$apache" for your Apache2 directory?}, 'yes'); unless ($ans =~ /^y/i) { die <<'END'; @@ -205,7 +193,6 @@ the desired top-level Apache2 directory. END - } return $apache; } @@ -250,14 +237,27 @@ sub which { my $program = shift; - return undef unless $program; - my @a = map {File::Spec->catfile($_, $program) } File::Spec->path(); + return unless $program; + my @extras = (); + my @drives = drives(); + if (@drives > 0) { + for my $drive (@drives) { + for ('Apache2', 'Program Files/Apache2', + 'Program Files/Apache Group/Apache2') { + my $bin = File::Spec->catpath($drive, $_, 'bin'); + push @extras, $bin if (-d $bin); + } + } + } + my @a = map {File::Spec->catfile($_, $program) } + (File::Spec->path(), @extras); for my $base(@a) { return $base if -x $base; for my $ext (@path_ext) { return "$base.$ext" if -x "$base.$ext"; } } + return; } sub generate_defs { @@ -333,7 +333,7 @@ rmtree($dir, 1, 1) or warn "rmtree of $dir failed: $!"; print "unlink $file\n"; unlink $file or warn "unlink of $file failed: $!"; - return "$apache/bin"; + return 1; } __DATA__