1# This file contains all the logic for running configure-time checks 2 3include(CheckSymbolExists) 4include(CheckIncludeFile) 5include(CheckIncludeFiles) 6include(CheckLibraryExists) 7 8set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) 9check_symbol_exists(ppoll poll.h HAVE_PPOLL) 10set(CMAKE_REQUIRED_DEFINITIONS) 11check_symbol_exists(sigaction signal.h HAVE_SIGACTION) 12 13check_include_file(termios.h HAVE_TERMIOS_H) 14check_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H) 15 16check_cxx_source_compiles(" 17 #include <sys/uio.h> 18 int main() { process_vm_readv(0, nullptr, 0, nullptr, 0, 0); return 0; }" 19 HAVE_PROCESS_VM_READV) 20check_cxx_source_compiles(" 21 #include <sys/syscall.h> 22 int main() { return __NR_process_vm_readv; }" 23 HAVE_NR_PROCESS_VM_READV) 24 25check_library_exists(compression compression_encode_buffer "" HAVE_LIBCOMPRESSION) 26 27# These checks exist in LLVM's configuration, so I want to match the LLVM names 28# so that the check isn't duplicated, but we translate them into the LLDB names 29# so that I don't have to change all the uses at the moment. 30set(LLDB_CONFIG_TERMIOS_SUPPORTED ${HAVE_TERMIOS_H}) 31if(NOT UNIX) 32 set(LLDB_DISABLE_POSIX 1) 33endif() 34 35if(NOT LLDB_CONFIG_HEADER_INPUT) 36 set(LLDB_CONFIG_HEADER_INPUT ${LLDB_INCLUDE_ROOT}/lldb/Host/Config.h.cmake) 37endif() 38 39if(NOT LLDB_CONFIG_HEADER_OUTPUT) 40 set(LLDB_CONFIG_HEADER_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/lldb/Host/Config.h) 41endif() 42 43# This should be done at the end 44configure_file( 45 ${LLDB_CONFIG_HEADER_INPUT} 46 ${LLDB_CONFIG_HEADER_OUTPUT} 47 ) 48