1061da546Spatrick# This file contains all the logic for running configure-time checks
2061da546Spatrick
3061da546Spatrickinclude(CheckSymbolExists)
4061da546Spatrickinclude(CheckIncludeFile)
5061da546Spatrickinclude(CheckIncludeFiles)
6061da546Spatrickinclude(CheckLibraryExists)
7061da546Spatrick
8061da546Spatrickset(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
9061da546Spatrickcheck_symbol_exists(ppoll poll.h HAVE_PPOLL)
10be691f3bSpatrickcheck_symbol_exists(ptsname_r stdlib.h HAVE_PTSNAME_R)
11061da546Spatrickset(CMAKE_REQUIRED_DEFINITIONS)
12061da546Spatrickcheck_cxx_symbol_exists(accept4 "sys/socket.h" HAVE_ACCEPT4)
13061da546Spatrick
14061da546Spatrickcheck_include_file(termios.h HAVE_TERMIOS_H)
15061da546Spatrickcheck_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
16061da546Spatrick
17061da546Spatrickcheck_cxx_symbol_exists(process_vm_readv "sys/uio.h" HAVE_PROCESS_VM_READV)
18061da546Spatrickcheck_cxx_symbol_exists(__NR_process_vm_readv "sys/syscall.h" HAVE_NR_PROCESS_VM_READV)
19061da546Spatrick
20061da546Spatrickcheck_library_exists(compression compression_encode_buffer "" HAVE_LIBCOMPRESSION)
21061da546Spatrick
22*f6aab3d8Srobertset(LLDB_INSTALL_LIBDIR_BASENAME "lib${LLDB_LIBDIR_SUFFIX}")
23*f6aab3d8Srobert
24061da546Spatrick# These checks exist in LLVM's configuration, so I want to match the LLVM names
25061da546Spatrick# so that the check isn't duplicated, but we translate them into the LLDB names
26061da546Spatrick# so that I don't have to change all the uses at the moment.
27061da546Spatrickset(LLDB_ENABLE_TERMIOS ${HAVE_TERMIOS_H})
28061da546Spatrickif (UNIX)
29061da546Spatrick  set(LLDB_ENABLE_POSIX ON)
30061da546Spatrickelse()
31061da546Spatrick  set(LLDB_ENABLE_POSIX OFF)
32061da546Spatrickendif()
33061da546Spatrick
34061da546Spatrickif(NOT LLDB_CONFIG_HEADER_INPUT)
35061da546Spatrick set(LLDB_CONFIG_HEADER_INPUT ${LLDB_INCLUDE_ROOT}/lldb/Host/Config.h.cmake)
36061da546Spatrickendif()
37061da546Spatrick
38061da546Spatrickif(NOT LLDB_CONFIG_HEADER_OUTPUT)
39061da546Spatrick set(LLDB_CONFIG_HEADER_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/lldb/Host/Config.h)
40061da546Spatrickendif()
41061da546Spatrick
42061da546Spatrick# This should be done at the end
43061da546Spatrickconfigure_file(
44061da546Spatrick  ${LLDB_CONFIG_HEADER_INPUT}
45061da546Spatrick  ${LLDB_CONFIG_HEADER_OUTPUT}
46061da546Spatrick  )
47