Commit | Line | Data |
---|---|---|
d8875586 MBT |
1 | ?RCS: $Id: d_socket.U 1 2006-08-24 12:32:52Z rmanfredi $ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi | |
4 | ?RCS: | |
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. | |
10 | ?RCS: | |
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 | |
14 | ?RCS: | |
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 | |
17 | ?RCS: | |
18 | ?RCS: Revision 3.0 1993/08/18 12:07:26 ram | |
19 | ?RCS: Baseline for dist 3.0 netwide release. | |
20 | ?RCS: | |
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 $@ %< | |
24 | ?S:d_socket: | |
25 | ?S: This variable conditionally defines HAS_SOCKET, which indicates | |
26 | ?S: that the BSD socket interface is supported. | |
27 | ?S:. | |
28 | ?S:d_sockpair: | |
29 | ?S: This variable conditionally defines the HAS_SOCKETPAIR symbol, which | |
30 | ?S: indicates that the BSD socketpair() is supported. | |
31 | ?S:. | |
32 | ?S:d_oldsock: | |
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. | |
35 | ?S:. | |
36 | ?S:socketlib: | |
37 | ?S: This variable has the names of any libraries needed for socket support. | |
38 | ?S:. | |
39 | ?S:sockethdr: | |
40 | ?S: This variable has any cpp -I flags needed for socket support. | |
41 | ?S:. | |
42 | ?C:HAS_SOCKET (SOCKET): | |
43 | ?C: This symbol, if defined, indicates that the BSD socket interface is | |
44 | ?C: supported. | |
45 | ?C:. | |
46 | ?C:HAS_SOCKETPAIR (SOCKETPAIR): | |
47 | ?C: This symbol, if defined, indicates that the BSD socketpair() call is | |
48 | ?C: supported. | |
49 | ?C:. | |
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. | |
54 | ?C:. | |
55 | ?H:#$d_socket HAS_SOCKET /**/ | |
56 | ?H:#$d_sockpair HAS_SOCKETPAIR /**/ | |
57 | ?H:#$d_oldsock USE_OLDSOCKET /**/ | |
58 | ?H:. | |
59 | ?T:val | |
60 | ?LINT:use libc | |
61 | ?LINT:set d_sockpair | |
62 | : see whether socket exists | |
63 | socketlib='' | |
64 | sockethdr='' | |
65 | echo " " | |
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 | |
69 | d_socket="$define" | |
70 | ?X: now check for advanced features | |
71 | if set setsockopt val -f; eval $csym; $val; then | |
72 | d_oldsock="$undef" | |
73 | else | |
74 | echo "...but it uses the old 4.1c interface, rather than 4.2" >&4 | |
75 | d_oldsock="$define" | |
76 | fi | |
77 | else | |
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 | |
83 | d_socket="$define" | |
84 | : we will have to assume that it supports the 4.2 BSD interface | |
85 | d_oldsock="$undef" | |
86 | else | |
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 | |
95 | socketlib="-lnet" | |
96 | sockethdr="-I/usr/netinclude" | |
97 | d_socket="$define" | |
98 | ?X: now check for advanced features | |
99 | if $contains setsockopt libc.list >/dev/null 2>&1; then | |
100 | d_oldsock="$undef" | |
101 | else | |
102 | echo "...using the old 4.1c interface, rather than 4.2" >&4 | |
103 | d_oldsock="$define" | |
104 | fi | |
105 | else | |
106 | echo "or even in libnet$_a, which is peculiar." >&4 | |
107 | d_socket="$undef" | |
108 | d_oldsock="$undef" | |
109 | fi | |
110 | else | |
111 | echo "or anywhere else I see." >&4 | |
112 | d_socket="$undef" | |
113 | d_oldsock="$undef" | |
114 | fi | |
115 | fi | |
116 | fi | |
117 | ||
118 | @if HAS_SOCKETPAIR || d_sockpair | |
119 | : see if socketpair exists | |
120 | set socketpair d_sockpair | |
121 | eval $inlibc | |
122 | ||
123 | @end |