autoconf-patches
[Top][All Lists]
Advanced

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

61-fyi-autom4te-m4?.patch


From: Akim Demaille
Subject: 61-fyi-autom4te-m4?.patch
Date: Fri, 31 Aug 2001 15:30:15 +0200

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        * bin/autoconf.in: Don't bother with `acsite.m4' and `aclocal.m4'.
        * bin/autom4te.in (&find_file): Support `FILE?' standing for
        optionally `FILE'.
        Use -e, not -f, since /dev/null for instance is OK.
        (&parse_args): Adjust.
        * lib/autom4te.in (Autoconf): Add `acsite.m4?' and `aclocal.m4?'.
        
        
Index: bin/autoconf.in
--- bin/autoconf.in Thu, 30 Aug 2001 20:46:39 +0200 akim
+++ bin/autoconf.in Thu, 30 Aug 2001 21:06:01 +0200 akim
@@ -224,9 +224,7 @@ Tracing:
 "--include=$localdir "\
 `test -n "$warnings" && echo "--warning=$warnings "`\
 "--output=$outfile "\
-`$initialization && echo "--melt "`\
-`test -f "$autoconf_dir/acsite.m4" && echo "$autoconf_dir/acsite.m4"`" "\
-`test -f "$localdir/aclocal.m4" && echo "$localdir/aclocal.m4"`
+`$initialization && echo "--melt "`
 
 # Autom4te expansion.
 eval set dummy "$traces"
Index: bin/autom4te.in
--- bin/autom4te.in Thu, 30 Aug 2001 16:11:54 +0200 akim
+++ bin/autom4te.in Thu, 30 Aug 2001 23:30:38 +0200 akim
@@ -367,23 +367,37 @@ sub load
 # We match exactly the behavior of GNU m4: first look in the current
 # directory (which includes the case of absolute file names), and, if
 # the file is not absolute, just fail.  Otherwise, look in the path.
+#
+# If the file is flagged as optional (ends with `?'), then return undef
+# if absent.
 sub find_file ($)
 {
   my ($filename) = @_;
+  my $optional = 0;
+
+  $optional = 1
+    if $filename =~ s/\?$//;
 
   return File::Spec->canonpath ($filename)
-    if -f $filename;
+    if -e $filename;
 
-  die "$me: no such file or directory: $filename\n"
-    if File::Spec->file_name_is_absolute ($filename);
+  if (File::Spec->file_name_is_absolute ($filename))
+    {
+      die "$me: no such file or directory: $filename\n"
+       unless $optional;
+      return undef;
+    }
 
   foreach my $path (@include)
     {
       return File::Spec->canonpath (File::Spec->catfile ($path, $filename))
-       if -f File::Spec->catfile ($path, $filename)
+       if -e File::Spec->catfile ($path, $filename)
     }
 
-  die "$me: no such file or directory: $filename\n";
+  die "$me: no such file or directory: $filename\n"
+    unless $optional;
+
+  return undef;
 }
 
 
@@ -399,6 +413,9 @@ Usage: $0 [OPTION] ... [FILES]
 Run GNU M4 on the FILES, avoiding useless runs.  If tracing, the output
 consists of the traces only, otherwise output the expansion of the FILES.
 The first of the FILES may be an M4 frozen file, but then must end in \`.m4f\'.
+Some files may be optional, i.e., will only be processed if found in the
+include path, but then must end in \`.m4?\';  the question mark is not part of
+the actual file name.
 
 Operation modes:
   -h, --help               print this help, then exit
@@ -581,11 +598,9 @@ sub parse_args ()
     if $melt;
 
   # We don't want to depend upon m4's --include to find the top level
-  # files.  Try to get a canonical name, as it's part of the key for caching.
-  for (my $i = 0; $i < $#ARGV; ++$i)
-    {
-      $ARGV[$i] = find_file ($ARGV[$i]);
-    }
+  # files.  Try to get a canonical name, as it's part of the key for
+  # caching.  And some files are optional.
+  @ARGV = grep { defined $_ } map { find_file ($_) } @ARGV;
 }
 
 
Index: lib/autom4te.in
--- lib/autom4te.in Tue, 28 Aug 2001 07:50:45 +0200 akim
+++ lib/autom4te.in Thu, 30 Aug 2001 21:05:35 +0200 akim
@@ -28,6 +28,8 @@ begin-language: "Autoconf"
 # patterns: "configure.in"
 args: --include @datadir@
 args: autoconf/autoconf.m4f
+args: acsite.m4?
+args: aclocal.m4?
 args: --mode 777
 args: --warning syntax
 args: --normalize



reply via email to

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