Target a minimal terminfo library rather than necessarily a full curses
library for color support detection. This still will use a curses
library if that is all we have available on the system. This change
tries to use a smaller subset of the curses library, specifically the
subset that is on some systems split off into a separate library. For
example, if you install ncurses configured --with-tinfo, a 'libtinfo' is
install that provides just the terminfo querying functionality. That
library is now used instead of curses when it is available.

This happens to fix a build error on systems with that library because
when we tried to link ncurses into the binary, we didn't pull tinfo in
as well. =]

It should also provide an easy path for supporting the NetBSD
libterminfo library, but as I don't have access to a NetBSD system I'm
leaving adding that support to those folks.

llvm-svn: 188160
diff --git a/llvm/cmake/modules/LLVM-Config.cmake b/llvm/cmake/modules/LLVM-Config.cmake
index 3e2447a..9fa45ce 100644
--- a/llvm/cmake/modules/LLVM-Config.cmake
+++ b/llvm/cmake/modules/LLVM-Config.cmake
@@ -10,13 +10,9 @@
       if( HAVE_LIBDL )
         set(system_libs ${system_libs} ${CMAKE_DL_LIBS})
       endif()
-      if(LLVM_ENABLE_CURSES)
-        if(HAVE_NCURSESW)
-          set(system_libs ${system_libs} ncursesw)
-        elseif(HAVE_NCURSES)
-          set(system_libs ${system_libs} ncurses)
-        elseif(HAVE_CURSES)
-          set(system_libs ${system_libs} curses)
+      if(LLVM_ENABLE_TERMINFO)
+        if(HAVE_TERMINFO)
+          set(system_libs ${system_libs} ${TERMINFO_LIBS})
         endif()
       endif()
       if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD )