autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 17-proto-autoscan-check.patch


From: Pavel Roskin
Subject: Re: 17-proto-autoscan-check.patch
Date: Mon, 22 Jan 2001 14:10:51 -0500 (EST)

On 22 Jan 2001, Akim Demaille wrote:

> >>>>> "Pavel" == Pavel Roskin <address@hidden> writes:
>
> Pavel> By using the modern features, such as "use strict" and "my" you
> Pavel> can write much better code. The patch follows.
>
> Please, Pavel, make your patch relative to the *latest* patch I sent,
> and accept the previous ones.  There is no point in working two
> different branches.  Let's go forward, and let's stop this ridiculous
> loss of time on the way we walk.  The only thing that matters is
> *where* we go.
>
> I have made steps _forward_, please, step in my tracks.

I've adjusted my patch so that it applies after your patches.

ChangeLog:
        * autoscan.pl: Use "use strict". Declare all global variables
        or make them private. Make all local variables private.
        (find_autoconf): New, moved some code from the top level.
        Use %ENV outside quotes to eliminate a warning.

Note that the result is still not satisfactory since autoscan examines
configure.in and cries about it, and I cannot suppress checking
configure.in from the command line.

Regards,
Pavel Roskin

_____________________________
--- autoscan.pl
+++ autoscan.pl
@@ -21,24 +21,17 @@

 require "find.pl";
 use Getopt::Long;
+use strict;
+
+use vars qw($autoconf $datadir $initfile $me $name $verbose
+            @cfiles @makefiles @shfiles
+            %functions_macros %headers_macros %identifiers_macros
+            %programs_macros %makevars_macros %needed_macros
+            %c_keywords %programs %headers %identifiers %makevars
+            %libraries %functions %printed);

 # Find the lib files and autoconf.
-$datadir = $ENV{"AC_MACRODIR"} || "@datadir@";
-($dir = $0) =~ s,[^/]*$,,;
-$autoconf = '';
-# We test "$dir/autoconf" in case we are in the build tree, in which case
-# the names are not transformed yet.
-foreach $file ("$ENV{AUTOCONF}" || '',
-              "$dir/@autoconf-name@",
-              "$dir/autoconf",
-              "@bindir@/@autoconf-name@")
-  {
-    if (-f $file)
-      {
-       $autoconf = $file;
-       last;
-      }
-  }
+&find_autoconf;

 ($me = $0) =~ s,.*/,,;
 $verbose = 0;
@@ -71,6 +64,29 @@

 exit 0;

