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