1 ?RCS: $Id: d_socket.U,v 3.0.1.2 1997/02/28 15:46:00 ram Exp $
3 ?RCS: Copyright (c) 1991-1993, 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 3.0.
11 ?RCS: $Log: d_socket.U,v $
12 ?RCS: Revision 3.0.1.2 1997/02/28 15:46:00 ram
13 ?RCS: patch61: replaced .a with $_a all over the place
15 ?RCS: Revision 3.0.1.1 1994/01/24 14:08:04 ram
16 ?RCS: patch16: can now safely declare private nm_extract in dependencies
18 ?RCS: Revision 3.0 1993/08/18 12:07:26 ram
19 ?RCS: Baseline for dist 3.0 netwide release.
21 ?MAKE:d_socket d_oldsock d_sockpair socketlib sockethdr \
22 d_msg_ctrunc d_msg_dontroute d_msg_oob d_msg_peek d_msg_proxy \
23 d_scm_rights d_sockaddr_sa_len: \
24 contains echo n c ar nm nm_opt nm_extract Inlibc Csym _a \
25 Compile cat rm_try Setvar Hasfield
26 ?MAKE: -pick add $@ %<
28 ?S: This variable conditionally defines HAS_SOCKET, which indicates
29 ?S: that the BSD socket interface is supported.
32 ?S: This variable conditionally defines the HAS_SOCKETPAIR symbol, which
33 ?S: indicates that the BSD socketpair() is supported.
36 ?S: This variable conditionally defines the OLDSOCKET symbol, which
37 ?S: indicates that the BSD socket interface is based on 4.1c and not 4.2.
40 ?S: This variable conditionally defines the HAS_MSG_CTRUNC symbol,
41 ?S: which indicates that the MSG_CTRUNC is available. #ifdef is
42 ?S: not enough because it may be an enum, glibc has been known to do this.
45 ?S: This variable conditionally defines the HAS_MSG_DONTROUTE symbol,
46 ?S: which indicates that the MSG_DONTROUTE is available. #ifdef is
47 ?S: not enough because it may be an enum, glibc has been known to do this.
50 ?S: This variable conditionally defines the HAS_MSG_OOB symbol,
51 ?S: which indicates that the MSG_OOB is available. #ifdef is
52 ?S: not enough because it may be an enum, glibc has been known to do this.
55 ?S: This variable conditionally defines the HAS_MSG_PEEK symbol,
56 ?S: which indicates that the MSG_PEEK is available. #ifdef is
57 ?S: not enough because it may be an enum, glibc has been known to do this.
60 ?S: This variable conditionally defines the HAS_MSG_PROXY symbol,
61 ?S: which indicates that the MSG_PROXY is available. #ifdef is
62 ?S: not enough because it may be an enum, glibc has been known to do this.
65 ?S: This variable conditionally defines the HAS_SCM_RIGHTS symbol,
66 ?S: which indicates that the SCM_RIGHTS is available. #ifdef is
67 ?S: not enough because it may be an enum, glibc has been known to do this.
70 ?S: This variable conditionally defines the HAS_SOCKADDR_SA_LEN symbol,
71 ?S: which indicates that a struct sockaddr structure has the sa_len
75 ?S: This variable has the names of any libraries needed for socket support.
78 ?S: This variable has any cpp '-I' flags needed for socket support.
80 ?C:HAS_SOCKET (SOCKET):
81 ?C: This symbol, if defined, indicates that the BSD socket interface is
84 ?C:HAS_SOCKETPAIR (SOCKETPAIR):
85 ?C: This symbol, if defined, indicates that the BSD socketpair() call is
88 ?C:USE_OLDSOCKET (OLDSOCKET):
89 ?C: This symbol, if defined, indicates that the 4.1c BSD socket interface
90 ?C: is supported instead of the 4.2/4.3 BSD socket interface. For instance,
91 ?C: there is no setsockopt() call.
94 ?C: This symbol, if defined, indicates that the MSG_CTRUNC is supported.
95 ?C: Checking just with #ifdef might not be enough because this symbol
96 ?C: has been known to be an enum.
99 ?C: This symbol, if defined, indicates that the MSG_DONTROUTE is supported.
100 ?C: Checking just with #ifdef might not be enough because this symbol
101 ?C: has been known to be an enum.
104 ?C: This symbol, if defined, indicates that the MSG_OOB is supported.
105 ?C: Checking just with #ifdef might not be enough because this symbol
106 ?C: has been known to be an enum.
109 ?C: This symbol, if defined, indicates that the MSG_PEEK is supported.
110 ?C: Checking just with #ifdef might not be enough because this symbol
111 ?C: has been known to be an enum.
114 ?C: This symbol, if defined, indicates that the MSG_PROXY is supported.
115 ?C: Checking just with #ifdef might not be enough because this symbol
116 ?C: has been known to be an enum.
119 ?C: This symbol, if defined, indicates that the SCM_RIGHTS is supported.
120 ?C: Checking just with #ifdef might not be enough because this symbol
121 ?C: has been known to be an enum.
123 ?C:HAS_SOCKADDR_SA_LEN:
124 ?C: This symbol, if defined, indicates that the struct sockaddr
125 ?C: structure has a member called sa_len, indicating the length of
128 ?H:#$d_socket HAS_SOCKET /**/
129 ?H:#$d_sockpair HAS_SOCKETPAIR /**/
130 ?H:#$d_sockaddr_sa_len HAS_SOCKADDR_SA_LEN /**/
131 ?H:#$d_oldsock USE_OLDSOCKET /**/
132 ?H:#$d_msg_ctrunc HAS_MSG_CTRUNC /**/
133 ?H:#$d_msg_dontroute HAS_MSG_DONTROUTE /**/
134 ?H:#$d_msg_oob HAS_MSG_OOB /**/
135 ?H:#$d_msg_peek HAS_MSG_PEEK /**/
136 ?H:#$d_msg_proxy HAS_MSG_PROXY /**/
137 ?H:#$d_scm_rights HAS_SCM_RIGHTS /**/
141 ?LINT:set d_sockpair d_sockaddr_sa_len
142 ?LINT:set d_msg_ctrunc d_msg_dontroute d_msg_oob d_msg_peek d_msg_proxy
143 ?LINT:set d_scm_rights
144 : see whether socket exists
148 $echo $n "Hmm... $c" >&4
149 if set socket val -f d_socket; eval $csym; $val; then
150 echo "Looks like you have Berkeley networking support." >&4
152 ?X: now check for advanced features
153 if set setsockopt val -f; eval $csym; $val; then
156 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
160 ?X: HP-UX, for one, puts all the socket stuff in socklib.o. Note that if we
161 ?X: come here on HP-UX, then we must have used nm to get symbols, or we really
162 ?X: don't have sockets anyway...
163 if $contains socklib libc.list >/dev/null 2>&1; then
164 echo "Looks like you have Berkeley networking support." >&4
166 : we will have to assume that it supports the 4.2 BSD interface
169 echo "You don't have Berkeley networking in libc$_a..." >&4
170 ?X: look for optional networking libraries
171 if test "X$d_socket" = "X$define"; then
172 echo "...but you seem to believe that you have sockets." >&4
174 for net in net socket
176 if test -f /usr/lib/lib$net$_a; then
177 ?X: space between two '(' needed for ksh
178 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
179 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
180 if $contains socket libc.list >/dev/null 2>&1; then
185 echo "...but the Wollongong group seems to have hacked it in." >&4
186 sockethdr="-I/usr/netinclude"
189 echo "Found Berkeley sockets interface in lib$net." >&4
190 ?X: now check for advanced features
191 if $contains setsockopt libc.list >/dev/null 2>&1; then
194 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
201 if test "X$d_socket" != "X$define"; then
202 echo "or anywhere else I see." >&4
210 @if HAS_SOCKETPAIR || d_sockpair
211 : see if socketpair exists
212 set socketpair d_sockpair
219 echo "Checking the availability sa_len in the sock struct ..." >&4
221 #include <sys/types.h>
222 #include <sys/socket.h>
229 set try; if eval $compile; then
232 set d_sockaddr_sa_len; eval $setvar
236 ?X: these constants are known to be troublesomely defined as enums
237 ?X: so that ifdef will not work for detecting their presence.
238 echo "Checking the availability of certain socket constants..." >&4
239 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
240 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
242 #include <sys/types.h>
243 #include <sys/socket.h>
249 set try; if eval $compile; then
252 set d_${enum}; eval $setvar