1 1.1 mrg How to compile GNU MPFR with mini-gmp 2 1.1 mrg ===================================== 3 1.1 mrg 4 1.1 mrg To build and test MPFR against mini-gmp: 5 1.1 mrg 6 1.1 mrg ./configure --with-mini-gmp=DIR [other configure options] 7 1.1 mrg make 8 1.1 mrg make check 9 1.1 mrg 10 1.1 mrg where DIR is the directory that contains mini-gmp 11 1.1 mrg (for example .../gmp-6.2.0/mini-gmp). 12 1.1 mrg 13 1.1 mrg "make" will build mini-gmp with the same compiler as for MPFR. 14 1.1 mrg 15 1.1 mrg For "make check", tests that use features not supported by mini-gmp 16 1.1 mrg (mpq_t, mpf_t, and the gmp_*printf functions) are skipped. 17 1.1 mrg 18 1.1 mrg Note: To use this version of the MPFR library, you need to define 19 1.1 mrg the MPFR_USE_MINI_GMP macro before including mpfr.h (alternatively, 20 1.1 mrg you can modify mpfr.h to define this macro at the beginning, though 21 1.1 mrg this is discouraged). And since mini-gmp currently does not provide 22 1.1 mrg random functions, you also need to define the gmp_randstate_t type 23 1.1 mrg with 24 1.1 mrg 25 1.1 mrg typedef long int gmp_randstate_t[1]; 26 1.1 mrg 27 1.1 mrg before including mpfr.h (or you may want to modify mini-gmp.h). 28 1.1 mrg 29 1.1 mrg Remark: The random functions provided by MPFR configured with mini-gmp 30 1.1.1.2 mrg use the standard rand() function, thus one should avoid mini-gmp if one 31 1.1.1.2 mrg needs some really serious random functions. Another consequence is that 32 1.1.1.2 mrg these functions may not be thread-safe. 33 1.1 mrg 34 1.1.1.2 mrg The build with mini-gmp may require ISO C99+ features, such as "long long". 35 1.1.1.2 mrg 36 1.1.1.2 mrg This was tested with revision 39ac9e4 and GMP 6.2.0 on x86_64 GNU/Linux: 37 1.1 mrg ============================================================================ 38 1.1 mrg Testsuite summary for MPFR 4.1.0-dev 39 1.1 mrg ============================================================================ 40 1.1 mrg # TOTAL: 183 41 1.1 mrg # PASS: 172 42 1.1 mrg # SKIP: 11 43 1.1 mrg # XFAIL: 0 44 1.1 mrg # FAIL: 0 45 1.1 mrg # XPASS: 0 46 1.1 mrg # ERROR: 0 47 1.1 mrg ============================================================================ 48 1.1 mrg 49 1.1 mrg How to use mini-gmp with reduced limb size 50 1.1 mrg ========================================== 51 1.1 mrg 52 1.1 mrg Following the idea of Micro-GMP [1], the GMP developers have adapted mini-gmp 53 1.1 mrg so that it can be used with a reduced limb size. For that, you need GMP 6.2.0 54 1.1 mrg (or later) and define the MINI_GMP_LIMB_TYPE macro with the associated base 55 1.1 mrg type, e.g. 56 1.1 mrg 57 1.1 mrg -DMINI_GMP_LIMB_TYPE=char (in practice, 8 bits) 58 1.1 mrg -DMINI_GMP_LIMB_TYPE=short (in practice, 16 bits) 59 1.1 mrg -DMINI_GMP_LIMB_TYPE=int (in practice, 32 bits) 60 1.1 mrg 61 1.1 mrg For example: 62 1.1 mrg 63 1.1 mrg ./configure --with-mini-gmp=DIR CFLAGS="-DMINI_GMP_LIMB_TYPE=int" 64 1.1 mrg 65 1.1.1.2 mrg This was tested with revision 39ac9e4 and GMP 6.2.0 on x86_64 GNU/Linux: 66 1.1 mrg ============================================================================ 67 1.1 mrg Testsuite summary for MPFR 4.1.0-dev 68 1.1 mrg ============================================================================ 69 1.1 mrg # TOTAL: 183 70 1.1 mrg # PASS: 172 71 1.1 mrg # SKIP: 11 72 1.1 mrg # XFAIL: 0 73 1.1 mrg # FAIL: 0 74 1.1 mrg # XPASS: 0 75 1.1 mrg # ERROR: 0 76 1.1 mrg ============================================================================ 77 1.1 mrg 78 1.1 mrg [1] https://members.loria.fr/PZimmermann/talks/microgmp.pdf 79