head	1.1;
branch	1.1.1;
access;
symbols
	netbsd-11-0-RC4:1.1.1.5
	netbsd-11-0-RC3:1.1.1.5
	netbsd-11-0-RC2:1.1.1.5
	netbsd-11-0-RC1:1.1.1.5
	perseant-exfatfs-base-20250801:1.1.1.5
	netbsd-11:1.1.1.5.0.4
	netbsd-11-base:1.1.1.5
	netbsd-10-1-RELEASE:1.1.1.4
	mpfr-4-2-1:1.1.1.5
	perseant-exfatfs-base-20240630:1.1.1.5
	perseant-exfatfs:1.1.1.5.0.2
	perseant-exfatfs-base:1.1.1.5
	netbsd-8-3-RELEASE:1.1.1.1
	netbsd-9-4-RELEASE:1.1.1.3
	netbsd-10-0-RELEASE:1.1.1.4
	netbsd-10-0-RC6:1.1.1.4
	netbsd-10-0-RC5:1.1.1.4
	netbsd-10-0-RC4:1.1.1.4
	netbsd-10-0-RC3:1.1.1.4
	netbsd-10-0-RC2:1.1.1.4
	netbsd-10-0-RC1:1.1.1.4
	mpfr-4-2-0:1.1.1.5
	netbsd-10:1.1.1.4.0.6
	netbsd-10-base:1.1.1.4
	netbsd-9-3-RELEASE:1.1.1.3
	cjep_sun2x-base1:1.1.1.4
	cjep_sun2x:1.1.1.4.0.4
	cjep_sun2x-base:1.1.1.4
	cjep_staticlib_x-base1:1.1.1.4
	netbsd-9-2-RELEASE:1.1.1.3
	cjep_staticlib_x:1.1.1.4.0.2
	cjep_staticlib_x-base:1.1.1.4
	netbsd-9-1-RELEASE:1.1.1.3
	mpfr-4-1-0:1.1.1.4
	phil-wifi-20200421:1.1.1.3
	phil-wifi-20200411:1.1.1.3
	is-mlppp:1.1.1.3.0.4
	is-mlppp-base:1.1.1.3
	phil-wifi-20200406:1.1.1.3
	netbsd-8-2-RELEASE:1.1.1.1
	netbsd-9-0-RELEASE:1.1.1.3
	netbsd-9-0-RC2:1.1.1.3
	netbsd-9-0-RC1:1.1.1.3
	phil-wifi-20191119:1.1.1.3
	netbsd-9:1.1.1.3.0.2
	netbsd-9-base:1.1.1.3
	phil-wifi-20190609:1.1.1.3
	netbsd-8-1-RELEASE:1.1.1.1
	netbsd-8-1-RC1:1.1.1.1
	pgoyette-compat-merge-20190127:1.1.1.2.2.1
	pgoyette-compat-20190127:1.1.1.3
	pgoyette-compat-20190118:1.1.1.3
	pgoyette-compat-1226:1.1.1.3
	pgoyette-compat-1126:1.1.1.3
	pgoyette-compat-1020:1.1.1.3
	pgoyette-compat-0930:1.1.1.3
	pgoyette-compat-0906:1.1.1.3
	mpfr-4-0-1:1.1.1.3
	netbsd-7-2-RELEASE:1.1.1.1
	pgoyette-compat-0728:1.1.1.2
	netbsd-8-0-RELEASE:1.1.1.1
	phil-wifi:1.1.1.2.0.4
	phil-wifi-base:1.1.1.2
	pgoyette-compat-0625:1.1.1.2
	netbsd-8-0-RC2:1.1.1.1
	pgoyette-compat-0521:1.1.1.2
	pgoyette-compat-0502:1.1.1.2
	pgoyette-compat-0422:1.1.1.2
	netbsd-8-0-RC1:1.1.1.1
	pgoyette-compat-0415:1.1.1.2
	pgoyette-compat-0407:1.1.1.2
	pgoyette-compat-0330:1.1.1.2
	pgoyette-compat-0322:1.1.1.2
	pgoyette-compat-0315:1.1.1.2
	netbsd-7-1-2-RELEASE:1.1.1.1
	pgoyette-compat:1.1.1.2.0.2
	pgoyette-compat-base:1.1.1.2
	netbsd-7-1-1-RELEASE:1.1.1.1
	matt-nb8-mediatek:1.1.1.1.0.26
	matt-nb8-mediatek-base:1.1.1.1
	mpfr-3-1-5:1.1.1.2
	perseant-stdc-iso10646:1.1.1.1.0.24
	perseant-stdc-iso10646-base:1.1.1.1
	netbsd-8:1.1.1.1.0.22
	netbsd-8-base:1.1.1.1
	prg-localcount2-base3:1.1.1.1
	prg-localcount2-base2:1.1.1.1
	prg-localcount2-base1:1.1.1.1
	prg-localcount2:1.1.1.1.0.20
	prg-localcount2-base:1.1.1.1
	pgoyette-localcount-20170426:1.1.1.1
	bouyer-socketcan-base1:1.1.1.1
	pgoyette-localcount-20170320:1.1.1.1
	netbsd-7-1:1.1.1.1.0.18
	netbsd-7-1-RELEASE:1.1.1.1
	netbsd-7-1-RC2:1.1.1.1
	netbsd-7-nhusb-base-20170116:1.1.1.1
	bouyer-socketcan:1.1.1.1.0.16
	bouyer-socketcan-base:1.1.1.1
	pgoyette-localcount-20170107:1.1.1.1
	netbsd-7-1-RC1:1.1.1.1
	pgoyette-localcount-20161104:1.1.1.1
	netbsd-7-0-2-RELEASE:1.1.1.1
	localcount-20160914:1.1.1.1
	netbsd-7-nhusb:1.1.1.1.0.14
	netbsd-7-nhusb-base:1.1.1.1
	pgoyette-localcount-20160806:1.1.1.1
	pgoyette-localcount-20160726:1.1.1.1
	pgoyette-localcount:1.1.1.1.0.12
	pgoyette-localcount-base:1.1.1.1
	netbsd-7-0-1-RELEASE:1.1.1.1
	netbsd-7-0:1.1.1.1.0.10
	netbsd-7-0-RELEASE:1.1.1.1
	netbsd-7-0-RC3:1.1.1.1
	netbsd-7-0-RC2:1.1.1.1
	netbsd-7-0-RC1:1.1.1.1
	tls-maxphys-base:1.1.1.1
	tls-maxphys:1.1.1.1.0.8
	netbsd-7:1.1.1.1.0.6
	netbsd-7-base:1.1.1.1
	yamt-pagecache:1.1.1.1.0.4
	yamt-pagecache-base9:1.1.1.1
	tls-earlyentropy:1.1.1.1.0.2
	tls-earlyentropy-base:1.1.1.1
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.1.1.1
	riastradh-drm2-base3:1.1.1.1
	mpfr-3-1-2:1.1.1.1
	mpfr:1.1.1;
