1 ?RCS: $Id: d_socket.U 1 2006-08-24 12:32:52Z rmanfredi $
3 ?RCS: Copyright (c) 1991-1997, 2004-2006, 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 4.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: contains libc \
22 echo n c nm_opt nm_extract Inlibc Csym _a
23 ?MAKE: -pick add $@ %<
25 ?S: This variable conditionally defines HAS_SOCKET, which indicates
26 ?S: that the BSD socket interface is supported.
29 ?S: This variable conditionally defines the HAS_SOCKETPAIR symbol, which
30 ?S: indicates that the BSD socketpair() is supported.
33 ?S: This variable conditionally defines the OLDSOCKET symbol, which
34 ?S: indicates that the BSD socket interface is based on 4.1c and not 4.2.
37 ?S: This variable has the names of any libraries needed for socket support.
40 ?S: This variable has any cpp -I flags needed for socket support.
42 ?C:HAS_SOCKET (SOCKET):
43 ?C: This symbol, if defined, indicates that the BSD socket interface is
46 ?C:HAS_SOCKETPAIR (SOCKETPAIR):
47 ?C: This symbol, if defined, indicates that the BSD socketpair() call is
50 ?C:USE_OLDSOCKET (OLDSOCKET):
51 ?C: This symbol, if defined, indicates that the 4.1c BSD socket interface
52 ?C: is supported instead of the 4.2/4.3 BSD socket interface. For instance,
53 ?C: there is no setsockopt() call.
55 ?H:#$d_socket HAS_SOCKET /**/
56 ?H:#$d_sockpair HAS_SOCKETPAIR /**/
57 ?H:#$d_oldsock USE_OLDSOCKET /**/
62 : see whether socket exists
66 $echo $n "Hmm... $c" >&4
67 if set socket val -f d_socket; eval $csym; $val; then
68 echo "Looks like you have Berkeley networking support." >&4
70 ?X: now check for advanced features
71 if set setsockopt val -f; eval $csym; $val; then
74 echo "...but it uses the old 4.1c interface, rather than 4.2" >&4
78 ?X: HP-UX, for one, puts all the socket stuff in socklib.o. Note that if we
79 ?X: come here on HP-UX, then we must have used nm to get symbols, or we really
80 ?X: don't have sockets anyway...
81 if $contains socklib libc.list >/dev/null 2>&1; then
82 echo "Looks like you have Berkeley networking support." >&4
84 : we will have to assume that it supports the 4.2 BSD interface
87 echo "You don't have Berkeley networking in libc$_a..." >&4
88 ?X: look for an optional networking library
89 if test -f /usr/lib/libnet$_a; then
90 ?X: space between two '(' needed for ksh
91 ( (nm $nm_opt /usr/lib/libnet$_a | eval $nm_extract) || \
92 ar t /usr/lib/libnet$_a) 2>/dev/null >> libc.list
93 if $contains socket libc.list >/dev/null 2>&1; then
94 echo "...but the Wollongong group seems to have hacked it in." >&4
96 sockethdr="-I/usr/netinclude"
98 ?X: now check for advanced features
99 if $contains setsockopt libc.list >/dev/null 2>&1; then
102 echo "...using the old 4.1c interface, rather than 4.2" >&4
106 echo "or even in libnet$_a, which is peculiar." >&4
111 echo "or anywhere else I see." >&4
118 @if HAS_SOCKETPAIR || d_sockpair
119 : see if socketpair exists
120 set socketpair d_sockpair