+sub get_tool_versions ($$)
+{
+ my ($bootstrap_tools, $gnulib_snapshot_timestamp) = @_;
+ defined $bootstrap_tools
+ or return ();
+
+ defined $gnulib_snapshot_timestamp
+ or $gnulib_snapshot_timestamp = strftime '%Y-%m-%d %T UTC', gmtime;
+
+ my $fail;
+ my @tool_list = split ',', $bootstrap_tools;
+ my @tool_version_pair;
+ foreach my $t (@tool_list)
+ {
+ if ($t eq 'gnulib')
+ {
+ push @tool_version_pair,
+ "CVS Gnulib sources from $gnulib_snapshot_timestamp";
+ next;
+ }
+ # Assume that the last "word" on the first line of
+ # `tool --version` output is the version string.
+ my ($first_line, undef) = split ("\n", `$t --version`);
+ if ($first_line =~ /.* (\d[\w.-]+)$/)
+ {
+ $t = ucfirst $t;
+ push @tool_version_pair, "$t $1";
+ }
+ else
+ {
+ defined $first_line
+ and $first_line = '';
+ warn "$ME: $t: unexpected --version output\n:$first_line";
+ $fail = 1;
+ }
+ }
+
+ $fail
+ and exit 1;
+
+ return @tool_version_pair;
+}
+