xref: /openbsd-src/gnu/llvm/lldb/cmake/modules/LLDBGenerateConfig.cmake (revision 1a8dbaac879b9f3335ad7fb25429ce63ac1d6bac)
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)
12check_cxx_symbol_exists(accept4 "sys/socket.h" HAVE_ACCEPT4)
13
14check_include_file(termios.h HAVE_TERMIOS_H)
15check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
16check_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
17
18check_cxx_symbol_exists(process_vm_readv "sys/uio.h" HAVE_PROCESS_VM_READV)
19check_cxx_symbol_exists(__NR_process_vm_readv "sys/syscall.h" HAVE_NR_PROCESS_VM_READV)
20
21check_library_exists(compression compression_encode_buffer "" HAVE_LIBCOMPRESSION)
22
23# These checks exist in LLVM's configuration, so I want to match the LLVM names
24# so that the check isn't duplicated, but we translate them into the LLDB names
25# so that I don't have to change all the uses at the moment.
26set(LLDB_ENABLE_TERMIOS ${HAVE_TERMIOS_H})
27if (UNIX)
28  set(LLDB_ENABLE_POSIX ON)
29else()
30  set(LLDB_ENABLE_POSIX OFF)
31endif()
32
33if(NOT LLDB_CONFIG_HEADER_INPUT)
34 set(LLDB_CONFIG_HEADER_INPUT ${LLDB_INCLUDE_ROOT}/lldb/Host/Config.h.cmake)
35endif()
36
37if(NOT LLDB_CONFIG_HEADER_OUTPUT)
38 set(LLDB_CONFIG_HEADER_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/lldb/Host/Config.h)
39endif()
40
41# This should be done at the end
42configure_file(
43  ${LLDB_CONFIG_HEADER_INPUT}
44  ${LLDB_CONFIG_HEADER_OUTPUT}
45  )
46