blob: 1a98996d916316e8a63bd905eedc61e842b0dead (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
How to compile GNU MPFR with mini-gmp
=====================================
(this was tested with MPFR 3.1.2 and GMP 5.1.3 on x86_64 GNU/Linux machine)
(also with MPFR svn 9700 and GMP 6.1.0-rc1: some GMP functions are missing)
1) extract the GMP tarball in say /tmp/gmp-5.1.3
go into /tmp/gmp-5.1.3/mini-gmp
add the following line in mini-gmp.c (say at line 43):
char gmp_version[] = "5.1.3";
gcc -O2 -g -fPIC -c mini-gmp.c
ar r libgmp.a mini-gmp.o
2) create a GMP install directory in say /tmp
mkdir /tmp/include
mkdir /tmp/lib
mv libgmp.a /tmp/lib
cp mini-gmp.h /tmp/include/gmp.h
3) do the following changes in /tmp/include/gmp.h:
$ diff gmp.h.orig gmp.h
29a30,35
> #define __GNU_MP_VERSION 5
> #define __GNU_MP_VERSION_MINOR 1
> #define __GNU_MP_VERSION_PATCHLEVEL 3
>
> extern char gmp_version[];
>
34a41,46
> #endif
>
> /* random generation functions */
> #ifndef gmp_randstate_t
> typedef long int __gmp_randstate_struct;
> typedef __gmp_randstate_struct gmp_randstate_t[1];
You also need to define GMP_NUMB_BITS and GMP_NAIL_BITS, for example:
#define GMP_NUMB_BITS 64
#define GMP_NAIL_BITS 0
4) extract the MPFR tarball in say /tmp/mpfr-3.1.2
./configure --with-gmp=/tmp --enable-mini-gmp
Note: to use this version of the MPFR library, you need to define
the MPFR_USE_MINI_GMP macro before including mpfr.h (alternatively,
you can modify mpfr.h to define this macro at the beginning).
|