locks; strict;
comment	@# @;


1.1
date	2013.11.28.12.30.54;	author mrg;	state Exp;
branches
	1.1.1.1;
next	;
commitid	suMNN8knGTUjE2fx;

1.1.1.1
date	2013.11.28.12.30.54;	author mrg;	state Exp;
branches
	1.1.1.1.4.1
	1.1.1.1.8.1;
next	1.1.1.2;
commitid	suMNN8knGTUjE2fx;

1.1.1.2
date	2017.08.17.01.09.25;	author mrg;	state Exp;
branches
	1.1.1.2.2.1
	1.1.1.2.4.1;
next	1.1.1.3;
commitid	byVWLjxDrcX5fv3A;

1.1.1.3
date	2018.09.04.05.02.03;	author mrg;	state Exp;
branches;
next	1.1.1.4;
commitid	aNyHel12V2dWaKQA;

1.1.1.4
date	2020.09.26.07.25.42;	author mrg;	state Exp;
branches;
next	1.1.1.5;
commitid	uDXWuNicgnpBNwpC;

1.1.1.5
date	2023.03.05.22.08.38;	author mrg;	state Exp;
branches;
next	;
commitid	AcBV1jKMu2z25ZfE;

1.1.1.1.4.1
date	2013.11.28.12.30.54;	author yamt;	state dead;
branches;
next	1.1.1.1.4.2;
commitid	nx2BSsHy0NPeAxBx;

1.1.1.1.4.2
date	2014.05.22.14.09.19;	author yamt;	state Exp;
branches;
next	;
commitid	nx2BSsHy0NPeAxBx;

1.1.1.1.8.1
date	2013.11.28.12.30.54;	author tls;	state dead;
branches;
next	1.1.1.1.8.2;
commitid	jTnpym9Qu0o4R1Nx;

