1 ?RCS: $Id: i_sysioctl.U 1 2006-08-24 12:32:52Z rmanfredi $
3 ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 4.0.
11 ?RCS: $Log: i_sysioctl.U,v $
12 ?RCS: Revision 3.0.1.2 1994/05/06 15:04:57 ram
13 ?RCS: patch23: added knowledge for <sys/filio.h> (WED)
14 ?RCS: patch23: optimized amount of findhdr calls
16 ?RCS: Revision 3.0.1.1 1993/11/10 17:36:09 ram
17 ?RCS: patch14: now use a compiler check for TIOCNOTTY because of HP-UX 9.x
19 ?RCS: Revision 3.0 1993/08/18 12:08:32 ram
20 ?RCS: Baseline for dist 3.0 netwide release.
22 ?MAKE:i_sysioctl i_bsdioctl i_sysfilio i_syssockio d_voidtty: test contains \
23 cat i_termio i_termios i_sgtty Setvar Findhdr +cc rm Inhdr
24 ?MAKE: -pick add $@ %<
26 ?S: This variable conditionally defines the I_SYS_IOCTL symbol, which
27 ?S: indicates to the C program that <sys/ioctl.h> exists and should
31 ?S: This variable conditionally defines the I_SYS_FILIO symbol, which
32 ?S: indicates to the C program that <sys/filio.h> exists and should
33 ?S: be included in preference to <sys/ioctl.h>.
36 ?S: This variable conditionally defines the I_SYS_BSDIOCTL symbol, which
37 ?S: indicates to the C program that <sys/bsdioctl.h> exists and should
41 ?S: This variable conditionally defines I_SYS_SOCKIO to indicate to the
42 ?S: C program that socket ioctl codes may be found in <sys/sockio.h>
43 ?S: instead of <sys/ioctl.h>.
46 ?S: This variable conditionally defines USE_IOCNOTTY to indicate that the
47 ?S: ioctl() call with TIOCNOTTY should be used to void tty association.
48 ?S: Otherwise (on USG probably), it is enough to close the standard file
49 ?S: descriptors and do a setpgrp().
51 ?C:I_SYS_IOCTL (I_SYSIOCTL):
52 ?C: This symbol, if defined, indicates that <sys/ioctl.h> exists and should
53 ?C: be included. Otherwise, include <sgtty.h> or <termio.h>.
56 ?C: This symbol, if defined, indicates that <sys/filio.h> exists and
57 ?C: should be included instead of <sys/ioctl.h>.
59 ?C:I_SYS_BSDIOCTL (I_BSDIOCTL):
60 ?C: This symbol, if defined, indicates that <sys/bsdioctl.h> exists and should
61 ?C: be included. Otherwise, try <sys/ioctl.h>. This is primarly intended for
62 ?C: definitions of sockets options, like SIOCATMARK.
64 ?C:I_SYS_SOCKIO (I_SYSSOCKIO):
65 ?C: This symbol, if defined, indicates the <sys/sockio.h> should be included
66 ?C: to get socket ioctl options, like SIOCATMARK.
68 ?C:USE_TIOCNOTTY (VOIDTTY):
69 ?C: This symbol, if defined indicate to the C program that the ioctl()
70 ?C: call with TIOCNOTTY should be used to void tty association.
71 ?C: Otherwise (on USG probably), it is enough to close the standard file
72 ?C: descriptors and do a setpgrp().
74 ?H:#$i_sysioctl I_SYS_IOCTL /**/
75 ?H:#$i_sysfilio I_SYS_FILIO /**/
76 ?H:#$i_bsdioctl I_SYS_BSDIOCTL /**/
77 ?H:#$i_syssockio I_SYS_SOCKIO /**/
78 ?H:#$d_voidtty USE_TIOCNOTTY /**/
81 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
83 set sys/filio.h i_sysfilio
86 if $test `./findhdr sys/ioctl.h`; then
88 echo '<sys/ioctl.h> found.' >&4
91 if $test $i_sysfilio = "$define"; then
92 echo '<sys/ioctl.h> NOT found.' >&4
94 $test $i_sgtty = "$define" && xxx="sgtty.h"
95 $test $i_termio = "$define" && xxx="termio.h"
96 $test $i_termios = "$define" && xxx="termios.h"
97 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
104 @if I_BSDIOCTL || i_bsdioctl
106 ?X: The only machine I know where this inclusion was necessary is a
107 ?X: BULL DPX 5000 (a French machine).
109 : see if socket ioctl defs are in sys/bsdioctl or sys/ioctl
111 xxx=`./findhdr sys/bsdioctl.h`
112 if $test "$xxx"; then
113 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
115 echo "You have socket ioctls defined in <sys/bsdioctl.h>." >&4
118 echo "No socket ioctls found in <sys/bsdioctl.h>." >&4
122 echo "<sys/bsdioctl.h> not found, but that's ok." >&4
129 @if I_SYSSOCKIO || i_syssockio
130 : see if socket ioctl defs are in sys/sockio.h
132 xxx=`./findhdr sys/sockio.h`
133 if $test "$xxx"; then
134 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
136 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
139 echo "No socket ioctls found in <sys/sockio.h>." >&4
144 case "$i_bsdioctl" in
145 "$define") $cat <<EOM
146 <sys/sockio.h> not found, using ioctls from <sys/bsdioctl.h>.
150 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
156 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
160 ?LINT:set i_syssockio
165 @if VOIDTTY || d_voidtty
166 : check how to void tty association
168 case "$i_sysioctl" in
169 "$define") xxx='sys/ioctl.h';;
170 ?X: otherwise $xxx was set during the determination of i_sysioctl, above.
173 ?X: Can't use $contains here since HP-UX 9.x has TIOCNOTTY between a pair
174 ?X: of #ifdef/#endif and is never actually defined. Oh well...
177 #include <sys/types.h> /* Just in case */
189 if ($cc -o tcio tcio.c && ./tcio) >/dev/null 2>&1; then
191 echo "TIOCNOTTY found in <$xxx>." >&4
192 echo "Using ioctl() call on /dev/tty to void tty association." >&4
195 echo "Closing standard file descriptors should void tty association." >&4
200 $rm -f tcio tcio.? core