autoconf-patches
[Top][All Lists]
Advanced

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

50-fyi-autoscan-1.patch


From: Akim Demaille
Subject: 50-fyi-autoscan-1.patch
Date: Mon, 26 Nov 2001 11:49:34 +0100

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        * bin/autoscan.in (&scan_c_file): Better parsing of CPP
        directives.
        (&scan_sh_file): Remove a duplicate pattern.
        (&check_configure_ac): Use long options.
        * lib/autoscan/headers (alloca.h): Check with AC_FUNC_ALLOCA.
        
        
Index: bin/autoscan.in
--- bin/autoscan.in Sat, 24 Nov 2001 18:49:34 +0100 akim
+++ bin/autoscan.in Sat, 24 Nov 2001 19:49:40 +0100 akim
@@ -47,7 +47,8 @@
 # $NEEDED_MACROS{MACRO} is an array of locations requiring MACRO.
 my %needed_macros = ();
 
-my @kinds = qw (functions headers identifiers programs makevars libraries);
+my @kinds = qw (functions headers identifiers programs
+                makevars libraries);
 
 # For each kind, the default macro.
 my %generic_macro =
@@ -224,12 +225,23 @@ sub scan_c_file ($)
        }
 
       # Preprocessor directives.
-      if (/^\s*\#\s*include\s*<([^>]*)>/)
+      if (s/^\s*\#\s*//)
        {
-         push (@{$used{'headers'}{$1}}, "$File::Find::name:$.");
+         if (/^include\s*<([^>]*)>/)
+           {
+             push (@{$used{'headers'}{$1}}, "$File::Find::name:$.");
+           }
+         if (s/^(if|ifdef|ifndef|elif)\s+//)
+           {
+             foreach my $word (split (/\W+/))
+               {
+                 push (@{$used{'identifiers'}{$word}}, "$File::Find::name:$.")
+                   unless $word eq 'defined' || $word !~ /^[a-zA-Z_]/;
+               }
+           }
+         # Ignore other preprocessor directives.
+         next;
        }
-      # Ignore other preprocessor directives.
-      next if /^\s*\#/;
 
       # Remove string and character constants.
       s,\"[^\"]*\",,g;
@@ -304,7 +316,6 @@ sub scan_sh_file ($)
     {
       # Strip out comments and variable references.
       s/#.*//;
-      s/#.*//;
       s/\${[^\}]*}//g;
       s/@address@hidden@//g;
 
@@ -401,8 +412,8 @@ sub output_kind ($$)
     if exists $kind_comment{$kind};
   foreach my $word (sort keys %{$used{$kind}})
     {
-      # Words that were caught, but not to be checked according to
-      # the autoscan library files.
+      # Words that were caught, but not to be checked according to the
+      # autoscan library files.
       next
        if ! exists $macro{$kind}{$word};
 
@@ -459,8 +470,9 @@ sub output ($)
 
   my $file = new Autom4te::XFile ">$configure_scan";
 
-  print $file "# Process this file with autoconf to produce a configure 
script.\n";
-  print $file "AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)\n";
+  print $file
+    ("# Process this file with autoconf to produce a configure script.\n"
+     . "AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)\n");
   if (defined $cfiles[0])
     {
       print $file "AC_CONFIG_SRCDIR([$cfiles[0]])\n";
@@ -506,7 +518,7 @@ sub check_configure_ac ($)
   # I'd be very happy if someone could explain to me why sort (uniq ...)
   # doesn't work properly: I need `uniq (sort ...)'.  --akim
   my $trace_option =
-    join (' -t ', '',
+    join (' --trace=', '',
          uniq (sort (map { s/\(.*//; $_ } keys %needed_macros)));
 
   verbose "running: $autoconf $trace_option $configure_ac";
Index: lib/autoscan/headers
--- lib/autoscan/headers Mon, 25 Jun 2001 00:48:12 +0200 akim
+++ lib/autoscan/headers Sat, 24 Nov 2001 19:38:15 +0100 akim
@@ -22,6 +22,7 @@
 
 # Ones that have their own macros.
 X11/Xlib.h     AC_PATH_X
+alloca.h        AC_FUNC_ALLOCA
 dirent.h       AC_HEADER_DIRENT
 float.h                AC_HEADER_STDC
 float.h                AC_CHECK_HEADERS
@@ -40,7 +41,6 @@
 
 # Others, checked with AC_CHECK_HEADERS.
 OS.h
-alloca.h
 argz.h
 arpa/inet.h
 errno.h



reply via email to

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