summaryrefslogtreecommitdiffabout
path: root/bootstrap
blob: 25bc72e580fb4f089a73523ea84f5bbd21b62d51 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/perl
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;

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: generating m4/varnish_mib.m4\n";
open(my $fd, '<', $mib2c_config);
my $prog;
while (<$fd>) {
    if (defined($prog)) {
	last if /^\@endperl\@/;
	$prog .= $_;
    } else {
	if (/^\@startperl\@/) {
	    $prog = "no strict \"vars\";\n";
	}
    }
}

my %vars;
eval $prog;
die $@ if $@;
die "$mib2c_config does not declare translation table"
    unless exists $vars{'varnish_translate_table'};

open(my $fd, '>', 'm4/varnish_mib.m4');
print $fd <<'EOT';
AC_DEFUN([AC_CHECK_VSC_C_MAIN_MEMBERS],
[save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $VARNISHAPI_CFLAGS"
EOT
;

foreach my $member (sort
		     map { $_->[1] }
		      grep { $_->[0] eq 'MAIN' }
		       values %{$vars{'varnish_translate_table'}}) {
    print $fd <<EOT
  AC_CHECK_MEMBERS([struct VSC_C_main.$member],,,
[#include <stddef.h>
#include <stdlib.h>
#include <stdint.h>
#include <limits.h>
#include <vapi/vsc.h>
#include <vapi/vsm.h>
#include <vcli.h>])
EOT
;
}
print $fd <<'EOT'
CFLAGS="$save_CFLAGS"
])    
EOT
;    
close $fd;

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

Return to:

Send suggestions and report system problems to the System administrator.