| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#! /usr/local/bin/perl |
|
2
|
|
|
|
|
|
|
BEGIN { |
|
3
|
1
|
|
|
1
|
|
4738
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
46
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
59
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use File::Spec; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
152
|
|
|
6
|
1
|
|
|
1
|
|
23
|
my($v,$d) = File::Spec->splitpath(File::Spec->rel2abs(__FILE__)); |
|
7
|
1
|
|
|
|
|
11
|
my @d = File::Spec->splitdir($d); |
|
8
|
1
|
|
|
|
|
4
|
pop @d for 1..2; |
|
9
|
1
|
|
|
|
|
13
|
my $dist_dir = File::Spec->catpath($v,File::Spec->catdir(@d), ''); |
|
10
|
1
|
|
33
|
|
|
19
|
$ENV{AUTOM4TE} ||= File::Spec->catfile($dist_dir, 'bin/autom4te'); |
|
11
|
1
|
|
33
|
|
|
9
|
$ENV{autom4te_perllibdir} ||= File::Spec->catdir($dist_dir, 'share/autoconf'); |
|
12
|
1
|
|
33
|
|
|
19
|
$ENV{AC_MACRODIR} ||= File::Spec->catdir($dist_dir, 'share/autoconf'); |
|
13
|
1
|
|
33
|
|
|
35
|
$ENV{AUTOCONF} ||= File::Spec->catfile($dist_dir, 'bin/autoconf'); |
|
14
|
1
|
|
33
|
|
|
15
|
$ENV{AUTOHEADER} ||= File::Spec->catfile($dist_dir, 'bin/autoheader'); |
|
15
|
1
|
50
|
33
|
|
|
43
|
$ENV{AUTOM4TE_CFG} ||= File::Spec->catfile($dist_dir, 'share/autoconf/autom4te.blib.cfg') |
|
|
|
|
33
|
|
|
|
|
|
16
|
|
|
|
|
|
|
if $d[-5] eq 'lib' && $d[-6] eq 'blib'; |
|
17
|
1
|
|
33
|
|
|
80
|
$ENV{trailer_m4} ||= File::Spec->catdir($dist_dir, 'share/autoconf/autoconf/trailer.m4'); |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
# -*- perl -*- |
|
20
|
|
|
|
|
|
|
# Generated from bin/autoscan.in; do not edit by hand. |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# autoscan - Create configure.scan (a preliminary configure.ac) for a package. |
|
23
|
|
|
|
|
|
|
# Copyright (C) 1994, 1999-2017, 2020-2023 Free Software Foundation, |
|
24
|
|
|
|
|
|
|
# Inc. |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# This program is free software: you can redistribute it and/or modify |
|
27
|
|
|
|
|
|
|
# it under the terms of the GNU General Public License as published by |
|
28
|
|
|
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or |
|
29
|
|
|
|
|
|
|
# (at your option) any later version. |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful, |
|
32
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
33
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
34
|
|
|
|
|
|
|
# GNU General Public License for more details. |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License |
|
37
|
|
|
|
|
|
|
# along with this program. If not, see . |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Written by David MacKenzie . |
|
40
|
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
164337
|
eval 'case $# in 0) exec /usr/local/bin/perl -S "$0";; *) exec /usr/local/bin/perl -S "$0" "$@";; esac' |
|
42
|
|
|
|
|
|
|
if 0; |
|
43
|
|
|
|
|
|
|
|
|
44
|
1
|
|
|
1
|
|
21
|
use 5.006; |
|
|
1
|
|
|
|
|
7
|
|
|
45
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
63
|
|
|
46
|
1
|
|
|
1
|
|
7
|
use warnings FATAL => 'all'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
103
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
BEGIN |
|
49
|
|
|
|
|
|
|
{ |
|
50
|
1
|
|
50
|
1
|
|
6
|
my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '/usr/local/lib/perl5/site_perl/5.42.0/x86_64-linux/auto/share/dist/Alien-autoconf/share/autoconf'; |
|
51
|
1
|
|
|
|
|
2
|
unshift @INC, $pkgdatadir; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# Override SHELL. On DJGPP SHELL may not be set to a shell |
|
54
|
|
|
|
|
|
|
# that can handle redirection and quote arguments correctly, |
|
55
|
|
|
|
|
|
|
# e.g.: COMMAND.COM. For DJGPP always use the shell that configure |
|
56
|
|
|
|
|
|
|
# has detected. |
|
57
|
1
|
50
|
|
|
|
19
|
$ENV{'SHELL'} = '/bin/bash' if ($^O eq 'dos'); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
1
|
|
|
1
|
|
4
|
use File::Basename; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
100
|
|
|
61
|
1
|
|
|
1
|
|
5
|
use File::Find; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
43
|
|
|
62
|
|
|
|
|
|
|
|
|
63
|
1
|
|
|
1
|
|
476
|
use Autom4te::ChannelDefs; |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
148
|
|
|
64
|
1
|
|
|
1
|
|
440
|
use Autom4te::Configure_ac; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
79
|
|
|
65
|
1
|
|
|
1
|
|
451
|
use Autom4te::FileUtils; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
145
|
|
|
66
|
1
|
|
|
1
|
|
513
|
use Autom4te::General; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
156
|
|
|
67
|
1
|
|
|
1
|
|
452
|
use Autom4te::XFile; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
71477
|
|
|
68
|
|
|
|
|
|
|
|
|
69
|
1
|
|
|
|
|
4
|
my (@cfiles, @makefiles, @shfiles, @subdirs, %printed); |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# The kind of the words we are looking for. |
|
72
|
1
|
|
|
|
|
8
|
my @kinds = qw (function header identifier program |
|
73
|
|
|
|
|
|
|
makevar librarie); |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# For each kind, the default macro. |
|
76
|
1
|
|
|
|
|
11
|
my %generic_macro = |
|
77
|
|
|
|
|
|
|
( |
|
78
|
|
|
|
|
|
|
'function' => 'AC_CHECK_FUNCS', |
|
79
|
|
|
|
|
|
|
'header' => 'AC_CHECK_HEADERS', |
|
80
|
|
|
|
|
|
|
'identifier' => 'AC_CHECK_TYPES', |
|
81
|
|
|
|
|
|
|
'program' => 'AC_CHECK_PROGS', |
|
82
|
|
|
|
|
|
|
'library' => 'AC_CHECK_LIB' |
|
83
|
|
|
|
|
|
|
); |
|
84
|
|
|
|
|
|
|
|
|
85
|
1
|
|
|
|
|
6
|
my %kind_comment = |
|
86
|
|
|
|
|
|
|
( |
|
87
|
|
|
|
|
|
|
'function' => 'Checks for library functions.', |
|
88
|
|
|
|
|
|
|
'header' => 'Checks for header files.', |
|
89
|
|
|
|
|
|
|
'identifier' => 'Checks for typedefs, structures, and compiler characteristics.', |
|
90
|
|
|
|
|
|
|
'program' => 'Checks for programs.', |
|
91
|
|
|
|
|
|
|
); |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# $USED{KIND}{ITEM} is the list of locations where the ITEM (of KIND) was |
|
94
|
|
|
|
|
|
|
# used in the user package. |
|
95
|
|
|
|
|
|
|
# For instance $USED{function}{alloca} is the list of 'file:line' where |
|
96
|
|
|
|
|
|
|
# 'alloca (...)' appears. |
|
97
|
1
|
|
|
|
|
3
|
my %used = (); |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# $MACRO{KIND}{ITEM} is the list of macros to use to test ITEM. |
|
100
|
|
|
|
|
|
|
# Initialized from lib/autoscan/*. E.g., $MACRO{function}{alloca} contains |
|
101
|
|
|
|
|
|
|
# the singleton AC_FUNC_ALLOCA. Some require several checks. |
|
102
|
1
|
|
|
|
|
2
|
my %macro = (); |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# $NEEDED_MACROS{MACRO} is an array of locations requiring MACRO. |
|
105
|
|
|
|
|
|
|
# E.g., $NEEDED_MACROS{AC_FUNC_ALLOC} the list of 'file:line' containing |
|
106
|
|
|
|
|
|
|
# 'alloca (...)'. |
|
107
|
1
|
|
|
|
|
6
|
my %needed_macros = |
|
108
|
|
|
|
|
|
|
( |
|
109
|
|
|
|
|
|
|
'AC_PREREQ' => [$me], |
|
110
|
|
|
|
|
|
|
); |
|
111
|
|
|
|
|
|
|
|
|
112
|
1
|
|
|
|
|
3
|
my $log; |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
# Autoconf and lib files. |
|
115
|
1
|
|
50
|
|
|
7
|
my $autom4te = $ENV{'AUTOM4TE'} || '/usr/local/lib/perl5/site_perl/5.42.0/x86_64-linux/auto/share/dist/Alien-autoconf/bin/autom4te'; |
|
116
|
1
|
|
|
|
|
4
|
my $autoconf = "$autom4te --language=autoconf"; |
|
117
|
1
|
|
|
|
|
2
|
my @prepend_include; |
|
118
|
1
|
|
|
|
|
3
|
my @include = ('/usr/local/lib/perl5/site_perl/5.42.0/x86_64-linux/auto/share/dist/Alien-autoconf/share/autoconf'); |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
# $help |
|
121
|
|
|
|
|
|
|
# ----- |
|
122
|
1
|
|
|
|
|
8
|
$help = "Usage: $0 [OPTION]... [SRCDIR] |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Examine source files in the directory tree rooted at SRCDIR, or the |
|
125
|
|
|
|
|
|
|
current directory if none is given. Search the source files for |
|
126
|
|
|
|
|
|
|
common portability problems, check for incompleteness of |
|
127
|
|
|
|
|
|
|
'configure.ac', and create a file 'configure.scan' which is a |
|
128
|
|
|
|
|
|
|
preliminary 'configure.ac' for that package. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
-h, --help print this help, then exit |
|
131
|
|
|
|
|
|
|
-V, --version print version number, then exit |
|
132
|
|
|
|
|
|
|
-v, --verbose verbosely report processing |
|
133
|
|
|
|
|
|
|
-d, --debug don't remove temporary files |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Library directories: |
|
136
|
|
|
|
|
|
|
-B, --prepend-include=DIR prepend directory DIR to search path |
|
137
|
|
|
|
|
|
|
-I, --include=DIR append directory DIR to search path |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Report bugs to . |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
The full documentation for Autoconf can be read via 'info autoconf', |
|
142
|
|
|
|
|
|
|
or on the Web at . |
|
143
|
|
|
|
|
|
|
"; |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
# $version |
|
146
|
|
|
|
|
|
|
# -------- |
|
147
|
1
|
|
|
|
|
3
|
$version = "autoscan (GNU Autoconf) 2.72 |
|
148
|
|
|
|
|
|
|
Copyright (C) 2023 Free Software Foundation, Inc. |
|
149
|
|
|
|
|
|
|
License GPLv3+/Autoconf: GNU GPL version 3 or later |
|
150
|
|
|
|
|
|
|
, |
|
151
|
|
|
|
|
|
|
This is free software: you are free to change and redistribute it. |
|
152
|
|
|
|
|
|
|
There is NO WARRANTY, to the extent permitted by law. |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Written by David J. MacKenzie and Akim Demaille. |
|
155
|
|
|
|
|
|
|
"; |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
## ------------------------ ## |
|
161
|
|
|
|
|
|
|
## Command line interface. ## |
|
162
|
|
|
|
|
|
|
## ------------------------ ## |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
# parse_args () |
|
165
|
|
|
|
|
|
|
# ------------- |
|
166
|
|
|
|
|
|
|
# Process any command line arguments. |
|
167
|
|
|
|
|
|
|
sub parse_args () |
|
168
|
|
|
|
|
|
|
{ |
|
169
|
1
|
|
|
1
|
|
9
|
getopt ('I|include=s' => \@include, |
|
170
|
|
|
|
|
|
|
'B|prepend-include=s' => \@prepend_include); |
|
171
|
|
|
|
|
|
|
|
|
172
|
0
|
0
|
|
|
|
|
die "$me: too many arguments |
|
173
|
|
|
|
|
|
|
Try '$me --help' for more information.\n" |
|
174
|
|
|
|
|
|
|
if @ARGV > 1; |
|
175
|
|
|
|
|
|
|
|
|
176
|
0
|
|
0
|
|
|
|
my $srcdir = $ARGV[0] || "."; |
|
177
|
|
|
|
|
|
|
|
|
178
|
0
|
|
|
|
|
|
verb "srcdir = $srcdir"; |
|
179
|
0
|
0
|
|
|
|
|
chdir $srcdir || error "cannot cd to $srcdir: $!"; |
|
180
|
|
|
|
|
|
|
} |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
# init_tables () |
|
184
|
|
|
|
|
|
|
# -------------- |
|
185
|
|
|
|
|
|
|
# Put values in the tables of what to do with each token. |
|
186
|
|
|
|
|
|
|
sub init_tables () |
|
187
|
|
|
|
|
|
|
{ |
|
188
|
|
|
|
|
|
|
# The data file format supports only one line of macros per function. |
|
189
|
|
|
|
|
|
|
# If more than that is required for a common portability problem, |
|
190
|
|
|
|
|
|
|
# a new Autoconf macro should probably be written for that case, |
|
191
|
|
|
|
|
|
|
# instead of duplicating the code in lots of configure.ac files. |
|
192
|
0
|
|
|
0
|
|
|
my $file = find_file ("autoscan/autoscan.list", |
|
193
|
|
|
|
|
|
|
reverse (@prepend_include), @include); |
|
194
|
0
|
|
|
|
|
|
my $table = new Autom4te::XFile ($file, "<"); |
|
195
|
0
|
|
|
|
|
|
my $tables_are_consistent = 1; |
|
196
|
|
|
|
|
|
|
|
|
197
|
0
|
|
|
|
|
|
while ($_ = $table->getline) |
|
198
|
|
|
|
|
|
|
{ |
|
199
|
|
|
|
|
|
|
# Ignore blank lines and comments. |
|
200
|
|
|
|
|
|
|
next |
|
201
|
0
|
0
|
0
|
|
|
|
if /^\s*$/ || /^\s*\#/; |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
# ': ' or... |
|
204
|
|
|
|
|
|
|
# ': warn: '. |
|
205
|
0
|
0
|
|
|
|
|
if (/^(\S+):\s+(\S+)\s+(\S.*)$/) |
|
206
|
|
|
|
|
|
|
{ |
|
207
|
0
|
|
|
|
|
|
my ($kind, $word, $macro) = ($1, $2, $3); |
|
208
|
|
|
|
|
|
|
error "$file:$.: invalid kind: $_" |
|
209
|
0
|
0
|
|
|
|
|
unless grep { $_ eq $kind } @kinds; |
|
|
0
|
|
|
|
|
|
|
|
210
|
0
|
|
|
|
|
|
push @{$macro{$kind}{$word}}, $macro; |
|
|
0
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
} |
|
212
|
|
|
|
|
|
|
else |
|
213
|
|
|
|
|
|
|
{ |
|
214
|
0
|
|
|
|
|
|
error "$file:$.: invalid definition: $_"; |
|
215
|
|
|
|
|
|
|
} |
|
216
|
|
|
|
|
|
|
} |
|
217
|
|
|
|
|
|
|
|
|
218
|
0
|
0
|
|
|
|
|
if ($debug) |
|
219
|
|
|
|
|
|
|
{ |
|
220
|
0
|
|
|
|
|
|
foreach my $kind (@kinds) |
|
221
|
|
|
|
|
|
|
{ |
|
222
|
0
|
|
|
|
|
|
foreach my $word (sort keys %{$macro{$kind}}) |
|
|
0
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
{ |
|
224
|
0
|
|
|
|
|
|
print "$kind: $word: @{$macro{$kind}{$word}}\n"; |
|
|
0
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
} |
|
226
|
|
|
|
|
|
|
} |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
} |
|
229
|
|
|
|
|
|
|
} |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
# used ($KIND, $WORD, [$WHERE]) |
|
233
|
|
|
|
|
|
|
# ----------------------------- |
|
234
|
|
|
|
|
|
|
# $WORD is used as a $KIND. |
|
235
|
|
|
|
|
|
|
sub used ($$;$) |
|
236
|
|
|
|
|
|
|
{ |
|
237
|
0
|
|
|
0
|
|
|
my ($kind, $word, $where) = @_; |
|
238
|
0
|
|
0
|
|
|
|
$where ||= "$File::Find::name:$."; |
|
239
|
0
|
0
|
0
|
|
|
|
if ( |
|
|
|
|
0
|
|
|
|
|
|
240
|
|
|
|
|
|
|
# Check for all the libraries. But '-links' is certainly a |
|
241
|
|
|
|
|
|
|
# 'find' argument, and '-le', a 'test' argument. |
|
242
|
|
|
|
|
|
|
($kind eq 'library' && $word !~ /^(e|inks)$/) |
|
243
|
|
|
|
|
|
|
# Other than libraries are to be checked only if listed in |
|
244
|
|
|
|
|
|
|
# the Autoscan library files. |
|
245
|
|
|
|
|
|
|
|| defined $macro{$kind}{$word} |
|
246
|
|
|
|
|
|
|
) |
|
247
|
|
|
|
|
|
|
{ |
|
248
|
0
|
|
|
|
|
|
push (@{$used{$kind}{$word}}, $where); |
|
|
0
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
} |
|
250
|
|
|
|
|
|
|
} |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
## ----------------------- ## |
|
255
|
|
|
|
|
|
|
## Scanning source files. ## |
|
256
|
|
|
|
|
|
|
## ----------------------- ## |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
# scan_c_file ($FILE-NAME) |
|
260
|
|
|
|
|
|
|
# ------------------------ |
|
261
|
|
|
|
|
|
|
sub scan_c_file ($) |
|
262
|
|
|
|
|
|
|
{ |
|
263
|
0
|
|
|
0
|
|
|
my ($file_name) = @_; |
|
264
|
0
|
|
|
|
|
|
push @cfiles, $File::Find::name; |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
# Nonzero if in a multiline comment. |
|
267
|
0
|
|
|
|
|
|
my $in_comment = 0; |
|
268
|
|
|
|
|
|
|
|
|
269
|
0
|
|
|
|
|
|
my $file = new Autom4te::XFile ($file_name, "<"); |
|
270
|
|
|
|
|
|
|
|
|
271
|
0
|
|
|
|
|
|
while ($_ = $file->getline) |
|
272
|
|
|
|
|
|
|
{ |
|
273
|
|
|
|
|
|
|
# Strip out comments. |
|
274
|
0
|
0
|
0
|
|
|
|
if ($in_comment && s,^.*?\*/,,) |
|
275
|
|
|
|
|
|
|
{ |
|
276
|
0
|
|
|
|
|
|
$in_comment = 0; |
|
277
|
|
|
|
|
|
|
} |
|
278
|
|
|
|
|
|
|
# The whole line is inside a comment. |
|
279
|
0
|
0
|
|
|
|
|
next if $in_comment; |
|
280
|
|
|
|
|
|
|
# All on one line. |
|
281
|
0
|
|
|
|
|
|
s,/\*.*?\*/,,g; |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
# Starting on this line. |
|
284
|
0
|
0
|
|
|
|
|
if (s,/\*.*$,,) |
|
285
|
|
|
|
|
|
|
{ |
|
286
|
0
|
|
|
|
|
|
$in_comment = 1; |
|
287
|
|
|
|
|
|
|
} |
|
288
|
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
# Preprocessor directives. |
|
290
|
0
|
0
|
|
|
|
|
if (s/^\s*\#\s*//) |
|
291
|
|
|
|
|
|
|
{ |
|
292
|
0
|
0
|
|
|
|
|
if (/^include\s*<([^>]*)>/) |
|
293
|
|
|
|
|
|
|
{ |
|
294
|
0
|
|
|
|
|
|
used ('header', $1); |
|
295
|
|
|
|
|
|
|
} |
|
296
|
0
|
0
|
|
|
|
|
if (s/^(if|ifdef|ifndef|elif)\s+//) |
|
297
|
|
|
|
|
|
|
{ |
|
298
|
0
|
|
|
|
|
|
foreach my $word (split (/\W+/)) |
|
299
|
|
|
|
|
|
|
{ |
|
300
|
0
|
0
|
0
|
|
|
|
used ('identifier', $word) |
|
301
|
|
|
|
|
|
|
unless $word eq 'defined' || $word !~ /^[a-zA-Z_]/; |
|
302
|
|
|
|
|
|
|
} |
|
303
|
|
|
|
|
|
|
} |
|
304
|
|
|
|
|
|
|
# Ignore other preprocessor directives. |
|
305
|
0
|
|
|
|
|
|
next; |
|
306
|
|
|
|
|
|
|
} |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
# Remove string and character constants. |
|
309
|
0
|
|
|
|
|
|
s,\"[^\"]*\",,g; |
|
310
|
0
|
|
|
|
|
|
s,\'[^\']*\',,g; |
|
311
|
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
# Tokens in the code. |
|
313
|
|
|
|
|
|
|
# Maybe we should ignore function definitions (in column 0)? |
|
314
|
0
|
|
|
|
|
|
while (s/\b([a-zA-Z_]\w*)\s*\(/ /) |
|
315
|
|
|
|
|
|
|
{ |
|
316
|
0
|
|
|
|
|
|
used ('function', $1); |
|
317
|
|
|
|
|
|
|
} |
|
318
|
0
|
|
|
|
|
|
while (s/\b([a-zA-Z_]\w*)\b/ /) |
|
319
|
|
|
|
|
|
|
{ |
|
320
|
0
|
|
|
|
|
|
used ('identifier', $1); |
|
321
|
|
|
|
|
|
|
} |
|
322
|
|
|
|
|
|
|
} |
|
323
|
|
|
|
|
|
|
|
|
324
|
0
|
|
|
|
|
|
$file->close; |
|
325
|
|
|
|
|
|
|
} |
|
326
|
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
# scan_makefile($MAKEFILE-NAME) |
|
329
|
|
|
|
|
|
|
# ----------------------------- |
|
330
|
|
|
|
|
|
|
sub scan_makefile ($) |
|
331
|
|
|
|
|
|
|
{ |
|
332
|
0
|
|
|
0
|
|
|
my ($file_name) = @_; |
|
333
|
0
|
|
|
|
|
|
push @makefiles, $File::Find::name; |
|
334
|
|
|
|
|
|
|
|
|
335
|
0
|
|
|
|
|
|
my $file = new Autom4te::XFile ($file_name, "<"); |
|
336
|
|
|
|
|
|
|
|
|
337
|
0
|
|
|
|
|
|
while ($_ = $file->getline) |
|
338
|
|
|
|
|
|
|
{ |
|
339
|
|
|
|
|
|
|
# Strip out comments. |
|
340
|
0
|
|
|
|
|
|
s/#.*//; |
|
341
|
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
# Variable assignments. |
|
343
|
0
|
|
|
|
|
|
while (s/\b([a-zA-Z_]\w*)\s*=/ /) |
|
344
|
|
|
|
|
|
|
{ |
|
345
|
0
|
|
|
|
|
|
used ('makevar', $1); |
|
346
|
|
|
|
|
|
|
} |
|
347
|
|
|
|
|
|
|
# Be sure to catch a whole word. For instance 'lex$U.$(OBJEXT)' |
|
348
|
|
|
|
|
|
|
# is a single token. Otherwise we might believe 'lex' is needed. |
|
349
|
0
|
|
|
|
|
|
foreach my $word (split (/\s+/)) |
|
350
|
|
|
|
|
|
|
{ |
|
351
|
|
|
|
|
|
|
# Libraries. |
|
352
|
0
|
0
|
|
|
|
|
if ($word =~ /^-l([a-zA-Z_]\w*)$/) |
|
353
|
|
|
|
|
|
|
{ |
|
354
|
0
|
|
|
|
|
|
used ('library', $1); |
|
355
|
|
|
|
|
|
|
} |
|
356
|
|
|
|
|
|
|
# Tokens in the code. |
|
357
|
|
|
|
|
|
|
# We allow some additional characters, e.g., '+', since |
|
358
|
|
|
|
|
|
|
# autoscan/programs includes 'c++'. |
|
359
|
0
|
0
|
|
|
|
|
if ($word =~ /^[a-zA-Z_][\w+]*$/) |
|
360
|
|
|
|
|
|
|
{ |
|
361
|
0
|
|
|
|
|
|
used ('program', $word); |
|
362
|
|
|
|
|
|
|
} |
|
363
|
|
|
|
|
|
|
} |
|
364
|
|
|
|
|
|
|
} |
|
365
|
|
|
|
|
|
|
|
|
366
|
0
|
|
|
|
|
|
$file->close; |
|
367
|
|
|
|
|
|
|
} |
|
368
|
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
# scan_sh_file($SHELL-SCRIPT-NAME) |
|
371
|
|
|
|
|
|
|
# -------------------------------- |
|
372
|
|
|
|
|
|
|
sub scan_sh_file ($) |
|
373
|
|
|
|
|
|
|
{ |
|
374
|
0
|
|
|
0
|
|
|
my ($file_name) = @_; |
|
375
|
0
|
|
|
|
|
|
push @shfiles, $File::Find::name; |
|
376
|
|
|
|
|
|
|
|
|
377
|
0
|
|
|
|
|
|
my $file = new Autom4te::XFile ($file_name, "<"); |
|
378
|
|
|
|
|
|
|
|
|
379
|
0
|
|
|
|
|
|
while ($_ = $file->getline) |
|
380
|
|
|
|
|
|
|
{ |
|
381
|
|
|
|
|
|
|
# Strip out comments and variable references. |
|
382
|
0
|
|
|
|
|
|
s/#.*//; |
|
383
|
0
|
|
|
|
|
|
s/\$\{[^\}]*}//g; |
|
384
|
0
|
|
|
|
|
|
s/@[^@]*@//g; |
|
385
|
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
# Tokens in the code. |
|
387
|
0
|
|
|
|
|
|
while (s/\b([a-zA-Z_]\w*)\b/ /) |
|
388
|
|
|
|
|
|
|
{ |
|
389
|
0
|
|
|
|
|
|
used ('program', $1); |
|
390
|
|
|
|
|
|
|
} |
|
391
|
|
|
|
|
|
|
} |
|
392
|
|
|
|
|
|
|
|
|
393
|
0
|
|
|
|
|
|
$file->close; |
|
394
|
|
|
|
|
|
|
} |
|
395
|
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
# scan_file () |
|
398
|
|
|
|
|
|
|
# ------------ |
|
399
|
|
|
|
|
|
|
# Called by &find on each file. $_ contains the current file name with |
|
400
|
|
|
|
|
|
|
# the current directory of the walk through. |
|
401
|
|
|
|
|
|
|
sub scan_file () |
|
402
|
|
|
|
|
|
|
{ |
|
403
|
|
|
|
|
|
|
# Wanted only if there is no corresponding FILE.in. |
|
404
|
|
|
|
|
|
|
return |
|
405
|
0
|
0
|
|
0
|
|
|
if -f "$_.in"; |
|
406
|
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
# Save $_ as Find::File requires it to be preserved. |
|
408
|
0
|
|
|
|
|
|
local $_ = $_; |
|
409
|
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
# Strip a useless leading './'. |
|
411
|
0
|
|
|
|
|
|
$File::Find::name =~ s,^\./,,; |
|
412
|
|
|
|
|
|
|
|
|
413
|
0
|
0
|
0
|
|
|
|
if ($_ ne '.' and -d $_ and |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
414
|
|
|
|
|
|
|
-f "$_/configure.in" || |
|
415
|
|
|
|
|
|
|
-f "$_/configure.ac" || |
|
416
|
|
|
|
|
|
|
-f "$_/configure.gnu" || |
|
417
|
|
|
|
|
|
|
-f "$_/configure") |
|
418
|
|
|
|
|
|
|
{ |
|
419
|
0
|
|
|
|
|
|
$File::Find::prune = 1; |
|
420
|
0
|
|
|
|
|
|
push @subdirs, $File::Find::name; |
|
421
|
|
|
|
|
|
|
} |
|
422
|
0
|
0
|
0
|
|
|
|
if (/\.[chlym](\.in)?$/) |
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
{ |
|
424
|
0
|
|
|
|
|
|
used 'program', 'cc', $File::Find::name; |
|
425
|
0
|
|
|
|
|
|
scan_c_file ($_); |
|
426
|
|
|
|
|
|
|
} |
|
427
|
|
|
|
|
|
|
elsif (/\.(cc|cpp|cxx|CC|C|hh|hpp|hxx|HH|H|yy|ypp|ll|lpp)(\.in)?$/) |
|
428
|
|
|
|
|
|
|
{ |
|
429
|
0
|
|
|
|
|
|
used 'program', 'c++', $File::Find::name; |
|
430
|
0
|
|
|
|
|
|
scan_c_file ($_); |
|
431
|
|
|
|
|
|
|
} |
|
432
|
|
|
|
|
|
|
elsif ((/^((?:GNUm|M|m)akefile)(\.in)?$/ && ! -f "$1.am") |
|
433
|
|
|
|
|
|
|
|| /^(?:GNUm|M|m)akefile(\.am)?$/) |
|
434
|
|
|
|
|
|
|
{ |
|
435
|
0
|
|
|
|
|
|
scan_makefile ($_); |
|
436
|
|
|
|
|
|
|
} |
|
437
|
|
|
|
|
|
|
elsif (/\.sh(\.in)?$/) |
|
438
|
|
|
|
|
|
|
{ |
|
439
|
0
|
|
|
|
|
|
scan_sh_file ($_); |
|
440
|
|
|
|
|
|
|
} |
|
441
|
|
|
|
|
|
|
} |
|
442
|
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
# scan_files () |
|
445
|
|
|
|
|
|
|
# ------------- |
|
446
|
|
|
|
|
|
|
# Read through the files and collect lists of tokens in them |
|
447
|
|
|
|
|
|
|
# that might create nonportabilities. |
|
448
|
|
|
|
|
|
|
sub scan_files () |
|
449
|
|
|
|
|
|
|
{ |
|
450
|
0
|
|
|
0
|
|
|
find (\&scan_file, '.'); |
|
451
|
|
|
|
|
|
|
|
|
452
|
0
|
0
|
|
|
|
|
if ($verbose) |
|
453
|
|
|
|
|
|
|
{ |
|
454
|
0
|
|
|
|
|
|
print "cfiles: @cfiles\n"; |
|
455
|
0
|
|
|
|
|
|
print "makefiles: @makefiles\n"; |
|
456
|
0
|
|
|
|
|
|
print "shfiles: @shfiles\n"; |
|
457
|
|
|
|
|
|
|
|
|
458
|
0
|
|
|
|
|
|
foreach my $kind (@kinds) |
|
459
|
|
|
|
|
|
|
{ |
|
460
|
0
|
|
|
|
|
|
print "\n$kind:\n"; |
|
461
|
0
|
|
|
|
|
|
foreach my $word (sort keys %{$used{$kind}}) |
|
|
0
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
{ |
|
463
|
0
|
|
|
|
|
|
print "$word: @{$used{$kind}{$word}}\n"; |
|
|
0
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
} |
|
465
|
|
|
|
|
|
|
} |
|
466
|
|
|
|
|
|
|
} |
|
467
|
|
|
|
|
|
|
} |
|
468
|
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
## ----------------------- ## |
|
471
|
|
|
|
|
|
|
## Output configure.scan. ## |
|
472
|
|
|
|
|
|
|
## ----------------------- ## |
|
473
|
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
# output_kind ($FILE, $KIND) |
|
476
|
|
|
|
|
|
|
# -------------------------- |
|
477
|
|
|
|
|
|
|
sub output_kind ($$) |
|
478
|
|
|
|
|
|
|
{ |
|
479
|
0
|
|
|
0
|
|
|
my ($file, $kind) = @_; |
|
480
|
|
|
|
|
|
|
# Lists of words to be checked with the generic macro. |
|
481
|
0
|
|
|
|
|
|
my @have; |
|
482
|
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
print $file "\n# $kind_comment{$kind}\n" |
|
484
|
0
|
0
|
|
|
|
|
if exists $kind_comment{$kind}; |
|
485
|
0
|
|
|
|
|
|
foreach my $word (sort keys %{$used{$kind}}) |
|
|
0
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
{ |
|
487
|
|
|
|
|
|
|
# Output the needed macro invocations in configure.scan if not |
|
488
|
|
|
|
|
|
|
# already printed, and remember these macros are needed. |
|
489
|
0
|
|
|
|
|
|
foreach my $macro (@{$macro{$kind}{$word}}) |
|
|
0
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
{ |
|
491
|
0
|
0
|
0
|
|
|
|
if ($macro =~ /^warn:\s+(.*)/) |
|
|
|
0
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
{ |
|
493
|
0
|
|
|
|
|
|
my $message = $1; |
|
494
|
0
|
|
|
|
|
|
foreach my $location (@{$used{$kind}{$word}}) |
|
|
0
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
{ |
|
496
|
0
|
|
|
|
|
|
warn "$location: warning: $message\n"; |
|
497
|
|
|
|
|
|
|
} |
|
498
|
|
|
|
|
|
|
} |
|
499
|
|
|
|
|
|
|
elsif (exists $generic_macro{$kind} |
|
500
|
|
|
|
|
|
|
&& $macro eq $generic_macro{$kind}) |
|
501
|
|
|
|
|
|
|
{ |
|
502
|
0
|
|
|
|
|
|
push (@have, $word); |
|
503
|
0
|
|
|
|
|
|
push (@{$needed_macros{"$generic_macro{$kind}([$word])"}}, |
|
504
|
0
|
|
|
|
|
|
@{$used{$kind}{$word}}); |
|
|
0
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
} |
|
506
|
|
|
|
|
|
|
else |
|
507
|
|
|
|
|
|
|
{ |
|
508
|
0
|
0
|
|
|
|
|
if (! $printed{$macro}) |
|
509
|
|
|
|
|
|
|
{ |
|
510
|
0
|
|
|
|
|
|
print $file "$macro\n"; |
|
511
|
0
|
|
|
|
|
|
$printed{$macro} = 1; |
|
512
|
|
|
|
|
|
|
} |
|
513
|
0
|
|
|
|
|
|
push (@{$needed_macros{$macro}}, |
|
514
|
0
|
|
|
|
|
|
@{$used{$kind}{$word}}); |
|
|
0
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
} |
|
516
|
|
|
|
|
|
|
} |
|
517
|
|
|
|
|
|
|
} |
|
518
|
0
|
0
|
|
|
|
|
print $file "$generic_macro{$kind}([" . join(' ', sort(@have)) . "])\n" |
|
519
|
|
|
|
|
|
|
if @have; |
|
520
|
|
|
|
|
|
|
} |
|
521
|
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
# output_libraries ($FILE) |
|
524
|
|
|
|
|
|
|
# ------------------------ |
|
525
|
|
|
|
|
|
|
sub output_libraries ($) |
|
526
|
|
|
|
|
|
|
{ |
|
527
|
0
|
|
|
0
|
|
|
my ($file) = @_; |
|
528
|
|
|
|
|
|
|
|
|
529
|
0
|
|
|
|
|
|
print $file "\n# Checks for libraries.\n"; |
|
530
|
0
|
|
|
|
|
|
foreach my $word (sort keys %{$used{'library'}}) |
|
|
0
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
{ |
|
532
|
0
|
|
|
|
|
|
print $file "# FIXME: Replace 'main' with a function in '-l$word':\n"; |
|
533
|
0
|
|
|
|
|
|
print $file "AC_CHECK_LIB([$word], [main])\n"; |
|
534
|
|
|
|
|
|
|
} |
|
535
|
|
|
|
|
|
|
} |
|
536
|
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
# output ($CONFIGURE_SCAN) |
|
539
|
|
|
|
|
|
|
# ------------------------ |
|
540
|
|
|
|
|
|
|
# Print a proto configure.ac. |
|
541
|
|
|
|
|
|
|
sub output ($) |
|
542
|
|
|
|
|
|
|
{ |
|
543
|
0
|
|
|
0
|
|
|
my $configure_scan = shift; |
|
544
|
0
|
|
|
|
|
|
my %unique_makefiles; |
|
545
|
|
|
|
|
|
|
|
|
546
|
0
|
|
|
|
|
|
my $file = new Autom4te::XFile ($configure_scan, ">"); |
|
547
|
|
|
|
|
|
|
|
|
548
|
0
|
|
|
|
|
|
print $file |
|
549
|
|
|
|
|
|
|
("# -*- Autoconf -*-\n" . |
|
550
|
|
|
|
|
|
|
"# Process this file with autoconf to produce a configure script.\n" . |
|
551
|
|
|
|
|
|
|
"\n" . |
|
552
|
|
|
|
|
|
|
"AC_PREREQ([2.72])\n" . |
|
553
|
|
|
|
|
|
|
"AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])\n"); |
|
554
|
0
|
0
|
|
|
|
|
if (defined $cfiles[0]) |
|
555
|
|
|
|
|
|
|
{ |
|
556
|
0
|
|
|
|
|
|
print $file "AC_CONFIG_SRCDIR([$cfiles[0]])\n"; |
|
557
|
0
|
|
|
|
|
|
print $file "AC_CONFIG_HEADERS([config.h])\n"; |
|
558
|
|
|
|
|
|
|
} |
|
559
|
|
|
|
|
|
|
|
|
560
|
0
|
|
|
|
|
|
output_kind ($file, 'program'); |
|
561
|
0
|
|
|
|
|
|
output_kind ($file, 'makevar'); |
|
562
|
0
|
|
|
|
|
|
output_libraries ($file); |
|
563
|
0
|
|
|
|
|
|
output_kind ($file, 'header'); |
|
564
|
0
|
|
|
|
|
|
output_kind ($file, 'identifier'); |
|
565
|
0
|
|
|
|
|
|
output_kind ($file, 'function'); |
|
566
|
|
|
|
|
|
|
|
|
567
|
0
|
|
|
|
|
|
print $file "\n"; |
|
568
|
0
|
0
|
|
|
|
|
if (@makefiles) |
|
569
|
|
|
|
|
|
|
{ |
|
570
|
|
|
|
|
|
|
# Change DIR/Makefile.in to DIR/Makefile. |
|
571
|
0
|
|
|
|
|
|
foreach my $m (@makefiles) |
|
572
|
|
|
|
|
|
|
{ |
|
573
|
0
|
|
|
|
|
|
$m =~ s/\.(?:in|am)$//; |
|
574
|
0
|
|
|
|
|
|
$unique_makefiles{$m}++; |
|
575
|
|
|
|
|
|
|
} |
|
576
|
0
|
|
|
|
|
|
print $file ("AC_CONFIG_FILES([", |
|
577
|
|
|
|
|
|
|
join ("\n ", |
|
578
|
|
|
|
|
|
|
sort keys %unique_makefiles), "])\n"); |
|
579
|
|
|
|
|
|
|
} |
|
580
|
0
|
0
|
|
|
|
|
if (@subdirs) |
|
581
|
|
|
|
|
|
|
{ |
|
582
|
0
|
|
|
|
|
|
print $file ("AC_CONFIG_SUBDIRS([", |
|
583
|
|
|
|
|
|
|
join ("\n ", |
|
584
|
|
|
|
|
|
|
sort @subdirs), "])\n"); |
|
585
|
|
|
|
|
|
|
} |
|
586
|
0
|
|
|
|
|
|
print $file "AC_OUTPUT\n"; |
|
587
|
|
|
|
|
|
|
|
|
588
|
0
|
|
|
|
|
|
$file->close; |
|
589
|
|
|
|
|
|
|
} |
|
590
|
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
## --------------------------------------- ## |
|
594
|
|
|
|
|
|
|
## Checking the accuracy of configure.ac. ## |
|
595
|
|
|
|
|
|
|
## --------------------------------------- ## |
|
596
|
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
# &check_configure_ac ($CONFIGURE_AC) |
|
599
|
|
|
|
|
|
|
# ----------------------------------- |
|
600
|
|
|
|
|
|
|
# Use autoconf to check if all the suggested macros are included |
|
601
|
|
|
|
|
|
|
# in CONFIGURE_AC. |
|
602
|
|
|
|
|
|
|
sub check_configure_ac ($) |
|
603
|
|
|
|
|
|
|
{ |
|
604
|
0
|
|
|
0
|
|
|
my ($configure_ac) = @_; |
|
605
|
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
# Find what needed macros are invoked in CONFIGURE_AC. |
|
607
|
|
|
|
|
|
|
# I'd be very happy if someone could explain to me why sort (uniq ...) |
|
608
|
|
|
|
|
|
|
# doesn't work properly: I need 'uniq (sort ...)'. --akim |
|
609
|
|
|
|
|
|
|
my $trace_option = |
|
610
|
|
|
|
|
|
|
join (' --trace=', '', |
|
611
|
0
|
|
|
|
|
|
uniq (sort (map { s/\(.*//; $_ } keys %needed_macros))); |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
# Suppress all warnings from the subsidiary autoconf invocation. |
|
614
|
0
|
|
|
|
|
|
local $ENV{WARNINGS} = 'none'; |
|
615
|
|
|
|
|
|
|
|
|
616
|
0
|
|
|
|
|
|
verb "running: WARNINGS=none $autoconf $trace_option $configure_ac"; |
|
617
|
0
|
|
|
|
|
|
my $traces = |
|
618
|
|
|
|
|
|
|
new Autom4te::XFile "$autoconf $trace_option $configure_ac |"; |
|
619
|
|
|
|
|
|
|
|
|
620
|
0
|
|
|
|
|
|
while ($_ = $traces->getline) |
|
621
|
|
|
|
|
|
|
{ |
|
622
|
0
|
|
|
|
|
|
chomp; |
|
623
|
0
|
|
|
|
|
|
my ($file, $line, $macro, @args) = split (/:/, $_); |
|
624
|
0
|
0
|
|
|
|
|
if ($macro =~ /^AC_CHECK_(HEADER|FUNC|TYPE|MEMBER)S$/) |
|
625
|
|
|
|
|
|
|
{ |
|
626
|
|
|
|
|
|
|
# To be rigorous, we should distinguish between space and comma |
|
627
|
|
|
|
|
|
|
# separated macros. But there is no point. |
|
628
|
0
|
|
|
|
|
|
foreach my $word (split (/\s|,/, $args[0])) |
|
629
|
|
|
|
|
|
|
{ |
|
630
|
|
|
|
|
|
|
# AC_CHECK_MEMBERS wants 'struct' or 'union'. |
|
631
|
0
|
0
|
0
|
|
|
|
if ($macro eq "AC_CHECK_MEMBERS" |
|
632
|
|
|
|
|
|
|
&& $word =~ /^stat.st_/) |
|
633
|
|
|
|
|
|
|
{ |
|
634
|
0
|
|
|
|
|
|
$word = "struct " . $word; |
|
635
|
|
|
|
|
|
|
} |
|
636
|
0
|
|
|
|
|
|
delete $needed_macros{"$macro([$word])"}; |
|
637
|
|
|
|
|
|
|
} |
|
638
|
|
|
|
|
|
|
} |
|
639
|
|
|
|
|
|
|
else |
|
640
|
|
|
|
|
|
|
{ |
|
641
|
0
|
|
|
|
|
|
delete $needed_macros{$macro}; |
|
642
|
|
|
|
|
|
|
} |
|
643
|
|
|
|
|
|
|
} |
|
644
|
|
|
|
|
|
|
|
|
645
|
0
|
|
|
|
|
|
$traces->close; |
|
646
|
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
# Report the missing macros. |
|
648
|
0
|
|
|
|
|
|
foreach my $macro (sort keys %needed_macros) |
|
649
|
|
|
|
|
|
|
{ |
|
650
|
|
|
|
|
|
|
warn ("$configure_ac: warning: missing $macro wanted by: " |
|
651
|
0
|
|
|
|
|
|
. (${$needed_macros{$macro}}[0]) |
|
|
0
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
. "\n"); |
|
653
|
0
|
|
|
|
|
|
print $log "$me: warning: missing $macro wanted by: \n"; |
|
654
|
0
|
|
|
|
|
|
foreach my $need (@{$needed_macros{$macro}}) |
|
|
0
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
{ |
|
656
|
0
|
|
|
|
|
|
print $log "\t$need\n"; |
|
657
|
|
|
|
|
|
|
} |
|
658
|
|
|
|
|
|
|
} |
|
659
|
|
|
|
|
|
|
} |
|
660
|
|
|
|
|
|
|
|
|
661
|
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
## -------------- ## |
|
663
|
|
|
|
|
|
|
## Main program. ## |
|
664
|
|
|
|
|
|
|
## -------------- ## |
|
665
|
|
|
|
|
|
|
|
|
666
|
1
|
|
|
|
|
5
|
parse_args; |
|
667
|
0
|
|
|
|
|
0
|
$log = new Autom4te::XFile ("$me.log", ">"); |
|
668
|
|
|
|
|
|
|
|
|
669
|
0
|
0
|
|
|
|
0
|
$autoconf .= " --debug" if $debug; |
|
670
|
0
|
0
|
|
|
|
0
|
$autoconf .= " --verbose" if $verbose; |
|
671
|
0
|
|
|
|
|
0
|
$autoconf .= join (' --include=', '', map { shell_quote ($_) } @include); |
|
|
0
|
|
|
|
|
0
|
|
|
672
|
0
|
|
|
|
|
0
|
$autoconf .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include); |
|
|
0
|
|
|
|
|
0
|
|
|
673
|
|
|
|
|
|
|
|
|
674
|
0
|
|
|
|
|
0
|
my $configure_ac = find_configure_ac; |
|
675
|
0
|
|
|
|
|
0
|
init_tables; |
|
676
|
0
|
|
|
|
|
0
|
scan_files; |
|
677
|
0
|
|
|
|
|
0
|
output ('configure.scan'); |
|
678
|
0
|
0
|
|
|
|
0
|
if (-f $configure_ac) |
|
679
|
|
|
|
|
|
|
{ |
|
680
|
0
|
|
|
|
|
0
|
check_configure_ac ($configure_ac); |
|
681
|
|
|
|
|
|
|
} |
|
682
|
|
|
|
|
|
|
# This close is really needed. For some reason, probably best named |
|
683
|
|
|
|
|
|
|
# a bug, it seems that the dtor of $LOG is not called automatically |
|
684
|
|
|
|
|
|
|
# at END. It results in a truncated file. |
|
685
|
0
|
|
|
|
|
0
|
$log->close; |
|
686
|
0
|
|
|
|
|
0
|
exit 0; |
|
687
|
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
### Setup "GNU" style for perl-mode and cperl-mode. |
|
689
|
|
|
|
|
|
|
## Local Variables: |
|
690
|
|
|
|
|
|
|
## perl-indent-level: 2 |
|
691
|
|
|
|
|
|
|
## perl-continued-statement-offset: 2 |
|
692
|
|
|
|
|
|
|
## perl-continued-brace-offset: 0 |
|
693
|
|
|
|
|
|
|
## perl-brace-offset: 0 |
|
694
|
|
|
|
|
|
|
## perl-brace-imaginary-offset: 0 |
|
695
|
|
|
|
|
|
|
## perl-label-offset: -2 |
|
696
|
|
|
|
|
|
|
## cperl-indent-level: 2 |
|
697
|
|
|
|
|
|
|
## cperl-brace-offset: 0 |
|
698
|
|
|
|
|
|
|
## cperl-continued-brace-offset: 0 |
|
699
|
|
|
|
|
|
|
## cperl-label-offset: -2 |
|
700
|
|
|
|
|
|
|
## cperl-extra-newline-before-brace: t |
|
701
|
|
|
|
|
|
|
## cperl-merge-trailing-else: nil |
|
702
|
|
|
|
|
|
|
## cperl-continued-statement-offset: 2 |
|
703
|
|
|
|
|
|
|
## End: |