[PATCH] alix2: correct h/w configuration
[openwrt.git] / tools / missing-macros / src / m4 / dnet.m4
1 # dnet.m4 serial 1 (libdnet-1.11)
2
3 dnl
4 dnl Check for 4.4 BSD sa_len member in sockaddr struct
5 dnl
6 dnl usage: AC_DNET_SOCKADDR_SA_LEN
7 dnl results: HAVE_SOCKADDR_SA_LEN (defined)
8 dnl
9 AC_DEFUN([AC_DNET_SOCKADDR_SA_LEN],
10 [AC_MSG_CHECKING(for sa_len in sockaddr struct)
11 AC_CACHE_VAL(ac_cv_dnet_sockaddr_has_sa_len,
12 AC_TRY_COMPILE([
13 # ifndef _SOCKADDR_LEN
14 # define _SOCKADDR_LEN 1
15 # endif
16 # include <sys/types.h>
17 # include <sys/socket.h>],
18 [u_int i = sizeof(((struct sockaddr *)0)->sa_len)],
19 ac_cv_dnet_sockaddr_has_sa_len=yes,
20 ac_cv_dnet_sockaddr_has_sa_len=no))
21 AC_MSG_RESULT($ac_cv_dnet_sockaddr_has_sa_len)
22 if test $ac_cv_dnet_sockaddr_has_sa_len = yes ; then
23 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1,
24 [Define if sockaddr struct has sa_len.])
25 fi])
26
27 dnl
28 dnl Check for sockaddr_in6 struct in <netinet/in.h>
29 dnl
30 dnl usage: AC_DNET_SOCKADDR_IN6
31 dnl results: HAVE_SOCKADDR_IN6
32 dnl
33 AC_DEFUN([AC_DNET_SOCKADDR_IN6],
34 [AC_MSG_CHECKING(for sockaddr_in6 struct in <netinet/in.h>)
35 AC_CACHE_VAL(ac_cv_dnet_netinet_in_h_has_sockaddr_in6,
36 AC_TRY_COMPILE([
37 # include <sys/types.h>
38 # include <sys/socket.h>
39 # include <netinet/in.h>],
40 [struct sockaddr_in6 sin6; sin6.sin6_family = AF_INET6;],
41 ac_cv_dnet_netinet_in_h_has_sockaddr_in6=yes,
42 ac_cv_dnet_netinet_in_h_has_sockaddr_in6=no))
43 AC_MSG_RESULT($ac_cv_dnet_netinet_in_h_has_sockaddr_in6)
44 if test $ac_cv_dnet_netinet_in_h_has_sockaddr_in6 = yes ; then
45 AC_DEFINE(HAVE_SOCKADDR_IN6, 1,
46 [Define if <netinet/in.h> has sockaddr_in6 struct.])
47 fi])
48
49 dnl
50 dnl Check for arp_dev member in arpreq struct
51 dnl
52 dnl usage: AC_DNET_ARPREQ_ARP_DEV
53 dnl results: HAVE_ARPREQ_ARP_DEV (defined)
54 dnl
55 AC_DEFUN([AC_DNET_ARPREQ_ARP_DEV],
56 [AC_MSG_CHECKING(for arp_dev in arpreq struct)
57 AC_CACHE_VAL(ac_cv_dnet_arpreq_has_arp_dev,
58 AC_TRY_COMPILE([
59 # include <sys/types.h>
60 # include <sys/socket.h>
61 # include <net/if_arp.h>],
62 [void *p = ((struct arpreq *)0)->arp_dev],
63 ac_cv_dnet_arpreq_has_arp_dev=yes,
64 ac_cv_dnet_arpreq_has_arp_dev=no))
65 AC_MSG_RESULT($ac_cv_dnet_arpreq_has_arp_dev)
66 if test $ac_cv_dnet_arpreq_has_arp_dev = yes ; then
67 AC_DEFINE(HAVE_ARPREQ_ARP_DEV, 1,
68 [Define if arpreq struct has arp_dev.])
69 fi])
70
71 dnl
72 dnl Check for rt_msghdr struct in <net/route.h>
73 dnl
74 dnl usage: AC_DNET_ROUTE_RT_MSGHDR
75 dnl results: HAVE_ROUTE_RT_MSGHDR
76 dnl
77 AC_DEFUN([AC_DNET_ROUTE_RT_MSGHDR],
78 [AC_MSG_CHECKING(for rt_msghdr struct in <net/route.h>)
79 AC_CACHE_VAL(ac_cv_dnet_route_h_has_rt_msghdr,
80 AC_TRY_COMPILE([
81 # include <sys/types.h>
82 # include <sys/socket.h>
83 # include <net/if.h>
84 # include <net/route.h>],
85 [struct rt_msghdr rtm; rtm.rtm_msglen = 0;],
86 ac_cv_dnet_route_h_has_rt_msghdr=yes,
87 ac_cv_dnet_route_h_has_rt_msghdr=no))
88 AC_MSG_RESULT($ac_cv_dnet_route_h_has_rt_msghdr)
89 if test $ac_cv_dnet_route_h_has_rt_msghdr = yes ; then
90 AC_DEFINE(HAVE_ROUTE_RT_MSGHDR, 1,
91 [Define if <net/route.h> has rt_msghdr struct.])
92 fi])
93
94 dnl
95 dnl Check for the Berkeley Packet Filter
96 dnl
97 dnl usage: AC_DNET_BSD_BPF
98 dnl results: HAVE_BSD_BPF
99 dnl
100 AC_DEFUN([AC_DNET_BSD_BPF],
101 [AC_MSG_CHECKING(for Berkeley Packet Filter)
102 AC_CACHE_VAL(ac_cv_dnet_bsd_bpf,
103 if test -c /dev/bpf0 ; then
104 ac_cv_dnet_bsd_bpf=yes
105 else
106 ac_cv_dnet_bsd_bpf=no
107 fi)
108 AC_MSG_RESULT($ac_cv_dnet_bsd_bpf)
109 if test $ac_cv_dnet_bsd_bpf = yes ; then
110 AC_DEFINE(HAVE_BSD_BPF, 1,
111 [Define if you have the Berkeley Packet Filter.])
112 fi])
113
114 dnl
115 dnl Check for the Linux /proc filesystem
116 dnl
117 dnl usage: AC_DNET_LINUX_PROCFS
118 dnl results: HAVE_LINUX_PROCFS
119 dnl
120 AC_DEFUN([AC_DNET_LINUX_PROCFS],
121 [AC_MSG_CHECKING(for Linux proc filesystem)
122 AC_CACHE_VAL(ac_cv_dnet_linux_procfs,
123 if test "x`cat /proc/sys/kernel/ostype 2>&-`" = "xLinux" ; then
124 ac_cv_dnet_linux_procfs=yes
125 else
126 ac_cv_dnet_linux_procfs=no
127 fi)
128 AC_MSG_RESULT($ac_cv_dnet_linux_procfs)
129 if test $ac_cv_dnet_linux_procfs = yes ; then
130 AC_DEFINE(HAVE_LINUX_PROCFS, 1,
131 [Define if you have the Linux /proc filesystem.])
132 fi])
133
134 dnl
135 dnl Check for Linux PF_PACKET sockets
136 dnl
137 dnl usage: AC_DNET_LINUX_PF_PACKET
138 dnl results: HAVE_LINUX_PF_PACKET
139 dnl
140 AC_DEFUN([AC_DNET_LINUX_PF_PACKET],
141 [AC_MSG_CHECKING(for Linux PF_PACKET sockets)
142 AC_CACHE_VAL(ac_cv_dnet_linux_pf_packet,
143 if test -f /usr/include/netpacket/packet.h ; then
144 ac_cv_dnet_linux_pf_packet=yes
145 else
146 ac_cv_dnet_linux_pf_packet=no
147 fi)
148 AC_MSG_RESULT($ac_cv_dnet_linux_pf_packet)
149 if test $ac_cv_dnet_linux_pf_packet = yes ; then
150 AC_DEFINE(HAVE_LINUX_PF_PACKET, 1,
151 [Define if you have Linux PF_PACKET sockets.])
152 fi])
153
154 dnl
155 dnl Check for SNMP MIB2 STREAMS (Solaris only?)
156 dnl
157 dnl usage: AC_DNET_STREAMS_MIB2
158 dnl results: HAVE_STREAMS_MIB2
159 dnl
160 AC_DEFUN([AC_DNET_STREAMS_MIB2],
161 [AC_MSG_CHECKING(for SNMP MIB2 STREAMS)
162 AC_CACHE_VAL(ac_cv_dnet_streams_mib2,
163 if test -f /usr/include/inet/mib2.h -a -c /dev/ip ; then
164 ac_cv_dnet_streams_mib2=yes
165 else
166 ac_cv_dnet_streams_mib2=no
167 fi)
168 AC_MSG_RESULT($ac_cv_dnet_streams_mib2)
169 if test $ac_cv_dnet_streams_mib2 = yes ; then
170 AC_DEFINE(HAVE_STREAMS_MIB2, 1,
171 [Define if you have SNMP MIB2 STREAMS.])
172 fi])
173
174 dnl
175 dnl Check for route(7) STREAMS (UnixWare only?)
176 dnl
177 dnl usage: AC_DNET_STREAMS_ROUTE
178 dnl results: HAVE_STREAMS_ROUTE
179 dnl
180 AC_DEFUN([AC_DNET_STREAMS_ROUTE],
181 [AC_MSG_CHECKING(for route(7) STREAMS)
182 AC_CACHE_VAL(ac_cv_dnet_streams_route,
183 if grep RTSTR_SEND /usr/include/net/route.h >/dev/null 2>&1 ; then
184 ac_cv_dnet_streams_route=yes
185 else
186 ac_cv_dnet_streams_route=no
187 fi)
188 AC_MSG_RESULT($ac_cv_dnet_streams_route)
189 if test $ac_cv_dnet_streams_route = yes ; then
190 AC_DEFINE(HAVE_STREAMS_ROUTE, 1,
191 [Define if you have route(7) STREAMS.])
192 fi])
193
194 dnl
195 dnl Check for arp(7) ioctls
196 dnl
197 dnl usage: AC_DNET_IOCTL_ARP
198 dnl results: HAVE_IOCTL_ARP
199 dnl
200 AC_DEFUN([AC_DNET_IOCTL_ARP],
201 [AC_MSG_CHECKING(for arp(7) ioctls)
202 AC_CACHE_VAL(ac_cv_dnet_ioctl_arp,
203 AC_EGREP_CPP(werd, [
204 # include <sys/types.h>
205 # define BSD_COMP
206 # include <sys/ioctl.h>
207 # ifdef SIOCGARP
208 werd
209 # endif],
210 ac_cv_dnet_ioctl_arp=yes,
211 ac_cv_dnet_ioctl_arp=no))
212 case "$host_os" in
213 irix*)
214 ac_cv_dnet_ioctl_arp=no ;;
215 esac
216 AC_MSG_RESULT($ac_cv_dnet_ioctl_arp)
217 if test $ac_cv_dnet_ioctl_arp = yes ; then
218 AC_DEFINE(HAVE_IOCTL_ARP, 1,
219 [Define if you have arp(7) ioctls.])
220 fi])
221
222 dnl
223 dnl Check for raw IP sockets ip_{len,off} host byte ordering
224 dnl
225 dnl usage: AC_DNET_RAWIP_HOST_OFFLEN
226 dnl results: HAVE_RAWIP_HOST_OFFLEN
227 dnl
228 AC_DEFUN([AC_DNET_RAWIP_HOST_OFFLEN],
229 [AC_MSG_CHECKING([for raw IP sockets ip_{len,off} host byte ordering])
230 AC_CACHE_VAL(ac_cv_dnet_rawip_host_offlen, [
231 case "$host_os" in
232 *openbsd*)
233 ac_cv_dnet_rawip_host_offlen=no ;;
234 *bsd*|*osf*|*unixware*)
235 ac_cv_dnet_rawip_host_offlen=yes ;;
236 *)
237 ac_cv_dnet_rawip_host_offlen=no ;;
238 esac])
239 AC_MSG_RESULT($ac_cv_dnet_rawip_host_offlen)
240 if test $ac_cv_dnet_rawip_host_offlen = yes ; then
241 AC_DEFINE(HAVE_RAWIP_HOST_OFFLEN, 1,
242 [Define if raw IP sockets require host byte ordering for ip_off, ip_len.])
243 fi])
244
245 dnl
246 dnl Check for cooked raw IP sockets
247 dnl
248 dnl usage: AC_DNET_RAWIP_COOKED
249 dnl results: HAVE_RAWIP_COOKED
250 dnl
251 AC_DEFUN([AC_DNET_RAWIP_COOKED],
252 [AC_MSG_CHECKING(for cooked raw IP sockets)
253 AC_CACHE_VAL(ac_cv_dnet_rawip_cooked, [
254 case "$host_os" in
255 solaris*|irix*)
256 ac_cv_dnet_rawip_cooked=yes ;;
257 *)
258 ac_cv_dnet_rawip_cooked=no ;;
259 esac])
260 AC_MSG_RESULT($ac_cv_dnet_rawip_cooked)
261 if test $ac_cv_dnet_rawip_cooked = yes ; then
262 AC_DEFINE(HAVE_RAWIP_COOKED, 1,
263 [Define if you have cooked raw IP sockets.])
264 fi])
265
266 dnl
267 dnl AC_LBL_LIBRARY_NET
268 dnl
269 dnl This test is for network applications that need socket() and
270 dnl gethostbyname() -ish functions. Under Solaris, those applications
271 dnl need to link with "-lsocket -lnsl". Under IRIX, they need to link
272 dnl with "-lnsl" but should *not* link with "-lsocket" because
273 dnl libsocket.a breaks a number of things (for instance:
274 dnl gethostbyname() under IRIX 5.2, and snoop sockets under most
275 dnl versions of IRIX).
276 dnl
277 dnl Unfortunately, many application developers are not aware of this,
278 dnl and mistakenly write tests that cause -lsocket to be used under
279 dnl IRIX. It is also easy to write tests that cause -lnsl to be used
280 dnl under operating systems where neither are necessary (or useful),
281 dnl such as SunOS 4.1.4, which uses -lnsl for TLI.
282 dnl
283 dnl This test exists so that every application developer does not test
284 dnl this in a different, and subtly broken fashion.
285
286 dnl It has been argued that this test should be broken up into two
287 dnl seperate tests, one for the resolver libraries, and one for the
288 dnl libraries necessary for using Sockets API. Unfortunately, the two
289 dnl are carefully intertwined and allowing the autoconf user to use
290 dnl them independantly potentially results in unfortunate ordering
291 dnl dependancies -- as such, such component macros would have to
292 dnl carefully use indirection and be aware if the other components were
293 dnl executed. Since other autoconf macros do not go to this trouble,
294 dnl and almost no applications use sockets without the resolver, this
295 dnl complexity has not been implemented.
296 dnl
297 dnl The check for libresolv is in case you are attempting to link
298 dnl statically and happen to have a libresolv.a lying around (and no
299 dnl libnsl.a).
300 dnl
301 AC_DEFUN([AC_LBL_LIBRARY_NET], [
302 # Most operating systems have gethostbyname() in the default searched
303 # libraries (i.e. libc):
304 AC_CHECK_FUNC(gethostbyname, ,
305 # Some OSes (eg. Solaris) place it in libnsl:
306 AC_CHECK_LIB(nsl, gethostbyname, ,
307 # Some strange OSes (SINIX) have it in libsocket:
308 AC_CHECK_LIB(socket, gethostbyname, ,
309 # Unfortunately libsocket sometimes depends on libnsl.
310 # AC_CHECK_LIB's API is essentially broken so the
311 # following ugliness is necessary:
312 AC_CHECK_LIB(socket, gethostbyname,
313 LIBS="-lsocket -lnsl $LIBS",
314 AC_CHECK_LIB(resolv, gethostbyname),
315 -lnsl))))
316 AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, ,
317 AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", ,
318 -lnsl)))
319 # DLPI needs putmsg under HPUX so test for -lstr while we're at it
320 AC_CHECK_LIB(str, putmsg)
321 ])
322
This page took 0.056477 seconds and 5 git commands to generate.