]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
CVS GNU M4 doesn't like `undefine(undefined)'.
authorAkim Demaille <akim@epita.fr>
Wed, 5 Sep 2001 07:04:02 +0000 (07:04 +0000)
committerAkim Demaille <akim@epita.fr>
Wed, 5 Sep 2001 07:04:02 +0000 (07:04 +0000)
* bin/autoupdate.in (&handle_m4_macros, &handle_autoconf_macros):
New, extracted from main.
Use IO::File wherever possible.
(input.m4): Be constant, use -I instead of hard coding $tmp.
Therefore be a quoted heredoc.
Don't invoke `_au_disable', since ac was not loaded, but just
`unm4.m4'.

ChangeLog
NEWS
bin/autoupdate.in
config/missing

index a2ff8e63d362567fb596768f8b291dd7755a25fe..dba605d10fc0ff1670569f3afde6d1ef5bbc0111 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2001-09-05  Akim Demaille  <akim@epita.fr>
+
+       CVS GNU M4 doesn't like `undefine(undefined)'.
+
+       * bin/autoupdate.in (&handle_m4_macros, &handle_autoconf_macros):
+       New, extracted from main.
+       Use IO::File wherever possible.
+       (input.m4): Be constant, use -I instead of hard coding $tmp.
+       Therefore be a quoted heredoc.
+       Don't invoke `_au_disable', since ac was not loaded, but just
+       `unm4.m4'.
+
 2001-08-31  Akim Demaille  <akim@epita.fr>
 
        Version 2.52d.
diff --git a/NEWS b/NEWS
index 3a01155d5d9979c69758228eb526d71dce29b443..989cb46a700076e4daf1058566b8671ae581a080 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-* Major changes in Autoconf 2.52d                       -*- outline -*-
+* Major changes in Autoconf 2.52e                       -*- outline -*-
 ** Licensing
   The Autoconf manual is now distributed under the terms of the GNU FDL.
 ** Requirements
index b2e9d2f2c5217fe7716b4ab889888c0f5b82d965..7b60f7b06d8dc8269fd2cd6bba590ab6049835e8 100644 (file)
@@ -103,6 +103,141 @@ sub parse_args ()
 }
 
 
+# ------------- #
+# M4 builtins.  #
+# ------------- #
+
+my @m4_builtins;
+
+# HANDLE_M4_SYMBOLS ()
+# --------------------
+# Create the following $tmp files:
+# m4.m4 -- enable the m4 builtins.
+# unm4.m4 -- disable the m4 builtins.
+# savem4.m4 -- save the m4 builtins.
+sub handle_m4_macros ()
+{
+  # Get the list of builtins.
+  xsystem ("echo dumpdef | $m4 2>$tmp/sugar.defs >/dev/null");
+  my $sugar_defs = new IO::File "$tmp/sugar.defs"
+    or die "$me: cannot open $tmp/sugar.defs: $!\n";
+  while ($_ = $sugar_defs->getline)
+    {
+      push @m4_builtins, $1
+        if /^(\w+):/;
+    }
+  $sugar_defs->close
+    or die "$me: cannot close $tmp/sugar.defs: $!\n";
+
+  # Output the files.
+  my $m4_m4 = new IO::File ">$tmp/m4.m4"
+    or die "$me: cannot create $tmp/m4.m4: $!\n";
+  print $m4_m4 "# m4.m4 -- enable the m4 builtins.\n";
+  my $unm4_m4 = new IO::File ">$tmp/unm4.m4"
+    or die "$me: cannot create $tmp/unm4.m4: $!\n";
+  print $unm4_m4 "# unm4.m4 -- disable the m4 builtins.\n";
+  my $m4save_m4 = new IO::File ">$tmp/m4save.m4"
+    or die "$me: cannot create $tmp/unm4.m4: $!\n";
+  print $m4save_m4 "# savem4.m4 -- save the m4 builtins.\n";
+  foreach (@m4_builtins)
+    {
+      print $m4_m4     "_au_define([$_], _au_defn([_au_$_]))\n";
+      print $unm4_m4   "_au_undefine([$_])\n";
+      print $m4save_m4 "define([_au_$_], defn([$_]))\n";
+    }
+  $m4save_m4->close
+    or die "$me: cannot close $tmp/m4save.m4: $!\n";
+  $unm4_m4->close
+    or die "$me: cannot close $tmp/unm4.m4: $!\n";
+  $m4_m4->close
+    or die "$me: cannot close $tmp/m4.m4: $!\n";
+}
+
+
+
+# ----------------- #
+# Autoconf macros.  #
+# ----------------- #
+
+
+# @AU_MACROS & AC_MACROS -- AU and AC macros and yet another useful comment.
+my (%ac_macros, %au_macros);
+
+
+# HANDLE_AUTOCONF_MACROS ()
+# -------------------------
+# @M4_BUILTINS -- M4 builtins and a useful comment.
+sub handle_autoconf_macros ()
+{
+  my $macros = new IO::File ("$autoconf"
+                            . " --trace AU_DEFUN:'AU:\$f:\$1'"
+                            . " --trace define:'AC:\$f:\$1'"
+                            . " --melt /dev/null |")
+    or die "$me: cannot open definitions reading pipe: $!\n";
+  while ($_ = $macros->getline)
+    {
+      chomp;
+      my ($domain, $file, $macro) = /^(AC|AU):(.*):([^:]*)$/ or next;
+      # ../lib/m4sugar/m4sugar.m4  -> m4sugar
+      # ../lib/autoconf/general.m4 -> autoconf
+      # aclocal.m4 -> ignore
+      next
+       if $file eq 'aclocal.m4';
+      my $set = basename (dirname ($file));
+      die "$me: unknown set: $set: $_\n"
+       unless $set =~ /^(m4sugar|autoconf)$/;
+      if ($domain eq "AC")
+       {
+         $ac_macros{$macro} = $set;
+       }
+      else
+       {
+         $au_macros{$macro} = $set;
+       }
+    }
+  $macros->close
+    or die ($! ? "$me: cannot close definitions reading pipe: $!\n"
+           : "$me: definitions reading pipe failed with exit status: $?\n");
+  # Don't keep AU macros in @AC_MACROS.
+  delete $ac_macros{$_}
+    foreach (keys %au_macros);
+  # Don't keep M4sugar macros which are redefined by Autoconf,
+  # such as `builtin', `changequote' etc.  See autoconf/autoconf.m4.
+  delete $ac_macros{$_}
+    foreach (@m4_builtins);
+  die "$me: no current Autoconf macros found\n"
+    unless keys %ac_macros;
+  die "$me: no obsolete Autoconf macros found\n"
+    unless keys %au_macros;
+
+  if ($debug)
+    {
+      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";
+    }
+
+  # ac.m4 -- autoquoting definitions of the AC macros (M4sugar excluded).
+  # unac.m4 -- undefine the AC macros.
+  my $ac_m4 = new IO::File ">$tmp/ac.m4"
+    or die "$me: cannot create $tmp/ac.m4: $!\n";
+  print $ac_m4 "# ac.m4 -- autoquoting definitions of the AC macros.\n";
+  my $unac_m4 = new IO::File ">$tmp/unac.m4"
+    or die "$me: cannot create $tmp/unac.m4: $!\n";
+  print $unac_m4 "# unac.m4 -- undefine the AC macros.\n";
+  foreach (sort grep { $ac_macros{$_} ne 'm4sugar' } keys %ac_macros)
+    {
+      print $ac_m4   "_au_define([$_], [[\$0(\$\@)]])\n";
+      print $unac_m4 "_au_undefine([$_])\n";
+    }
+  $unac_m4->close
+    or die "$me: cannot close $tmp/unac.m4: $!\n";
+  $ac_m4->close
+    or die "$me: cannot close $tmp/ac.m4: $!\n";
+}
+
+
 ## -------------- ##
 ## Main program.  ##
 ## -------------- ##
