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