diff libgui/qterminal/libqterminal/unix/kpty.cpp @ 18264:d033b08e9b0e stable

Detect and use appropriate terminal attribute functions (bug #41212) * configure.ac: Add AC_CHECK_FUNCS for tcgetattr and tcsetattr. * kpty.cpp (_tcgetattr, _tcsetattr): Define to the appropriate terminal attribute functions based on system library support, not OS type macros. Fixes build failures on non-Linux GNU-based systems. Based on a Debian patch to the kde4libs package.
author Mike Miller <mtmiller@ieee.org>
date Sun, 12 Jan 2014 17:51:47 -0500
parents d63878346099
children 91805d8ab62f
line wrap: on
line diff
--- a/libgui/qterminal/libqterminal/unix/kpty.cpp	Sun Jan 12 12:41:39 2014 +0100
+++ b/libgui/qterminal/libqterminal/unix/kpty.cpp	Sun Jan 12 17:51:47 2014 -0500
@@ -116,24 +116,24 @@
 # define _NEW_TTY_CTRL
 #endif
 
-#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__)
+#if defined(HAVE_TCGETATTR)
+# define _tcgetattr(fd, ttmode) tcgetattr(fd, ttmode)
+#elif defined(TIOCGETA)
 # define _tcgetattr(fd, ttmode) ioctl(fd, TIOCGETA, (char *)ttmode)
+#elif defined(TCGETS)
+# define _tcgetattr(fd, ttmode) ioctl(fd, TCGETS, (char *)ttmode)
 #else
-# if defined(_HPUX_SOURCE) || defined(__Lynx__) || defined (__CYGWIN__)
-#  define _tcgetattr(fd, ttmode) tcgetattr(fd, ttmode)
-# else
-#  define _tcgetattr(fd, ttmode) ioctl(fd, TCGETS, (char *)ttmode)
-# endif
+# error No method available to get terminal attributes
 #endif
 
-#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__)
+#if defined(HAVE_TCSETATTR) && defined(TCSANOW)
+# define _tcsetattr(fd, ttmode) tcsetattr(fd, TCSANOW, ttmode)
+#elif defined(TIOCSETA)
 # define _tcsetattr(fd, ttmode) ioctl(fd, TIOCSETA, (char *)ttmode)
+#elif defined(TCSETS)
+# define _tcsetattr(fd, ttmode) ioctl(fd, TCSETS, (char *)ttmode)
 #else
-# if defined(_HPUX_SOURCE) || defined(__CYGWIN__)
-#  define _tcsetattr(fd, ttmode) tcsetattr(fd, TCSANOW, ttmode)
-# else
-#  define _tcsetattr(fd, ttmode) ioctl(fd, TCSETS, (char *)ttmode)
-# endif
+# error No method available to set terminal attributes
 #endif
 
 #include <QtCore>