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*([^,\)]*)(?:,|\))?/) {
80 foreach my $name (split(/\s+/, $1)) {
81 $$conditional_headers{$name}++;
83 } elsif(/^AC_CHECK_FUNCS\(\s*([^,\)]*)(?:,|\))?/) {
84 foreach my $name (split(/\s+/, $1)) {
85 $$conditional_functions{$name}++;
87 } elsif(/^AC_FUNC_ALLOCA/) {
88 $$conditional_headers{"alloca.h"}++;
94 if($$options->progress) {
95 $$output->progress("$config_h_in_file");
98 open(IN, "< $config_h_in_file");
101 # remove leading and trailing whitespace
107 if(/^\#undef\s+(\S+)$/) {
108 $$conditionals{$1}++;
118 my $functions = \%{$self->{FUNCTIONS}};
122 return $$functions{$name};
127 my $conditionals = \%{$self->{CONDITIONALS}};
131 return $$conditionals{$name};
134 sub found_conditional {
136 my $conditional_found = \%{$self->{CONDITIONAL_FOUND}};
140 $$conditional_found{$name}++;
143 sub is_conditional_header {
145 my $conditional_headers = \%{$self->{CONDITIONAL_HEADERS}};
149 return $$conditional_headers{$name};
152 sub is_conditional_function {
154 my $conditional_functions = \%{$self->{CONDITIONAL_FUNCTIONS}};
158 return $$conditional_functions{$name};
164 my $output = \${$self->{OUTPUT}};
165 my $conditional_found = \%{$self->{CONDITIONAL_FOUND}};
166 my $conditionals = \%{$self->{CONDITIONALS}};
169 foreach my $name (sort(keys(%$conditionals))) {
170 if($name =~ /^const|inline|size_t$/) { next; }
172 if(0 && !$$conditional_found{$name}) {
173 push @messages, "config.h.in: conditional $name not used\n";
177 foreach my $message (sort(@messages)) {
178 $$output->write($message);