]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* bin/autoconf.as: Handle `-' just like other input files.
authorNoah Misch <noah@cs.caltech.edu>
Thu, 17 May 2007 02:43:12 +0000 (02:43 +0000)
committerNoah Misch <noah@cs.caltech.edu>
Thu, 17 May 2007 02:43:12 +0000 (02:43 +0000)
* bin/autom4te.in (parse_args): Pass `-' through.
(handle_output): Skip the forbidden token search if we read from stdin.
(up_to_date): Always treat stdin as out of date.
* tests/tools.at (autoconf: input from stdin): New test.
(autoconf: forbidden tokens, basic): Check a second `autoconf' run.

ChangeLog
bin/autoconf.as
bin/autom4te.in
tests/tools.at

index 1926feee0f122001ed337202ec8549738fc80e6d..fb8c064b361aba7efdcb5d60f728d22741c0cf65 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-05-16  Noah Misch  <noah@cs.caltech.edu>
+
+       * bin/autoconf.as: Handle `-' just like other input files.
+       * bin/autom4te.in (parse_args): Pass `-' through.
+       (handle_output): Skip the forbidden token search if we read from stdin.
+       (up_to_date): Always treat stdin as out of date.
+       * tests/tools.at (autoconf: input from stdin): New test.
+       (autoconf: forbidden tokens, basic): Check a second `autoconf' run.
+
 2007-05-16  Stepan Kasal  <kasal@ucw.cz>
 
        * tests/foreign.at tests/semantics.at, tests/tools.at: Remove
index bf04f5fe7b17675e5036d2b4d884f0d55fd0761f..1e65913c7b80e75d8fb0b13339bbfe8abed916c1 100644 (file)
@@ -164,8 +164,8 @@ case $# in
       exit 1
     fi
     test -z "$traces" && test -z "$outfile" && outfile=configure;;
-  1) # autom4te doesn't like `-'.
-     test "x$1" != "x-" && infile=$1 ;;
+  1)
+    infile=$1 ;;
   *) exec >&2
      AS_ECHO(["$as_me: invalid number of arguments."])
      AS_ECHO(["$help"])
index 5c5af9363c479e13032c10c0ab04e60c31148214..09f7cf9b58579a449275c494785838fa06dfdb70 100644 (file)
@@ -418,7 +418,11 @@ Try `$me --help' for more information."
   my @argv;
   foreach (@ARGV)
     {
-      if (/\.m4f$/)
+      if ($_ eq '-')
+       {
+         push @argv, $_;
+       }
+      elsif (/\.m4f$/)
        {
          # Frozen files are optional => pass a `?' to `find_file'.
          my $file = find_file ("$_?", @include);
@@ -586,27 +590,30 @@ sub handle_output ($$)
 
   # Locate the forbidden words in the last input file.
   # This is unsatisfying but...
-  my $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b';
-  my $file = new Autom4te::XFile ($ARGV[$#ARGV]);
   $exit_code = 1;
-
-  while ($_ = $file->getline)
+  if ($ARGV[$#ARGV] ne '-')
     {
-      # Don't complain in comments.  Well, until we have something
-      # better, don't consider `#include' etc. are comments.
-      s/\#.*//
-       unless /^\#(if|include|endif|ifdef|ifndef|define)\b/;
-
-      # Complain once per word, but possibly several times per line.
-      while (/$prohibited/)
+      my $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b';
+      my $file = new Autom4te::XFile ($ARGV[$#ARGV]);
+      
+      while ($_ = $file->getline)
        {
-         my $word = $1;
-         warn_forbidden ("$ARGV[$#ARGV]:$.", $word, %forbidden);
-         delete $prohibited{$word};
-         # If we're done, exit.
-         return
-           if ! %prohibited;
-         $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b';
+         # Don't complain in comments.  Well, until we have something
+         # better, don't consider `#include' etc. to be comments.
+         s/\#.*//
+           unless /^\#(if|include|endif|ifdef|ifndef|define)\b/;
+
+         # Complain once per word, but possibly several times per line.
+         while (/$prohibited/)
+           {
+             my $word = $1;
+             warn_forbidden ("$ARGV[$#ARGV]:$.", $word, %forbidden);
+             delete $prohibited{$word};
+             # If we're done, exit.
+             return
+               if ! %prohibited;
+             $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b';
+           }
        }
     }
   warn_forbidden ("$output:$prohibited{$_}", $_, %forbidden)
@@ -876,6 +883,10 @@ sub up_to_date ($)
   # We depend at least upon the arguments.
   my @dep = @ARGV;
 
+  # stdin is always out of date.
+  if (grep { $_ eq '-' } @dep)
+    { return 0 }
+
   # Files may include others.  We can use traces since we just checked
   # if they are available.
   handle_traces ($req, "$tmp/dependencies",
index e0dc37c54e3d77dadc18aed8f36373555a84e028..79fc66f45f872e5f0ee85144bc8e6278f9f744c0 100644 (file)
@@ -285,6 +285,8 @@ configure.ac:4: error: possibly undefined macro: AS@&t@_FOO
 configure.ac:5: error: possibly undefined macro: _AS@&t@_BAR
 configure.ac:6: error: possibly undefined macro: d@&t@nl
 ]])
+# Second run should succeed and yield no output.
+AT_CHECK([autoconf])
 
 AT_CLEANUP
 
@@ -386,6 +388,23 @@ AT_CHECK([[grep '^[^/].*/mkdir -p' sub/foo]], 1)
 AT_CLEANUP
 
 
+# autoconf: input from stdin
+# --------------------------
+AT_SETUP([autoconf: input from stdin])
+
+# Past Autoconf versions failed to read from stdin when other, non-frozen input
+# files were present.
+AT_DATA([aclocal.m4])
+
+AT_CHECK([echo 'AC_INIT(X, 1.0, bug-autoconf@gnu.org)' | autoconf -t AC_INIT -],
+        0, [stdin:1:AC_INIT:X:1.0:bug-autoconf@gnu.org
+])
+AT_CHECK([echo 'AC_INIT(X, 2.0, bug-autoconf@gnu.org)' | autoconf -t AC_INIT -],
+        0, [stdin:1:AC_INIT:X:2.0:bug-autoconf@gnu.org
+])
+
+AT_CLEANUP
+