summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2017-12-26 16:39:25 +0000
committerSergei Trofimovich <slyfox@gentoo.org>2017-12-26 16:39:56 +0000
commitcdf7f5c37e8a3dfacfbf5fc81a6a2a8ef3b77a9a (patch)
treee3c8033fab8adfe48826f06282e27c1de9a720ba /dev-libs/mpc
parentwww-servers/nginx: Bump to v1.13.8 mainline (diff)
downloadgentoo-cdf7f5c37e8a3dfacfbf5fc81a6a2a8ef3b77a9a.tar.gz
gentoo-cdf7f5c37e8a3dfacfbf5fc81a6a2a8ef3b77a9a.tar.bz2
gentoo-cdf7f5c37e8a3dfacfbf5fc81a6a2a8ef3b77a9a.zip
dev-libs/mpc: fix build failure against mpfr-4.0.0, bug #642300
mprf-4.0.0 introduced new 'mpfr_fmma' symbol that collides with mpc's 'mpfr_fmma' symbol. It's a backport of upstream commit https://scm.gforge.inria.fr/anonscm/gitweb?p=mpc/mpc.git;a=commitdiff;h=36a84f43f326de14db888ba07936cc9621c23f19 ("use mpfr_fmma and mpfr_fmms if provided by mpfr") which does the following to mitigate build failure: - rename local symbol to 'mpc_fmma' to avoid collision - reuse mpfr's symbol if that exists Reported-by: Perfect Gentleman Closes: https://bugs.gentoo.org/642300 Package-Manager: Portage-2.3.19, Repoman-2.3.6
Diffstat (limited to 'dev-libs/mpc')
-rw-r--r--dev-libs/mpc/files/mpc-1.0.3-mpfr-4.0.0.patch85
-rw-r--r--dev-libs/mpc/mpc-1.0.3.ebuild1
2 files changed, 86 insertions, 0 deletions
diff --git a/dev-libs/mpc/files/mpc-1.0.3-mpfr-4.0.0.patch b/dev-libs/mpc/files/mpc-1.0.3-mpfr-4.0.0.patch
new file mode 100644
index 000000000000..7f9f7e2b9743
--- /dev/null
+++ b/dev-libs/mpc/files/mpc-1.0.3-mpfr-4.0.0.patch
@@ -0,0 +1,85 @@
+https://bugs.gentoo.org/642300
+
+From 36a84f43f326de14db888ba07936cc9621c23f19 Mon Sep 17 00:00:00 2001
+From: Paul Zimmermann <Paul.Zimmermann@inria.fr>
+Date: Sun, 10 Jan 2016 23:19:37 +0100
+Subject: [PATCH] use mpfr_fmma and mpfr_fmms if provided by mpfr
+
+---
+ configure.ac | 16 ++++++++++++++++
+ src/mul.c | 15 ++++++++++++---
+ 2 files changed, 28 insertions(+), 3 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index b6fa199..bdb21ff 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -165,6 +165,22 @@ AC_LINK_IFELSE(
+ AC_MSG_ERROR([libmpfr not found or uses a different ABI (including static vs shared).])
+ ])
+
++AC_MSG_CHECKING(for mpfr_fmma)
++LIBS="-lmpfr $LIBS"
++AC_LINK_IFELSE(
++ [AC_LANG_PROGRAM(
++ [[#include "mpfr.h"]],
++ [[mpfr_t x; mpfr_fmma (x, x, x, x, x, 0);]]
++ )],
++ [
++ AC_MSG_RESULT(yes)
++ AC_DEFINE(HAVE_MPFR_FMMA, 1, [mpfr_fmma is present])
++ ],
++ [
++ AC_MSG_RESULT(no)
++ AC_DEFINE(HAVE_MPFR_FMMA, 0, [mpfr_fmma is not present])
++ ])
++
+ # Check for a recent GMP
+ # We only guarantee that with a *functional* and recent enough GMP version,
+ # MPC will compile; we do not guarantee that GMP will compile.
+diff --git a/src/mul.c b/src/mul.c
+index 3c9c0a7..8c4afe4 100644
+--- a/src/mul.c
++++ b/src/mul.c
+@@ -175,8 +175,9 @@ mul_imag (mpc_ptr z, mpc_srcptr x, mpc_srcptr y, mpc_rnd_t rnd)
+ #define MPFR_EXP(x) ((x)->_mpfr_exp)
+ #define MPFR_LIMB_SIZE(x) ((MPFR_PREC (x) - 1) / GMP_NUMB_BITS + 1)
+
++#if HAVE_MPFR_FMMA == 0
+ static int
+-mpfr_fmma (mpfr_ptr z, mpfr_srcptr a, mpfr_srcptr b, mpfr_srcptr c,
++mpc_fmma (mpfr_ptr z, mpfr_srcptr a, mpfr_srcptr b, mpfr_srcptr c,
+ mpfr_srcptr d, int sign, mpfr_rnd_t rnd)
+ {
+ /* Computes z = ab+cd if sign >= 0, or z = ab-cd if sign < 0.
+@@ -359,6 +360,7 @@ mpfr_fmma (mpfr_ptr z, mpfr_srcptr a, mpfr_srcptr b, mpfr_srcptr c,
+ return inex;
+ }
++#endif
+
+
+ int
+ mpc_mul_naive (mpc_ptr z, mpc_srcptr x, mpc_srcptr y, mpc_rnd_t rnd)
+@@ -375,10 +377,17 @@ mpc_mul_naive (mpc_ptr z, mpc_srcptr x, mpc_srcptr y, mpc_rnd_t rnd)
+ else
+ rop [0] = z [0];
+
+- inex = MPC_INEX (mpfr_fmma (mpc_realref (rop), mpc_realref (x), mpc_realref (y), mpc_imagref (x),
+- mpc_imagref (y), -1, MPC_RND_RE (rnd)),
++#if HAVE_MPFR_FMMA
++ inex = MPC_INEX (mpfr_fmms (mpc_realref (rop), mpc_realref (x), mpc_realref (y), mpc_imagref (x),
++ mpc_imagref (y), MPC_RND_RE (rnd)),
+ mpfr_fmma (mpc_imagref (rop), mpc_realref (x), mpc_imagref (y), mpc_imagref (x),
++ mpc_realref (y), MPC_RND_IM (rnd)));
++#else
++ inex = MPC_INEX (mpc_fmma (mpc_realref (rop), mpc_realref (x), mpc_realref (y), mpc_imagref (x),
++ mpc_imagref (y), -1, MPC_RND_RE (rnd)),
++ mpc_fmma (mpc_imagref (rop), mpc_realref (x), mpc_imagref (y), mpc_imagref (x),
+ mpc_realref (y), +1, MPC_RND_IM (rnd)));
++#endif
+
+ mpc_set (z, rop, MPC_RNDNN);
+ if (overlap)
+--
+2.15.1
+
diff --git a/dev-libs/mpc/mpc-1.0.3.ebuild b/dev-libs/mpc/mpc-1.0.3.ebuild
index 198111c0b081..ac5e3396ddd4 100644
--- a/dev-libs/mpc/mpc-1.0.3.ebuild
+++ b/dev-libs/mpc/mpc-1.0.3.ebuild
@@ -19,6 +19,7 @@ DEPEND=">=dev-libs/gmp-4.3.2[${MULTILIB_USEDEP},static-libs?]
RDEPEND="${DEPEND}"
src_prepare() {
+ epatch "${FILESDIR}"/${P}-mpfr-4.0.0.patch
elibtoolize #347317
}