Author: stevehay Date: Tue Nov 19 11:31:54 2013 New Revision: 1543390 URL: http://svn.apache.org/r1543390 Log: Import http://archive.apache.org/dist/perl/win32-bin/apxs_win32-0.3.tar.gz
Modified: perl/apxs/trunk/Configure.pl perl/apxs/trunk/README perl/apxs/trunk/apr_win32.pl perl/apxs/trunk/apu_win32.pl perl/apxs/trunk/apxs_win32 perl/apxs/trunk/apxs_win32.pl perl/apxs/trunk/util.pl Modified: perl/apxs/trunk/Configure.pl URL: http://svn.apache.org/viewvc/perl/apxs/trunk/Configure.pl?rev=1543390&r1=1543389&r2=1543390&view=diff ============================================================================== --- perl/apxs/trunk/Configure.pl (original) +++ perl/apxs/trunk/Configure.pl Tue Nov 19 11:31:54 2013 @@ -10,105 +10,139 @@ use File::Spec::Functions; require 'util.pl'; BEGIN { - die 'This script is intended for Win32' unless $^O =~ /Win32/i; + die 'This script is intended for Win32' unless $^O =~ /Win32/i; } -my ($apache, $help); +my ($apache, $help, $progname); GetOptions( 'with-apache2=s' => \$apache, + 'with-apache-prog=s' => \$progname, 'help' => \$help, ) or usage($0); usage($0) if $help; my @path_ext; path_ext(); -$apache ||= search(); +($apache, $progname) = search($apache, $progname); + +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) { - warn "Cannot parse $file: $@" if $@; - warn "Cannot do $file: $!" unless defined $return; - warn "Cannot run $file" unless $return; - } + push @ARGV, "--with-apache2=$apache"; + unless (my $return = do $file) { + die "Cannot parse $file: $@" if $@; + die "Cannot do $file: $!" unless defined $return; + die "Cannot run $file" unless $return; + } } sub search { - my $apache; - if (my $bin = which('Apache')) { - (my $candidate = dirname($bin)) =~ s!bin$!!; - if (-d $candidate and check($candidate)) { - $apache = $candidate; - } - } - 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 ($apache and -d $apache and check($apache)); - - $apache = Win32::GetShortPathName($apache); - $apache =~ s!\\$!!; - my $ans = prompt(qq{\nUse "$apache" for your Apache2 directory?}, 'yes'); - unless ($ans =~ /^y/i) { - die <<'END'; + my ($apache, $progname) = @_; + + if ($apache) { + die qq{Cannot find the "$apache" directory} unless -d $apache; + if ($progname) { + my $bin = catfile $apache, 'bin', $progname; + die qq{"$bin" appears not to be an executable file} unless (-x $bin); + } + else { + $progname = 'Apache.exe'; + } + if (check_httpd($apache, $progname)) { + $apache = Win32::GetShortPathName($apache); + $apache =~ s!\\$!!; + return ($apache, $progname); + } + else { + die qq{"$apache" appears not to be a suitable Apache2 installation}; + } + } + + for my $binary( qw(Apache.exe httpd.exe) ) { + my ($candidate, $bin); + if ($bin = which($binary)) { + ($candidate = dirname($bin)) =~ s!bin$!!; + if (-d $candidate and check_httpd($candidate, $binary)) { + $apache = $candidate; + $progname = $binary; + last; + } + } + } + + $progname ||= 'Apache.exe'; + + unless ($apache and -d $apache) { + $apache = prompt("Please give the path to your Apache2 installation:", + $apache); + $progname = prompt("Please give the name of your Apache program name:", + $progname); + } + die "Cannot find a suitable Apache2 installation!" + unless ($apache and -d $apache and check_httpd($apache, $progname)); + + $apache = Win32::GetShortPathName($apache); + $apache =~ s!\\$!!; + my $ans = prompt(qq{\nUse "$apache" for your Apache2 directory?}, 'yes'); + unless ($ans =~ /^y/i) { + die <<'END'; Please run this configuration script again, and give the --with-apache2=C:\Path\to\Apache2 option to specify -the desired top-level Apache2 directory. +the desired top-level Apache2 directory and, if necessary, +the --with-apache-prog=httpd.exe to specify the Apache +program name. END - } - return $apache; + } + return ($apache, $progname); } sub drives { - my @drives = (); - eval{require Win32API::File;}; - return map {"$_:\\"} ('C' .. 'Z') if $@; - my @r = Win32API::File::getLogicalDrives(); - return unless @r > 0; - for (@r) { - my $t = Win32API::File::GetDriveType($_); - push @drives, $_ if ($t == 3 or $t == 4); - } - return @drives > 0 ? @drives : undef; + my @drives = (); + eval{require Win32API::File;}; + return map {"$_:\\"} ('C' .. 'Z') if $@; + my @r = Win32API::File::getLogicalDrives(); + return unless @r > 0; + for (@r) { + my $t = Win32API::File::GetDriveType($_); + push @drives, $_ if ($t == 3 or $t == 4); + } + return @drives > 0 ? @drives : undef; } sub path_ext { - if ($ENV{PATHEXT}) { - push @path_ext, split ';', $ENV{PATHEXT}; - for my $ext (@path_ext) { - $ext =~ s/^\.*(.+)$/$1/; - } - } - else { - #Win9X: doesn't have PATHEXT - push @path_ext, qw(com exe bat); - } + if ($ENV{PATHEXT}) { + push @path_ext, split ';', $ENV{PATHEXT}; + for my $ext (@path_ext) { + $ext =~ s/^\.*(.+)$/$1/; + } + } + else { + #Win9X: doesn't have PATHEXT + push @path_ext, qw(com exe bat); + } } sub which { - my $program = shift; - 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 = catfile $drive, $_, 'bin'; - push @extras, $bin if (-d $bin); - } - } - } - my @a = map {catfile($_, $program) } - (path(), @extras); - for my $base(@a) { - return $base if -x $base; - for my $ext (@path_ext) { - return "$base.$ext" if -x "$base.$ext"; - } + my $program = shift; + 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 = catfile $drive, $_, 'bin'; + push @extras, $bin if (-d $bin); + } + } + } + my @a = map {catfile($_, $program) } (path(), @extras); + for my $base(@a) { + return $base if -x $base; + for my $ext (@path_ext) { + return "$base.$ext" if -x "$base.$ext"; } - return; + } + return; } Modified: perl/apxs/trunk/README URL: http://svn.apache.org/viewvc/perl/apxs/trunk/README?rev=1543390&r1=1543389&r2=1543390&view=diff ============================================================================== --- perl/apxs/trunk/README (original) +++ perl/apxs/trunk/README Tue Nov 19 11:31:54 2013 @@ -5,8 +5,18 @@ To install, at a DOS prompt run which will attempt to find your top-level Apache2 directory. If this is unsuccessful, or the guess is wrong, run perl Configure.pl --with-apache2=\Path\to\Apache2 -The utilties will be placed under \Path\to\Apache2\bin\. +The utilities will be placed under \Path\to\Apache2\bin\. + +If you are building for Apache 2.1-dev/2.2, you will discover +that it's now httpd.exe, not Apache.exe. Specifying + + perl Configure.pl --with-apache-prog=httpd.exe + +will provide the results you hoped for. Randy Kobes <ra...@theoryx5.uwinnipeg.ca> -March 17, 2004 +Bill Rowe <wrowe rowe-clan.net> provided the fixes necessary +for Apache 2.1-dev/2.2. + +July 22, 2005 Modified: perl/apxs/trunk/apr_win32.pl URL: http://svn.apache.org/viewvc/perl/apxs/trunk/apr_win32.pl?rev=1543390&r1=1543389&r2=1543390&view=diff ============================================================================== --- perl/apxs/trunk/apr_win32.pl (original) +++ perl/apxs/trunk/apr_win32.pl Tue Nov 19 11:31:54 2013 @@ -45,7 +45,7 @@ unless (defined $prefix and -d $prefix) $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); Modified: perl/apxs/trunk/apu_win32.pl URL: http://svn.apache.org/viewvc/perl/apxs/trunk/apu_win32.pl?rev=1543390&r1=1543389&r2=1543390&view=diff ============================================================================== --- perl/apxs/trunk/apu_win32.pl (original) +++ perl/apxs/trunk/apu_win32.pl Tue Nov 19 11:31:54 2013 @@ -45,7 +45,7 @@ unless (defined $prefix and -d $prefix) $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); Modified: perl/apxs/trunk/apxs_win32 URL: http://svn.apache.org/viewvc/perl/apxs/trunk/apxs_win32?rev=1543390&r1=1543389&r2=1543390&view=diff ============================================================================== --- perl/apxs/trunk/apxs_win32 (original) +++ perl/apxs/trunk/apxs_win32 Tue Nov 19 11:31:54 2013 @@ -41,6 +41,7 @@ my $exec_prefix = get_vars('exec_pre my $datadir = get_vars('datadir'); my $localstatedir = get_vars('localstatedir'); my $CFG_TARGET = get_vars('progname'); +my $progname = get_vars('progname'); my $CFG_SYSCONFDIR = get_vars('sysconfdir'); my $CFG_SYSCONF = get_vars('sysconf'); my $CFG_CFLAGS = join ' ', map { get_vars($_) } @@ -302,6 +303,7 @@ if ($opt_g) { my $data = join('', <DATA>); $data =~ s!__END__.*!!s; $data =~ s|%NAME%|$name|sg; + $data =~ s|%PROGNAME%|$progname|sg; $data =~ s|%SYSCONF%|$CFG_SYSCONF|sg; $data =~ s|%PREFIX%|$prefix|sg; $data =~ s|%INSTALLBUILDDIR%|$installbuilddir|sg; @@ -687,7 +689,7 @@ top_builddir=%PREFIX% # the used tools APXS=apxs -APACHECTL=Apache.exe -k +APACHECTL=%PROGNAME% -k # additional defines, includes and libraries #DEFS=-Dmy_define=my_value Modified: perl/apxs/trunk/apxs_win32.pl URL: http://svn.apache.org/viewvc/perl/apxs/trunk/apxs_win32.pl?rev=1543390&r1=1543389&r2=1543390&view=diff ============================================================================== --- perl/apxs/trunk/apxs_win32.pl (original) +++ perl/apxs/trunk/apxs_win32.pl Tue Nov 19 11:31:54 2013 @@ -7,8 +7,9 @@ use Config; use ExtUtils::MakeMaker; use File::Spec::Functions; require 'util.pl'; -my ($apache, $help); +my ($apache, $help, $progname); GetOptions( 'with-apache2=s' => \$apache, + 'with-apache-prog=s' => \$progname, 'help' => \$help, ) or usage($0); usage($0) if $help; @@ -18,13 +19,14 @@ unless (defined $apache and -d $apache) $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); my $perl = which('perl'); my %subs_cfg = ( '%APACHE2%' => $apache, + '%PROGNAME%' => $progname, '%AWK%' => which('awk') || which('gawk') || '', '%CC%' => $Config{cc}, '%CPP%' => $Config{cpp}, @@ -132,7 +134,7 @@ close $out; system ('pl2bat', $apxs_out) == 0 or die "system pl2bat $apxs_out failed: $?"; -print qq{\napxs.bat has been created under $apache/bin.\n\n}; +print qq{\napxs.bat has been created under $apache\\bin.\n\n}; __DATA__ exp_exec_prefix = %APACHE2% @@ -166,7 +168,7 @@ htdbm_LTFLAGS = ab_LTFLAGS = checkgid_LTFLAGS = APACHECTL_ULIMIT = -progname = Apache.exe +progname = %PROGNAME% MPM_LIB = server/mpm/winnt/ OS = win32 OS_DIR = win32 Modified: perl/apxs/trunk/util.pl URL: http://svn.apache.org/viewvc/perl/apxs/trunk/util.pl?rev=1543390&r1=1543389&r2=1543390&view=diff ============================================================================== --- perl/apxs/trunk/util.pl (original) +++ perl/apxs/trunk/util.pl Tue Nov 19 11:31:54 2013 @@ -1,32 +1,84 @@ -sub usage { - my $script = shift; - print <<"END"; - - Usage: perl $script [--with-apache2=C:\Path\to\Apache2] - perl $script --help - -Options: - - --with-apache2=C:\Path\to\Apache2 : specify the top-level Apache2 directory - --help : print this help message - -With no options specified, an attempt will be made to find a suitable -Apache2 directory. - -END - exit; -} - -sub check { - my $apache = shift; - 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!; - return 1; -} - -1; +use File::Spec::Functions; + +sub usage { + my $script = shift; + 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 +Apache2 directory with a program name of "Apache.exe". + +END + exit; +} + +sub check_httpd { + my ($apache, $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/$progname" -v}; + die qq{"$apache" does not appear to be version 2} + unless $vers =~ m!Apache/2!; + + return 1; +} + +sub check_apr { + (my $prefix) = @_; + my ($dir); + + my $lib = catdir $prefix, 'lib'; + opendir($dir, $lib) or die qq{Cannot opendir $lib: $!}; + my @libs = grep /^libapr\b\S+lib$/, readdir $dir; + closedir $dir; + die qq{Unable to find apr lib beneath $lib} unless (scalar @libs > 0); + + die qq{No apr.h header found under $prefix/include} + unless -e qq{$prefix/include/apr.h}; + + my $bin = catdir $prefix, 'bin'; + opendir($dir, $bin) or die qq{Cannot opendir $bin: $!}; + my @bins = grep /^libapr\b\S+dll$/, readdir $dir; + closedir $dir; + die qq{Unable to find apr dll beneath $bin} unless (scalar @bins > 0); + + return 1; +} + +sub check_apu { + (my $prefix) = @_; + my ($dir); + + my $lib = catdir $prefix, 'lib'; + opendir($dir, $lib) or die qq{Cannot opendir $lib: $!}; + my @libs = grep /^libaprutil\b\S+lib$/, readdir $dir; + closedir $dir; + die qq{Unable to find aprutil lib beneath $lib} unless (scalar @libs > 0); + + die qq{No apu.h header found under $prefix/include} + unless -e qq{$prefix/include/apu.h}; + + my $bin = catdir $prefix, 'bin'; + opendir($dir, $bin) or die qq{Cannot opendir $bin: $!}; + my @bins = grep /^libaprutil\b\S+dll$/, readdir $dir; + closedir $dir; + die qq{Unable to find aprutil dll beneath $bin} unless (scalar @bins > 0); + + return 1; +} + +1;