r22187: Test kerberos logins in the smbclient blackbox tests, including with a
[Samba.git] / source / script / find_unused_makefilevars.pl
blob1bed1228eca8da9f388fa8cde31b11220c961242
1 #!/usr/bin/perl
2 # Script that reads in Makefile.in and outputs the names of all
3 # used but undefined vars and all defined but unused vars
4 # Copyright Jelmer Vernooij <jelmer@samba.org>
6 # Arguments:
7 # 1: Makefile.in
10 my %references;
11 my %defines;
13 # First, make a list of defines in configure
14 $in = shift;
16 open(IN, $in);
17 while(<IN>) {
18 my $line = $_;
19 while($line =~ /^\b([a-zA-Z0-9_][a-zA-Z0-9_]*)\b[ \t]*=.*/sgm) {
20 $defines{$1} = 1;
22 while($line =~ /\$\(([a-zA-Z0-9_][a-zA-Z0-9_]*)\)/sgm) {
23 $references{$1} = 1;
26 close IN;
28 print "##### DEFINED BUT UNUSED: #####\n";
29 foreach(%defines) {
30 # print $_." defined\n";
32 if ($_ != 1) {
33 if ($references{$_} != 1) {
34 print $_."\n";
39 print "##### USED BUT UNDEFINED: #####\n";
40 foreach(%references) {
41 if ($_ != 1) {
42 if ($defines{$_} != 1) {
43 print $_."\n";