Fix `integer-gmp2` compilation with GMP 4.x (#9281)
authorHerbert Valerio Riedel <hvr@gnu.org>
Thu, 13 Nov 2014 09:49:43 +0000 (10:49 +0100)
committerHerbert Valerio Riedel <hvr@gnu.org>
Thu, 13 Nov 2014 09:49:43 +0000 (10:49 +0100)
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

index ecee592..930f5b8 100644 (file)
 #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