+sub find_autoconf
+{
+  # Find the lib files and autoconf.
+  my $dir;
+  my $file;
+  $datadir = $ENV{"AC_MACRODIR"} || "@datadir@";
+  ($dir = $0) =~ s,[^/]*$,,;
+  $autoconf = '';
+  # We test "$dir/autoconf" in case we are in the build tree, in which case
+  # the names are not transformed yet.
+  foreach $file ($ENV{"AUTOCONF"} || '',
+                "$dir/@autoconf-name@",
+                "$dir/autoconf",
+                "@bindir@/@autoconf-name@")
+    {
+      if (-f $file)
+       {
+         $autoconf = $file;
+         last;
+       }
+    }
+}
+
 # Display usage (--help).
 sub print_usage
 {
@@ -108,6 +124,7 @@
 # Process any command line arguments.
 sub parse_args
 {
+  my $srcdir;
   Getopt::Long::config ("bundling");
   Getopt::Long::GetOptions ("A|autoconf-dir|m|macrodir=s" => \$datadir,
                            "h|help" => \&print_usage,
@@ -132,7 +149,7 @@
 # Put values in the tables of what to do with each token.
 sub init_tables
 {
-  local($kind, $word, $macro);
+  my ($kind, $word, $macro);

   # Initialize a table of C keywords (to ignore).
   # Taken from K&R 1st edition p. 180.
@@ -206,6 +223,7 @@
 # that might create nonportabilities.
 sub scan_files
 {
+  my $file;
   if (defined $cfiles[0])
     {
       $initfile = $cfiles[0];          # Pick one at random.
@@ -239,8 +257,8 @@
 # -----------------
 sub scan_c_file
 {
-  local($file) = @_;
-  local($in_comment) = 0;      # Nonzero if in a multiline comment.
+  my ($file) = @_;
+  my ($in_comment) = 0;        # Nonzero if in a multiline comment.

   open(CFILE, "<$file") || die "$me: cannot open $file: $!\n";
   while (<CFILE>)
@@ -291,7 +309,7 @@

   if ($verbose)
     {
-      local($word);
+      my ($word);

       print "\n$file functions:\n";
       foreach $word (sort keys %functions)
@@ -315,7 +333,7 @@

 sub scan_makefile
 {
-  local($file) = @_;
+  my ($file) = @_;

   open(MFILE, "<$file") || die "$me: cannot open $file: $!\n";
   while (<MFILE>)
@@ -346,7 +364,7 @@

   if ($verbose)
     {
-      local($word);
+      my ($word);

       print "\n$file makevars:\n";
       foreach $word (sort keys %makevars)
@@ -370,7 +388,7 @@

 sub scan_sh_file
 {
-  local($file) = @_;
+  my ($file) = @_;

   open(MFILE, "<$file") || die "$me: cannot open $file: $!\n";
   while (<MFILE>)
@@ -390,7 +408,7 @@

   if ($verbose)
     {
-      local($word);
+      my ($word);

       print "\n$file programs:\n";
       foreach $word (sort keys %programs)
@@ -403,7 +421,7 @@
 # Print a proto configure.ac.
 sub output
 {
-  local (%unique_makefiles);
+  my %unique_makefiles;

   print CONF "# Process this file with autoconf to produce a configure 
script.\n";
   print CONF "AC_INIT\n";
@@ -438,7 +456,7 @@
 # Print Autoconf macro $1 if it's not undef and hasn't been printed already.
 sub print_unique
 {
-  local($macro, @where) = @_;
+  my ($macro, @where) = @_;

   if (defined($macro) && !defined($printed{$macro}))
     {
@@ -453,7 +471,7 @@

 sub output_programs
 {
-  local ($word);
+  my $word;

   print CONF "\n# Checks for programs.\n";
   foreach $word (sort keys %programs)
@@ -468,7 +486,7 @@

 sub output_libraries
 {
-  local ($word);
+  my ($word);

   print CONF "\n# Checks for libraries.\n";
   foreach $word (sort keys %libraries)
@@ -480,7 +498,8 @@

 sub output_headers
 {
-  local ($word);
+  my $word;
+  my @have_headers;

   print CONF "\n# Checks for header files.\n";
   foreach $word (sort keys %headers)
@@ -501,7 +520,8 @@

 sub output_identifiers
 {
-  local ($word);
+  my $word;
+  my @have_types;

   print CONF "\n# Checks for typedefs, structures, and compiler 
characteristics.\n";
   foreach $word (sort keys %identifiers)
@@ -522,7 +542,8 @@

 sub output_functions
 {
-  local ($word);
+  my $word;
+  my @have_funcs;

   print CONF "\n# Checks for library functions.\n";
   foreach $word (sort keys %functions)
@@ -546,9 +567,10 @@
 # in `configure.ac'
 sub check_configure_ac
 {
-  local ($configure_ac) = $@;
-  local ($trace_option) = '';
-  local ($word);
+  my ($configure_ac) = $@;
+  my ($trace_option) = '';
+  my ($word);
+  my ($macro);

   foreach $macro (sort keys %needed_macros)
     {
@@ -560,7 +582,7 @@

   while (<TRACES>)
     {
-      local ($file, $line, $macro, $args) = split (/:/, $_, 4);
+      my ($file, $line, $macro, $args) = split (/:/, $_, 4);
       delete ($needed_macros{$macro});
     }

_____________________________





reply via email to

[Prev in Thread] Current Thread [Next in Thread]