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

2018-11-20 Thread Michał Górny via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rCRT347338: [cmake] Fix detecting terminfo library (authored 
by mgorny, committed by ).

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
@@ -121,10 +121,12 @@
 
 # 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()


Index: cmake/config-ix.cmake
===
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -121,10 +121,12 @@
 
 # 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()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2018-11-18 Thread Michał Górny via Phabricator via cfe-commits
mgorny updated this revision to Diff 174534.
mgorny edited the summary of this revision.
mgorny added a comment.

Updated for check order change in master.


https://reviews.llvm.org/D54641

Files:
  cmake/config-ix.cmake


Index: cmake/config-ix.cmake
===
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -121,10 +121,12 @@
 
 # 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()


Index: cmake/config-ix.cmake
===
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -121,10 +121,12 @@
 
 # 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()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2018-11-16 Thread Kamil Rytarowski via Phabricator via cfe-commits
krytarowski accepted this revision.
krytarowski added a comment.
This revision is now accepted and ready to land.

In https://reviews.llvm.org/D54641#1301620, @mgorny wrote:

> Well, sure but I think changing the order should be done separately from 
> this. I'm fixing a bug resulting from people deciding to customize code 
> instead of keeping it in sync; so I'd rather not combine it with 
> intentionally mis-syncing the code.


It will be good to evaluate the changed order (in particular whether it still 
works fine on Linux).


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D54641



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2018-11-16 Thread Kamil Rytarowski via Phabricator via cfe-commits
krytarowski added a comment.

As I understand it -ltinfo vs -lterminfo is mixing native curses(3) and 
external ncurses(3) from pkgsrc, while we prefer to use entirely our native 
version for all LLVM projects.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D54641



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2018-11-16 Thread Kamil Rytarowski via Phabricator via cfe-commits
krytarowski added a comment.

Context:

> Do not return -ltinfo from llvm-config --system-libs --link-static
> 
> under NetBSD. Bump PKGREVISION
> 
> Rust language 1.20.0 uses these options and Rust build system uses it
>  as '-l tinfo' and our wrapper does not handle this.

https://github.com/NetBSD/pkgsrc/commit/2ca60b7c8cec0e6c0f3100d9439b6d126424ae2d#diff-079668572f99829ef3e9afc048ebc7a0


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D54641



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2018-11-16 Thread Kamil Rytarowski via Phabricator via cfe-commits
krytarowski added a comment.

I have got a local patch in pkgsrc-wip/llvm-netbsd:

  $NetBSD$
  
  --- cmake/config-ix.cmake.orig2017-12-08 18:50:04.615602612 +
  +++ cmake/config-ix.cmake
  @@ -153,7 +153,7 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memor
   endif()
   if(LLVM_ENABLE_TERMINFO)
 set(HAVE_TERMINFO 0)
  -  foreach(library tinfo terminfo curses ncurses ncursesw)
  +  foreach(library terminfo tinfo curses ncurses ncursesw)
   string(TOUPPER ${library} library_suffix)
   check_library_exists(${library} setupterm "" 
HAVE_TERMINFO_${library_suffix})
   if(HAVE_TERMINFO_${library_suffix})

Shouldn't we apply it here too?


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D54641



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2018-11-16 Thread Michał Górny via Phabricator via cfe-commits
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()


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()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits