summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2013-08-12 09:49:17 +0000
committerChandler Carruth <chandlerc@gmail.com>2013-08-12 09:49:17 +0000
commit8d8bdff6d7eccb05bf16e18141263ee72ea8296b (patch)
tree6433ea896c6e1bf5d2996bb770920fb1cd9d1682 /cmake
parent6a4e44f0de6e59d4458e3795c765a9001ba1b87f (diff)
downloadexternal_llvm-8d8bdff6d7eccb05bf16e18141263ee72ea8296b.zip
external_llvm-8d8bdff6d7eccb05bf16e18141263ee72ea8296b.tar.gz
external_llvm-8d8bdff6d7eccb05bf16e18141263ee72ea8296b.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188160 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rwxr-xr-xcmake/config-ix.cmake24
-rw-r--r--cmake/modules/LLVM-Config.cmake10
-rw-r--r--cmake/modules/LLVMConfig.cmake.in7
3 files changed, 20 insertions, 21 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index 0567820..13bd40d 100755
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -74,6 +74,7 @@ check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT)
check_include_file(mach/mach.h HAVE_MACH_MACH_H)
check_include_file(mach-o/dyld.h HAVE_MACH_O_DYLD_H)
+check_include_file(term.h HAVE_TERM_H)
check_include_file(curses.h HAVE_CURSES_H)
check_include_file(ncurses.h HAVE_NCURSES_H)
check_include_file(ncursesw.h HAVE_NCURSESW_H)
@@ -103,18 +104,21 @@ if( NOT PURE_WINDOWS )
else()
set(HAVE_LIBZ 0)
endif()
- if(LLVM_ENABLE_CURSES)
- check_library_exists(curses has_colors "" HAVE_CURSES)
- if(NOT HAVE_CURSES)
- check_library_exists(ncurses has_colors "" HAVE_NCURSES)
- set(HAVE_CURSES ${HAVE_NCURSES})
- if(NOT HAVE_CURSES)
- check_library_exists(ncursesw has_colors "" HAVE_NCURSESW)
- set(HAVE_CURSES ${HAVE_NCURSESW})
+ if(LLVM_ENABLE_TERMINFO AND
+ (HAVE_TERM_H OR HAVE_CURSES_H OR HAVE_NCURSES_H OR HAVE_NCURSESW_H OR
+ HAVE_NCURSES_CURSES_H OR HAVE_NCURSESW_CURSES_H))
+ set(HAVE_TERMINFO 0)
+ foreach(library tinfo curses ncurses ncursesw)
+ string(TOUPPER ${library} library_suffix)
+ check_library_exists(${library} setupterm "" HAVE_TERMINFO_${library_suffix})
+ if(HAVE_TERMINFO_${library_suffix})
+ set(HAVE_TERMINFO 1)
+ set(TERMINFO_LIBS "${library}")
+ break()
endif()
- endif()
+ endforeach()
else()
- set(HAVE_CURSES 0)
+ set(HAVE_TERMINFO 0)
endif()
endif()
diff --git a/cmake/modules/LLVM-Config.cmake b/cmake/modules/LLVM-Config.cmake
index 3e2447a..9fa45ce 100644
--- a/cmake/modules/LLVM-Config.cmake
+++ b/cmake/modules/LLVM-Config.cmake
@@ -10,13 +10,9 @@ function(get_system_libs return_var)
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 )
diff --git a/cmake/modules/LLVMConfig.cmake.in b/cmake/modules/LLVMConfig.cmake.in
index d87e242..68fe296 100644
--- a/cmake/modules/LLVMConfig.cmake.in
+++ b/cmake/modules/LLVMConfig.cmake.in
@@ -20,7 +20,7 @@ set(TARGET_TRIPLE "@TARGET_TRIPLE@")
set(LLVM_TOOLS_BINARY_DIR @LLVM_TOOLS_BINARY_DIR@)
-set(LLVM_ENABLE_CURSES @LLVM_ENABLE_CURSES@)
+set(LLVM_ENABLE_TERMINFO @LLVM_ENABLE_TERMINFO@)
set(LLVM_ENABLE_THREADS @LLVM_ENABLE_THREADS@)
@@ -30,9 +30,8 @@ set(LLVM_NATIVE_ARCH @LLVM_NATIVE_ARCH@)
set(LLVM_ENABLE_PIC @LLVM_ENABLE_PIC@)
-set(HAVE_CURSES @HAVE_CURSES@)
-set(HAVE_NCURSES @HAVE_NCURSES@)
-set(HAVE_NCURSESW @HAVE_NCURSESW@)
+set(HAVE_TERMINFO @HAVE_TERMINFO@)
+set(TERMINFO_LIBS @TERMINFO_LIBS@)
set(HAVE_LIBDL @HAVE_LIBDL@)
set(HAVE_LIBPTHREAD @HAVE_LIBPTHREAD@)
set(HAVE_LIBZ @HAVE_LIBZ@)