[compiler-rt] r342523 - [XRay] Detect terminfo library
Dean Michael Berris via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 18 18:35:53 PDT 2018
Author: dberris
Date: Tue Sep 18 18:35:52 2018
New Revision: 342523
URL: http://llvm.org/viewvc/llvm-project?rev=342523&view=rev
Log:
[XRay] Detect terminfo library
Instead of assuming `-ltinfo` works, check whether there's terminfo
support on the host where LLVMSupport is compiled.
Follow-up to D52220.
Modified:
compiler-rt/trunk/cmake/config-ix.cmake
compiler-rt/trunk/lib/xray/tests/CMakeLists.txt
Modified: compiler-rt/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=342523&r1=342522&r2=342523&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/config-ix.cmake Tue Sep 18 18:35:52 2018
@@ -105,6 +105,20 @@ check_library_exists(dl dlopen "" COMPIL
check_library_exists(rt shm_open "" COMPILER_RT_HAS_LIBRT)
check_library_exists(m pow "" COMPILER_RT_HAS_LIBM)
check_library_exists(pthread pthread_create "" COMPILER_RT_HAS_LIBPTHREAD)
+
+# Look for terminfo library, used in unittests that depend on LLVMSupport.
+if(LLVM_ENABLE_TERMINFO)
+ foreach(library tinfo terminfo curses ncurses ncursesw)
+ string(TOUPPER ${library} library_suffix)
+ check_library_exists(
+ ${library} setupterm "" COMPILER_RT_HAS_TERMINFO)
+ if(COMPILER_RT_HAS_TERMINFO)
+ set(COMPILER_RT_TERMINFO_LIB "${library}")
+ break()
+ endif()
+ endforeach()
+endif()
+
if (ANDROID AND COMPILER_RT_HAS_LIBDL)
# Android's libstdc++ has a dependency on libdl.
list(APPEND CMAKE_REQUIRED_LIBRARIES dl)
Modified: compiler-rt/trunk/lib/xray/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/tests/CMakeLists.txt?rev=342523&r1=342522&r2=342523&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/xray/tests/CMakeLists.txt Tue Sep 18 18:35:52 2018
@@ -54,6 +54,11 @@ if (NOT APPLE)
append_list_if(COMPILER_RT_HAS_LIBRT -lrt XRAY_UNITTEST_LINK_FLAGS)
append_list_if(COMPILER_RT_HAS_LIBDL -ldl XRAY_UNITTEST_LINK_FLAGS)
append_list_if(COMPILER_RT_HAS_LIBPTHREAD -pthread XRAY_UNITTEST_LINK_FLAGS)
+
+ # Needed by LLVMSupport.
+ append_list_if(
+ COMPILER_RT_HAS_TERMINFO
+ -l${COMPILER_RT_TERMINFO_LIB} XRAY_UNITTEST_LINK_FLAGS)
endif()
macro(add_xray_unittest testname)
@@ -75,7 +80,7 @@ macro(add_xray_unittest testname)
DEPS gtest xray llvm-xray LLVMXRay LLVMTestingSupport
CFLAGS ${XRAY_UNITTEST_CFLAGS}
LINK_FLAGS ${TARGET_LINK_FLAGS} ${XRAY_UNITTEST_LINK_FLAGS}
- -lLLVMXRay -lLLVMSupport -lLLVMTestingSupport -ltinfo
+ -lLLVMXRay -lLLVMSupport -lLLVMTestingSupport
)
set_target_properties(XRayUnitTests
PROPERTIES
More information about the llvm-commits
mailing list