|
|
@@ -11,9 +11,10 @@ include(CheckFunctionExists) |
|
|
|
include(CheckCXXSourceCompiles) |
|
|
|
include(TestBigEndian) |
|
|
|
|
|
|
|
include(CheckCompilerVersion) |
|
|
|
include(HandleLLVMStdlib) |
|
|
|
|
|
|
|
if( UNIX AND NOT BEOS ) |
|
|
|
if( UNIX AND NOT (BEOS OR HAIKU) ) |
|
|
|
# Used by check_symbol_exists: |
|
|
|
set(CMAKE_REQUIRED_LIBRARIES m) |
|
|
|
endif() |
|
|
@@ -66,6 +67,7 @@ check_include_file(sys/param.h HAVE_SYS_PARAM_H) |
|
|
|
check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H) |
|
|
|
check_include_file(sys/stat.h HAVE_SYS_STAT_H) |
|
|
|
check_include_file(sys/time.h HAVE_SYS_TIME_H) |
|
|
|
check_include_file(sys/types.h HAVE_SYS_TYPES_H) |
|
|
|
check_include_file(sys/uio.h HAVE_SYS_UIO_H) |
|
|
|
check_include_file(termios.h HAVE_TERMIOS_H) |
|
|
|
check_include_file(unistd.h HAVE_UNISTD_H) |
|
|
@@ -107,6 +109,16 @@ if( NOT PURE_WINDOWS ) |
|
|
|
check_library_exists(rt clock_gettime "" HAVE_LIBRT) |
|
|
|
endif() |
|
|
|
|
|
|
|
if(HAVE_LIBPTHREAD) |
|
|
|
# We want to find pthreads library and at the moment we do want to |
|
|
|
# have it reported as '-l<lib>' instead of '-pthread'. |
|
|
|
# TODO: switch to -pthread once the rest of the build system can deal with it. |
|
|
|
set(CMAKE_THREAD_PREFER_PTHREAD TRUE) |
|
|
|
set(THREADS_HAVE_PTHREAD_ARG Off) |
|
|
|
find_package(Threads REQUIRED) |
|
|
|
set(PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT}) |
|
|
|
endif() |
|
|
|
|
|
|
|
# Don't look for these libraries on Windows. Also don't look for them if we're |
|
|
|
# using MSan, since uninstrmented third party code may call MSan interceptors |
|
|
|
# like strlen, leading to false positives. |
|
|
@@ -135,9 +147,15 @@ if( NOT PURE_WINDOWS AND NOT LLVM_USE_SANITIZER MATCHES "Memory.*") |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
check_library_exists(xar xar_open "" HAVE_LIBXAR) |
|
|
|
if(HAVE_LIBXAR) |
|
|
|
set(XAR_LIB xar) |
|
|
|
endif() |
|
|
|
|
|
|
|
# function checks |
|
|
|
check_symbol_exists(arc4random "stdlib.h" HAVE_DECL_ARC4RANDOM) |
|
|
|
check_symbol_exists(backtrace "execinfo.h" HAVE_BACKTRACE) |
|
|
|
check_symbol_exists(_Unwind_Backtrace "unwind.h" HAVE_UNWIND_BACKTRACE) |
|
|
|
check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE) |
|
|
|
check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE) |
|
|
|
check_symbol_exists(setrlimit sys/resource.h HAVE_SETRLIMIT) |
|
|
@@ -150,6 +168,9 @@ if( HAVE_SETJMP_H ) |
|
|
|
check_symbol_exists(siglongjmp setjmp.h HAVE_SIGLONGJMP) |
|
|
|
check_symbol_exists(sigsetjmp setjmp.h HAVE_SIGSETJMP) |
|
|
|
endif() |
|
|
|
if( HAVE_SIGNAL_H ) |
|
|
|
check_symbol_exists(sigaltstack signal.h HAVE_SIGALTSTACK) |
|
|
|
endif() |
|
|
|
if( HAVE_SYS_UIO_H ) |
|
|
|
check_symbol_exists(writev sys/uio.h HAVE_WRITEV) |
|
|
|
endif() |
|
|
@@ -395,12 +416,12 @@ else () |
|
|
|
set(LLVM_NATIVE_ASMPRINTER LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter) |
|
|
|
|
|
|
|
# We don't have an ASM parser for all architectures yet. |
|
|
|
if (EXISTS ${CMAKE_SOURCE_DIR}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/CMakeLists.txt) |
|
|
|
if (EXISTS ${PROJECT_SOURCE_DIR}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/CMakeLists.txt) |
|
|
|
set(LLVM_NATIVE_ASMPARSER LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser) |
|
|
|
endif () |
|
|
|
|
|
|
|
# We don't have an disassembler for all architectures yet. |
|
|
|
if (EXISTS ${CMAKE_SOURCE_DIR}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/CMakeLists.txt) |
|
|
|
if (EXISTS ${PROJECT_SOURCE_DIR}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/CMakeLists.txt) |
|
|
|
set(LLVM_NATIVE_DISASSEMBLER LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler) |
|
|
|
endif () |
|
|
|
endif () |
|
|
@@ -446,21 +467,6 @@ else() |
|
|
|
set(HAVE_DIA_SDK 0) |
|
|
|
endif( MSVC ) |
|
|
|
|
|
|
|
if( PURE_WINDOWS ) |
|
|
|
CHECK_CXX_SOURCE_COMPILES(" |
|
|
|
#include <windows.h> |
|
|
|
#include <imagehlp.h> |
|
|
|
extern \"C\" void foo(PENUMLOADED_MODULES_CALLBACK); |
|
|
|
extern \"C\" void foo(BOOL(CALLBACK*)(PCSTR,ULONG_PTR,ULONG,PVOID)); |
|
|
|
int main(){return 0;}" |
|
|
|
HAVE_ELMCB_PCSTR) |
|
|
|
if( HAVE_ELMCB_PCSTR ) |
|
|
|
set(WIN32_ELMCB_PCSTR "PCSTR") |
|
|
|
else() |
|
|
|
set(WIN32_ELMCB_PCSTR "PSTR") |
|
|
|
endif() |
|
|
|
endif( PURE_WINDOWS ) |
|
|
|
|
|
|
|
# FIXME: Signal handler return type, currently hardcoded to 'void' |
|
|
|
set(RETSIGTYPE void) |
|
|
|
|
|
|
@@ -526,7 +532,7 @@ else() |
|
|
|
if(GO_EXECUTABLE STREQUAL "GO_EXECUTABLE-NOTFOUND") |
|
|
|
message(STATUS "Go bindings disabled.") |
|
|
|
else() |
|
|
|
execute_process(COMMAND ${GO_EXECUTABLE} run ${CMAKE_SOURCE_DIR}/bindings/go/conftest.go |
|
|
|
execute_process(COMMAND ${GO_EXECUTABLE} run ${PROJECT_SOURCE_DIR}/bindings/go/conftest.go |
|
|
|
RESULT_VARIABLE GO_CONFTEST) |
|
|
|
if(GO_CONFTEST STREQUAL "0") |
|
|
|
set(LLVM_BINDINGS "${LLVM_BINDINGS} go") |
|
|
|