Skip to content
Tcl Source Code View Ticket
Login

View Ticket

detection of the system's tty API is bad.

Closed / Fixed219405ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 05:12:31
OriginalBugID: 6316 Bug
Version: 8.3.1
SubmitDate: '2000-09-27'
LastModified: '2000-10-25'
Severity: LOW
Status: UnAssn
Submitter: techsupp
OS: Linux-SuSE
OSVersion: 7.0
Machine: PII/400
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'


Name:
Reinhard Max

Comments:
I assume that it is sufficient to look, if the respective header files
    exist instead of testing, if the APIs actually work at configuration
    time. This seems to be right for Linux, but I don't know if it is also
    true for other systems.

ReproducibleScript:
unix $ ./configure
[...]
checking termios vs. termio vs. sgtty... termios
[...]
unix $./configure </dev/null
[...]
checking termios vs. termio vs. sgtty... none
[...]

ObservedBehavior:
When unix/configure is called with stdin not being a tty the test wheather termios, termio or sgtty is availible fails and the "-mode" option to "fconfigure" isn't compiled in.

DesiredBehavior:
unix $ ./configure </dev/null
[...]
checking termios vs. termio vs. sgtty... termios
[...]

Patch:
--- unix/tcl.m4
+++ unix/tcl.m4 2000/09/13 09:53:43
@@ -1215,60 +1215,23 @@
 #--------------------------------------------------------------------

 AC_DEFUN(SC_SERIAL_PORT, [
-    AC_MSG_CHECKING([termios vs. termio vs. sgtty])

-    AC_TRY_RUN([
-#include <termios.h>
-
-main()
-{
-    struct termios t;
-    if (tcgetattr(0, &t) == 0) {
-       cfsetospeed(&t, 0);
-       t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
-       return 0;
-    }
-    return 1;
-}], tk_ok=termios, tk_ok=no, tk_ok=no)
+    AC_CHECK_HEADER(termios.h, tk_ok=termios, tk_ok=no)

     if test $tk_ok = termios; then
        AC_DEFINE(USE_TERMIOS)
     else
-       AC_TRY_RUN([
-#include <termio.h>
-
-main()
-{
-    struct termio t;
-    if (ioctl(0, TCGETA, &t) == 0) {
-       t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
-       return 0;
-    }
-    return 1;
-    }], tk_ok=termio, tk_ok=no, tk_ok=no)
+       AC_CHECK_HEADER(termio.h, tk_ok=termio, tk_ok=no)

     if test $tk_ok = termio; then
        AC_DEFINE(USE_TERMIO)
     else
-       AC_TRY_RUN([
-#include <sgtty.h>
-
-main()
-{
-    struct sgttyb t;
-    if (ioctl(0, TIOCGETP, &t) == 0) {
-       t.sg_ospeed = 0;
-       t.sg_flags |= ODDP | EVENP | RAW;
-       return 0;
-    }
-    return 1;
-}], tk_ok=sgtty, tk_ok=none, tk_ok=none)
+       AC_CHECK_HEADER(sgtty.h, tk_ok=sgtty, tk_ok=none)
     if test $tk_ok = sgtty; then
        AC_DEFINE(USE_SGTTY)
     fi
     fi
     fi
-    AC_MSG_RESULT($tk_ok)
 ])

PatchFiles:
unix/tcl.m4
dkfplain2000-11-19 18:33:11
I don't know what the consequences of doing this are.
rmaxplain2001-02-07 13:55:48
Submitted a hopefully better and more portable patch as patch #103639 and #102923..
dkf Ticket [219405ffff]: 1 change [History diff]2001-02-08 21:48:39
hobbs Ticket [219405ffff]: 1 change [History diff]2001-04-03 13:29:11
hobbsplain2001-04-05 05:14:14
Logged In: YES 
user_id=72656

Fixed in 8.4a3/8.3.3, see patch at 402923.
Log in (anonymous is fine) to add a comment.