mincore_test.cmake 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #.rst:
  2. # Mincore char test
  3. # --------------
  4. #
  5. # Test whether function 'mincore' accept 3-rd param as char* or unsigned char*
  6. #
  7. # This piece of code is runaround and exists untill mincore is in use.
  8. # It is much more better to refactor 'crashdump' func in the code and move
  9. # all the stuff about dumping current query to the very end, after
  10. # all another significant info is collected. This way it will be
  11. # not so important whether we dump the query or not at all, and so,
  12. # no mincore check will be necessary.
  13. #
  14. # For now the problem is that prototype is different on linux/bsd,
  15. # and so, this special testing is necessary to successfully compile.
  16. #
  17. #=============================================================================
  18. # Copyright 2017-2026, Manticore Software LTD (https://manticoresearch.com)
  19. #
  20. # Distributed under the OSI-approved BSD License (the "License");
  21. # see accompanying file Copyright.txt for details.
  22. #
  23. # This software is distributed WITHOUT ANY WARRANTY; without even the
  24. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  25. # See the License for more information.
  26. #=============================================================================
  27. set ( _MINCORE_TEST "#include <unistd.h>
  28. #include <sys/mman.h>
  29. int main()
  30. {
  31. size_t length = 0;
  32. void* pAddr = 0;
  33. unsigned char *vec = 0;
  34. return mincore ( pAddr, length, vec );
  35. }" )
  36. include ( CheckCXXSourceCompiles )
  37. CHECK_CXX_SOURCE_COMPILES ( "${_MINCORE_TEST}" HAVE_UNSIGNED_MINCORE )
  38. unset ( _MINCORE_TEST )
  39. mark_as_advanced ( HAVE_UNSIGNED_MINCORE )