diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | Makefile.in | 2 | ||||
-rwxr-xr-x | automake.in | 91 | ||||
-rw-r--r-- | m4/Makefile.am | 2 | ||||
-rw-r--r-- | m4/Makefile.in | 2 | ||||
-rw-r--r-- | tests/Makefile.am | 3 | ||||
-rw-r--r-- | tests/Makefile.in | 3 | ||||
-rwxr-xr-x | tests/version4.test | 11 |
9 files changed, 91 insertions, 35 deletions
@@ -1,3 +1,13 @@ +2001-06-08 Tom Tromey <tromey@redhat.com> + + * tests/version4.test: New file. + * automake.in (version_check): New sub. + (handle_options): Use it. + * tests/Makefile.am (AUTOMAKE_OPTIONS): Removed. + (TESTS): Added version4.test. + * m4/Makefile.am (AUTOMAKE_OPTIONS): Removed. + * Makefile.am (AUTOMAKE_OPTIONS): Remove `gnits'. + 2001-06-04 Kevin Dalley <kevind@rahul.net> * lib/am/dejagnu.am (site.exp): Fix typo. diff --git a/Makefile.am b/Makefile.am index 2323573cd..ca9033968 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to create Makefile.in -AUTOMAKE_OPTIONS = gnits 1.4 dist-bzip2 +AUTOMAKE_OPTIONS = 1.4 dist-bzip2 ## We need `.' in SUBDIRS because we want `check' to build `.' before ## tests. diff --git a/Makefile.in b/Makefile.in index 7e904aad0..9f19b74e6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -66,7 +66,7 @@ _am_include = @_am_include@ _am_quote = @_am_quote@ install_sh = @install_sh@ -AUTOMAKE_OPTIONS = gnits 1.4 dist-bzip2 +AUTOMAKE_OPTIONS = 1.4 dist-bzip2 SUBDIRS = . m4 lib tests diff --git a/automake.in b/automake.in index 2a6df3c8e..d7d7feb76 100755 --- a/automake.in +++ b/automake.in @@ -1324,6 +1324,69 @@ sub generate_makefile ################################################################ +# A helper which handles the logic of requiring a version number in +# AUTOMAKE_OPTIONS. Return 1 on error, 0 on success. +sub version_check ($$$$) +{ + my ($rmajor, $rminor, $ralpha, $rfork) = ($1, $2, $3, $4); + + &prog_error ("version is incorrect: $VERSION") + if $VERSION !~ /(\d+)\.(\d+)([a-z]?)-?([A-Za-z0-9]+)?/; + + my ($tmajor, $tminor, $talpha, $tfork) = ($1, $2, $3, $4); + + $rfork ||= ''; + $tfork ||= ''; + + my $rminorminor = 0; + my $tminorminor = 0; + + # Some versions were labelled like `1.4-p3a'. This is the same as + # an alpha release labelled `1.4.3a'. However, a version like + # `1.4g' is the same as `1.4.99g'. Yes, this sucks. Moral: + # always listen to the users. + if ($rfork =~ /p([0-9]+)([a-z]?)/) + { + $rminorminor = $1; + # `1.4a-p3b' never existed. But we'll accept it anyway. + $ralpha = $ralpha || $2 || ''; + $rfork = ''; + } + if ($tfork =~ /p([0-9]+)([a-z]?)/) + { + $tminorminor = $1; + # `1.4a-p3b' never existed. But we'll accept it anyway. + $talpha = $talpha || $2 || ''; + $tfork = ''; + } + + $rminorminor = 99 if $ralpha ne '' && $rminorminor == 0; + $tminorminor = 99 if $talpha ne '' && $tminorminor == 0; + + # 2.0 is better than 1.0. + # 1.2 is better than 1.1. + # 1.2a is better than 1.2. + # If we require 3.4n-foo then we require something + # >= 3.4n, with the `foo' fork identifier. + # The $r* variables are what the user specified. + # The $t* variables denote automake itself. + if ($rmajor > $tmajor + || ($rmajor == $tmajor && $rminor > $tminor) + || ($rminor == $tminor && $rminor == $tminor + && $rminorminor > $tminorminor) + || ($rminor == $tminor && $rminor == $tminor + && $rminorminor == $tminorminor + && $ralpha gt $talpha) + || ($rfork ne '' && $rfork ne $tfork)) + { + &am_line_error ('AUTOMAKE_OPTIONS', + "require version $_, but have $VERSION"); + return 1; + } + + return 0; +} + # Handle AUTOMAKE_OPTIONS variable. Return 1 on error, 0 otherwise. sub handle_options { @@ -1364,32 +1427,10 @@ sub handle_options elsif (/(\d+)\.(\d+)([a-z]?)(-[A-Za-z0-9]+)?/) { # Got a version number. - - my ($rmajor, $rminor, $ralpha, $rfork) = ($1, $2, $3, $4); - - &prog_error ("version is incorrect: $VERSION") - if $VERSION !~ /(\d+)\.(\d+)([a-z]?)(-[A-Za-z0-9]+)?/; - - my ($tmajor, $tminor, $talpha, $tfork) = ($1, $2, $3, $4); - - $rfork ||= ''; - $tfork ||= ''; - - # 2.0 is better than 1.0. - # 1.2 is better than 1.1. - # 1.2a is better than 1.2. - # If we require 3.4n-foo then we require something - # >= 3.4n, with the `foo' fork identifier. - if ($rmajor > $tmajor - || ($rmajor == $tmajor && $rminor > $tminor) - || ($rminor == $tminor && $rminor == $tminor - && $ralpha gt $talpha) - || ($rfork ne '' && $rfork ne $tfork)) - { - &am_line_error ('AUTOMAKE_OPTIONS', - "require version $_, but have $VERSION"); + if (version_check ($1, $2, $3, $4)) + { return 1; - } + } } else { diff --git a/m4/Makefile.am b/m4/Makefile.am index 4c016886b..3825b3e21 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -1,7 +1,5 @@ ## Process this file with automake to create Makefile.in -AUTOMAKE_OPTIONS = gnits - m4datadir = $(datadir)/aclocal m4data_DATA = ccstdc.m4 cond.m4 depend.m4 depout.m4 dmalloc.m4 \ error.m4 gcj.m4 header.m4 init.m4 lex.m4 lispdir.m4 make.m4 \ diff --git a/m4/Makefile.in b/m4/Makefile.in index c69295cdb..40ed2c9d2 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -66,8 +66,6 @@ _am_include = @_am_include@ _am_quote = @_am_quote@ install_sh = @install_sh@ -AUTOMAKE_OPTIONS = gnits - m4datadir = $(datadir)/aclocal m4data_DATA = ccstdc.m4 cond.m4 depend.m4 depout.m4 dmalloc.m4 \ error.m4 gcj.m4 header.m4 init.m4 lex.m4 lispdir.m4 make.m4 \ diff --git a/tests/Makefile.am b/tests/Makefile.am index 96e633b40..ba99fc02b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,7 +1,5 @@ ## Process this file with automake to create Makefile.in -AUTOMAKE_OPTIONS = gnits - XFAIL_TESTS = subdir5.test TESTS = \ @@ -285,6 +283,7 @@ vartar.test \ version.test \ version2.test \ version3.test \ +version4.test \ vpath.test \ vtexi.test \ vtexi2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 4a9574a7a..f88d16ba5 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -66,8 +66,6 @@ _am_include = @_am_include@ _am_quote = @_am_quote@ install_sh = @install_sh@ -AUTOMAKE_OPTIONS = gnits - XFAIL_TESTS = subdir5.test TESTS = \ @@ -351,6 +349,7 @@ vartar.test \ version.test \ version2.test \ version3.test \ +version4.test \ vpath.test \ vtexi.test \ vtexi2.test \ diff --git a/tests/version4.test b/tests/version4.test new file mode 100755 index 000000000..9744b5904 --- /dev/null +++ b/tests/version4.test @@ -0,0 +1,11 @@ +#! /bin/sh + +# Test to make sure we are compatible with the 1.4-p1 series. + +. $srcdir/defs || exit 1 + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = 1.4-p3 +END + +$AUTOMAKE |