Zimmermann Paul Paul.Zimmermann at
Wed Jan 15 21:31:18 UTC 2014


I tried to compile MPFR with mini-gmp. I needed to do a few changes:

Changes in mini-gmp.c:

1) I had to add #define mpz_init __gmpz_init, because in MPFR
   configure we check for __gmpz_init

2) I had to add a line:
   unsigned int mp_bits_per_limb = GMP_NUMB_BITS;

3) I had to change "static void" to "void" for gmp_default_alloc,
   gmp_default_realloc and gmp_default_free since we use them in MPFR

Changes in mini-gmp.h: I had to add the following:

> #define __GNU_MP_VERSION            5
> #define __GNU_MP_VERSION_MINOR      1
> #define __gmp_const const
> #define __GMP_DECLSPEC
> #define GMP_NUMB_BITS 64
> extern unsigned int mp_bits_per_limb;
> #define __gmp_allocate_func gmp_default_alloc
> void *gmp_default_alloc (size_t size);
> #define __gmp_reallocate_func gmp_default_realloc
> void *gmp_default_realloc (void *old, size_t old_size, size_t new_size);
> #define __gmp_free_func gmp_default_free
> void gmp_default_free(void *p, size_t size);

With those few additions, and some changes on the MPFR side (mainly to not
compile all functions involving mpf_*, mpq_*, or gmp_randstate_t) I was able
to compile libmpfr.a. Now trying the test files...

It would be great if those changes could be made upstream.


More information about the gmp-devel mailing list