]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* autoupdate.in (&parse_args): Support `-'.
authorAkim Demaille <akim@epita.fr>
Sun, 25 Feb 2001 10:43:13 +0000 (10:43 +0000)
committerAkim Demaille <akim@epita.fr>
Sun, 25 Feb 2001 10:43:13 +0000 (10:43 +0000)
ChangeLog
autoupdate.in
autoupdate.sh
bin/autoupdate.in

index 2eb749a443a941b55a414e47990d55528b66e7ed..cafb7a743782d9360f23461b8b04c149a30038ca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-02-25  Akim Demaille  <akim@epita.fr>
+
+       * autoupdate.in (&parse_args): Support `-'.
+
+       
 2001-02-25  Akim Demaille  <akim@epita.fr>
 
        * autoupdate.in: Less Bournisms, more Wallisms.
index ac8876c0d81940745b5aedceb119690d59116a1e..961ef50ea8b93ce45f297c957a316423be470f0c 100644 (file)
@@ -137,12 +137,18 @@ sub find_configure_ac ()
 sub parse_args ()
 {
   my $srcdir;
+  # F*k.  Getopt seems bogus and dies when given `-' with `bundling'.
+  # If fixed some day, use this: '' => sub { push @ARGV, "-" }
+  my $update_stdin = grep /^-$/, @ARGV;
+  @ARGV = grep !/^-$/, @ARGV;
   Getopt::Long::config ("bundling");
-  Getopt::Long::GetOptions ("A|autoconf-dir|m|macrodir=s" => \$autoconf_dir,
-                           "h|help" => \&print_usage,
-                           "V|version" => \&print_version,
-                           "v|verbose" => \$verbose)
+  Getopt::Long::GetOptions ('A|autoconf-dir|m|macrodir=s' => \$autoconf_dir,
+                           'h|help'    => \&print_usage,
+                           'V|version' => \&print_version,
+                           'v|verbose' => \$verbose)
     or exit 1;
+  push @ARGV, '-'
+    if $update_stdin;
   if (! @ARGV)
     {
       my $configure_ac = find_configure_ac;
@@ -245,13 +251,17 @@ close MACROS
 # Don't keep AU macros in @AC_MACROS.
 delete $ac_macros{$_}
   foreach (keys %au_macros);
-print STDERR "AC: " . join (' ', sort keys %ac_macros) . "\n\n\n";
-print STDERR "AU: " . join (' ', sort keys %au_macros) . "\n";
+if ($verbose)
+  {
+    print STDERR "Current Autoconf macros:\n";
+    print STDERR join (' ', sort keys %ac_macros) . "\n\n";
+    print STDERR "Obsolete Autoconf macros:\n";
+    print STDERR join (' ', sort keys %au_macros) . "\n\n";
+  }
 
 # $au_changequote -- enable the quote `[', `]' right before any AU macro.
 my $au_changequote =
   's/\b(' . join ('|', keys %au_macros) . ')\b/_au_changequote([,])$1/g';
-print STDERR "$au_changequote\n";
 
 # au.m4 -- definitions the AU macros.
 system ("$autoconf --trace AU_DEFUN:'_au_defun(\@<:\@\$1\@:>\@,
@@ -409,8 +419,12 @@ EOF
     # Now ask m4 to perform the update.
     print STDERR "$me: running $m4 $tmp/input.m4"
        if $verbose;
-    system ("$m4 $tmp/input.m4 >$tmp/updated") == 0
-       or die "$me: cannot update \`$filename'";
+    if (system ("$m4 $tmp/input.m4 >$tmp/updated"))
+       {
+        # Don't let `die' with random errno.
+        $! = 1;
+        die "$me: cannot update \`$filename'\n";
+       };
 
     if ("$file" eq "$tmp/stdin")
        {
index ac8876c0d81940745b5aedceb119690d59116a1e..961ef50ea8b93ce45f297c957a316423be470f0c 100644 (file)
@@ -137,12 +137,18 @@ sub find_configure_ac ()
 sub parse_args ()
 {
   my $srcdir;
+  # F*k.  Getopt seems bogus and dies when given `-' with `bundling'.
+  # If fixed some day, use this: '' => sub { push @ARGV, "-" }
+  my $update_stdin = grep /^-$/, @ARGV;
+  @ARGV = grep !/^-$/, @ARGV;
   Getopt::Long::config ("bundling");
-  Getopt::Long::GetOptions ("A|autoconf-dir|m|macrodir=s" => \$autoconf_dir,
-                           "h|help" => \&print_usage,
-                           "V|version" => \&print_version,
-                           "v|verbose" => \$verbose)
+  Getopt::Long::GetOptions ('A|autoconf-dir|m|macrodir=s' => \$autoconf_dir,
+                           'h|help'    => \&print_usage,
+                           'V|version' => \&print_version,
+                           'v|verbose' => \$verbose)
     or exit 1;
+  push @ARGV, '-'
+    if $update_stdin;
   if (! @ARGV)
     {
       my $configure_ac = find_configure_ac;
@@ -245,13 +251,17 @@ close MACROS
 # Don't keep AU macros in @AC_MACROS.
 delete $ac_macros{$_}
   foreach (keys %au_macros);
-print STDERR "AC: " . join (' ', sort keys %ac_macros) . "\n\n\n";
-print STDERR "AU: " . join (' ', sort keys %au_macros) . "\n";
+if ($verbose)
+  {
+    print STDERR "Current Autoconf macros:\n";
+    print STDERR join (' ', sort keys %ac_macros) . "\n\n";
+    print STDERR "Obsolete Autoconf macros:\n";
+    print STDERR join (' ', sort keys %au_macros) . "\n\n";
+  }
 
 # $au_changequote -- enable the quote `[', `]' right before any AU macro.
 my $au_changequote =
   's/\b(' . join ('|', keys %au_macros) . ')\b/_au_changequote([,])$1/g';
-print STDERR "$au_changequote\n";
 
 # au.m4 -- definitions the AU macros.
 system ("$autoconf --trace AU_DEFUN:'_au_defun(\@<:\@\$1\@:>\@,
@@ -409,8 +419,12 @@ EOF
     # Now ask m4 to perform the update.
     print STDERR "$me: running $m4 $tmp/input.m4"
        if $verbose;
-    system ("$m4 $tmp/input.m4 >$tmp/updated") == 0
-       or die "$me: cannot update \`$filename'";
+    if (system ("$m4 $tmp/input.m4 >$tmp/updated"))
+       {
+        # Don't let `die' with random errno.
+        $! = 1;
+        die "$me: cannot update \`$filename'\n";
+       };
 
     if ("$file" eq "$tmp/stdin")
        {
index ac8876c0d81940745b5aedceb119690d59116a1e..961ef50ea8b93ce45f297c957a316423be470f0c 100644 (file)
@@ -137,12 +137,18 @@ sub find_configure_ac ()
 sub parse_args ()
 {
   my $srcdir;
+  # F*k.  Getopt seems bogus and dies when given `-' with `bundling'.
+  # If fixed some day, use this: '' => sub { push @ARGV, "-" }
+  my $update_stdin = grep /^-$/, @ARGV;
+  @ARGV = grep !/^-$/, @ARGV;
   Getopt::Long::config ("bundling");
-  Getopt::Long::GetOptions ("A|autoconf-dir|m|macrodir=s" => \$autoconf_dir,
-                           "h|help" => \&print_usage,
-                           "V|version" => \&print_version,
-                           "v|verbose" => \$verbose)
+  Getopt::Long::GetOptions ('A|autoconf-dir|m|macrodir=s' => \$autoconf_dir,
+                           'h|help'    => \&print_usage,
+                           'V|version' => \&print_version,
+                           'v|verbose' => \$verbose)
     or exit 1;
+  push @ARGV, '-'
+    if $update_stdin;
   if (! @ARGV)
     {
       my $configure_ac = find_configure_ac;
@@ -245,13 +251,17 @@ close MACROS
 # Don't keep AU macros in @AC_MACROS.
 delete $ac_macros{$_}
   foreach (keys %au_macros);
-print STDERR "AC: " . join (' ', sort keys %ac_macros) . "\n\n\n";
-print STDERR "AU: " . join (' ', sort keys %au_macros) . "\n";
+if ($verbose)
+  {
+    print STDERR "Current Autoconf macros:\n";
+    print STDERR join (' ', sort keys %ac_macros) . "\n\n";
+    print STDERR "Obsolete Autoconf macros:\n";
+    print STDERR join (' ', sort keys %au_macros) . "\n\n";
+  }
 
 # $au_changequote -- enable the quote `[', `]' right before any AU macro.
 my $au_changequote =
   's/\b(' . join ('|', keys %au_macros) . ')\b/_au_changequote([,])$1/g';
-print STDERR "$au_changequote\n";
 
 # au.m4 -- definitions the AU macros.
 system ("$autoconf --trace AU_DEFUN:'_au_defun(\@<:\@\$1\@:>\@,
@@ -409,8 +419,12 @@ EOF
     # Now ask m4 to perform the update.
     print STDERR "$me: running $m4 $tmp/input.m4"
        if $verbose;
-    system ("$m4 $tmp/input.m4 >$tmp/updated") == 0
-       or die "$me: cannot update \`$filename'";
+    if (system ("$m4 $tmp/input.m4 >$tmp/updated"))
+       {
+        # Don't let `die' with random errno.
+        $! = 1;
+        die "$me: cannot update \`$filename'\n";
+       };
 
     if ("$file" eq "$tmp/stdin")
        {