1.1.1.1.8.2
date	2014.08.20.00.00.07;	author tls;	state Exp;
branches;
next	;
commitid	jTnpym9Qu0o4R1Nx;

1.1.1.2.2.1
date	2018.09.06.06.53.49;	author pgoyette;	state Exp;
branches;
next	;
commitid	HCi1bXD317XIK0RA;

1.1.1.2.4.1
date	2019.06.10.22.02.32;	author christos;	state Exp;
branches;
next	;
commitid	jtc8rnCzWiEEHGqB;


desc
@@


1.1
log
@Initial revision
@
text
@#!/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, 2011, 2012, 2013 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+)(-\S+)?/
  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+)\s/
  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";

open CONFIGURE, '<', 'configure.ac'
  or die "$!\n$0: can't open configure.ac file\n";
my $dllversion = $cur - $age;
my $dllvinconf;
while (<CONFIGURE>)
  {
    /^\s*LIBMPFR_LDFLAGS\s*=.*-Wl,--output-def,\.libs\/libmpfr-(\d+)\.dll\.def/
      and $dllvinconf = $1, last;
  }
close CONFIGURE or die "$!\n$0: can't close configure.ac file\n";
defined $dllvinconf or die "$0: missing correct LIBMPFR_LDFLAGS line\n";
$suf eq '-dev' || $dllversion eq $dllvinconf
  or die "$0: bad libmpfr.dll-version value (libmpfr-$dllvinconf.dll.def".
  " instead of libmpfr-$dllversion.dll.def)\n";
@


1.1.1.1
log
@initial import of MPFR 3.1.2.  changes since 3.0.1:

