mirror of
git://git.sv.gnu.org/autoconf
synced 2025-02-17 14:01:27 +08:00
* aclibraries: New.
* autoscan.in (@kinds): Add `libraries'. Use `@kinds' instead of hard coded lists. (%programs, %headers, %identifiers, %makevars, %libraries, %functions): Remove, replaced by... (%used): this.
This commit is contained in:
parent
c306314db9
commit
54a953b733
@ -1,3 +1,12 @@
|
|||||||
|
2001-06-12 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* aclibraries: New.
|
||||||
|
* autoscan.in (@kinds): Add `libraries'.
|
||||||
|
Use `@kinds' instead of hard coded lists.
|
||||||
|
(%programs, %headers, %identifiers, %makevars, %libraries, %functions):
|
||||||
|
Remove, replaced by...
|
||||||
|
(%used): this.
|
||||||
|
|
||||||
2001-06-12 Akim Demaille <akim@epita.fr>
|
2001-06-12 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* autoscan.in (%functions_macros %headers_macros)
|
* autoscan.in (%functions_macros %headers_macros)
|
||||||
|
@ -41,7 +41,7 @@ m4sources = m4sugar.m4 m4sh.m4 \
|
|||||||
acfunctions.m4 acheaders.m4 actypes.m4
|
acfunctions.m4 acheaders.m4 actypes.m4
|
||||||
|
|
||||||
distpkgdataDATA = acfunctions acheaders acidentifiers acmakevars acprograms \
|
distpkgdataDATA = acfunctions acheaders acidentifiers acmakevars acprograms \
|
||||||
$(m4sources)
|
aclibraries $(m4sources)
|
||||||
|
|
||||||
nodistpkgdataDATA = autoconf.m4f
|
nodistpkgdataDATA = autoconf.m4f
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Makefile.in generated automatically by automake 1.4-p2 from Makefile.am
|
# Makefile.in generated automatically by automake 1.4-p3 from Makefile.am
|
||||||
|
|
||||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||||
# This Makefile.in is free software; the Free Software Foundation
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
@ -86,7 +86,7 @@ EXTRA_SCRIPTS = autoscan autoupdate
|
|||||||
m4sources = m4sugar.m4 m4sh.m4 autoconf.m4 acgeneral.m4 acoldnames.m4 acspecific.m4 aclang.m4 acversion.m4 acfunctions.m4 acheaders.m4 actypes.m4
|
m4sources = m4sugar.m4 m4sh.m4 autoconf.m4 acgeneral.m4 acoldnames.m4 acspecific.m4 aclang.m4 acversion.m4 acfunctions.m4 acheaders.m4 actypes.m4
|
||||||
|
|
||||||
|
|
||||||
distpkgdataDATA = acfunctions acheaders acidentifiers acmakevars acprograms $(m4sources)
|
distpkgdataDATA = acfunctions acheaders acidentifiers acmakevars acprograms aclibraries $(m4sources)
|
||||||
|
|
||||||
|
|
||||||
nodistpkgdataDATA = autoconf.m4f
|
nodistpkgdataDATA = autoconf.m4f
|
||||||
|
26
aclibraries
Normal file
26
aclibraries
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# aclibraries -- autoscan's mapping from libraries to Autoconf macros
|
||||||
|
# Copyright 2001
|
||||||
|
# Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
# 02111-1307, USA.
|
||||||
|
|
||||||
|
# Ones that have their own macros.
|
||||||
|
|
||||||
|
# Others, checked with AC_CHECK_LIB.
|
||||||
|
|
||||||
|
# Local Variables:
|
||||||
|
# mode: shell-script
|
||||||
|
# End:
|
76
autoscan.in
76
autoscan.in
@ -26,20 +26,22 @@ use Getopt::Long;
|
|||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
use vars qw($autoconf $datadir $initfile $me $name $verbose
|
use vars qw($autoconf $datadir $initfile $me $name $verbose
|
||||||
@cfiles @makefiles @shfiles
|
@cfiles @makefiles @shfiles %c_keywords %printed);
|
||||||
%c_keywords %programs %headers %identifiers %makevars
|
|
||||||
%libraries %functions %printed);
|
|
||||||
|
|
||||||
($me = $0) =~ s,.*/,,;
|
($me = $0) =~ s,.*/,,;
|
||||||
$verbose = 0;
|
$verbose = 0;
|
||||||
|
|
||||||
|
# $USED{KIND}{ITEM} is set if ITEM is used in the program.
|
||||||
|
# It is set to its list of locations.
|
||||||
|
my %used = ();
|
||||||
|
|
||||||
# $MACRO{KIND}{ITEM} is the macro to use to test ITEM.
|
# $MACRO{KIND}{ITEM} is the macro to use to test ITEM.
|
||||||
my %macro = ();
|
my %macro = ();
|
||||||
|
|
||||||
# $NEEDED_MACROS{MACRO} is an array of locations requiring MACRO.
|
# $NEEDED_MACROS{MACRO} is an array of locations requiring MACRO.
|
||||||
my %needed_macros = ();
|
my %needed_macros = ();
|
||||||
|
|
||||||
my @kinds = qw (functions headers identifiers programs makevars);
|
my @kinds = qw (functions headers identifiers programs makevars libraries);
|
||||||
|
|
||||||
# For each kind, the default macro.
|
# For each kind, the default macro.
|
||||||
my %generic_macro =
|
my %generic_macro =
|
||||||
@ -48,6 +50,7 @@ my %generic_macro =
|
|||||||
'headers' => 'AC_CHECK_HEADERS',
|
'headers' => 'AC_CHECK_HEADERS',
|
||||||
'identifiers' => 'AC_CHECK_TYPES',
|
'identifiers' => 'AC_CHECK_TYPES',
|
||||||
'programs' => 'AC_CHECK_PROGS'
|
'programs' => 'AC_CHECK_PROGS'
|
||||||
|
'libraries' => 'AC_CHECK_LIB'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -184,12 +187,12 @@ sub init_tables ()
|
|||||||
# Taken from K&R 1st edition p. 180.
|
# Taken from K&R 1st edition p. 180.
|
||||||
# ANSI C, GNU C, and C++ keywords can introduce portability problems,
|
# ANSI C, GNU C, and C++ keywords can introduce portability problems,
|
||||||
# so don't ignore them.
|
# so don't ignore them.
|
||||||
foreach my $word (qw (int char float double struct union long short
|
|
||||||
unsigned auto extern register typedef static
|
foreach (qw (int char float double struct union long short unsigned
|
||||||
goto return sizeof break continue if else for
|
auto extern register typedef static goto return sizeof break
|
||||||
do while switch case default))
|
continue if else for do while switch case default))
|
||||||
{
|
{
|
||||||
$c_keywords{$word} = 0;
|
$c_keywords{$_} = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# The data file format supports only one line of macros per function.
|
# The data file format supports only one line of macros per function.
|
||||||
@ -266,7 +269,7 @@ sub scan_files ()
|
|||||||
|
|
||||||
foreach $file (@cfiles)
|
foreach $file (@cfiles)
|
||||||
{
|
{
|
||||||
push (@{$programs{"cc"}}, $file);
|
push (@{$used{'programs'}{"cc"}}, $file);
|
||||||
scan_c_file ($file);
|
scan_c_file ($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,14 +289,12 @@ sub scan_files ()
|
|||||||
print "makefiles:", join(" ", @makefiles), "\n";
|
print "makefiles:", join(" ", @makefiles), "\n";
|
||||||
print "shfiles:", join(" ", @shfiles), "\n";
|
print "shfiles:", join(" ", @shfiles), "\n";
|
||||||
|
|
||||||
foreach my $class (qw (functions identifiers headers
|
foreach my $kind (@kinds)
|
||||||
makevars libraries programs))
|
|
||||||
{
|
{
|
||||||
print "\n$class:\n";
|
print "\n$kind:\n";
|
||||||
my $h = eval "\\\%$class";
|
foreach my $word (sort keys %{$used{$kind}})
|
||||||
foreach my $word (sort keys %$h)
|
|
||||||
{
|
{
|
||||||
print "$word: @{$h->{$word}}\n";
|
print "$word: @{$used{$kind}{$word}}\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -330,7 +331,7 @@ sub scan_c_file ($)
|
|||||||
# Preprocessor directives.
|
# Preprocessor directives.
|
||||||
if (/^\s*\#\s*include\s*<([^>]*)>/)
|
if (/^\s*\#\s*include\s*<([^>]*)>/)
|
||||||
{
|
{
|
||||||
push (@{$headers{$1}}, "$file:$.");
|
push (@{$used{'headers'}{$1}}, "$file:$.");
|
||||||
}
|
}
|
||||||
# Ignore other preprocessor directives.
|
# Ignore other preprocessor directives.
|
||||||
next if /^\s*\#/;
|
next if /^\s*\#/;
|
||||||
@ -343,12 +344,12 @@ sub scan_c_file ($)
|
|||||||
# Maybe we should ignore function definitions (in column 0)?
|
# Maybe we should ignore function definitions (in column 0)?
|
||||||
while (s/\b([a-zA-Z_]\w*)\s*\(/ /)
|
while (s/\b([a-zA-Z_]\w*)\s*\(/ /)
|
||||||
{
|
{
|
||||||
push (@{$functions{$1}}, "$file:$.")
|
push (@{$used{'functions'}{$1}}, "$file:$.")
|
||||||
if !defined $c_keywords{$1};
|
if !defined $c_keywords{$1};
|
||||||
}
|
}
|
||||||
while (s/\b([a-zA-Z_]\w*)\b/ /)
|
while (s/\b([a-zA-Z_]\w*)\b/ /)
|
||||||
{
|
{
|
||||||
push (@{$identifiers{$1}}, "$file:$.")
|
push (@{$used{'identifiers'}{$1}}, "$file:$.")
|
||||||
if !defined $c_keywords{$1};
|
if !defined $c_keywords{$1};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -374,17 +375,17 @@ sub scan_makefile ($)
|
|||||||
# Variable assignments.
|
# Variable assignments.
|
||||||
while (s/\b([a-zA-Z_]\w*)\s*=/ /)
|
while (s/\b([a-zA-Z_]\w*)\s*=/ /)
|
||||||
{
|
{
|
||||||
push (@{$makevars{$1}}, "$file:$.");
|
push (@{$used{'makevars'}{$1}}, "$file:$.");
|
||||||
}
|
}
|
||||||
# Libraries.
|
# Libraries.
|
||||||
while (s/\B-l([a-zA-Z_]\w*)\b/ /)
|
while (s/\B-l([a-zA-Z_]\w*)\b/ /)
|
||||||
{
|
{
|
||||||
push (@{$libraries{$1}}, "$file:$.");
|
push (@{$used{'libraries'}{$1}}, "$file:$.");
|
||||||
}
|
}
|
||||||
# Tokens in the code.
|
# Tokens in the code.
|
||||||
while (s/\b([a-zA-Z_]\w*)\b/ /)
|
while (s/\b([a-zA-Z_]\w*)\b/ /)
|
||||||
{
|
{
|
||||||
push (@{$programs{$1}}, "$file:$.");
|
push (@{$used{'programs'}{$1}}, "$file:$.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(MFILE);
|
close(MFILE);
|
||||||
@ -408,7 +409,7 @@ sub scan_sh_file ($)
|
|||||||
# Tokens in the code.
|
# Tokens in the code.
|
||||||
while (s/\b([a-zA-Z_]\w*)\b/ /)
|
while (s/\b([a-zA-Z_]\w*)\b/ /)
|
||||||
{
|
{
|
||||||
push (@{$programs{$1}}, "$file:$.");
|
push (@{$used{'programs'}{$1}}, "$file:$.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(MFILE);
|
close(MFILE);
|
||||||
@ -438,13 +439,13 @@ sub print_unique ($@)
|
|||||||
sub output_programs ()
|
sub output_programs ()
|
||||||
{
|
{
|
||||||
print CONF "\n# Checks for programs.\n";
|
print CONF "\n# Checks for programs.\n";
|
||||||
foreach my $word (sort keys %programs)
|
foreach my $word (sort keys %{$used{'programs'}})
|
||||||
{
|
{
|
||||||
print_unique ($macro{'programs'}{$word}, @{$programs{$word}});
|
print_unique ($macro{'programs'}{$word}, @{$used{'programs'}{$word}});
|
||||||
}
|
}
|
||||||
foreach my $word (sort keys %makevars)
|
foreach my $word (sort keys %{$used{'makevars'}})
|
||||||
{
|
{
|
||||||
print_unique ($macro{'makevars'}{$word}, @{$makevars{$word}});
|
print_unique ($macro{'makevars'}{$word}, @{$used{'makevars'}{$word}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -454,7 +455,7 @@ sub output_programs ()
|
|||||||
sub output_libraries ()
|
sub output_libraries ()
|
||||||
{
|
{
|
||||||
print CONF "\n# Checks for libraries.\n";
|
print CONF "\n# Checks for libraries.\n";
|
||||||
foreach my $word (sort keys %libraries)
|
foreach my $word (sort keys %{$used{'libraries'}})
|
||||||
{
|
{
|
||||||
print CONF "# FIXME: Replace `main' with a function in `-l$word':\n";
|
print CONF "# FIXME: Replace `main' with a function in `-l$word':\n";
|
||||||
print CONF "AC_CHECK_LIB([$word], [main])\n";
|
print CONF "AC_CHECK_LIB([$word], [main])\n";
|
||||||
@ -469,7 +470,7 @@ sub output_headers ()
|
|||||||
my @have_headers;
|
my @have_headers;
|
||||||
|
|
||||||
print CONF "\n# Checks for header files.\n";
|
print CONF "\n# Checks for header files.\n";
|
||||||
foreach my $word (sort keys %headers)
|
foreach my $word (sort keys %{$used{'headers'}})
|
||||||
{
|
{
|
||||||
if (defined $macro{'headers'}{$word})
|
if (defined $macro{'headers'}{$word})
|
||||||
{
|
{
|
||||||
@ -477,11 +478,12 @@ sub output_headers ()
|
|||||||
{
|
{
|
||||||
push (@have_headers, $word);
|
push (@have_headers, $word);
|
||||||
push (@{$needed_macros{"AC_CHECK_HEADERS([$word])"}},
|
push (@{$needed_macros{"AC_CHECK_HEADERS([$word])"}},
|
||||||
@{$headers{$word}});
|
@{$used{'headers'}{$word}});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print_unique ($macro{'headers'}{$word}, @{$headers{$word}});
|
print_unique ($macro{'headers'}{$word},
|
||||||
|
@{$used{'headers'}{$word}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -497,7 +499,7 @@ sub output_identifiers ()
|
|||||||
my @have_types;
|
my @have_types;
|
||||||
|
|
||||||
print CONF "\n# Checks for typedefs, structures, and compiler characteristics.\n";
|
print CONF "\n# Checks for typedefs, structures, and compiler characteristics.\n";
|
||||||
foreach my $word (sort keys %identifiers)
|
foreach my $word (sort keys %{$used{'identifiers'}})
|
||||||
{
|
{
|
||||||
if (defined $macro{'identifiers'}{$word})
|
if (defined $macro{'identifiers'}{$word})
|
||||||
{
|
{
|
||||||
@ -505,12 +507,12 @@ sub output_identifiers ()
|
|||||||
{
|
{
|
||||||
push (@have_types, $word);
|
push (@have_types, $word);
|
||||||
push (@{$needed_macros{"AC_CHECK_TYPES([$word])"}},
|
push (@{$needed_macros{"AC_CHECK_TYPES([$word])"}},
|
||||||
@{$identifiers{$word}});
|
@{$used{'identifiers'}{$word}});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print_unique ($macro{'identifiers'}{$word},
|
print_unique ($macro{'identifiers'}{$word},
|
||||||
@{$identifiers{$word}});
|
@{$used{'identifiers'}{$word}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -526,7 +528,7 @@ sub output_functions ()
|
|||||||
my @have_funcs;
|
my @have_funcs;
|
||||||
|
|
||||||
print CONF "\n# Checks for library functions.\n";
|
print CONF "\n# Checks for library functions.\n";
|
||||||
foreach my $word (sort keys %functions)
|
foreach my $word (sort keys %{$used{'functions'}})
|
||||||
{
|
{
|
||||||
if (defined $macro{'functions'}{$word})
|
if (defined $macro{'functions'}{$word})
|
||||||
{
|
{
|
||||||
@ -534,12 +536,12 @@ sub output_functions ()
|
|||||||
{
|
{
|
||||||
push (@have_funcs, $word);
|
push (@have_funcs, $word);
|
||||||
push (@{$needed_macros{"AC_CHECK_FUNCS([$word])"}},
|
push (@{$needed_macros{"AC_CHECK_FUNCS([$word])"}},
|
||||||
@{$functions{$word}});
|
@{$used{'functions'}{$word}});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print_unique ($macro{'functions'}{$word},
|
print_unique ($macro{'functions'}{$word},
|
||||||
@{$functions{$word}});
|
@{$used{'functions'}{$word}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,20 +26,22 @@ use Getopt::Long;
|
|||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
use vars qw($autoconf $datadir $initfile $me $name $verbose
|
use vars qw($autoconf $datadir $initfile $me $name $verbose
|
||||||
@cfiles @makefiles @shfiles
|
@cfiles @makefiles @shfiles %c_keywords %printed);
|
||||||
%c_keywords %programs %headers %identifiers %makevars
|
|
||||||
%libraries %functions %printed);
|
|
||||||
|
|
||||||
($me = $0) =~ s,.*/,,;
|
($me = $0) =~ s,.*/,,;
|
||||||
$verbose = 0;
|
$verbose = 0;
|
||||||
|
|
||||||
|
# $USED{KIND}{ITEM} is set if ITEM is used in the program.
|
||||||
|
# It is set to its list of locations.
|
||||||
|
my %used = ();
|
||||||
|
|
||||||
# $MACRO{KIND}{ITEM} is the macro to use to test ITEM.
|
# $MACRO{KIND}{ITEM} is the macro to use to test ITEM.
|
||||||
my %macro = ();
|
my %macro = ();
|
||||||
|
|
||||||
# $NEEDED_MACROS{MACRO} is an array of locations requiring MACRO.
|
# $NEEDED_MACROS{MACRO} is an array of locations requiring MACRO.
|
||||||
my %needed_macros = ();
|
my %needed_macros = ();
|
||||||
|
|
||||||
my @kinds = qw (functions headers identifiers programs makevars);
|
my @kinds = qw (functions headers identifiers programs makevars libraries);
|
||||||
|
|
||||||
# For each kind, the default macro.
|
# For each kind, the default macro.
|
||||||
my %generic_macro =
|
my %generic_macro =
|
||||||
@ -48,6 +50,7 @@ my %generic_macro =
|
|||||||
'headers' => 'AC_CHECK_HEADERS',
|
'headers' => 'AC_CHECK_HEADERS',
|
||||||
'identifiers' => 'AC_CHECK_TYPES',
|
'identifiers' => 'AC_CHECK_TYPES',
|
||||||
'programs' => 'AC_CHECK_PROGS'
|
'programs' => 'AC_CHECK_PROGS'
|
||||||
|
'libraries' => 'AC_CHECK_LIB'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -184,12 +187,12 @@ sub init_tables ()
|
|||||||
# Taken from K&R 1st edition p. 180.
|
# Taken from K&R 1st edition p. 180.
|
||||||
# ANSI C, GNU C, and C++ keywords can introduce portability problems,
|
# ANSI C, GNU C, and C++ keywords can introduce portability problems,
|
||||||
# so don't ignore them.
|
# so don't ignore them.
|
||||||
foreach my $word (qw (int char float double struct union long short
|
|
||||||
unsigned auto extern register typedef static
|
foreach (qw (int char float double struct union long short unsigned
|
||||||
goto return sizeof break continue if else for
|
auto extern register typedef static goto return sizeof break
|
||||||
do while switch case default))
|
continue if else for do while switch case default))
|
||||||
{
|
{
|
||||||
$c_keywords{$word} = 0;
|
$c_keywords{$_} = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# The data file format supports only one line of macros per function.
|
# The data file format supports only one line of macros per function.
|
||||||
@ -266,7 +269,7 @@ sub scan_files ()
|
|||||||
|
|
||||||
foreach $file (@cfiles)
|
foreach $file (@cfiles)
|
||||||
{
|
{
|
||||||
push (@{$programs{"cc"}}, $file);
|
push (@{$used{'programs'}{"cc"}}, $file);
|
||||||
scan_c_file ($file);
|
scan_c_file ($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,14 +289,12 @@ sub scan_files ()
|
|||||||
print "makefiles:", join(" ", @makefiles), "\n";
|
print "makefiles:", join(" ", @makefiles), "\n";
|
||||||
print "shfiles:", join(" ", @shfiles), "\n";
|
print "shfiles:", join(" ", @shfiles), "\n";
|
||||||
|
|
||||||
foreach my $class (qw (functions identifiers headers
|
foreach my $kind (@kinds)
|
||||||
makevars libraries programs))
|
|
||||||
{
|
{
|
||||||
print "\n$class:\n";
|
print "\n$kind:\n";
|
||||||
my $h = eval "\\\%$class";
|
foreach my $word (sort keys %{$used{$kind}})
|
||||||
foreach my $word (sort keys %$h)
|
|
||||||
{
|
{
|
||||||
print "$word: @{$h->{$word}}\n";
|
print "$word: @{$used{$kind}{$word}}\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -330,7 +331,7 @@ sub scan_c_file ($)
|
|||||||
# Preprocessor directives.
|
# Preprocessor directives.
|
||||||
if (/^\s*\#\s*include\s*<([^>]*)>/)
|
if (/^\s*\#\s*include\s*<([^>]*)>/)
|
||||||
{
|
{
|
||||||
push (@{$headers{$1}}, "$file:$.");
|
push (@{$used{'headers'}{$1}}, "$file:$.");
|
||||||
}
|
}
|
||||||
# Ignore other preprocessor directives.
|
# Ignore other preprocessor directives.
|
||||||
next if /^\s*\#/;
|
next if /^\s*\#/;
|
||||||
@ -343,12 +344,12 @@ sub scan_c_file ($)
|
|||||||
# Maybe we should ignore function definitions (in column 0)?
|
# Maybe we should ignore function definitions (in column 0)?
|
||||||
while (s/\b([a-zA-Z_]\w*)\s*\(/ /)
|
while (s/\b([a-zA-Z_]\w*)\s*\(/ /)
|
||||||
{
|
{
|
||||||
push (@{$functions{$1}}, "$file:$.")
|
push (@{$used{'functions'}{$1}}, "$file:$.")
|
||||||
if !defined $c_keywords{$1};
|
if !defined $c_keywords{$1};
|
||||||
}
|
}
|
||||||
while (s/\b([a-zA-Z_]\w*)\b/ /)
|
while (s/\b([a-zA-Z_]\w*)\b/ /)
|
||||||
{
|
{
|
||||||
push (@{$identifiers{$1}}, "$file:$.")
|
push (@{$used{'identifiers'}{$1}}, "$file:$.")
|
||||||
if !defined $c_keywords{$1};
|
if !defined $c_keywords{$1};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -374,17 +375,17 @@ sub scan_makefile ($)
|
|||||||
# Variable assignments.
|
# Variable assignments.
|
||||||
while (s/\b([a-zA-Z_]\w*)\s*=/ /)
|
while (s/\b([a-zA-Z_]\w*)\s*=/ /)
|
||||||
{
|
{
|
||||||
push (@{$makevars{$1}}, "$file:$.");
|
push (@{$used{'makevars'}{$1}}, "$file:$.");
|
||||||
}
|
}
|
||||||
# Libraries.
|
# Libraries.
|
||||||
while (s/\B-l([a-zA-Z_]\w*)\b/ /)
|
while (s/\B-l([a-zA-Z_]\w*)\b/ /)
|
||||||
{
|
{
|
||||||
push (@{$libraries{$1}}, "$file:$.");
|
push (@{$used{'libraries'}{$1}}, "$file:$.");
|
||||||
}
|
}
|
||||||
# Tokens in the code.
|
# Tokens in the code.
|
||||||
while (s/\b([a-zA-Z_]\w*)\b/ /)
|
while (s/\b([a-zA-Z_]\w*)\b/ /)
|
||||||
{
|
{
|
||||||
push (@{$programs{$1}}, "$file:$.");
|
push (@{$used{'programs'}{$1}}, "$file:$.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(MFILE);
|
close(MFILE);
|
||||||
@ -408,7 +409,7 @@ sub scan_sh_file ($)
|
|||||||
# Tokens in the code.
|
# Tokens in the code.
|
||||||
while (s/\b([a-zA-Z_]\w*)\b/ /)
|
while (s/\b([a-zA-Z_]\w*)\b/ /)
|
||||||
{
|
{
|
||||||
push (@{$programs{$1}}, "$file:$.");
|
push (@{$used{'programs'}{$1}}, "$file:$.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(MFILE);
|
close(MFILE);
|
||||||
@ -438,13 +439,13 @@ sub print_unique ($@)
|
|||||||
sub output_programs ()
|
sub output_programs ()
|
||||||
{
|
{
|
||||||
print CONF "\n# Checks for programs.\n";
|
print CONF "\n# Checks for programs.\n";
|
||||||
foreach my $word (sort keys %programs)
|
foreach my $word (sort keys %{$used{'programs'}})
|
||||||
{
|
{
|
||||||
print_unique ($macro{'programs'}{$word}, @{$programs{$word}});
|
print_unique ($macro{'programs'}{$word}, @{$used{'programs'}{$word}});
|
||||||
}
|
}
|
||||||
foreach my $word (sort keys %makevars)
|
foreach my $word (sort keys %{$used{'makevars'}})
|
||||||
{
|
{
|
||||||
print_unique ($macro{'makevars'}{$word}, @{$makevars{$word}});
|
print_unique ($macro{'makevars'}{$word}, @{$used{'makevars'}{$word}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -454,7 +455,7 @@ sub output_programs ()
|
|||||||
sub output_libraries ()
|
sub output_libraries ()
|
||||||
{
|
{
|
||||||
print CONF "\n# Checks for libraries.\n";
|
print CONF "\n# Checks for libraries.\n";
|
||||||
foreach my $word (sort keys %libraries)
|
foreach my $word (sort keys %{$used{'libraries'}})
|
||||||
{
|
{
|
||||||
print CONF "# FIXME: Replace `main' with a function in `-l$word':\n";
|
print CONF "# FIXME: Replace `main' with a function in `-l$word':\n";
|
||||||
print CONF "AC_CHECK_LIB([$word], [main])\n";
|
print CONF "AC_CHECK_LIB([$word], [main])\n";
|
||||||
@ -469,7 +470,7 @@ sub output_headers ()
|
|||||||
my @have_headers;
|
my @have_headers;
|
||||||
|
|
||||||
print CONF "\n# Checks for header files.\n";
|
print CONF "\n# Checks for header files.\n";
|
||||||
foreach my $word (sort keys %headers)
|
foreach my $word (sort keys %{$used{'headers'}})
|
||||||
{
|
{
|
||||||
if (defined $macro{'headers'}{$word})
|
if (defined $macro{'headers'}{$word})
|
||||||
{
|
{
|
||||||
@ -477,11 +478,12 @@ sub output_headers ()
|
|||||||
{
|
{
|
||||||
push (@have_headers, $word);
|
push (@have_headers, $word);
|
||||||
push (@{$needed_macros{"AC_CHECK_HEADERS([$word])"}},
|
push (@{$needed_macros{"AC_CHECK_HEADERS([$word])"}},
|
||||||
@{$headers{$word}});
|
@{$used{'headers'}{$word}});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print_unique ($macro{'headers'}{$word}, @{$headers{$word}});
|
print_unique ($macro{'headers'}{$word},
|
||||||
|
@{$used{'headers'}{$word}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -497,7 +499,7 @@ sub output_identifiers ()
|
|||||||
my @have_types;
|
my @have_types;
|
||||||
|
|
||||||
print CONF "\n# Checks for typedefs, structures, and compiler characteristics.\n";
|
print CONF "\n# Checks for typedefs, structures, and compiler characteristics.\n";
|
||||||
foreach my $word (sort keys %identifiers)
|
foreach my $word (sort keys %{$used{'identifiers'}})
|
||||||
{
|
{
|
||||||
if (defined $macro{'identifiers'}{$word})
|
if (defined $macro{'identifiers'}{$word})
|
||||||
{
|
{
|
||||||
@ -505,12 +507,12 @@ sub output_identifiers ()
|
|||||||
{
|
{
|
||||||
push (@have_types, $word);
|
push (@have_types, $word);
|
||||||
push (@{$needed_macros{"AC_CHECK_TYPES([$word])"}},
|
push (@{$needed_macros{"AC_CHECK_TYPES([$word])"}},
|
||||||
@{$identifiers{$word}});
|
@{$used{'identifiers'}{$word}});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print_unique ($macro{'identifiers'}{$word},
|
print_unique ($macro{'identifiers'}{$word},
|
||||||
@{$identifiers{$word}});
|
@{$used{'identifiers'}{$word}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -526,7 +528,7 @@ sub output_functions ()
|
|||||||
my @have_funcs;
|
my @have_funcs;
|
||||||
|
|
||||||
print CONF "\n# Checks for library functions.\n";
|
print CONF "\n# Checks for library functions.\n";
|
||||||
foreach my $word (sort keys %functions)
|
foreach my $word (sort keys %{$used{'functions'}})
|
||||||
{
|
{
|
||||||
if (defined $macro{'functions'}{$word})
|
if (defined $macro{'functions'}{$word})
|
||||||
{
|
{
|
||||||
@ -534,12 +536,12 @@ sub output_functions ()
|
|||||||
{
|
{
|
||||||
push (@have_funcs, $word);
|
push (@have_funcs, $word);
|
||||||
push (@{$needed_macros{"AC_CHECK_FUNCS([$word])"}},
|
push (@{$needed_macros{"AC_CHECK_FUNCS([$word])"}},
|
||||||
@{$functions{$word}});
|
@{$used{'functions'}{$word}});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print_unique ($macro{'functions'}{$word},
|
print_unique ($macro{'functions'}{$word},
|
||||||
@{$functions{$word}});
|
@{$used{'functions'}{$word}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
26
lib/autoscan/libraries
Normal file
26
lib/autoscan/libraries
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# aclibraries -- autoscan's mapping from libraries to Autoconf macros
|
||||||
|
# Copyright 2001
|
||||||
|
# Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
# 02111-1307, USA.
|
||||||
|
|
||||||
|
# Ones that have their own macros.
|
||||||
|
|
||||||
|
# Others, checked with AC_CHECK_LIB.
|
||||||
|
|
||||||
|
# Local Variables:
|
||||||
|
# mode: shell-script
|
||||||
|
# End:
|
Loading…
Reference in New Issue
Block a user