@@ -115,80 +250,8 @@ $autoconf .= " --force" if $force;
 $autoconf .= " --verbose" if $verbose;
 
 mktmpdir ('au');
-
-# @M4_BUILTINS -- M4 builtins and a useful comment.
-my @m4_builtins = `echo dumpdef | $m4 2>&1 >/dev/null`;
-map { s/:.*//;s/\W// } @m4_builtins;
-
-
-# m4.m4 -- enable the m4 builtins.
-# unm4.m4 -- disable the m4 builtins.
-# savem4.m4 -- save the m4 builtins.
-open M4_M4, ">$tmp/m4.m4"
-  or die "$me: cannot open $tmp/m4.m4: $!\n";
-open UNM4_M4, ">$tmp/unm4.m4"
-  or die "$me: cannot open $tmp/unm4.m4: $!\n";
-open M4SAVE_M4, ">$tmp/m4save.m4"
-  or die "$me: cannot open $tmp/unm4.m4: $!\n";
-foreach (@m4_builtins)
-  {
-    print M4_M4     "_au_define([$_], _au_defn([_au_$_]))\n";
-    print UNM4_M4   "_au_undefine([$_])\n";
-    print M4SAVE_M4 "define([_au_$_], defn([$_]))\n";
-  }
-close M4SAVE_M4
-  or die "$me: cannot close $tmp/m4save.m4: $!\n";
-close UNM4_M4
-  or die "$me: cannot close $tmp/unm4.m4: $!\n";
-close M4_M4
-  or die "$me: cannot close $tmp/m4.m4: $!\n";
-
-
-# @AU_MACROS & AC_MACROS -- AU and AC macros and yet another useful comment.
-open MACROS, ("$autoconf "
-             . "--trace AU_DEFUN:'AU:\$f:\$1' --trace define:'AC:\$f:\$1' "
-             . "--melt /dev/null |")
-  or die "$me: cannot open definitions reading pipe: $!\n";
-my (%ac_macros, %au_macros);
-while (<MACROS>)
-  {
-    chomp;
-    my ($domain, $file, $macro) = /^(AC|AU):(.*):([^:]*)$/ or next;
-    # ../lib/m4sugar/m4sugar.m4  -> m4sugar
-    # ../lib/autoconf/general.m4 -> autoconf
-    # aclocal.m4 -> ignore
-    next
-      if $file eq 'aclocal.m4';
-    my $set = basename (dirname ($file));
-    die "$me: unknown set: $set: $_\n"
-      unless $set =~ /^(m4sugar|autoconf)$/;
-    if ($domain eq "AC")
-      {
-       $ac_macros{$macro} = $set;
-      }
-    else
-      {
-       $au_macros{$macro} = $set;
-      }
-  }
-close MACROS
-  or die ($! ? "$me: cannot close definitions reading pipe: $!\n"
-         : "$me: definitions reading pipe failed with exit status: $?\n");
-# Don't keep AU macros in @AC_MACROS.
-delete $ac_macros{$_}
-  foreach (keys %au_macros);
-if ($debug)
-  {
-    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";
-  }
-die "$me: no current Autoconf macros found\n"
-  unless keys %ac_macros;
-die "$me: no obsolete Autoconf macros found\n"
-  unless keys %au_macros;
-
+handle_m4_macros;
+handle_autoconf_macros;
 
 # $au_changequote -- enable the quote `[', `]' right before any AU macro.
 my $au_changequote =
@@ -199,23 +262,6 @@ xsystem ("$autoconf --trace AU_DEFUN:'_au_defun(\@<:\@\$1\@:>\@,
 \@<:\@\$2\@:>\@)' --melt /dev/null "
        . ">$tmp/au.m4");
 
-# ac.m4 -- autoquoting definitions of the AC macros (M4sugar excluded).
-# disable.m4 -- undefine the macros of AC and m4sugar.
-open AC_M4, ">$tmp/ac.m4"
-  or die "$me: cannot open: $!\n";
-open DISABLE_M4, ">$tmp/disable.m4"
-  or die "$me: cannot open: $!\n";
-foreach (sort keys %ac_macros)
-  {
-    print AC_M4      "_au_define([$_], [[\$0(\$\@)]])\n"
-      unless $ac_macros{$_} eq 'm4sugar';
-    print DISABLE_M4 "_au_undefine([$_])\n";
-  }
-close DISABLE_M4
-  or die "$me: cannot close $tmp/disable.m4: $!\n";
-close AC_M4
-  or die "$me: cannot close $tmp/ac.m4: $!\n";
-
 
 
 ## ------------------- ##
@@ -239,24 +285,24 @@ foreach my $file (@ARGV)
     # input.m4 -- m4 program to produce the updated file.
     # Load the values, the dispatcher, neutralize m4, and the prepared
     # input file.
-    my $input_m4 = <<EOF;
+    my $input_m4 = <<\EOF;
       divert(-1)                                            -*- Autoconf -*-
       changequote([, ])
 
       # Move all the builtins into the `_au_' pseudo namespace
