2
dnl Copyright (C) 1993-2003 Free Software Foundation, Inc.
3
dnl This file is free software, distributed under the terms of the GNU
4
dnl General Public License. As a special exception to the GNU General
5
dnl Public License, this file may be distributed as part of a program
6
dnl that contains a configuration script generated by Autoconf, under
7
dnl the same distribution terms as the rest of that program.
9
dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
14
[AC_CHECK_HEADERS(termios.h termio.h sys/termio.h sgtty.h)dnl
15
if test $ac_cv_header_termios_h = yes; then
16
dnl HAVE_TERMIOS_H defined
17
AC_CHECK_FUNCS(tcgetattr tcflow)dnl
19
AC_CHECK_HEADERS(sys/stream.h sys/ptem.h)dnl
23
#include <sys/types.h>
26
#if defined(HAVE_TERMIOS_H) && defined(HAVE_TCGETATTR) && defined(HAVE_TCFLOW)
29
#if defined(HAVE_TERMIO_H) || defined(HAVE_SYS_TERMIO_H)
30
#ifdef HAVE_SYS_TERMIO_H
31
#include <sys/termio.h>
37
#include <sys/ioctl.h>
40
#ifdef HAVE_SYS_STREAM_H
41
#include <sys/stream.h>
43
#ifdef HAVE_SYS_PTEM_H
47
ioctl_prog='int x = FIONREAD;'
48
CL_COMPILE_CHECK([FIONREAD], cl_cv_decl_FIONREAD_termio_h,
49
$ioctl_decl, $ioctl_prog, ioctl_ok=1)dnl
50
if test -z "$ioctl_ok"; then
51
CL_COMPILE_CHECK([FIONREAD in sys/filio.h], cl_cv_decl_FIONREAD_sys_filio_h,
52
$ioctl_decl[#include <sys/filio.h>], $ioctl_prog,
53
AC_DEFINE(NEED_SYS_FILIO_H,,[need <sys/filio.h> for using ioctl FIONREAD])
56
if test -z "$ioctl_ok"; then
57
CL_COMPILE_CHECK([FIONREAD in sys/ioctl.h], cl_cv_decl_FIONREAD_sys_ioctl_h,
58
$ioctl_decl[#include <sys/ioctl.h>], $ioctl_prog,
59
AC_DEFINE(NEED_SYS_IOCTL_H,,[need <sys/ioctl.h> for using ioctl FIONREAD])
65
[AC_BEFORE([$0], [CL_IOCTL])
66
AC_CHECK_HEADERS(termios.h termio.h sys/termio.h sgtty.h)dnl
67
if test $ac_cv_header_termios_h = yes; then
68
dnl HAVE_TERMIOS_H defined
69
dnl A/UX has <termios.h> but is lacking tcgetattr etc.
70
CL_LINK_CHECK([tcgetattr], cl_cv_func_tcgetattr,
71
[#include <termios.h>], [struct termios t; tcgetattr(0,&t);],
72
AC_DEFINE(HAVE_TCGETATTR,,[have tcgetattr(), either as a function or as a macro defined by <termios.h>]))dnl
73
CL_LINK_CHECK([TCSAFLUSH in termios.h], cl_cv_decl_TCSAFLUSH,
74
[#include <termios.h>], [int x = TCSAFLUSH;],
75
AC_DEFINE(HAVE_TCSAFLUSH,,[<termios.h> defines TCSAFLUSH]))dnl
76
dnl Linux libc5 defines struct winsize in <termios.h>, <termio.h>, <sys/ioctl.h>.
77
dnl Linux libc6 defines struct winsize in <termio.h>, <sys/ioctl.h>.
78
dnl Since we don't want to include both <termios.h> and <termio.h> (they may
79
dnl conflict), prefer <sys/ioctl.h> to <termio.h>.
80
dnl SCO defines struct winsize in <sys/ptem.h>, which itself needs <sys/stream.h>.
81
CL_COMPILE_CHECK([struct winsize in termios.h], cl_cv_struct_winsize,
82
[#include <termios.h>], [struct winsize w;], )dnl
83
if test $cl_cv_struct_winsize = no; then
84
CL_COMPILE_CHECK([struct winsize in sys/ioctl.h], cl_cv_struct_winsize_ioctl,
85
[#include <sys/types.h>
86
#include <sys/ioctl.h>],
87
[struct winsize w;], AC_DEFINE(WINSIZE_NEED_SYS_IOCTL_H,,[have <termios.h> but need <sys/ioctl.h> for `struct winsize']))dnl
88
if test $cl_cv_struct_winsize_ioctl = no; then
89
CL_COMPILE_CHECK([struct winsize in sys/ptem.h], cl_cv_struct_winsize_ptem,
90
[#include <sys/types.h>
91
#include <sys/stream.h>
92
#include <sys/ptem.h>],
93
[struct winsize w;], AC_DEFINE(WINSIZE_NEED_SYS_PTEM_H,,[have <termios.h> but need <sys/ptem.h> for `struct winsize']))dnl