From 3729d7d62b9973baa60d253fe0463d6d607dd815 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Mon, 12 Aug 2013 10:40:11 +0000 Subject: Remove all checking for the various terminfo headers (term.h and curses.h). Finding these headers is next to impossible. For example, on Debian systems libtinfo-dev provides the terminfo reading library we want, but *not* term.h. For the header, you have to use libncurses-dev. And libncursesw-dev provides a *different* term.h in a different location! These headers aren't worth it. We want two functions the signatures of which are clearly spec'ed in sys-v and other documentation. Just declare them ourselves and call them. This should fix some debian builders and provide better support for "minimal" debian systems that do want color autodetection. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188165 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/Unix/Process.inc | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) (limited to 'lib/Support/Unix') diff --git a/lib/Support/Unix/Process.inc b/lib/Support/Unix/Process.inc index 1bb3e22..768c338 100644 --- a/lib/Support/Unix/Process.inc +++ b/lib/Support/Unix/Process.inc @@ -38,28 +38,6 @@ # include #endif -// Pull in the headers we found to go with the terminfo reading library (tinfo, -// curses, whatever it may be). We have to pull in the 'curses.h' header as the -// SysV spec only provides certain values and defines from that header even -// though we work hard to not link against all of the curses implementation -// when avoidable. -#ifdef HAVE_TERMINFO -# if defined(HAVE_CURSES_H) -# include -# elif defined(HAVE_NCURSES_H) -# include -# elif defined(HAVE_NCURSESW_H) -# include -# elif defined(HAVE_NCURSES_CURSES_H) -# include -# elif defined(HAVE_NCURSESW_CURSES_H) -# include -# endif -# if defined(HAVE_TERM_H) -# include -# endif -#endif - //===----------------------------------------------------------------------===// //=== WARNING: Implementation here must contain only generic UNIX code that //=== is guaranteed to work on *all* UNIX variants. @@ -269,6 +247,14 @@ unsigned Process::StandardErrColumns() { return getColumns(2); } +#ifdef HAVE_TERMINFO +// We manually declare these two extern functions because finding the correct +// headers from various terminfo, curses, or other sources is harder than +// writing their specs down. +extern "C" int setupterm(char *term, int filedes, int *errret); +extern "C" int tigetnum(char *capname); +#endif + static bool terminalHasColors(int fd) { #ifdef HAVE_TERMINFO // First, acquire a global lock because these C routines are thread hostile. @@ -276,7 +262,7 @@ static bool terminalHasColors(int fd) { MutexGuard G(M); int errret = 0; - if (setupterm((char *)0, fd, &errret) != OK) + if (setupterm((char *)0, fd, &errret) != 0) // Regardless of why, if we can't get terminfo, we shouldn't try to print // colors. return false; @@ -294,7 +280,7 @@ static bool terminalHasColors(int fd) { // // The 'tigetnum' routine returns -2 or -1 on errors, and might return 0 if // the terminfo says that no colors are supported. - if (tigetnum("colors") > 0) + if (tigetnum((char *)"colors") > 0) return true; #endif -- cgit v1.1