has_gmp.cpp 971 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright John Maddock 2008.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #include <cstddef> // See https://gcc.gnu.org/gcc-4.9/porting_to.html
  6. #include <gmp.h>
  7. #include <boost/config.hpp>
  8. #ifdef __GNUC__
  9. #pragma message "__GNU_MP_VERSION=" BOOST_STRINGIZE(__GNU_MP_VERSION)
  10. #pragma message "__GNU_MP_VERSION_MINOR=" BOOST_STRINGIZE(__GNU_MP_VERSION_MINOR)
  11. #endif
  12. #if (__GNU_MP_VERSION < 4) || ((__GNU_MP_VERSION == 4) && (__GNU_MP_VERSION_MINOR < 2))
  13. #error "Incompatible GMP version"
  14. #endif
  15. int main()
  16. {
  17. void* (*alloc_func_ptr)(size_t);
  18. void* (*realloc_func_ptr)(void*, size_t, size_t);
  19. void (*free_func_ptr)(void*, size_t);
  20. mp_get_memory_functions(&alloc_func_ptr, &realloc_func_ptr, &free_func_ptr);
  21. mpz_t integ;
  22. mpz_init(integ);
  23. if (integ[0]._mp_d)
  24. mpz_clear(integ);
  25. return 0;
  26. }