|
1 | | -SAGE_SPKG_CONFIGURE([gmp], [ |
2 | | - sage_spkg_install_gmp=no |
| 1 | +SAGE_SPKG_CONFIGURE([gmp], [dnl |
| 2 | + sage_spkg_install_gmp=no |
3 | 3 | AC_CHECK_HEADER(gmp.h, [], [sage_spkg_install_gmp=yes]) |
4 | 4 | AC_CHECK_HEADER(gmpxx.h, [], [sage_spkg_install_gmp=yes]) |
| 5 | + # Check that GMP >= 6.2.1; this test is copied from FLINT. |
| 6 | + AC_MSG_CHECKING([if version of GMP is greater than 6.2.1]) |
| 7 | + AC_COMPILE_IFELSE([ |
| 8 | + AC_LANG_PROGRAM( |
| 9 | + [[#include <gmp.h> |
| 10 | + ]], |
| 11 | + [[#if (__GNU_MP_VERSION < 6) \ |
| 12 | + || (__GNU_MP_VERSION == 6 && __GNU_MP_VERSION_MINOR < 2) \ |
| 13 | + || (__GNU_MP_VERSION == 6 && __GNU_MP_VERSION_MINOR == 2 && __GNU_MP_VERSION_PATCHLEVEL < 1) |
| 14 | + # error GMP version 6.2.1 or later is required |
| 15 | + #endif |
| 16 | + ]] |
| 17 | + )], [dnl |
| 18 | + AC_MSG_RESULT([yes]) |
| 19 | + ], [dnl |
| 20 | + AC_MSG_RESULT([no]) |
| 21 | + sage_spkg_install_gmp=yes |
| 22 | + ]) |
| 23 | + dnl The test above uses the headers only. To protect against header/library |
| 24 | + dnl mismatches, we now check for a function. |
5 | 25 | dnl mpn_gcd_11 appeared in GMP 6.2.1 |
6 | 26 | dnl It is undocumented but is used by Flint when built with default |
7 | 27 | dnl flags. |
8 | 28 | AC_SEARCH_LIBS([__gmpn_gcd_11], [gmp], [], |
9 | 29 | [sage_spkg_install_gmp=yes]) |
10 | | -], [], [], [ |
| 30 | +], [], [], [dnl |
11 | 31 | if test x$sage_spkg_install_gmp = xyes; then |
12 | 32 | AC_SUBST(SAGE_GMP_PREFIX, ['$SAGE_LOCAL']) |
13 | 33 | AC_SUBST(SAGE_GMP_INCLUDE, ['$SAGE_LOCAL/include']) |
|
0 commit comments