ConfigureChecks.cmake 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. include(CheckCCompilerFlag)
  2. include(CheckCSourceCompiles)
  3. include(CheckIncludeFile)
  4. include(CheckIncludeFiles)
  5. include(CheckLibraryExists)
  6. include(CheckSymbolExists)
  7. include(TestBigEndian)
  8. check_include_file("dlfcn.h" HAVE_DLFCN_H)
  9. check_include_file("fcntl.h" HAVE_FCNTL_H)
  10. check_include_file("inttypes.h" HAVE_INTTYPES_H)
  11. check_include_file("memory.h" HAVE_MEMORY_H)
  12. check_include_file("stdint.h" HAVE_STDINT_H)
  13. check_include_file("stdlib.h" HAVE_STDLIB_H)
  14. check_include_file("strings.h" HAVE_STRINGS_H)
  15. check_include_file("string.h" HAVE_STRING_H)
  16. check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
  17. check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
  18. check_include_file("unistd.h" HAVE_UNISTD_H)
  19. check_symbol_exists("getpagesize" "unistd.h" HAVE_GETPAGESIZE)
  20. check_symbol_exists("mmap" "sys/mman.h" HAVE_MMAP)
  21. check_symbol_exists("getrandom" "sys/random.h" HAVE_GETRANDOM)
  22. if(EXPAT_WITH_LIBBSD)
  23. set(CMAKE_REQUIRED_LIBRARIES "${LIB_BSD}")
  24. set(_bsd "bsd/")
  25. else()
  26. set(_bsd "")
  27. endif()
  28. check_symbol_exists("arc4random_buf" "${_bsd}stdlib.h" HAVE_ARC4RANDOM_BUF)
  29. if(NOT HAVE_ARC4RANDOM_BUF)
  30. check_symbol_exists("arc4random" "${_bsd}stdlib.h" HAVE_ARC4RANDOM)
  31. endif()
  32. set(CMAKE_REQUIRED_LIBRARIES)
  33. #/* Define to 1 if you have the ANSI C header files. */
  34. check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
  35. test_big_endian(WORDS_BIGENDIAN)
  36. #/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
  37. if(WORDS_BIGENDIAN)
  38. set(BYTEORDER 4321)
  39. else(WORDS_BIGENDIAN)
  40. set(BYTEORDER 1234)
  41. endif(WORDS_BIGENDIAN)
  42. if(HAVE_SYS_TYPES_H)
  43. check_symbol_exists("off_t" "sys/types.h" off_t)
  44. check_symbol_exists("size_t" "sys/types.h" size_t)
  45. else(HAVE_SYS_TYPES_H)
  46. set(off_t "long")
  47. set(size_t "unsigned")
  48. endif(HAVE_SYS_TYPES_H)
  49. check_c_source_compiles("
  50. #include <stdlib.h> /* for NULL */
  51. #include <unistd.h> /* for syscall */
  52. #include <sys/syscall.h> /* for SYS_getrandom */
  53. int main() {
  54. syscall(SYS_getrandom, NULL, 0, 0);
  55. return 0;
  56. }"
  57. HAVE_SYSCALL_GETRANDOM)
  58. check_c_compiler_flag("-fno-strict-aliasing" FLAG_NO_STRICT_ALIASING)
  59. check_c_compiler_flag("-fvisibility=hidden" FLAG_VISIBILITY)
  60. check_library_exists(m cos "" _EXPAT_LIBM_FOUND)