summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2014-11-13 10:49:43 +0100
committerHerbert Valerio Riedel <hvr@gnu.org>2014-11-13 10:49:43 +0100
commit63a9d9387f27e5842bed5946c5f1381f209d2918 (patch)
tree7643ae2434688125ee0b2920d2846cc68049b10a /libraries
parent212a350547e950cc5be465a3d76e346ef14bf2ab (diff)
downloadhaskell-63a9d9387f27e5842bed5946c5f1381f209d2918.tar.gz
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.
Diffstat (limited to 'libraries')
-rw-r--r--libraries/integer-gmp2/cbits/wrappers.c9
1 files changed, 9 insertions, 0 deletions
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