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