From 08f2af33a1a724eddd3be66da5d4989cfc8d764cb481284a2826a5b1b1f613d6 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 2 Jan 2018 13:06:58 +0000 Subject: [PATCH] - Add mpc-1.0.3-addsubulp.diff and mpc-1.0.3-fmma.diff to fix build with mpfr 4.0.0. OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/mpc?expand=0&rev=35 --- mpc-1.0.3-addsubulp.diff | 25 +++++++++++++ mpc-1.0.3-fmma.diff | 76 ++++++++++++++++++++++++++++++++++++++++ mpc.changes | 6 ++++ mpc.spec | 6 +++- 4 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 mpc-1.0.3-addsubulp.diff create mode 100644 mpc-1.0.3-fmma.diff diff --git a/mpc-1.0.3-addsubulp.diff b/mpc-1.0.3-addsubulp.diff new file mode 100644 index 0000000..9efb9c9 --- /dev/null +++ b/mpc-1.0.3-addsubulp.diff @@ -0,0 +1,25 @@ +From: Paul Zimmermann +Date: Wed, 4 Oct 2017 20:09:40 +0000 (+0200) +Subject: replace obsolete mpfr_add_one_ulp/mpfr_sub_one_ulp functions +X-Git-Url: https://scm.gforge.inria.fr/anonscm/gitweb?p=mpc%2Fmpc.git;a=commitdiff_plain;h=5eaa17651b759c7856a118835802fecbebcf46ad + +replace obsolete mpfr_add_one_ulp/mpfr_sub_one_ulp functions +--- + +Index: mpc-1.0.3/src/mpc-impl.h +=================================================================== +--- mpc-1.0.3.orig/src/mpc-impl.h 2018-01-02 14:04:02.075989843 +0100 ++++ mpc-1.0.3/src/mpc-impl.h 2018-01-02 14:05:02.712974966 +0100 +@@ -60,8 +60,10 @@ along with this program. If not, see htt + mpfr_setsign (x, y, 0, rnd) : \ + mpfr_copysign (x, y, z, rnd)) + /* work around spurious signs in nan */ +-#define MPFR_ADD_ONE_ULP(x) mpfr_add_one_ulp (x, GMP_RNDN) +-#define MPFR_SUB_ONE_ULP(x) mpfr_sub_one_ulp (x, GMP_RNDN) ++#define MPFR_ADD_ONE_ULP(x) \ ++ (mpfr_sgn (x) > 0 ? mpfr_nextabove (x) : mpfr_nextbelow (x)) ++#define MPFR_SUB_ONE_ULP(x) \ ++ (mpfr_sgn (x) > 0 ? mpfr_nextbelow (x) : mpfr_nextabove (x)) + /* drop unused rounding mode from macroes */ + #define MPFR_SWAP(a,b) do { mpfr_srcptr tmp; tmp = a; a = b; b = tmp; } while (0) + diff --git a/mpc-1.0.3-fmma.diff b/mpc-1.0.3-fmma.diff new file mode 100644 index 0000000..54b289d --- /dev/null +++ b/mpc-1.0.3-fmma.diff @@ -0,0 +1,76 @@ +From 36a84f43f326de14db888ba07936cc9621c23f19 Mon Sep 17 00:00:00 2001 +From: Paul Zimmermann +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. +--- mpc-1.0.3/src/mul.c.orig 2015-02-16 13:37:30.000000000 +0100 ++++ mpc-1.0.3/src/mul.c 2018-01-02 13:54:34.030414144 +0100 +@@ -171,8 +171,9 @@ + } + + ++#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. +@@ -319,6 +320,7 @@ + + return inex; + } ++#endif + + + int +@@ -337,10 +339,17 @@ + else + rop [0] = z [0]; + ++#if HAVE_MPFR_FMMA + 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)), + mpfr_fmma (mpc_imagref (rop), mpc_realref (x), mpc_imagref (y), mpc_imagref (x), + mpc_realref (y), +1, 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) diff --git a/mpc.changes b/mpc.changes index 6652938..643ea6a 100644 --- a/mpc.changes +++ b/mpc.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Jan 2 13:06:25 UTC 2018 - rguenther@suse.com + +- Add mpc-1.0.3-addsubulp.diff and mpc-1.0.3-fmma.diff to fix build + with mpfr 4.0.0. + ------------------------------------------------------------------- Tue Nov 17 21:09:56 UTC 2015 - mpluskal@suse.com diff --git a/mpc.spec b/mpc.spec index b06d02b..968c372 100644 --- a/mpc.spec +++ b/mpc.spec @@ -1,7 +1,7 @@ # # spec file for package mpc # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -27,6 +27,8 @@ Source0: http://www.multiprecision.org/mpc/download/mpc-%{version}.tar.gz Source1: http://www.multiprecision.org/mpc/download/mpc-%{version}.tar.gz.sig Source2: %{name}.keyring Source3: baselibs.conf +Patch1: mpc-1.0.3-fmma.diff +Patch2: mpc-1.0.3-addsubulp.diff BuildRequires: gmp-devel BuildRequires: mpfr-devel Requires(post): %{install_info_prereq} @@ -60,6 +62,8 @@ MPC multiple-precision complex library development files. %prep %setup -q +%patch1 -p1 +%patch2 -p1 %build %configure