7 my $class = ref($proto) || $proto;
11 my $options = \
${$self->{OPTIONS
}};
12 my $output = \
${$self->{OUTPUT
}};
13 my $functions = \
%{$self->{FUNCTIONS
}};
14 my $conditionals = \
%{$self->{CONDITIONALS
}};
15 my $conditional_headers = \
%{$self->{CONDITIONAL_HEADERS
}};
16 my $conditional_functions = \
%{$self->{CONDITIONAL_FUNCTIONS
}};
21 my $configure_in_file = shift;
22 my $config_h_in_file = shift;
24 $api_file =~ s/^\.\///;
25 $configure_in_file =~ s/^\.\///;
26 $config_h_in_file =~ s/^\.\///;
28 if($$options->progress) {
29 $$output->progress("$api_file");
32 open(IN
, "< $api_file");
35 s/^\s*?(.*?)\s*$/$1/; # remove whitespace at begin and end of line
36 s/^(.*?)\s*#.*$/$1/; # remove comments
37 /^$/ && next; # skip empty lines
43 if($$options->progress) {
44 $$output->progress("$configure_in_file");
48 open(IN
, "< $configure_in_file");
50 while($again || (defined($_ = <IN
>))) {
57 # remove trailing whitespace
60 # remove leading whitespace
63 $_ = $current . " " . $next;
70 # remove leading and trailing whitespace
79 if(/^AC_CHECK_HEADERS\(\s*(.*?)\)\s*$/) {
80 my @arguments = split(/,/,$1);
81 foreach my $name (split(/\s+/, $arguments[0])) {
82 $$conditional_headers{$name}++;
84 } elsif(/^AC_CHECK_FUNCS\(\s*(.*?)\)\s*$/) {
85 my @arguments = split(/,/,$1);
86 foreach my $name (split(/\s+/, $arguments[0])) {
87 $$conditional_functions{$name}++;
89 } elsif(/^AC_FUNC_ALLOCA/) {
90 $$conditional_headers{"alloca.h"}++;
96 if($$options->progress) {
97 $$output->progress("$config_h_in_file");
100 open(IN
, "< $config_h_in_file");
103 # remove leading and trailing whitespace
109 if(/^\#undef\s+(\S+)$/) {
110 $$conditionals{$1}++;
120 my $functions = \
%{$self->{FUNCTIONS
}};
124 return $$functions{$name};
129 my $conditionals = \
%{$self->{CONDITIONALS
}};
133 return $$conditionals{$name};
136 sub found_conditional
{
138 my $conditional_found = \
%{$self->{CONDITIONAL_FOUND
}};
142 $$conditional_found{$name}++;
145 sub is_conditional_header
{
147 my $conditional_headers = \
%{$self->{CONDITIONAL_HEADERS
}};
151 return $$conditional_headers{$name};
154 sub is_conditional_function
{
156 my $conditional_functions = \
%{$self->{CONDITIONAL_FUNCTIONS
}};
160 return $$conditional_functions{$name};
166 my $output = \
${$self->{OUTPUT
}};
167 my $conditional_found = \
%{$self->{CONDITIONAL_FOUND
}};
168 my $conditionals = \
%{$self->{CONDITIONALS
}};
171 foreach my $name (sort(keys(%$conditionals))) {
172 if($name =~ /^const|inline|size_t$/) { next; }
174 if(0 && !$$conditional_found{$name}) {
175 push @messages, "config.h.in: conditional $name not used\n";
179 foreach my $message (sort(@messages)) {
180 $$output->write($message);