+2001-01-22 Akim Demaille <akim@epita.fr>
+
+ * autoscan.pl ($headers, $functions, $identifiers, $libraries):
+ Also register locations of their requirement instead of a simple
+ counter.
+ (&check_configure_ac): Close TRACES.
+
2001-01-22 Akim Demaille <akim@epita.fr>
* autoscan.pl: Formatting changes.
------------------------------------------------------------------------------
-* autoscan: Tell the files that caused inclusion of each macro,
-in a dnl comment. (Seems to be hard.)
-
-------------------------------------------------------------------------------
-
* Look at user contributed macros:
IEEE double precision math
more
foreach $file (@cfiles)
{
- $programs{"cc"}++;
+ push (@{$programs{"cc"}}, $file);
&scan_c_file($file);
}
# Preprocessor directives.
if (/^\s*\#\s*include\s*<([^>]*)>/)
{
- $headers{$1}++;
+ push (@{$headers{$1}}, "$file:$.");
}
# Ignore other preprocessor directives.
next if /^\s*\#/;
# Maybe we should ignore function definitions (in column 0)?
while (s/\b([a-zA-Z_]\w*)\s*\(/ /)
{
- $functions{$1}++
+ push (@{$functions{$1}}, "$file:$.")
if !defined($c_keywords{$1});
}
while (s/\b([a-zA-Z_]\w*)\b/ /)
{
- $identifiers{$1}++
+ push (@{$identifiers{$1}}, "$file:$.")
if !defined($c_keywords{$1});
}
}
print "\n$file functions:\n";
foreach $word (sort keys %functions)
{
- print "$word $functions{$word}\n";
+ print "$word: @{$functions{$word}}\n";
}
print "\n$file identifiers:\n";
foreach $word (sort keys %identifiers)
{
- print "$word $identifiers{$word}\n";
+ print "$word: @{$identifiers{$word}}\n";
}
print "\n$file headers:\n";
foreach $word (sort keys %headers)
{
- print "$word $headers{$word}\n";
+ print "$word: @{$headers{$word}}\n";
}
}
}
# Libraries.
while (s/\B-l([a-zA-Z_]\w*)\b/ /)
{
- $libraries{$1}++;
+ push (@{$libraries{$1}}, "$file:$.");
}
# Tokens in the code.
while (s/\b([a-zA-Z_]\w*)\b/ /)
print "\n$file makevars:\n";
foreach $word (sort keys %makevars)
{
- print "$word @{$makevars{$word}}\n";
+ print "$word: @{$makevars{$word}}\n";
}
print "\n$file libraries:\n";
foreach $word (sort keys %libraries)
{
- print "$word $libraries{$word}\n";
+ print "$word: @{$libraries{$word}}\n";
}
print "\n$file programs:\n";
foreach $word (sort keys %programs)
{
- print "$word @{$programs{$word}}\n";
+ print "$word: @{$programs{$word}}\n";
}
}
}
}
close(MFILE);
- if ($verbose) {
- local($word);
+ if ($verbose)
+ {
+ local($word);
- print "\n$file programs:\n";
- foreach $word (sort keys %programs)
- {
- print "$word @{$programs{$word}}\n";
- }
- }
+ print "\n$file programs:\n";
+ foreach $word (sort keys %programs)
+ {
+ print "$word: @{$programs{$word}}\n";
+ }
+ }
}
# Print a proto configure.ac.
local ($word);
print CONF "\n# Checks for libraries.\n";
- foreach $word (sort keys %libraries) {
- print CONF "# FIXME: Replace `main' with a function in `-l$word':\n";
- print CONF "AC_CHECK_LIB([$word], [main])\n";
- }
+ foreach $word (sort keys %libraries)
+ {
+ print CONF "# FIXME: Replace `main' with a function in `-l$word':\n";
+ print CONF "AC_CHECK_LIB([$word], [main])\n";
+ }
}
sub output_headers
}
else
{
- &print_unique($headers_macros{$word});
+ &print_unique($headers_macros{$word}, @{$headers{$word}});
}
}
print CONF "AC_CHECK_HEADERS([" . join(' ', sort(@have_headers)) . "])\n"
}
else
{
- &print_unique ($identifiers_macros{$word});
+ &print_unique ($identifiers_macros{$word}, @{$identifiers{$word}});
}
}
print CONF "AC_CHECK_TYPES([" . join(', ', sort(@have_types)) . "])\n"
}
else
{
- &print_unique($functions_macros{$word});
+ &print_unique($functions_macros{$word}, @{$functions{$word}});
}
}
print CONF "AC_CHECK_FUNCS([" . join(' ', sort(@have_funcs)) . "])\n"
delete ($needed_macros{$macro});
}
+ close (TRACES) ||
+ die "$me: cannot close traces: $!\n";
+
foreach $macro (sort keys %needed_macros)
{
print STDERR "warning: missing $macro wanted by: @{$needed_macros{$macro}}\n";
foreach $file (@cfiles)
{
- $programs{"cc"}++;
+ push (@{$programs{"cc"}}, $file);
&scan_c_file($file);
}
# Preprocessor directives.
if (/^\s*\#\s*include\s*<([^>]*)>/)
{
- $headers{$1}++;
+ push (@{$headers{$1}}, "$file:$.");
}
# Ignore other preprocessor directives.
next if /^\s*\#/;
# Maybe we should ignore function definitions (in column 0)?
while (s/\b([a-zA-Z_]\w*)\s*\(/ /)
{
- $functions{$1}++
+ push (@{$functions{$1}}, "$file:$.")
if !defined($c_keywords{$1});
}
while (s/\b([a-zA-Z_]\w*)\b/ /)
{
- $identifiers{$1}++
+ push (@{$identifiers{$1}}, "$file:$.")
if !defined($c_keywords{$1});
}
}
print "\n$file functions:\n";
foreach $word (sort keys %functions)
{
- print "$word $functions{$word}\n";
+ print "$word: @{$functions{$word}}\n";
}
print "\n$file identifiers:\n";
foreach $word (sort keys %identifiers)
{
- print "$word $identifiers{$word}\n";
+ print "$word: @{$identifiers{$word}}\n";
}
print "\n$file headers:\n";
foreach $word (sort keys %headers)
{
- print "$word $headers{$word}\n";
+ print "$word: @{$headers{$word}}\n";
}
}
}
# Libraries.
while (s/\B-l([a-zA-Z_]\w*)\b/ /)
{
- $libraries{$1}++;
+ push (@{$libraries{$1}}, "$file:$.");
}
# Tokens in the code.
while (s/\b([a-zA-Z_]\w*)\b/ /)
print "\n$file makevars:\n";
foreach $word (sort keys %makevars)
{
- print "$word @{$makevars{$word}}\n";
+ print "$word: @{$makevars{$word}}\n";
}
print "\n$file libraries:\n";
foreach $word (sort keys %libraries)
{
- print "$word $libraries{$word}\n";
+ print "$word: @{$libraries{$word}}\n";
}
print "\n$file programs:\n";
foreach $word (sort keys %programs)
{
- print "$word @{$programs{$word}}\n";
+ print "$word: @{$programs{$word}}\n";
}
}
}
}
close(MFILE);
- if ($verbose) {
- local($word);
+ if ($verbose)
+ {
+ local($word);
- print "\n$file programs:\n";
- foreach $word (sort keys %programs)
- {
- print "$word @{$programs{$word}}\n";
- }
- }
+ print "\n$file programs:\n";
+ foreach $word (sort keys %programs)
+ {
+ print "$word: @{$programs{$word}}\n";
+ }
+ }
}
# Print a proto configure.ac.
local ($word);
print CONF "\n# Checks for libraries.\n";
- foreach $word (sort keys %libraries) {
- print CONF "# FIXME: Replace `main' with a function in `-l$word':\n";
- print CONF "AC_CHECK_LIB([$word], [main])\n";
- }
+ foreach $word (sort keys %libraries)
+ {
+ print CONF "# FIXME: Replace `main' with a function in `-l$word':\n";
+ print CONF "AC_CHECK_LIB([$word], [main])\n";
+ }
}
sub output_headers
}
else
{
- &print_unique($headers_macros{$word});
+ &print_unique($headers_macros{$word}, @{$headers{$word}});
}
}
print CONF "AC_CHECK_HEADERS([" . join(' ', sort(@have_headers)) . "])\n"
}
else
{
- &print_unique ($identifiers_macros{$word});
+ &print_unique ($identifiers_macros{$word}, @{$identifiers{$word}});
}
}
print CONF "AC_CHECK_TYPES([" . join(', ', sort(@have_types)) . "])\n"
}
else
{
- &print_unique($functions_macros{$word});
+ &print_unique($functions_macros{$word}, @{$functions{$word}});
}
}
print CONF "AC_CHECK_FUNCS([" . join(' ', sort(@have_funcs)) . "])\n"
delete ($needed_macros{$macro});
}
+ close (TRACES) ||
+ die "$me: cannot close traces: $!\n";
+
foreach $macro (sort keys %needed_macros)
{
print STDERR "warning: missing $macro wanted by: @{$needed_macros{$macro}}\n";
foreach $file (@cfiles)
{
- $programs{"cc"}++;
+ push (@{$programs{"cc"}}, $file);
&scan_c_file($file);
}
# Preprocessor directives.
if (/^\s*\#\s*include\s*<([^>]*)>/)
{
- $headers{$1}++;
+ push (@{$headers{$1}}, "$file:$.");
}
# Ignore other preprocessor directives.
next if /^\s*\#/;
# Maybe we should ignore function definitions (in column 0)?
while (s/\b([a-zA-Z_]\w*)\s*\(/ /)
{
- $functions{$1}++
+ push (@{$functions{$1}}, "$file:$.")
if !defined($c_keywords{$1});
}
while (s/\b([a-zA-Z_]\w*)\b/ /)
{
- $identifiers{$1}++
+ push (@{$identifiers{$1}}, "$file:$.")
if !defined($c_keywords{$1});
}
}
print "\n$file functions:\n";
foreach $word (sort keys %functions)
{
- print "$word $functions{$word}\n";
+ print "$word: @{$functions{$word}}\n";
}
print "\n$file identifiers:\n";
foreach $word (sort keys %identifiers)
{
- print "$word $identifiers{$word}\n";
+ print "$word: @{$identifiers{$word}}\n";
}
print "\n$file headers:\n";
foreach $word (sort keys %headers)
{
- print "$word $headers{$word}\n";
+ print "$word: @{$headers{$word}}\n";
}
}
}
# Libraries.
while (s/\B-l([a-zA-Z_]\w*)\b/ /)
{
- $libraries{$1}++;
+ push (@{$libraries{$1}}, "$file:$.");
}
# Tokens in the code.
while (s/\b([a-zA-Z_]\w*)\b/ /)
print "\n$file makevars:\n";
foreach $word (sort keys %makevars)
{
- print "$word @{$makevars{$word}}\n";
+ print "$word: @{$makevars{$word}}\n";
}
print "\n$file libraries:\n";
foreach $word (sort keys %libraries)
{
- print "$word $libraries{$word}\n";
+ print "$word: @{$libraries{$word}}\n";
}
print "\n$file programs:\n";
foreach $word (sort keys %programs)
{
- print "$word @{$programs{$word}}\n";
+ print "$word: @{$programs{$word}}\n";
}
}
}
}
close(MFILE);
- if ($verbose) {
- local($word);
+ if ($verbose)
+ {
+ local($word);
- print "\n$file programs:\n";
- foreach $word (sort keys %programs)
- {
- print "$word @{$programs{$word}}\n";
- }
- }
+ print "\n$file programs:\n";
+ foreach $word (sort keys %programs)
+ {
+ print "$word: @{$programs{$word}}\n";
+ }
+ }
}
# Print a proto configure.ac.
local ($word);
print CONF "\n# Checks for libraries.\n";
- foreach $word (sort keys %libraries) {
- print CONF "# FIXME: Replace `main' with a function in `-l$word':\n";
- print CONF "AC_CHECK_LIB([$word], [main])\n";
- }
+ foreach $word (sort keys %libraries)
+ {
+ print CONF "# FIXME: Replace `main' with a function in `-l$word':\n";
+ print CONF "AC_CHECK_LIB([$word], [main])\n";
+ }
}
sub output_headers
}
else
{
- &print_unique($headers_macros{$word});
+ &print_unique($headers_macros{$word}, @{$headers{$word}});
}
}
print CONF "AC_CHECK_HEADERS([" . join(' ', sort(@have_headers)) . "])\n"
}
else
{
- &print_unique ($identifiers_macros{$word});
+ &print_unique ($identifiers_macros{$word}, @{$identifiers{$word}});
}
}
print CONF "AC_CHECK_TYPES([" . join(', ', sort(@have_types)) . "])\n"
}
else
{
- &print_unique($functions_macros{$word});
+ &print_unique($functions_macros{$word}, @{$functions{$word}});
}
}
print CONF "AC_CHECK_FUNCS([" . join(' ', sort(@have_funcs)) . "])\n"
delete ($needed_macros{$macro});
}
+ close (TRACES) ||
+ die "$me: cannot close traces: $!\n";
+
foreach $macro (sort keys %needed_macros)
{
print STDERR "warning: missing $macro wanted by: @{$needed_macros{$macro}}\n";