termios.h contains the winsize structure we need to determine the
[oota-llvm.git] / lib / System / Unix / Process.inc
index b1286b7bfcd5e98050120d8837e0878a53d34512..e4f37a1ff597057ad6795bc6a2a49cc2f40f8f60 100644 (file)
@@ -27,6 +27,9 @@
 #ifdef HAVE_SYS_IOCTL_H
 #  include <sys/ioctl.h>
 #endif
+#ifdef HAVE_TERMIOS_H
+#  include <termios.h>
+#endif
 
 //===----------------------------------------------------------------------===//
 //=== WARNING: Implementation here must contain only generic UNIX code that
@@ -204,7 +207,7 @@ static unsigned getColumns(int FileID) {
 
   unsigned Columns = 0;
 
-#ifdef HAVE_SYS_IOCTL_H
+#if defined(HAVE_SYS_IOCTL_H) && defined(HAVE_TERMIOS_H)
   // Try to determine the width of the terminal.
   struct winsize ws;
   if (ioctl(FileID, TIOCGWINSZ, &ws) == 0)