5 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
10 @EXPORT_OK = qw($nativeapi);
12 use vars qw($nativeapi);
14 use config qw(&file_type $current_dir $wine_dir $winapi_check_dir);
15 use options qw($options);
16 use output qw($output);
18 $nativeapi = 'nativeapi'->new;
22 my $class = ref($proto) || $proto;
24 bless ($self, $class);
26 my $functions = \%{$self->{FUNCTIONS}};
27 my $conditionals = \%{$self->{CONDITIONALS}};
28 my $conditional_headers = \%{$self->{CONDITIONAL_HEADERS}};
29 my $conditional_functions = \%{$self->{CONDITIONAL_FUNCTIONS}};
31 my $api_file = "$winapi_check_dir/nativeapi.dat";
32 my $configure_in_file = "$wine_dir/configure.in";
33 my $config_h_in_file = "$wine_dir/include/config.h.in";
35 $api_file =~ s/^\.\///;
36 $configure_in_file =~ s/^\.\///;
37 $config_h_in_file =~ s/^\.\///;
39 $output->progress("$api_file");
41 open(IN, "< $api_file");
44 s/^\s*(.*?)\s*$/$1/; # remove whitespace at begin and end of line
45 s/^(.*?)\s*#.*$/$1/; # remove comments
46 /^$/ && next; # skip empty lines
52 $output->progress("$configure_in_file");
55 open(IN, "< $configure_in_file");
57 while($again || (defined($_ = <IN>))) {
64 # remove trailing whitespace
67 # remove leading whitespace
70 $_ = $current . " " . $next;
77 # remove leading and trailing whitespace
86 if(/^AC_CHECK_HEADERS\(\s*([^,\)]*)(?:,|\))?/) {
87 foreach my $name (split(/\s+/, $1)) {
88 $$conditional_headers{$name}++;
90 } elsif(/^AC_CHECK_FUNCS\(\s*([^,\)]*)(?:,|\))?/) {
91 foreach my $name (split(/\s+/, $1)) {
92 $$conditional_functions{$name}++;
94 } elsif(/^AC_FUNC_ALLOCA/) {
95 $$conditional_headers{"alloca.h"}++;
101 $output->progress("$config_h_in_file");
103 open(IN, "< $config_h_in_file");
106 # remove leading and trailing whitespace
112 if(/^\#undef\s+(\S+)$/) {
113 $$conditionals{$1}++;
125 my $functions = \%{$self->{FUNCTIONS}};
129 return $$functions{$name};
134 my $conditionals = \%{$self->{CONDITIONALS}};
138 return $$conditionals{$name};
141 sub found_conditional {
143 my $conditional_found = \%{$self->{CONDITIONAL_FOUND}};
147 $$conditional_found{$name}++;
150 sub is_conditional_header {
152 my $conditional_headers = \%{$self->{CONDITIONAL_HEADERS}};
156 return $$conditional_headers{$name};
159 sub is_conditional_function {
161 my $conditional_functions = \%{$self->{CONDITIONAL_FUNCTIONS}};
165 return $$conditional_functions{$name};
171 my $output = \${$self->{OUTPUT}};
172 my $conditional_found = \%{$self->{CONDITIONAL_FOUND}};
173 my $conditionals = \%{$self->{CONDITIONALS}};
176 foreach my $name (sort(keys(%$conditionals))) {
177 if($name =~ /^const|inline|size_t$/) { next; }
179 if(0 && !$$conditional_found{$name}) {
180 push @messages, "config.h.in: conditional $name not used\n";
184 foreach my $message (sort(@messages)) {
185 $output->write($message);