[Beignet] [PATCH] GBE: fix terminfo library linkage

2014-02-16 Thread Boqun Feng
In some distros, the terminal libraries are divided into two
libraries, one is tinfo and the other is ncurses, however, for
other distros, there is only one single ncurses library with
all functions.
In order to link proper terminal library for LLVM, find_library
macro in cmake can be used. In this patch, the tinfo is prefered,
so that it wouldn't affect linkage behavior in distros with tinfo.

Signed-off-by: Boqun Feng boqun.f...@gmail.com
---
 backend/src/CMakeLists.txt | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/backend/src/CMakeLists.txt b/backend/src/CMakeLists.txt
index 6db4a2a..6e37d95 100644
--- a/backend/src/CMakeLists.txt
+++ b/backend/src/CMakeLists.txt
@@ -189,7 +189,13 @@ target_link_libraries(
   ${CMAKE_DL_LIBS})
 
 if (LLVM_VERSION_NODOT VERSION_EQUAL 34)
-  target_link_libraries(gbe tinfo)
+  find_library(TERMINFO NAMES tinfo ncurses)
+  if (${TERMINFO} STREQUAL TERMINFO-NOTFOUND)
+message(FATAL_ERROR no libtinfo or libncurses is found in system)
+  else (${TERMINFO} STREQUAL TERMINFO-NOTFOUND)
+target_link_libraries(gbe ${TERMINFO})
+message(STATUS use ${TERMINFO} as terminal control library)
+  endif (${TERMINFO} STREQUAL TERMINFO-NOTFOUND)
 endif(LLVM_VERSION_NODOT VERSION_EQUAL 34)
 
 link_directories (${LLVM_LIBRARY_DIR})
-- 
1.8.5.4

___
Beignet mailing list
Beignet@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet


Re: [Beignet] [PATCH] GBE: fix terminfo library linkage

2014-02-16 Thread Igor Gnatenko
On Mon, 2014-02-17 at 10:12 +0800, Zhigang Gong wrote: 
 This patch LGTM.
 
 CC to Igor, could you help to test this patch in your environment?
Sure! I've tested. It works. 
 Thanks.
 
 On Mon, Feb 17, 2014 at 09:49:26AM +0800, Boqun Feng wrote:
  In some distros, the terminal libraries are divided into two
  libraries, one is tinfo and the other is ncurses, however, for
  other distros, there is only one single ncurses library with
  all functions.
  In order to link proper terminal library for LLVM, find_library
  macro in cmake can be used. In this patch, the tinfo is prefered,
  so that it wouldn't affect linkage behavior in distros with tinfo.
  
  Signed-off-by: Boqun Feng boqun.f...@gmail.com
Reviewed-by: Igor Gnatenko i.gnatenko.br...@gmail.com 
  ---
   backend/src/CMakeLists.txt | 8 +++-
   1 file changed, 7 insertions(+), 1 deletion(-)
  
  diff --git a/backend/src/CMakeLists.txt b/backend/src/CMakeLists.txt
  index 6db4a2a..6e37d95 100644
  --- a/backend/src/CMakeLists.txt
  +++ b/backend/src/CMakeLists.txt
  @@ -189,7 +189,13 @@ target_link_libraries(
 ${CMAKE_DL_LIBS})
   
   if (LLVM_VERSION_NODOT VERSION_EQUAL 34)
  -  target_link_libraries(gbe tinfo)
  +  find_library(TERMINFO NAMES tinfo ncurses)
  +  if (${TERMINFO} STREQUAL TERMINFO-NOTFOUND)
  +message(FATAL_ERROR no libtinfo or libncurses is found in system)
  +  else (${TERMINFO} STREQUAL TERMINFO-NOTFOUND)
  +target_link_libraries(gbe ${TERMINFO})
  +message(STATUS use ${TERMINFO} as terminal control library)
  +  endif (${TERMINFO} STREQUAL TERMINFO-NOTFOUND)
   endif(LLVM_VERSION_NODOT VERSION_EQUAL 34)
   
   link_directories (${LLVM_LIBRARY_DIR})
  -- 
  1.8.5.4
  
  ___
  Beignet mailing list
  Beignet@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/beignet
 ___
 Beignet mailing list
 Beignet@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/beignet


-- 
-Igor Gnatenko

___
Beignet mailing list
Beignet@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet