From: Akim Demaille Date: Wed, 5 Sep 2001 07:04:02 +0000 (+0000) Subject: CVS GNU M4 doesn't like `undefine(undefined)'. X-Git-Tag: AUTOCONF-2.52f~172 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d55f8a44728f38d5d1cb97c117c38f7b1fe09c7;p=thirdparty%2Fautoconf.git 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'. --- diff --git a/ChangeLog b/ChangeLog index a2ff8e63d..dba605d10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2001-09-05 Akim Demaille + + 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 Version 2.52d. diff --git a/NEWS b/NEWS index 3a01155d5..989cb46a7 100644 --- 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 diff --git a/bin/autoupdate.in b/bin/autoupdate.in index b2e9d2f2c..7b60f7b06 100644 --- a/bin/autoupdate.in +++ b/bin/autoupdate.in @@ -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 () - { - 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 = <$tmp/updated"); update_file ("$tmp/updated", "$file" eq "$tmp/stdin" ? '-' : "$file"); diff --git a/config/missing b/config/missing index 3aef1fb1d..3199d495f 100755 --- a/config/missing +++ b/config/missing @@ -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