gmp.h needs to detect bit width more dynamically to support universal builds on mac

Dan Kegel dank at
Tue Dec 3 14:37:05 UTC 2013

Thanks.  Might be worth adding a note to

I hadn't been running "make check", but I'll start.
Can you confirm the kludge should work at least for the --without-nails case?
- Dan

On Tue, Dec 3, 2013 at 5:04 AM, Niels Möller <nisse at> wrote:
> Dan Kegel <dank at> writes:
>> The fix is easy.  Here's a patch that should Do The Right Thing, and
>> be completely safe for upstream:
> I'm pretty sure it totally breaks builds with --enable-nails, a feature
> currently not enabled by default, but which we'd like to be able to play
> with.
> I think a better way is to have in something like
> #define GMP_LIMB_BITS                      @GMP_ALT_LIMB_BITS@
> #define GMP_NAIL_BITS                      @GMP_ALT_NAIL_BITS@
> #else
> #define GMP_LIMB_BITS                      @GMP_LIMB_BITS@
> #define GMP_NAIL_BITS                      @GMP_NAIL_BITS@
> #endif
> where configure defines a non-zero GMP_USE_ALT_SIZES only for configurations where
> multiple ABI:s with different limb sizes are available. Maybe some other
> values, e.g., LONGLONG_LIMB, also needs alternative values.
> In your case, you'd have configure define
>   GMP_USE_ALT_SIZES __x86_64__
> It's a known problem, and solving it is not beneficial just for MacOS.
> E.g., it would be nice to be able to install both 32-bit and 64-bit gmp
> in parallel on, e.g., gnu/linux x86_64, with libraries in different
> directories, say /usr/lib and /use/lib32, but sharing the same
> $prefix/include/gmp.h. In this case, it would be nice to automagically
> chose default $libdir depending on the ABI (I try do that in Nettle's
> configure script, see
> but it's a bit messy).
> Regards,
> /Niels
> --
> Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
> Internet email is subject to wholesale government surveillance.

More information about the gmp-bugs mailing list