Recognize NetBSD's terminfo implementation.
[oota-llvm.git] / cmake / config-ix.cmake
index 0567820b3319057e3c53066d2a9cb64edc6b1e8f..93046fe1b51d9c6be999742a0c40de9c8106e8e1 100755 (executable)
@@ -74,12 +74,6 @@ 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(curses.h HAVE_CURSES_H)
-check_include_file(ncurses.h HAVE_NCURSES_H)
-check_include_file(ncursesw.h HAVE_NCURSESW_H)
-check_include_file(ncurses/curses.h HAVE_NCURSES_CURSES_H)
-check_include_file(ncursesw/curses.h HAVE_NCURSESW_CURSES_H)
-
 # library checks
 if( NOT PURE_WINDOWS )
   check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD)
@@ -103,18 +97,19 @@ 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)
+    set(HAVE_TERMINFO 0)
+    foreach(library tinfo terminfo 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()