~ubuntu-branches/debian/squeeze/ffcall/squeeze

« back to all changes in this revision

Viewing changes to src/m4/termios.m4

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Egger
  • Date: 2010-06-26 15:29:30 UTC
  • mfrom: (5.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20100626152930-c09y01gk3szcnykn
Tags: 1.10+cvs20100619-2
Ship to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
dnl -*- Autoconf -*-
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.
8
 
 
9
 
dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
10
 
 
11
 
AC_PREREQ(2.57)
12
 
 
13
 
AC_DEFUN([RL_TERM],
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
18
 
fi
19
 
AC_CHECK_HEADERS(sys/stream.h sys/ptem.h)dnl
20
 
ioctl_decl='
21
 
#include <stdlib.h>
22
 
#ifdef HAVE_UNISTD_H
23
 
#include <sys/types.h>
24
 
#include <unistd.h>
25
 
#endif
26
 
#if defined(HAVE_TERMIOS_H) && defined(HAVE_TCGETATTR) && defined(HAVE_TCFLOW)
27
 
#include <termios.h>
28
 
#else
29
 
#if defined(HAVE_TERMIO_H) || defined(HAVE_SYS_TERMIO_H)
30
 
#ifdef HAVE_SYS_TERMIO_H
31
 
#include <sys/termio.h>
32
 
#else
33
 
#include <termio.h>
34
 
#endif
35
 
#else
36
 
#include <sgtty.h>
37
 
#include <sys/ioctl.h>
38
 
#endif
39
 
#endif
40
 
#ifdef HAVE_SYS_STREAM_H
41
 
#include <sys/stream.h>
42
 
#endif
43
 
#ifdef HAVE_SYS_PTEM_H
44
 
#include <sys/ptem.h>
45
 
#endif
46
 
'
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])
54
 
ioctl_ok=1)dnl
55
 
fi
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])
60
 
ioctl_ok=1)dnl
61
 
fi
62
 
])
63
 
 
64
 
AC_DEFUN([CL_TERM],
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
94
 
fi
95
 
fi
96
 
fi
97
 
])