-      include([$tmp/m4save.m4])
+      include([m4save.m4])
 
       # _au_defun(NAME, BODY)
       # ---------------------
       # Define NAME to BODY, plus AU activation/deactivation.
       _au_define([_au_defun],
-      [_au_define([\$1],
+      [_au_define([$1],
       [_au_enable()dnl
-      \$2[]dnl
+      $2[]dnl
       _au_disable()])])
 
       # Import the definition of the obsolete macros.
-      _au_include([$tmp/au.m4])
+      _au_include([au.m4])
 
 
       ## ------------------------ ##
@@ -281,9 +327,9 @@ foreach my $file (@ARGV)
       _au_changecom([#])
 
       # Enable the m4 builtins, m4sugar and the autoquoting AC macros.
-      _au_include([$tmp/m4.m4])
+      _au_include([m4.m4])
       _au_include([m4sugar/m4sugar.m4])
-      _au_include([$tmp/ac.m4])
+      _au_include([ac.m4])
 
       _au_divert(0)])
 
@@ -304,8 +350,8 @@ foreach my $file (@ARGV)
       _au_define([__au_disable],
       [_au_divert(-1)
       # Disable m4sugar, the AC autoquoting macros, and m4.
-      _au_include([$tmp/disable.m4])
-      _au_include([$tmp/unm4.m4])
+      _au_include([unac.m4])
+      _au_include([unm4.m4])
 
       # Disable special characters.
       _au_changequote()
@@ -327,7 +373,16 @@ foreach my $file (@ARGV)
       ## ------------------------------- ##
       ## Disable, and process the file.  ##
       ## ------------------------------- ##
-      _au_disable()_au_dnl
+      _au_divert(-1)
+      # Disable m4: M4sugar and the AC autoquoting macros are not loaded yet,
+      # hence invoking `_au_disable' is wrong.
+      _au_include([unm4.m4])
+
+      # Disable special characters.
+      _au_changequote()
+      _au_changecom()
+
+      _au_divert(0)_au_dnl
 EOF
 
     $input_m4 =~ s/^      //mg;
@@ -350,7 +405,7 @@ EOF
 
     # Now ask m4 to perform the update.
     xsystem ("$m4"
-            . join (' --include=', '', @include)
+            . join (' --include=', '', @include, $tmp)
             . " $tmp/input.m4 >$tmp/updated");
     update_file ("$tmp/updated",
                 "$file" eq "$tmp/stdin" ? '-' : "$file");
index 3aef1fb1d23c2d6c85a0133ebf62f070ecc09cc0..3199d495f525c3b661418235899c307da3d5e455 100755 (executable)
@@ -78,7 +78,7 @@ Supported PROGRAM values:
     ;;
 
   -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
-    echo "missing 0.3 - GNU automake"
+    echo "missing 0.4 - GNU automake"
     ;;
 
   -*)
@@ -88,6 +88,11 @@ Supported PROGRAM values:
     ;;
 
   aclocal)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
     echo 1>&2 "\
 WARNING: \`$1' is missing on your system.  You should only need it if
          you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
@@ -97,6 +102,11 @@ WARNING: \`$1' is missing on your system.  You should only need it if
     ;;
 
   autoconf)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
     echo 1>&2 "\
 WARNING: \`$1' is missing on your system.  You should only need it if
          you modified \`${configure_ac}'.  You might want to install the
@@ -106,6 +116,11 @@ WARNING: \`$1' is missing on your system.  You should only need it if
     ;;
 
   autoheader)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
     echo 1>&2 "\
 WARNING: \`$1' is missing on your system.  You should only need it if
          you modified \`acconfig.h' or \`${configure_ac}'.  You might want
@@ -125,6 +140,11 @@ WARNING: \`$1' is missing on your system.  You should only need it if
     ;;
 
   automake)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
     echo 1>&2 "\
 WARNING: \`$1' is missing on your system.  You should only need it if
          you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
@@ -135,6 +155,34 @@ WARNING: \`$1' is missing on your system.  You should only need it if
           while read f; do touch "$f"; done
     ;;
 
+  autom4te)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+         system.  You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1Help2man' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    if test -f "$file"; then
+       touch $file
+    else
+       test -z "$file" || exec >$file
+       echo "#! /bin/sh"
+       echo "# Created by GNU Automake missing as a replacement of"
+       echo "#  $ $@"
+       echo "exit 0"
+       chmod +x $file
+       exit 1
+    fi
+    ;;
+
   bison|yacc)
     echo 1>&2 "\
 WARNING: \`$1' is missing on your system.  You should only need it if
@@ -189,6 +237,11 @@ WARNING: \`$1' is missing on your system.  You should only need it if
     ;;
 
   help2man)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
     echo 1>&2 "\
 WARNING: \`$1' is missing on your system.  You should only need it if
         you modified a dependency of a manual page.  You may need the
@@ -209,7 +262,7 @@ WARNING: \`$1' is missing on your system.  You should only need it if
     ;;
 
   makeinfo)
-    if test -z "$run" && (makeinfo --version > /dev/null 2>&1); then
+    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
        # We have makeinfo, but it failed.
        exit 1
     fi