File: util.pl

package info (click to toggle)
libapreq2 2.17-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,164 kB
  • sloc: ansic: 8,283; perl: 5,451; sh: 4,627; cpp: 380; makefile: 270; javascript: 186
file content (38 lines) | stat: -rw-r--r-- 977 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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;
}

require File::Spec;
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};
    for my $b(qw(Apache.exe httpd.exe)) {
        my $binary = File::Spec->catfile($apache, 'bin', $b);
        next unless -x $binary;
        my $vers = qx{$binary -v};
        die qq{"$apache" does not appear to be version 2.x}
            unless $vers =~ m!Apache/2.!;
        last;
    }
    return 1;
}

1;