Commit | Line | Data |
---|---|---|
33a01fd2 | 1 | ?RCS: $Id$ |
d8875586 MBT |
2 | ?RCS: |
3 | ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi | |
cf39bd7e | 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 \ | |
7bfb7bd7 | 25 | d_socket i_systime i_sysselct i_syssock |
d8875586 MBT |
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 | ||
64 | Checking to see how well your C compiler handles fd_set and friends ... | |
65 | EOM | |
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 | |
7bfb7bd7 | 75 | #$i_syssock I_SYS_SOCKET |
d8875586 MBT |
76 | #include <sys/types.h> |
77 | #ifdef HAS_SOCKET | |
7bfb7bd7 | 78 | #ifdef I_SYS_SOCKET |
d8875586 MBT |
79 | #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */ |
80 | #endif | |
7bfb7bd7 | 81 | #endif |
d8875586 MBT |
82 | #ifdef I_SYS_TIME |
83 | #include <sys/time.h> | |
84 | #endif | |
85 | #ifdef I_SYS_SELECT | |
86 | #include <sys/select.h> | |
87 | #endif | |
88 | int main() { | |
89 | fd_set fds; | |
90 | ||
91 | #ifdef TRYBITS | |
92 | if(fds.fds_bits); | |
93 | #endif | |
94 | ||
95 | #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO) | |
96 | exit(0); | |
97 | #else | |
98 | exit(1); | |
99 | #endif | |
100 | } | |
101 | EOCP | |
102 | if $cc $ccflags -DTRYBITS -o fd_set fd_set.c >fd_set.out 2>&1 ; then | |
103 | d_fds_bits="$define" | |
104 | d_fd_set="$define" | |
105 | echo "Well, your system knows about the normal fd_set typedef..." >&4 | |
106 | if ./fd_set; then | |
107 | echo "and you have the normal fd_set macros (just as I'd expect)." >&4 | |
108 | d_fd_macros="$define" | |
109 | else | |
110 | $cat >&4 <<'EOM' | |
111 | but not the normal fd_set macros! Gaaack! I'll have to cover for you. | |
112 | EOM | |
113 | d_fd_macros="$undef" | |
114 | fi | |
115 | else | |
116 | $cat <<'EOM' | |
117 | Hmm, your compiler has some difficulty with fd_set. Checking further... | |
118 | EOM | |
119 | if $cc $ccflags -o fd_set fd_set.c >fd_set.out 2>&1 ; then | |
120 | d_fds_bits="$undef" | |
121 | d_fd_set="$define" | |
122 | echo "Well, your system has some sort of fd_set available..." >&4 | |
123 | if ./fd_set; then | |
124 | echo "and you have the normal fd_set macros." >&4 | |
125 | d_fd_macros="$define" | |
126 | else | |
127 | $cat <<'EOM' | |
128 | but not the normal fd_set macros! Gross! More work for me... | |
129 | EOM | |
130 | d_fd_macros="$undef" | |
131 | fi | |
132 | else | |
133 | echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4 | |
134 | d_fd_set="$undef" | |
135 | d_fds_bits="$undef" | |
136 | d_fd_macros="$undef" | |
137 | fi | |
138 | fi | |
139 | $rm -f fd_set* | |
140 | ||
141 |