This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[UTIL] Perl system does not default to $_
[metaconfig.git] / dist / U / d_fd_set.U
CommitLineData
33a01fd2 1?RCS: $Id$
d8875586
MBT
2?RCS:
3?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
4?RCS:
33a01fd2 5?RCS: You may redistribute only under the terms of the Artistic License,
d8875586
MBT
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
33a01fd2 8?RCS: that same Artistic License; a copy of which may be found at the root
d8875586
MBT
9?RCS: of the source tree for dist 4.0.
10?RCS:
11?RCS: $Log: d_fd_set.U,v $
12?RCS: Revision 3.0.1.3 1997/02/28 15:33:16 ram
13?RCS: patch61: added ?F: metalint hint
14?RCS:
15?RCS: Revision 3.0.1.2 1994/06/20 06:57:23 ram
16?RCS: patch30: extended scope for fd_set checks (ADO)
17?RCS:
18?RCS: Revision 3.0.1.1 1994/01/24 14:06:27 ram
19?RCS: patch16: comments for HAS_FD_* symbols were not consistent
20?RCS:
21?RCS: Revision 3.0 1993/08/18 12:06:02 ram
22?RCS: Baseline for dist 3.0 netwide release.
23?RCS:
24?MAKE:d_fd_set d_fd_macros d_fds_bits: cat +cc +ccflags rm Oldconfig \
25 d_socket i_systime i_sysselct
26?MAKE: -pick add $@ %<
27?S:d_fd_set:
28?S: This variable contains the eventual value of the HAS_FD_SET symbol,
29?S: which indicates if your C compiler knows about the fd_set typedef.
30?S:.
31?S:d_fd_macros:
32?S: This variable contains the eventual value of the HAS_FD_MACROS symbol,
33?S: which indicates if your C compiler knows about the macros which
34?S: manipulate an fd_set.
35?S:.
36?S:d_fds_bits:
37?S: This variable contains the eventual value of the HAS_FDS_BITS symbol,
38?S: which indicates if your fd_set typedef contains the fds_bits member.
39?S: If you have an fd_set typedef, but the dweebs who installed it did
40?S: a half-fast job and neglected to provide the macros to manipulate
41?S: an fd_set, HAS_FDS_BITS will let us know how to fix the gaffe.
42?S:.
43?C:HAS_FD_SET:
44?C: This symbol, when defined, indicates presence of the fd_set typedef
45?C: in <sys/types.h>
46?C:.
47?C:HAS_FD_MACROS:
48?C: This symbol, when defined, indicates presence of the macros used to
49?C: manipulate an fd_set.
50?C:.
51?C:HAS_FDS_BITS:
52?C: This symbol, when defined, indicates presence of the fds_bits member in
53?C: fd_set. This knowledge is useful if fd_set is available but the macros
54?C: aren't.
55?C:.
56?H:#$d_fd_set HAS_FD_SET /**/
57?H:#$d_fd_macros HAS_FD_MACROS /**/
58?H:#$d_fds_bits HAS_FDS_BITS /**/
59?H:.
60?F:!fd_set
61: check for fd_set items
62$cat <<EOM
63
64Checking to see how well your C compiler handles fd_set and friends ...
65EOM
66?X: The FD_SET macros can be in strange places. On some SysV-based
67?X: systems, they are in <sys/bsdtypes.h>, which is included (perhaps)
68?X: by <sys/socket.h>. We won't force people to include
69?X: <sys/bsdtypes.h> because it might introduce other
70?X: incompatibilities.
71$cat >fd_set.c <<EOCP
72#$i_systime I_SYS_TIME
73#$i_sysselct I_SYS_SELECT
74#$d_socket HAS_SOCKET
75#include <sys/types.h>
76#ifdef HAS_SOCKET
77#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
78#endif
79#ifdef I_SYS_TIME
80#include <sys/time.h>
81#endif
82#ifdef I_SYS_SELECT
83#include <sys/select.h>
84#endif
85int main() {
86 fd_set fds;
87
88#ifdef TRYBITS
89 if(fds.fds_bits);
90#endif
91
92#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
93 exit(0);
94#else
95 exit(1);
96#endif
97}
98EOCP
99if $cc $ccflags -DTRYBITS -o fd_set fd_set.c >fd_set.out 2>&1 ; then
100 d_fds_bits="$define"
101 d_fd_set="$define"
102 echo "Well, your system knows about the normal fd_set typedef..." >&4
103 if ./fd_set; then
104 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
105 d_fd_macros="$define"
106 else
107 $cat >&4 <<'EOM'
108but not the normal fd_set macros! Gaaack! I'll have to cover for you.
109EOM
110 d_fd_macros="$undef"
111 fi
112else
113 $cat <<'EOM'
114Hmm, your compiler has some difficulty with fd_set. Checking further...
115EOM
116 if $cc $ccflags -o fd_set fd_set.c >fd_set.out 2>&1 ; then
117 d_fds_bits="$undef"
118 d_fd_set="$define"
119 echo "Well, your system has some sort of fd_set available..." >&4
120 if ./fd_set; then
121 echo "and you have the normal fd_set macros." >&4
122 d_fd_macros="$define"
123 else
124 $cat <<'EOM'
125but not the normal fd_set macros! Gross! More work for me...
126EOM
127 d_fd_macros="$undef"
128 fi
129 else
130 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
131 d_fd_set="$undef"
132 d_fds_bits="$undef"
133 d_fd_macros="$undef"
134 fi
135fi
136$rm -f fd_set*
137
138