]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* bin/autoscan.in (&scan_c_file): Better parsing of CPP
authorAkim Demaille <akim@epita.fr>
Mon, 26 Nov 2001 10:51:29 +0000 (10:51 +0000)
committerAkim Demaille <akim@epita.fr>
Mon, 26 Nov 2001 10:51:29 +0000 (10:51 +0000)
directives.
(&scan_sh_file): Remove a duplicate pattern.
(&check_configure_ac): Use long options.
* lib/autoscan/headers (alloca.h): Check with AC_FUNC_ALLOCA.

ChangeLog
bin/autoscan.in
lib/autoscan/headers

index e9e54a02a1fb79940abb69dd22c4791646f48830..f6c1b52cccfe08b764f3d703af9d78c52f105622 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2001-11-26  Akim Demaille  <akim@epita.fr>
+
+       * 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.
+
+       
 2001-11-26  Akim Demaille  <akim@epita.fr>
 
        * bin/autoscan.in (scan_c_file): Fix the handling of C comments.
index 3c6d7b2b43dda57ac4c14ab85c22c6cf01220eaf..7927a3cb519086c072a86c84726b415a74024362 100644 (file)
@@ -47,7 +47,8 @@ my %macro = ();
 # $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/@[^@]*@//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 (' -', '',
+    join (' --trace=', '',
          uniq (sort (map { s/\(.*//; $_ } keys %needed_macros)));
 
   verbose "running: $autoconf $trace_option $configure_ac";
index a5b840482b1d4bd5698e40f6af4abf1f0fd14694..aa5235955e244aab5ce13ca08c4ddb90649476a0 100644 (file)
@@ -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 @@ sys/wait.h    AC_HEADER_SYS_WAIT
 
 # Others, checked with AC_CHECK_HEADERS.
 OS.h
-alloca.h
 argz.h
 arpa/inet.h
 errno.h