- Bug fixes (see <http://www.mpfr.org/mpfr-3.1.1/#fixed> or ChangeLog file).
- Bug fixes (see <http://www.mpfr.org/mpfr-3.1.0/#fixed> or ChangeLog file).
- TLS support is now detected automatically. If TLS is supported, MPFR is
  built as thread safe by default. To disable TLS explicitly, configure
  MPFR with --disable-thread-safe.
- The mpfr_urandom and mpfr_urandomb functions now return identical values
  on processors with different word size (assuming the same random seed, and
  since the GMP random generator does not depend itself on the word size,
  cf http://gmplib.org/list-archives/gmp-devel/2010-September/001642.html).
- The mpfr_add_one_ulp and mpfr_sub_one_ulp macros (which are obsolete and
  no more documented) will be removed in a future release.
- Speed improvement for the mpfr_sqr and mpfr_div functions using Mulders'
  algorithm. As a consequence, other functions using those routines are
  also faster.
- Much faster formatted output (mpfr_printf, etc.) with %Rg and similar.
- New functions mpfr_buildopt_gmpinternals_p, mpfr_buildopt_tune_case,
  mpfr_frexp, mpfr_grandom and mpfr_z_sub.
- New divide-by-zero exception (flag) and associated functions.
- Internal change: the logging mechanism has been improved.
- Bug fixes, in particular a huge inefficiency in mpfr_exp (when the
  target precision is less than MPFR_EXP_THRESHOLD) on hard-to-round
  cases, which can take several minutes.
@
text
@@


1.1.1.2
log
@initial import of MPFR 3.1.5 package.  changes since 3.1.2:

Changes from version 3.1.4 to version 3.1.5:
- C++11 compatibility.
- Bug fixes (see <http://www.mpfr.org/mpfr-3.1.4/#fixed> and ChangeLog file).
- More tests.

Changes from version 3.1.3 to version 3.1.4:
- Improved MPFR manual.
- Bug fixes (see <http://www.mpfr.org/mpfr-3.1.3/#fixed> and ChangeLog file).
- MinGW (MS Windows): Added support for thread-safe DLL (shared library).

Changes from version 3.1.2 to version 3.1.3:
- Better support for Automake 1.13+ (now used to generate the tarball).
- Improved MPFR manual.
- Bug fixes (see <http://www.mpfr.org/mpfr-3.1.2/#fixed> and ChangeLog file).
@
text
@d6 1
a6 1
# Copyright 2010-2016 Free Software Foundation, Inc.
@


1.1.1.2.4.1
log
@Sync with HEAD
@
text
@d6 1
a6 1
# Copyright 2010-2018 Free Software Foundation, Inc.
@


1.1.1.2.2.1
log
@Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
@
text
@d6 1
a6 1
# Copyright 2010-2018 Free Software Foundation, Inc.
@


1.1.1.3
log
@import mpfr 4.0.1.  main changes since 3.1.5 are:

Changes from version 4.0.0 to version 4.0.1:
- Bug fixes (see ChangeLog file), in particular in mpfr_div_ui, which
  could yield an incorrectly rounded result to nearest when using
  different precisions; this bug had been present since the introduction
  of mpfr_div_ui, and in MPFR 4.0.0, it was affecting mpfr_div too.

Changes from versions 3.1.* to version 4.0.0:
- Partial support of MPFR_RNDF (faithful rounding).
- New functions: mpfr_fpif_export and mpfr_fpif_import to export and import
  numbers in a floating-point interchange format, independent both on the
  number of bits per word and on the endianness.
- New function mpfr_fmodquo to return the low bits of the quotient
  corresponding to mpfr_fmod.
- New functions mpfr_flags_clear, mpfr_flags_set, mpfr_flags_test,
  mpfr_flags_save and mpfr_flags_restore to operate on groups of flags.
- New functions mpfr_set_float128 and mpfr_get_float128 to convert from/to
  the __float128 type (requires --enable-float128 and compiler support).
- New functions mpfr_buildopt_float128_p and mpfr_buildopt_sharedcache_p.
- New functions mpfr_rint_roundeven and mpfr_roundeven, completing the
  other similar round-to-integer functions for rounding to nearest with
  the even-rounding rule.
- New macro mpfr_round_nearest_away to add partial emulation of the
  rounding to nearest-away (as defined in IEEE 754-2008).
- New functions mpfr_nrandom and mpfr_erandom to generate random numbers
  following normal and exponential distributions respectively.
- New functions mpfr_fmma and mpfr_fmms to compute a*b+c*d and a*b-c*d.
- New function mpfr_rootn_ui, similar to mpfr_root, but agreeing with the
  rootn function of the IEEE 754-2008 standard.
- New functions mpfr_log_ui to compute the logarithm of an integer,
  mpfr_gamma_inc for the incomplete Gamma function.
- New function mpfr_beta for the Beta function (incomplete, experimental).
- New function mpfr_get_q to convert a floating-point number into rational.
- Dropped K&R C compatibility.
- Major speedup in mpfr_add, mpfr_sub, mpfr_mul, mpfr_div and mpfr_sqrt when
  all operands have the same precision and this precision is less than twice
  the number of bits per word, e.g., less than 128 on a 64-bit computer.
- Speedup by a factor of almost 2 in the double <--> mpfr conversions
  (mpfr_set_d and mpfr_get_d).
- Speedup in mpfr_log1p and mpfr_atanh for small arguments.
- Speedup in the mpfr_const_euler function (contributed by Fredrik Johansson),
  in the computation of Bernoulli numbers (used in mpfr_gamma, mpfr_li2,
  mpfr_digamma, mpfr_lngamma and mpfr_lgamma), in mpfr_div, in mpfr_fma
  and mpfr_fms.
@
text
@d6 1
a6 1
# Copyright 2010-2018 Free Software Foundation, Inc.
@


1.1.1.4
log
@GNU mpfr 4.1.0.  main changes from 4.0:

Changed __float128 to the type _Float128 specified in ISO/IEC TS 18661.
__float128 is used as a fallback if _Float128 is not supported.
New function mpfr_get_str_ndigits about conversion to a string of digits.
New function mpfr_dot for the dot product (incomplete, experimental).
New functions mpfr_get_decimal128 and mpfr_set_decimal128 (available
only when MPFR has been built with decimal float support).
New function mpfr_cmpabs_ui.
New function mpfr_total_order_p for the IEEE 754 totalOrder predicate.
The mpfr_out_str function now accepts bases from -2 to -36, in order to
follow mpfr_get_str and GMP's mpf_out_str functions (these cases gave an
assertion failure, as with other invalid bases).
Shared caches: cleanup; really detect lock failures (abort in this case).
Improved mpfr_add and mpfr_sub when all operands have a precision
equal to twice the number of bits per word, e.g., 128 bits on a 64-bit
platform.
Optimized the tuning parameters for various architectures.
@
text
@d6 1
a6 1
# Copyright 2010-2020 Free Software Foundation, Inc.
d51 2
a52 17

if (defined $vinfo)
  {
    # Check that the -version-info value in the libmpfr_la_LDFLAGS line
    # corresponds to the expected value from the comment ($vinfo).
    $vinfo eq $1
      or die "$0: bad -version-info value ($1 instead of $vinfo)\n";
  }
else
  {
    # If this is a release or a release candidate, make sure that $vinfo
    # is defined. For intermediate versions, this value may not be known
    # yet (for instance, the ABI may be broken some time later), so that
    # defining $vinfo is not required.
    $suf =~ /^(-rc.*)?$/
      and die "$0: missing comment with -version-info value for MPFR $mv.x";
  }
@


1.1.1.5
log
@initial import of MPFR 4.2.0.  changes from 4.1.0 include:

Binary compatible with MPFR 4.0.* and 4.1.*, though some minor changes
in the behavior of the formatted output functions may be visible,
regarded as underspecified behavior or bug fixes (see below).

New functions mpfr_cosu, mpfr_sinu, mpfr_tanu, mpfr_acosu, mpfr_asinu,
mpfr_atanu and mpfr_atan2u.

New functions mpfr_cospi, mpfr_sinpi, mpfr_tanpi, mpfr_acospi,
mpfr_asinpi, mpfr_atanpi and mpfr_atan2pi.

New functions mpfr_log2p1, mpfr_log10p1, mpfr_exp2m1, mpfr_exp10m1 and
mpfr_compound_si.

New functions mpfr_fmod_ui, mpfr_powr, mpfr_pown, mpfr_pow_uj,
mpfr_pow_sj and mpfr_rootn_si (mpfr_pown is actually a macro defined as
an alias for mpfr_pow_sj).

Bug fixes.
- In particular, for the formatted output functions (mpfr_printf, etc.),
the case where the precision consists only of a period has been fixed to
be like .0 as specified in the ISO C standard, and the manual has been
corrected and clarified.
- The macros of the custom interface have also been fixed:
they now behave like functions (except a minor limitation for
mpfr_custom_init_set).
@
text
@d6 1
a6 1
# Copyright 2010-2023 Free Software Foundation, Inc.
@


1.1.1.1.8.1
log
@file ck-version-info was added on branch tls-maxphys on 2014-08-20 00:00:07 +0000
@
text
@d1 67
@


1.1.1.1.8.2
log
@Rebase to HEAD as of a few days ago.
@
text
@a0 67
#!/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, 2011, 2012, 2013 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+)(-\S+)?/
  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+)\s/
  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";

open CONFIGURE, '<', 'configure.ac'
  or die "$!\n$0: can't open configure.ac file\n";
my $dllversion = $cur - $age;
my $dllvinconf;
while (<CONFIGURE>)
  {
    /^\s*LIBMPFR_LDFLAGS\s*=.*-Wl,--output-def,\.libs\/libmpfr-(\d+)\.dll\.def/
      and $dllvinconf = $1, last;
  }
close CONFIGURE or die "$!\n$0: can't close configure.ac file\n";
defined $dllvinconf or die "$0: missing correct LIBMPFR_LDFLAGS line\n";
$suf eq '-dev' || $dllversion eq $dllvinconf
  or die "$0: bad libmpfr.dll-version value (libmpfr-$dllvinconf.dll.def".
  " instead of libmpfr-$dllversion.dll.def)\n";
@


1.1.1.1.4.1
log
@file ck-version-info was added on branch yamt-pagecache on 2014-05-22 14:09:19 +0000
@
text
@d1 67
@


1.1.1.1.4.2
log
@sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")
@
text
@a0 67
#!/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, 2011, 2012, 2013 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+)(-\S+)?/
  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+)\s/
  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";

open CONFIGURE, '<', 'configure.ac'
  or die "$!\n$0: can't open configure.ac file\n";
my $dllversion = $cur - $age;
my $dllvinconf;
while (<CONFIGURE>)
  {
    /^\s*LIBMPFR_LDFLAGS\s*=.*-Wl,--output-def,\.libs\/libmpfr-(\d+)\.dll\.def/
      and $dllvinconf = $1, last;
  }
close CONFIGURE or die "$!\n$0: can't close configure.ac file\n";
defined $dllvinconf or die "$0: missing correct LIBMPFR_LDFLAGS line\n";
$suf eq '-dev' || $dllversion eq $dllvinconf
  or die "$0: bad libmpfr.dll-version value (libmpfr-$dllvinconf.dll.def".
  " instead of libmpfr-$dllversion.dll.def)\n";
@
