From 590db905986fd350cc90fab511244b0a79358066 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 12 Sep 1996 05:28:40 +0000 Subject: [PATCH] rewrote version handling. handle := macros --- ChangeLog | 5 +++++ TODO | 6 ------ automake.in | 50 +++++++++++++++++++++++++++++++---------------- tests/ChangeLog | 2 ++ tests/Makefile.am | 2 +- tests/Makefile.in | 2 +- tests/colneq.test | 12 ++++++++++++ 7 files changed, 54 insertions(+), 25 deletions(-) create mode 100755 tests/colneq.test diff --git a/ChangeLog b/ChangeLog index bee954ea..93172ba1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ Wed Sep 11 11:54:44 1996 Tom Tromey + * automake.in (handle_options): Rewrote version handling. Now + returns error indicator. + (MACRO_PATTERN, BOGUS_MACRO_PATTERN): Handle `:=' definitions. + (RULE_PATTERN): Exclude `:=' from being a rule. + * m4/AM_PROG_CC_STDC.m4 (ac_save_CC): Bug fix from Jim Meyering. * automake.in (variable_value_as_list): Always use am_line_error. diff --git a/TODO b/TODO index fb88b3ab..a6c53533 100644 --- a/TODO +++ b/TODO @@ -4,9 +4,6 @@ Priorities for release: must at least partially rewrite dist system (to handle distributing info files, which is currently somewhat broken). -when checking version numbers in AUTOMAKE_OPTIONS, an alpha release -should compare less than the full release; eg "1.0" < "1.0a" < "1.1". - Per Bothner says: Per> 1) Being able to build a set of non-source programs Per> from source porgrams, without necessarily linking them together. @@ -37,7 +34,6 @@ Per> .class files from a list of .java source files. * patch from Joel Weber about fixing yacc; in particular generating .h file -!! remove autosystem-specific macros !! should write autoconf-style doc entries for each m4 macro [ this should really go into autoconf in some automatic way ] @@ -55,8 +51,6 @@ fixing configure target name (no $srcdir) * must update GNU Hello -** when can aclocal.m4 be auto-generated? - ** many requests for a way to omit a file from the distribution. Should be done like `!foo' or `~foo' in _SOURCES, etc. Such files should be removed explicitly after the copy step! diff --git a/automake.in b/automake.in index 61b8b9ba..e0407ec7 100755 --- a/automake.in +++ b/automake.in @@ -38,9 +38,9 @@ $am_dir = "@datadir@/@PACKAGE@"; $IGNORE_PATTERN = "^##([^#].*)?\$"; $WHITE_PATTERN = "^[ \t]*\$"; $COMMENT_PATTERN = "^#"; -$RULE_PATTERN = "^([\$a-zA-Z_.][-.a-zA-Z0-9_(){}/]*) *:"; -$MACRO_PATTERN = "^([A-Za-z][A-Za-z0-9_]*)[ \t]*=[ \t]*(.*)\$"; -$BOGUS_MACRO_PATTERN = "^([^ \t]*)[ \t]*=[ \t]*(.*)\$"; +$RULE_PATTERN = "^([\$a-zA-Z_.][-.a-zA-Z0-9_(){}/]*) *:([^=].*|)\$"; +$MACRO_PATTERN = "^([A-Za-z][A-Za-z0-9_]*)[ \t]*:?=[ \t]*(.*)\$"; +$BOGUS_MACRO_PATTERN = "^([^ \t]*)[ \t]*:?=[ \t]*(.*)\$"; $GNITS_VERSION_PATTERN = "[0-9]+\\.[0-9]+([a-z]|\\.[0-9]+)?"; # Constants to define the "strictness" level. @@ -421,7 +421,11 @@ sub generate_makefile push (@phony, 'default'); &read_am_file ($makefile . '.am'); - &handle_options; + if (&handle_options) + { + # Fatal error. Just return, so we can continue with next file. + return; + } # Check first, because we might modify some state. &check_gnu_standards; @@ -492,10 +496,10 @@ sub generate_makefile ################################################################ -# Handle AUTOMAKE_OPTIONS variable. +# Handle AUTOMAKE_OPTIONS variable. Return 1 on error, 0 otherwise. sub handle_options { - return if ! &variable_defined ('AUTOMAKE_OPTIONS'); + return 0 if ! &variable_defined ('AUTOMAKE_OPTIONS'); foreach (&variable_value_as_list ('AUTOMAKE_OPTIONS')) { @@ -523,16 +527,28 @@ sub handle_options { $use_dependencies = 0; } - elsif (/[0-9]+\.?[0-9]+/) + elsif (/([0-9]+)\.([0-9]+)/) { - # Got a version number. Is the syntax too strict? - local ($num_version); - ($num_version = $VERSION) =~ tr/0-9//cd; - if ($num_version < $_) + # Got a version number. Note that alpha releases count as + # the next higher release. Note also that we assume there + # will be a maximum of 100 minor releases for any given + # major release. + local ($rmajor, $rminor) = ($1, $2); + if ($VERSION !~ /([0-9]+)\.([0-9]+)([a-z])?/) + { + print STDERR + "automake: programming error: version is incorrect\n"; + exit 1; + } + local ($tmajor, $tminor) = ($1, $2); + # Handle alpha versions. + ++$tminor if defined $3; + + if ($rmajor > $tmajor || ($rmajor == $tmajor && $rminor > $tminor)) { &am_line_error ('AUTOMAKE_OPTIONS', "require version $_, only have $VERSION"); - exit 1; + return 1; } } else @@ -541,6 +557,8 @@ sub handle_options 'option ', $_, 'not recognized'); } } + + return 0; } # Return object extension. Just once, put some code into the output. @@ -1909,12 +1927,10 @@ sub handle_aclocal_m4 $regen_aclocal = 1; $acinclude = 1; } - else - { - # FIXME: how to tell if aclocal.m4 should be automatically - # regenerated? - } + # Note that it might be possible that aclocal.m4 doesn't exist but + # should be auto-generated. This case probably isn't very + # important. if ($regen_aclocal) { $output_rules .= ("aclocal.m4: " diff --git a/tests/ChangeLog b/tests/ChangeLog index 9bdff5b8..59a6539b 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,5 +1,7 @@ Wed Sep 11 13:57:10 1996 Tom Tromey + * colneq.test: New file. + * interp2.test: New file. Sun Sep 8 10:47:07 1996 Tom Tromey diff --git a/tests/Makefile.am b/tests/Makefile.am index fcc7c82c..d22533e9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -14,6 +14,6 @@ error.test colon.test vtexi2.test tags.test comment.test libfiles.test \ man.test info.test obsolete.test lex.test scripts.test subdir2.test \ exsource.test canon4.test dup.test defun.test cxxlink.test cxxnoc.test \ order.test libobj2.test interp.test alllib.test block.test libobj3.test \ -gnits.test interp2.test +gnits.test interp2.test colneq.test EXTRA_DIST = defs $(TESTS) diff --git a/tests/Makefile.in b/tests/Makefile.in index e803aa54..613a3074 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -52,7 +52,7 @@ error.test colon.test vtexi2.test tags.test comment.test libfiles.test \ man.test info.test obsolete.test lex.test scripts.test subdir2.test \ exsource.test canon4.test dup.test defun.test cxxlink.test cxxnoc.test \ order.test libobj2.test interp.test alllib.test block.test libobj3.test \ -gnits.test interp2.test +gnits.test interp2.test colneq.test EXTRA_DIST = defs $(TESTS) mkinstalldirs = $(top_srcdir)/mkinstalldirs diff --git a/tests/colneq.test b/tests/colneq.test new file mode 100755 index 00000000..e3db4947 --- /dev/null +++ b/tests/colneq.test @@ -0,0 +1,12 @@ +#! /bin/sh + +# Test that := definitions work. + +. $srcdir/defs || exit 1 + +cat > Makefile.am << 'END' +ICONS := $(wildcard *.xbm) +data_DATA = $(ICONS) +END + +$AUTOMAKE -- 2.43.5