diff options
Diffstat (limited to 'unix/tcl.m4')
-rw-r--r-- | unix/tcl.m4 | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/unix/tcl.m4 b/unix/tcl.m4 index e4587ea..0bef313 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1287,8 +1287,68 @@ main() } return 1; }], tk_ok=sgtty, tk_ok=none, tk_ok=none) + if test $tk_ok = sgtty; then AC_DEFINE(USE_SGTTY) + else + AC_TRY_RUN([ +#include <termios.h> +#include <errno.h> + +main() +{ + struct termios t; + if (tcgetattr(0, &t) == 0 + || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { + cfsetospeed(&t, 0); + t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB; + return 0; + } + return 1; +}], tk_ok=termios, tk_ok=no, tk_ok=no) + + if test $tk_ok = termios; then + AC_DEFINE(USE_TERMIOS) + else + AC_TRY_RUN([ +#include <termio.h> +#include <errno.h> + +main() +{ + struct termio t; + if (ioctl(0, TCGETA, &t) == 0 + || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { + t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB; + return 0; + } + return 1; + }], tk_ok=termio, tk_ok=no, tk_ok=no) + + if test $tk_ok = termio; then + AC_DEFINE(USE_TERMIO) + else + AC_TRY_RUN([ +#include <sgtty.h> +#include <errno.h> + +main() +{ + struct sgttyb t; + if (ioctl(0, TIOCGETP, &t) == 0 + || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { + t.sg_ospeed = 0; + t.sg_flags |= ODDP | EVENP | RAW; + return 0; + } + return 1; +}], tk_ok=sgtty, tk_ok=none, tk_ok=none) + + if test $tk_ok = sgtty; then + AC_DEFINE(USE_SGTTY) + fi + fi + fi fi fi fi |