gmp.h needs to detect bit width more dynamically to support universal builds on mac
Niels Möller
nisse at lysator.liu.se
Tue Dec 3 13:04:59 UTC 2013
Dan Kegel <dank at kegel.com> writes:
> The fix is easy. Here's a patch that should Do The Right Thing, and
> be completely safe for upstream:
> http://kegel.com/gmp-universal-h.patch
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 config.h.in something like
#if @GMP_USE_ALT_SIZES@
#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__
GMP_ALT_LIMB_BITS 64
GMP_ALT_NAIL_BITS 0
GMP_LIMB_BITS 32
GMP_NAIL_BITS 0
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
http://git.lysator.liu.se/nettle/nettle/blobs/master/configure.ac#line170),
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