report on libraries that don't get used as well.

This commit is contained in:
espie 2004-11-23 11:17:59 +00:00
parent a56c20faa7
commit 8710bf432e

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl -w
# $OpenBSD: check-libs-elf,v 1.9 2004/11/23 11:13:20 espie Exp $
# $OpenBSD: check-libs-elf,v 1.10 2004/11/23 11:17:59 espie Exp $
# Copyright (c) 2001 Marc Espie
#
@ -53,6 +53,7 @@ sub find_library
my $error = 0;
my %registered;
my %used;
if (defined $ENV{'LIB_DEPENDS'}) {
for my $d (split(/[ ,\n]+/, $ENV{'LIB_DEPENDS'})) {
@ -60,6 +61,7 @@ if (defined $ENV{'LIB_DEPENDS'}) {
$d =~ s/\.$//;
$d =~ s/(?:\.\d+){1,2}$//;
$registered{$d} = 1;
$used{$d} = 0;
}
}
@ -67,6 +69,7 @@ if (defined $ENV{'WANTLIB'}) {
for my $r (split(/\s+/, $ENV{'WANTLIB'})) {
$r =~ s/(?:\.\d+){1,2}$//;
$registered{$r} = 1;
$used{$r} = 0;
}
}
@ -101,7 +104,9 @@ while (<$libs>) {
} else {
next;
}
unless (exists $registered{$name}) {
if (exists $registered{$name}) {
$used{$name} = 1;
} else {
my $spec="$name.$major.$minor";
if (defined $path) {
$spec="$path/$spec";
@ -112,4 +117,9 @@ while (<$libs>) {
}
close($libs);
while (my ($k, $v) = each %used) {
next if $v == 1;
print "lib-depends-check: unused library $k\n";
}
exit($error);