changeset 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 09ef57c61b3b
children 91805d8ab62f
files configure.ac libgui/qterminal/libqterminal/unix/kpty.cpp
diffstat 2 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Sun Jan 12 12:41:39 2014 +0100
+++ b/configure.ac	Sun Jan 12 17:51:47 2014 -0500
@@ -2186,7 +2186,7 @@
 AC_CHECK_FUNCS([log1p log1pf pipe])
 AC_CHECK_FUNCS([realpath resolvepath roundl])
 AC_CHECK_FUNCS([select setgrent setpwent siglongjmp strsignal])
-AC_CHECK_FUNCS([tempnam tgammaf toascii])
+AC_CHECK_FUNCS([tcgetattr tcsetattr tempnam tgammaf toascii])
 AC_CHECK_FUNCS([umask waitpid])
 AC_CHECK_FUNCS([_kbhit])
 
--- 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>