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>))) {
56 $_ = $1 . " " . $line;
61 # remove leading and trailing whitespace
64 if(/^AC_CHECK_HEADERS\(\s*(.*?)\)\s*$/) {
65 my @arguments = split(/,/,$1);
66 foreach my $name (split(/\s+/, $arguments[0])) {
67 $$conditional_headers{$name}++;
69 } elsif(/^AC_CHECK_FUNCS\(\s*(.*?)\)\s*$/) {
70 my @arguments = split(/,/,$1);
71 foreach my $name (split(/\s+/, $arguments[0])) {
72 $$conditional_functions{$name}++;
74 } elsif(/^AC_FUNC_ALLOCA/) {
75 $$conditional_headers{"alloca.h"}++;
81 if($$options->progress) {
82 $$output->progress("$config_h_in_file");
85 open(IN, "< $config_h_in_file");
88 if(/^\#undef\s+(\S+)$/) {
99 my $functions = \%{$self->{FUNCTIONS}};
103 return $$functions{$name};
108 my $conditionals = \%{$self->{CONDITIONALS}};
112 return $$conditionals{$name};
115 sub is_conditional_header {
117 my $conditional_headers = \%{$self->{CONDITIONAL_HEADERS}};
121 return $$conditional_headers{$name};
124 sub is_conditional_function {
126 my $conditional_functions = \%{$self->{CONDITIONAL_FUNCTIONS}};
130 return $$conditional_functions{$name};