summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2010-08-17 12:45:22 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2010-08-17 12:45:22 +0000
commit06499bb95c98e277cf06990c39a9d8cd230a0771 (patch)
tree8718f17c1763599ccbcac81a50834bff160ab40c /tools
parent43d8270c29cbdb7c1decfc6b37914a3455041fa9 (diff)
downloadmpfr-06499bb95c98e277cf06990c39a9d8cd230a0771.tar.gz
Added tools/ck-version-info Perl script with the same license as
Makefile.am, to check consistency concerning -version-info and that the -version-info value is up-to-date. Updated Makefile.am: * In dist-hook, replaced complex sh code by a call to ck-version-info. * Distribute ck-version-info (EXTRA_DIST). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@7091 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tools')
-rwxr-xr-xtools/ck-version-info52
1 files changed, 52 insertions, 0 deletions
diff --git a/tools/ck-version-info b/tools/ck-version-info
new file mode 100755
index 000000000..164f30c97
--- /dev/null
+++ b/tools/ck-version-info
@@ -0,0 +1,52 @@
+#!/usr/bin/env perl
+
+# Note: this script must not be used to build MPFR due to the
+# dependency on perl, but this is OK for "make dist".
+
+# Copyright 2010 Free Software Foundation, Inc.
+# This script is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+use strict;
+use Cwd;
+
+if (! -d 'src')
+ {
+ getcwd() =~ m,/tools$,
+ or die "Execute $0 from the MPFR source directory\n";
+ chdir '..' or die "$!\n$0: can't change cwd\n";
+ }
+
+open VERSION, '<', 'VERSION'
+ or die "$!\n$0: can't open VERSION file\n";
+my $version = do { local $/; <VERSION> };
+close VERSION or die "$!\n$0: can't close VERSION file\n";
+
+my ($mv,$pl,$suf) = $version =~ /^(\d+\.\d+)\.(\d+)(-.*)?$/
+ or die "$0: bad VERSION format\n";
+
+open MF, '<', 'src/Makefile.am'
+ or die "$!\n$0: can't open Makefile.am file\n";
+my $cur = 0;
+my $age = -1;
+my $vinfo; # expected -version-info value
+while (<MF>)
+ {
+ last if $cur && ! /^\s*(#.*)$/;
+ /^#\s+(\d+\.\d+)\.x\s+(\d+):x:(\d+)/ or next;
+ $2 == ++$cur or die "$0: bad CURRENT ($2)";
+ $3 == 0 || $3 == $age + 1 or die "$0: bad AGE ($3)";
+ $age = $3;
+ $mv eq $1 and $vinfo = "$cur:$pl:$age";
+ }
+/^libmpfr_la_LDFLAGS\s+=\s+-version-info\s+(\d+:\d+:\d+)$/
+ or die "$0: missing correct libmpfr_la_LDFLAGS line";
+close MF or die "$!\n$0: can't close Makefile.am file\n";
+$suf eq '-dev' || $vinfo eq $1
+ or die "$0: bad -version-info value ($1 instead of $vinfo)\n";