#!/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 <) { 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 < #include #include #include #include #include #include ]) EOT ; } print $fd <<'EOT' CFLAGS="$save_CFLAGS" ]) EOT ; close $fd; print "$0: reconfiguring\n"; exec('autoreconf -f -i -s');