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 \
24 contains libc echo n c ar nm nm_opt nm_extract Inlibc Csym _a \
25 Compile cat rm 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 has the names of any libraries needed for socket support.
73 ?S: This variable has any cpp '-I' flags needed for socket support.
75 ?C:HAS_SOCKET (SOCKET):
76 ?C: This symbol, if defined, indicates that the BSD socket interface is
79 ?C:HAS_SOCKETPAIR (SOCKETPAIR):
80 ?C: This symbol, if defined, indicates that the BSD socketpair() call is
83 ?C:USE_OLDSOCKET (OLDSOCKET):
84 ?C: This symbol, if defined, indicates that the 4.1c BSD socket interface
85 ?C: is supported instead of the 4.2/4.3 BSD socket interface. For instance,
86 ?C: there is no setsockopt() call.
89 ?C: This symbol, if defined, indicates that the MSG_CTRUNC is supported.
90 ?C: Checking just with #ifdef might not be enough because this symbol
91 ?C: has been known to be an enum.
94 ?C: This symbol, if defined, indicates that the MSG_DONTROUTE 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_OOB 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_PEEK 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_PROXY 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 SCM_RIGHTS is supported.
115 ?C: Checking just with #ifdef might not be enough because this symbol
116 ?C: has been known to be an enum.
118 ?H:#$d_socket HAS_SOCKET /**/
119 ?H:#$d_sockpair HAS_SOCKETPAIR /**/
120 ?H:#$d_oldsock USE_OLDSOCKET /**/
121 ?H:#$d_msg_ctrunc HAS_MSG_CTRUNC /**/
122 ?H:#$d_msg_dontroute HAS_MSG_DONTROUTE /**/
123 ?H:#$d_msg_oob HAS_MSG_OOB /**/
124 ?H:#$d_msg_peek HAS_MSG_PEEK /**/
125 ?H:#$d_msg_proxy HAS_MSG_PROXY /**/
126 ?H:#$d_scm_rights HAS_SCM_RIGHTS /**/
131 ?LINT:set d_msg_ctrunc d_msg_dontroute d_msg_oob d_msg_peek d_msg_proxy
132 ?LINT:set d_scm_rights
135 : see whether socket exists
137 $echo $n "Hmm... $c" >&4
138 if set socket val -f d_socket; eval $csym; $val; then
139 echo "Looks like you have Berkeley networking support." >&4
141 ?X: now check for advanced features
142 if set setsockopt val -f; eval $csym; $val; then
145 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
149 ?X: HP-UX, for one, puts all the socket stuff in socklib.o. Note that if we
150 ?X: come here on HP-UX, then we must have used nm to get symbols, or we really
151 ?X: don't have sockets anyway...
152 if $contains socklib libc.list >/dev/null 2>&1; then
153 echo "Looks like you have Berkeley networking support." >&4
155 : we will have to assume that it supports the 4.2 BSD interface
158 echo "You don't have Berkeley networking in libc$_a..." >&4
159 ?X: look for optional networking libraries
160 if test "X$d_socket" = "X$define"; then
161 echo "...but you seem to believe that you have sockets." >&4
163 for net in net socket
165 if test -f /usr/lib/lib$net$_a; then
166 ?X: space between two '(' needed for ksh
167 ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \
168 $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
169 if $contains socket libc.list >/dev/null 2>&1; then
174 echo "...but the Wollongong group seems to have hacked it in." >&4
175 sockethdr="-I/usr/netinclude"
178 echo "Found Berkeley sockets interface in lib$net." >& 4
179 ?X: now check for advanced features
180 if $contains setsockopt libc.list >/dev/null 2>&1; then
183 echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
190 if test "X$d_socket" != "X$define"; then
191 echo "or anywhere else I see." >&4
199 @if HAS_SOCKETPAIR || d_sockpair
200 : see if socketpair exists
201 set socketpair d_sockpair
207 ?X: these constants are known to be troublesomely defined as enums
208 ?X: so that ifdef will not work for detecting their presence.
209 echo "Checking the availability of certain socket constants..." >& 4
210 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
211 enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
213 #include <sys/types.h>
214 #include <sys/socket.h>
220 set try; if eval $compile; then
223 set d_${enum}; eval $setvar