From 63a9d9387f27e5842bed5946c5f1381f209d2918 Mon Sep 17 00:00:00 2001 From: Herbert Valerio Riedel Date: Thu, 13 Nov 2014 10:49:43 +0100 Subject: Fix `integer-gmp2` compilation with GMP 4.x (#9281) GMP 4.x didn't provide the `mp_bitcnt_t` typedef yet, so we locally define one if GMP 4.x is detected. --- libraries/integer-gmp2/cbits/wrappers.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libraries/integer-gmp2/cbits/wrappers.c b/libraries/integer-gmp2/cbits/wrappers.c index ecee592317..930f5b8508 100644 --- a/libraries/integer-gmp2/cbits/wrappers.c +++ b/libraries/integer-gmp2/cbits/wrappers.c @@ -14,6 +14,15 @@ #include "HsFFI.h" #include "MachDeps.h" +// GMP 4.x compatibility +#if !defined(__GNU_MP_VERSION) +# error __GNU_MP_VERSION not defined +#elif __GNU_MP_VERSION < 4 +# error need GMP 4.0 or later +#elif __GNU_MP_VERSION < 5 +typedef unsigned long int mp_bitcnt_t; +#endif + #if (GMP_NUMB_BITS) != (GMP_LIMB_BITS) # error GMP_NUMB_BITS != GMP_LIMB_BITS not supported #endif -- cgit v1.2.1