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