[PATCH] D54641: [compiler-rt] [cmake] Fix detecting terminfo library

Michał Górny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 16 11:32:10 PST 2018


mgorny created this revision.
mgorny added reviewers: krytarowski, dberris, labath.
Herald added subscribers: Sanitizers, llvm-commits.

Copy the fix for determining the correct terminfo library from LLVM --
use distinct variables for check_library_exists() calls.  Otherwise,
the first check (for -ltinfo) populates the variable and no other checks
are performed.  Effectively, systems with other libraries than the first
one listed are presumed not to have terminfo routines at all.

This partially fixes undefined symbols when linking XRay tests.  It's
probably not the best solution to the problem there but as long
as the terminfo check stays in config-ix, I thnk it's worth fixing.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D54641

Files:
  cmake/config-ix.cmake


Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -122,9 +122,11 @@
 # 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)
+      ${library} setupterm "" COMPILER_RT_HAS_TERMINFO_${library_suffix})
+    if(COMPILER_RT_HAS_TERMINFO_${library_suffix})
+      set(COMPILER_RT_HAS_TERMINFO TRUE)
       set(COMPILER_RT_TERMINFO_LIB "${library}")
       break()
     endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54641.174417.patch
Type: text/x-patch
Size: 743 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181116/b0207d37/attachment.bin>


More information about the cfe-commits mailing list