From: Tom Tromey Date: Sat, 9 Jun 2001 00:34:28 +0000 (+0000) Subject: * tests/version4.test: New file. X-Git-Tag: Release-1-4h~36 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=e094694e6d2a07ecbfa8d4e407013da65e08e741;p=automake.git * 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'. --- diff --git a/ChangeLog b/ChangeLog index 9ceb31d4..15d1bb60 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2001-06-08 Tom Tromey + + * 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 * lib/am/dejagnu.am (site.exp): Fix typo. diff --git a/Makefile.am b/Makefile.am index 2323573c..ca903396 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 7e904aad..9f19b74e 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 2a6df3c8..d7d7feb7 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 4c016886..3825b3e2 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 c69295cd..40ed2c9d 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 96e633b4..ba99fc02 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 4a9574a7..f88d16ba 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 00000000..9744b590 --- /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