summaryrefslogtreecommitdiff
path: root/lib/Support/Unix
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2013-08-12 10:40:11 +0000
committerChandler Carruth <chandlerc@gmail.com>2013-08-12 10:40:11 +0000
commit3729d7d62b9973baa60d253fe0463d6d607dd815 (patch)
tree5fbd3c29ccb29fc17ee40ed64593bd7bd23feacb /lib/Support/Unix
parentdfb5ceae90c016ba4ca8a7f1a3b79c360d888f30 (diff)
downloadllvm-3729d7d62b9973baa60d253fe0463d6d607dd815.tar.gz
llvm-3729d7d62b9973baa60d253fe0463d6d607dd815.tar.bz2
llvm-3729d7d62b9973baa60d253fe0463d6d607dd815.tar.xz
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
Diffstat (limited to 'lib/Support/Unix')
-rw-r--r--lib/Support/Unix/Process.inc34
1 files changed, 10 insertions, 24 deletions
diff --git a/lib/Support/Unix/Process.inc b/lib/Support/Unix/Process.inc
index 1bb3e2244c..768c338a4d 100644
--- a/lib/Support/Unix/Process.inc
+++ b/lib/Support/Unix/Process.inc
@@ -38,28 +38,6 @@
# include <termios.h>
#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 <curses.h>
-# elif defined(HAVE_NCURSES_H)
-# include <ncurses.h>
-# elif defined(HAVE_NCURSESW_H)
-# include <ncursesw.h>
-# elif defined(HAVE_NCURSES_CURSES_H)
-# include <ncurses/curses.h>
-# elif defined(HAVE_NCURSESW_CURSES_H)
-# include <ncursesw/curses.h>
-# endif
-# if defined(HAVE_TERM_H)
-# include <term.h>
-# 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