3 # Note: this script must not be used to build MPFR due to the
4 # dependency on perl, but this is OK for "make dist".
6 # Copyright 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
7 # This script is free software; the Free Software Foundation
8 # gives unlimited permission to copy and/or distribute it,
9 # with or without modifications, as long as this notice is preserved.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 getcwd() =~ m,/tools$,
22 or die "Execute $0 from the MPFR source directory\n";
23 chdir '..' or die "$!\n$0: can't change cwd\n";
26 open VERSION, '<', 'VERSION'
27 or die "$!\n$0: can't open VERSION file\n";
28 my $version = do { local $/; <VERSION> };
29 close VERSION or die "$!\n$0: can't close VERSION file\n";
31 my ($mv,$pl,$suf) = $version =~ /^(\d+\.\d+)\.(\d+)(-\S+)?/
32 or die "$0: bad VERSION format\n";
34 open MF, '<', 'src/Makefile.am'
35 or die "$!\n$0: can't open Makefile.am file\n";
38 my $vinfo; # expected -version-info value
41 last if $cur && ! /^\s*(#.*)$/;
42 /^#\s+(\d+\.\d+)\.x\s+(\d+):x:(\d+)/ or next;
43 $2 == ++$cur or die "$0: bad CURRENT ($2)";
44 $3 == 0 || $3 == $age + 1 or die "$0: bad AGE ($3)";
46 $mv eq $1 and $vinfo = "$cur:$pl:$age";
48 /^libmpfr_la_LDFLAGS\s+=.*\s-version-info\s+(\d+:\d+:\d+)\s/
49 or die "$0: missing correct libmpfr_la_LDFLAGS line";
50 close MF or die "$!\n$0: can't close Makefile.am file\n";
51 $suf eq '-dev' || $vinfo eq $1
52 or die "$0: bad -version-info value ($1 instead of $vinfo)\n";
54 open CONFIGURE, '<', 'configure.ac'
55 or die "$!\n$0: can't open configure.ac file\n";
56 my $dllversion = $cur - $age;
60 /^\s*LIBMPFR_LDFLAGS\s*=.*-Wl,--output-def,\.libs\/libmpfr-(\d+)\.dll\.def/
61 and $dllvinconf = $1, last;
63 close CONFIGURE or die "$!\n$0: can't close configure.ac file\n";
64 defined $dllvinconf or die "$0: missing correct LIBMPFR_LDFLAGS line\n";
65 $suf eq '-dev' || $dllversion eq $dllvinconf
66 or die "$0: bad libmpfr.dll-version value (libmpfr-$dllvinconf.dll.def".
67 " instead of libmpfr-$dllversion.dll.def)\n";