aboutsummaryrefslogtreecommitdiff
path: root/bootstrap
blob: 5717cbc491fbc8eed5b6c35c896686a18b1062ee (plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh
#! -*-perl-*-
eval 'exec perl -x -wS $0 ${1+"$@"}'
    if 0;

use strict;
use autodie;

my $mib2c_config = 'src/varnish_mib.mib2c';

die "This file must be run from the varnish-mib top level source directory"
    unless -r $mib2c_config;

sub vercmp {
    my ($va, $vb) = @_;
    my @a = split /\./, $va;
    my @b = split /\./, $vb;
    my $res;
    while (defined(my $na = shift @a)) {
	return 0 unless $na =~ /^\d+$/;
	my $nb = shift @b;
	return 1 unless defined($nb);
	return 0 unless $nb =~ /^\d+$/;
	$res = $na <=> $nb;
	last if $res;
    }
    $res;
}
    
if (-f 'lib/prereq.pl') {
    print "$0: checking prerequisites\n";
    our @prereq;
    do 'lib/prereq.pl';

    while ((my $pkg = shift @prereq) && defined(my $req = shift @prereq)) {
	my $v = eval "require $pkg; \$${pkg}::VERSION";
	if ($@) {
	    warn "$pkg not installed";
	    next;
	}
	print "$0: $pkg version $v installed\n";
	if ($v && vercmp($v, $req) < 0) {
	    warn "$pkg: version $v too old (at least $req is required)";
	}
    }
}

print "$0: creating ancillary directories and files\n";
foreach my $dir ('m4', 'build-aux') {
    mkdir($dir) unless -d $dir;
}

unless (-f 'ChangeLog') {
    open(my $fd, '>', 'ChangeLog');
    print $fd <<EOT
This file is a placeholder.  It will be filled with actual data by the first
run of make.
EOT
;
    close $fd;
}

print "$0: reconfiguring\n";
exec('autoreconf -f -i -s');

Return to:

Send suggestions and report system problems to the System administrator.