# otherwise it will think rules like `foo=bar; \' are errors.
my $MACRO_PATTERN = '^ *([A-Za-z0-9_@]+)[ \t]*([:+]?)=[ \t]*(.*)$';
my $BOGUS_MACRO_PATTERN = '^ *([^ \t]*)[ \t]*([:+]?)=[ \t]*(.*)$';
-my $GNITS_VERSION_PATTERN = '[0-9]+\.[0-9]+([a-z]|\.[0-9]+)?';
+# This pattern recognizes a Gnits version id and sets $1 if the
+# release is an alpha release. We also allow a suffix which can be
+# used to extend the version number with a "fork" identifier.
+my $GNITS_VERSION_PATTERN = '[0-9]+\.[0-9]+([a-z]|\.[0-9]+)?(-[A-Za-z0-9]+)?';
my $IF_PATTERN = '^if[ \t]+([A-Za-z][A-Za-z0-9_]*)[ \t]*(#.*)?$';
my $ELSE_PATTERN = '^else(?:[ \t]+([A-Za-z][A-Za-z0-9_]*))?[ \t]*(#.*)?$';
my $ENDIF_PATTERN = '^endif(?:[ \t]+([A-Za-z][A-Za-z0-9_]*))?[ \t]*(#.*)?$';
{
$use_dependencies = 0;
}
- elsif (/([0-9]+)\.([0-9]+)([a-z]?)/)
+ elsif (/([0-9]+)\.([0-9]+)([a-z]?)(-[A-Za-z0-9]+)?/)
{
# Got a version number.
- my ($rmajor, $rminor, $ralpha) = ($1, $2, $3);
+ my ($rmajor, $rminor, $ralpha, $rfork) = ($1, $2, $3, $4);
&prog_error ("version is incorrect: $VERSION")
- if $VERSION !~ /([0-9]+)\.([0-9]+)([a-z]?)/;
+ if $VERSION !~ /([0-9]+)\.([0-9]+)([a-z]?)(-[A-Za-z0-9]+)?/;
- my ($tmajor, $tminor, $talpha) = ($1, $2, $3);
+ 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))
- {
+ && $ralpha gt $talpha)
+ || ($rfork ne '' && $rfork ne $tfork))
+ {
&am_line_error ('AUTOMAKE_OPTIONS',
- "require version $_, only have $VERSION");
+ "require version $_, but have $VERSION");
return 1;
- }
+ }
}
else
{