summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rwxr-xr-xcmake/config-ix.cmake29
1 files changed, 29 insertions, 0 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index e19cb349d5..4a87a23aed 100755
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -190,6 +190,35 @@ llvm_find_program(fdp)
llvm_find_program(dot)
llvm_find_program(dotty)
+if( LLVM_ENABLE_FFI )
+ find_path(FFI_INCLUDE_PATH ffi.h PATHS ${FFI_INCLUDE_DIR})
+ if( FFI_INCLUDE_PATH )
+ set(FFI_HEADER ffi.h CACHE INTERNAL "")
+ set(HAVE_FFI_H 1 CACHE INTERNAL "")
+ else()
+ find_path(FFI_INCLUDE_PATH ffi/ffi.h PATHS ${FFI_INCLUDE_DIR})
+ if( FFI_INCLUDE_PATH )
+ set(FFI_HEADER ffi/ffi.h CACHE INTERNAL "")
+ set(HAVE_FFI_FFI_H 1 CACHE INTERNAL "")
+ endif()
+ endif()
+
+ if( NOT FFI_HEADER )
+ message(FATAL_ERROR "libffi includes are not found.")
+ endif()
+
+ find_library(FFI_LIBRARY_PATH ffi PATHS ${FFI_LIBRARY_DIR})
+ if( NOT FFI_LIBRARY_PATH )
+ message(FATAL_ERROR "libffi is not found.")
+ endif()
+
+ list(APPEND CMAKE_REQUIRED_LIBRARIES ${FFI_LIBRARY_PATH})
+ list(APPEND CMAKE_REQUIRED_INCLUDES ${FFI_INCLUDE_PATH})
+ check_symbol_exists(ffi_call ${FFI_HEADER} HAVE_FFI_CALL)
+ list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES ${FFI_INCLUDE_PATH})
+ list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES ${FFI_LIBRARY_PATH})
+endif( LLVM_ENABLE_FFI )
+
# Define LLVM_MULTITHREADED if gcc atomic builtins exists.
include(CheckAtomic)