This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Metaconfig documentation update (part 2)
[metaconfig.git] / dist-3.0at70b / mcon / U / i_sysioctl.U
CommitLineData
959f3c4c
JH
1?RCS: $Id: i_sysioctl.U,v 3.0.1.2 1994/05/06 15:04:57 ram Exp $
2?RCS:
3?RCS: Copyright (c) 1991-1993, Raphael Manfredi
4?RCS:
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 3.0.
10?RCS:
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
15?RCS:
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
18?RCS:
19?RCS: Revision 3.0 1993/08/18 12:08:32 ram
20?RCS: Baseline for dist 3.0 netwide release.
21?RCS:
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 $@ %<
25?S:i_sysioctl:
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
28?S: be included.
29?S:.
30?S:i_sysfilio:
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>.
34?S:.
35?S:i_bsdioctl:
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
38?S: be included.
39?S:.
40?S:i_syssockio:
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>.
44?S:.
45?S:d_voidtty:
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: decriptors and do a setpgrp().
50?S:.
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>.
54?C:.
55?C:I_SYS_FILIO:
56?C: This symbol, if defined, indicates that <sys/filio.h> exists and
57?C: should be included instead of <sys/ioctl.h>.
58?C:.
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.
63?C:.
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.
67?C:.
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: decriptors and do a setpgrp().
73?C:.
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 /**/
79?H:.
80?T:xxx
81: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
82?LINT:set i_sysfilio
83set sys/filio.h i_sysfilio
84eval $inhdr
85echo " "
86if $test `./findhdr sys/ioctl.h`; then
87 val="$define"
88 echo '<sys/ioctl.h> found.' >&4
89else
90 val="$undef"
91 if $test $i_sysfilio = "$define"; then
92 echo '<sys/ioctl.h> NOT found.' >&4
93 else
94 $test $i_sgtty = "$define" && xxx="sgtty.h"
95 $test $i_termio = "$define" && xxx="termio.h"
96 $test $i_termios = "$define" && xxx="termios.h"
97echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
98 fi
99fi
100?LINT:set i_sysioctl
101set i_sysioctl
102eval $setvar
103
104@if I_BSDIOCTL || i_bsdioctl
105?X:
106?X: The only machine I know where this inclusion was necessary is a
107?X: BULL DPX 5000 (a French machine).
108?X:
109: see if socket ioctl defs are in sys/bsdioctl or sys/ioctl
110echo " "
111xxx=`./findhdr sys/bsdioctl.h`
112if $test "$xxx"; then
113 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
114 val="$define"
115 echo "You have socket ioctls defined in <sys/bsdioctl.h>." >&4
116 else
117 val="$undef"
118 echo "No socket ioctls found in <sys/bsdioctl.h>." >&4
119 fi
120else
121 val="$undef"
122 echo "<sys/bsdioctl.h> not found, but that's ok." >&4
123fi
124?LINT:set i_bsdioctl
125set i_bsdioctl
126eval $setvar
127
128@end
129@if I_SYSSOCKIO || i_syssockio
130: see if socket ioctl defs are in sys/sockio.h
131echo " "
132xxx=`./findhdr sys/sockio.h`
133if $test "$xxx"; then
134 if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
135 val="$define"
136 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
137 else
138 val="$undef"
139 echo "No socket ioctls found in <sys/sockio.h>." >&4
140 fi
141else
142 val="$undef"
143@if I_BSDIOCTL
144 case "$i_bsdioctl" in
145 "$define") $cat <<EOM
146<sys/sockio.h> not found, using ioctls from <sys/bsdioctl.h>.
147EOM
148 ;;
149 *) $cat <<EOM
150<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
151EOM
152 ;;
153 esac
154@else
155 $cat <<EOM
156<sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
157EOM
158@end
159fi
160?LINT:set i_syssockio
161set i_syssockio
162eval $setvar
163
164@end
165@if VOIDTTY || d_voidtty
166: check how to void tty association
167echo " "
168case "$i_sysioctl" in
169"$define") xxx='sys/ioctl.h';;
170?X: otherwise $xxx was set during the determination of i_sysioctl, above.
171esac
172?X:
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...
175?X:
176$cat > tcio.c <<EOM
177#include <sys/types.h> /* Just in case */
178#include <$xxx>
179
15b97373 180int main()
959f3c4c
JH
181{
182#ifdef TIOCNOTTY
183 exit(0);
184#else
185 exit(1);
186#endif
187}
188EOM
189if ($cc -o tcio tcio.c && ./tcio) >/dev/null 2>&1; then
190 val="$define"
191 echo "TIOCNOTTY found in <$xxx>." >&4
192 echo "Using ioctl() call on /dev/tty to void tty association." >&4
193else
194 val="$undef"
195 echo "Closing standard file descriptors should void tty association." >&4
196fi
197?LINT:set d_voidtty
198set d_voidtty
199eval $setvar
200$rm -f tcio tcio.? core
201
202@end