You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.5 KiB

  1. # Is the gmp header file new enough? (should be implemented with an argument)
  2. AC_DEFUN(CL_GMP_H_VERSION,
  3. [AC_CACHE_CHECK([for recent enough gmp.h], cl_cv_new_gmp_h, [
  4. AC_TRY_CPP([#include <gmp.h>
  5. #if !defined(__GNU_MP_VERSION) || (__GNU_MP_VERSION < 3)
  6. #error "ancient gmp.h"
  7. #endif],
  8. cl_cv_new_gmp_h="yes", cl_cv_new_gmp_h="no")
  9. ])])dnl
  10. # Does libgmp provide some functionality introduced in version 3.0?
  11. AC_DEFUN(CL_GMP_CHECK,
  12. [AC_CACHE_CHECK([for working libgmp], cl_cv_new_libgmp, [
  13. SAVELIBS=$LIBS
  14. LIBS="$LIBS -lgmp"
  15. AC_TRY_LINK([#include <gmp.h>],[mpn_divexact_by3(0,0,0)],
  16. cl_cv_new_libgmp="yes", cl_cv_new_libgmp="no"; LIBS=$SAVELIBS)
  17. ])])
  18. # What is sizeof(mp_limb_t)? (It has to match sizeof(uintD) later.)
  19. AC_DEFUN(CL_GMP_SET_UINTD,
  20. [AC_CACHE_CHECK([how large gmp demands uintD to be], cl_cv_gmp_set_uintd, [
  21. AC_TRY_RUN([#include <stdio.h>
  22. #include <gmp.h>
  23. int main() {
  24. FILE *f=fopen("conftestval", "w");
  25. if (!f) return(1);
  26. if (sizeof(mp_limb_t) > sizeof(long))
  27. fprintf(f, "long long");
  28. else if (sizeof(mp_limb_t) == sizeof(long))
  29. fprintf(f, "long");
  30. else if (sizeof(mp_limb_t) == sizeof(int))
  31. fprintf(f, "int");
  32. else return(1);
  33. return(0);
  34. }], cl_cv_gmp_set_uintd=`cat conftestval`; \
  35. cl_gmp_demands="GMP_DEMANDS_UINTD_`echo ${cl_cv_gmp_set_uintd} | sed -e 'y/ gilnot/_GILNOT/'`";
  36. AC_DEFINE_UNQUOTED($cl_gmp_demands),
  37. AC_MSG_ERROR([CLN can't handle the result]),dnl
  38. AC_MSG_ERROR([cross-compiling - cannot determine]))
  39. ])])