termios.h contains the winsize structure we need to determine the
authorDouglas Gregor <dgregor@apple.com>
Mon, 18 May 2009 17:21:34 +0000 (17:21 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 18 May 2009 17:21:34 +0000 (17:21 +0000)
width of a terminal. Don't try to get the width of a terminal if we
don't have this header.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72018 91177308-0d34-0410-b5e6-96231b3b80d8

autoconf/configure.ac
cmake/config-ix.cmake
configure
include/llvm/Config/config.h.cmake
include/llvm/Config/config.h.in
lib/System/Unix/Process.inc

index 1e04b8c246c3215995d15778315b80f5d0efe918..cb217a5143b67537ef046d36267c1b13030314d8 100644 (file)
@@ -823,8 +823,8 @@ AC_HEADER_SYS_WAIT
 AC_HEADER_TIME
 
 AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h])
-AC_CHECK_HEADERS([malloc.h setjmp.h signal.h stdint.h unistd.h utime.h])
-AC_CHECK_HEADERS([windows.h])
+AC_CHECK_HEADERS([malloc.h setjmp.h signal.h stdint.h termios.h unistd.h])
+AC_CHECK_HEADERS([utime.h windows.h])
 AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h])
 AC_CHECK_HEADERS([sys/types.h sys/ioctl.h malloc/malloc.h mach/mach.h])
 if test "$ENABLE_THREADS" -eq 1 ; then
index 7e4016fb34c0aef02052cb62893fec189b5a98d5..adebb1b38f52bbef2b6f2727ff6a86080af47a8d 100755 (executable)
@@ -34,6 +34,7 @@ check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
 check_include_file(sys/stat.h HAVE_SYS_STAT_H)
 check_include_file(sys/time.h HAVE_SYS_TIME_H)
 check_include_file(sys/types.h HAVE_SYS_TYPES_H)
+check_include_file(termios.h HAVE_TERMIOS_H)
 check_include_file(unistd.h HAVE_UNISTD_H)
 check_include_file(utime.h HAVE_UTIME_H)
 check_include_file(windows.h HAVE_WINDOWS_H)
index 2229b358d0b9e4fbeafc120ab5a3519546c6226b..3a352775197e563e03506d72c5e7ed209543d2fe 100755 (executable)
--- a/configure
+++ b/configure
@@ -28963,7 +28963,7 @@ done
 
 
 
-for ac_header in malloc.h setjmp.h signal.h stdint.h unistd.h utime.h
+for ac_header in malloc.h setjmp.h signal.h stdint.h termios.h unistd.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
@@ -29132,7 +29132,8 @@ fi
 done
 
 
-for ac_header in windows.h
+
+for ac_header in utime.h windows.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
index 443afb17873bac158f84a64b9cbecdbcc84f7250..caabf0779abad15f4c616210bd94257138d81bc8 100644 (file)
 /* Define to 1 if the system has the type `uint64_t'. */
 #undef HAVE_UINT64_T
 
+/* Define to 1 if you have the <termios.h> header file. */
+#cmakedefine HAVE_TERMIOS_H ${HAVE_TERMIOS_H}
+
 /* Define to 1 if you have the <unistd.h> header file. */
 #cmakedefine HAVE_UNISTD_H ${HAVE_UNISTD_H}
 
index f0522e51f1a4043a4eaa05782a52515ae63289e4..8ab67a4f63a181eea8b549f257be810a388412f9 100644 (file)
 /* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
 #undef HAVE_SYS_WAIT_H
 
+/* Define to 1 if you have the <termios.h> header file. */
+#undef HAVE_TERMIOS_H
+
 /* Define to 1 if the system has the type `uint64_t'. */
 #undef HAVE_UINT64_T
 
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)