autoconf-patches
[Top][All Lists]
Advanced

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

autoscan and C++


From: Jens Petersen
Subject: autoscan and C++
Date: 10 Jul 2001 17:54:39 +0900
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Academic Rigor)

The patch below, makes autoscan more C++ friendly.  In
particular it makes it recognise files with C++ extensions
as needing a C++ compiler and the program g++.

Jens


2001-07-10  Jens Petersen  <address@hidden>

        * autoscan.in (scan_c_file): If the filename extension is C++ then
        add program CC, otherwise add cc.
        (scan_makefile): Improve programs regexp to parse things like
        "g++", "file.c" and "some-conf" as tokens.
        (scan_file): Match a file extension of cpp as C++ too.


Index: autoscan.in
===================================================================
RCS file: /cvsroot/autoconf/autoconf/autoscan.in,v
retrieving revision 1.56
diff -u -r1.56 autoscan.in
--- autoscan.in 2001/07/04 07:45:12     1.56
+++ autoscan.in 2001/07/10 08:36:52
@@ -265,7 +265,14 @@
   my ($file) = @_;
 
   push (@cfiles, $File::Find::name);
-  push (@{$used{'programs'}{"cc"}}, $File::Find::name);
+  if ($File::Find::name =~ s/\.c(c|pp)(\.in)?$//)
+    {
+      push (@{$used{'programs'}{"CC"}}, $File::Find::name);
+    }
+  else
+    {
+      push (@{$used{'programs'}{"cc"}}, $File::Find::name);
+    }
 
   # Nonzero if in a multiline comment.
   my $in_comment = 0;
@@ -346,7 +353,7 @@
          push (@{$used{'libraries'}{$1}}, "$File::Find::name:$.");
        }
       # Tokens in the code.
-      while (s/\b([a-zA-Z_]\w*)\b/ /)
+      while (s/\b([a-zA-Z_][\w\+\.-]+)/ /)
        {
          push (@{$used{'programs'}{$1}}, "$File::Find::name:$.");
        }
@@ -396,7 +403,7 @@
   # Strip a useless leading `./'.
   $File::Find::name =~ s,^\./,,;
 
-  if (/\.[chlymC](\.in)?$/ || /\.cc(\.in)?$/)
+  if (/\.[chlymC](\.in)?$/ || /\.c(c|pp)(\.in)?$/)
     {
       scan_c_file ($_);
     }



reply via email to

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