[compiler-rt] r347338 - [cmake] Fix detecting terminfo library

Michal Gorny via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 20 10:41:11 PST 2018


Author: mgorny
Date: Tue Nov 20 10:41:11 2018
New Revision: 347338

URL: http://llvm.org/viewvc/llvm-project?rev=347338&view=rev
Log:
[cmake] Fix detecting terminfo library

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.

Also sync the check order to include the NetBSD fix from r347156.

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.

Differential Revision: https://reviews.llvm.org/D54641

Modified:
    compiler-rt/trunk/cmake/config-ix.cmake

Modified: compiler-rt/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=347338&r1=347337&r2=347338&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/config-ix.cmake Tue Nov 20 10:41:11 2018
@@ -121,10 +121,12 @@ check_library_exists(pthread pthread_cre
 
 # Look for terminfo library, used in unittests that depend on LLVMSupport.
 if(LLVM_ENABLE_TERMINFO)
-  foreach(library tinfo terminfo curses ncurses ncursesw)
+  foreach(library terminfo tinfo 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()




More information about the llvm-commits mailing list