]> The Tcpdump Group git mirrors - libpcap/blob - configure.ac
Add netmap support.
[libpcap] / configure.ac
1 dnl
2 dnl Copyright (c) 1994, 1995, 1996, 1997
3 dnl The Regents of the University of California. All rights reserved.
4 dnl
5 dnl Process this file with autoconf to produce a configure script.
6 dnl
7
8 #
9 # See
10 #
11 # http://ftp.gnu.org/gnu/config/README
12 #
13 # for the URLs to use to fetch new versions of config.guess and
14 # config.sub.
15 #
16
17 AC_PREREQ(2.61)
18 AC_INIT(pcap.c)
19
20 AC_CANONICAL_SYSTEM
21
22 AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
23 AC_PROG_CC
24 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
25 AC_LBL_SHLIBS_INIT
26 AC_LBL_C_INLINE
27 AC_C___ATTRIBUTE__
28 if test "$ac_cv___attribute__" = "yes"; then
29 AC_C___ATTRIBUTE___UNUSED
30 fi
31
32 AC_CHECK_HEADERS(sys/bitypes.h)
33
34 AC_CHECK_TYPE([int8_t], ,
35 [AC_DEFINE([int8_t], [signed char],
36 [Define to `signed char' if int8_t not defined.])],
37 [AC_INCLUDES_DEFAULT
38 #ifdef HAVE_SYS_BITYPES_H
39 #include <sys/bitypes.h>
40 #endif])
41 AC_CHECK_TYPE([u_int8_t], ,
42 [AC_DEFINE([u_int8_t], [unsigned char],
43 [Define to `unsigned char' if u_int8_t not defined.])],
44 [AC_INCLUDES_DEFAULT
45 #ifdef HAVE_SYS_BITYPES_H
46 #include <sys/bitypes.h>
47 #endif])
48 AC_CHECK_TYPE([int16_t], ,
49 [AC_DEFINE([int16_t], [short],
50 [Define to `short' if int16_t not defined.])]
51 [AC_INCLUDES_DEFAULT
52 #ifdef HAVE_SYS_BITYPES_H
53 #include <sys/bitypes.h>
54 #endif])
55 AC_CHECK_TYPE([u_int16_t], ,
56 [AC_DEFINE([u_int16_t], [unsigned short],
57 [Define to `unsigned short' if u_int16_t not defined.])],
58 [AC_INCLUDES_DEFAULT
59 #ifdef HAVE_SYS_BITYPES_H
60 #include <sys/bitypes.h>
61 #endif])
62 AC_CHECK_TYPE([int32_t], ,
63 [AC_DEFINE([int32_t], [int],
64 [Define to `int' if int32_t not defined.])],
65 [AC_INCLUDES_DEFAULT
66 #ifdef HAVE_SYS_BITYPES_H
67 #include <sys/bitypes.h>
68 #endif])
69 AC_CHECK_TYPE([u_int32_t], ,
70 [AC_DEFINE([u_int32_t], [unsigned int],
71 [Define to `unsigned int' if u_int32_t not defined.])],
72 [AC_INCLUDES_DEFAULT
73 #ifdef HAVE_SYS_BITYPES_H
74 #include <sys/bitypes.h>
75 #endif])
76 AC_CHECK_TYPE([int64_t], ,
77 [AC_DEFINE([int64_t], [long long],
78 [Define to `long long' if int64_t not defined.])],
79 [AC_INCLUDES_DEFAULT
80 #ifdef HAVE_SYS_BITYPES_H
81 #include <sys/bitypes.h>
82 #endif])
83 AC_CHECK_TYPE([u_int64_t], ,
84 [AC_DEFINE([u_int64_t], [unsigned long long],
85 [Define to `unsigned long long' if u_int64_t not defined.])],
86 [AC_INCLUDES_DEFAULT
87 #ifdef HAVE_SYS_BITYPES_H
88 #include <sys/bitypes.h>
89 #endif])
90
91 #
92 # Try to arrange for large file support.
93 #
94 AC_SYS_LARGEFILE
95 AC_FUNC_FSEEKO
96
97 dnl
98 dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to
99 dnl include <sys/ioccom.h>, and we were to drop support for older
100 dnl releases without that fix, so that pcap-bpf.c doesn't need to
101 dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES"
102 dnl in "aclocal.m4" uses it, so we would still have to test for it
103 dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
104 dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris.
105 dnl
106 AC_CHECK_HEADERS(sys/ioccom.h sys/select.h sys/sockio.h limits.h)
107 AC_CHECK_HEADERS(linux/types.h)
108 AC_CHECK_HEADERS(linux/if_packet.h netpacket/packet.h netpacket/if_packet.h)
109 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
110 #include <sys/socket.h>
111 #include <net/if.h>])
112 if test "$ac_cv_header_net_pfvar_h" = yes; then
113 #
114 # Check for various PF actions.
115 #
116 AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR)
117 AC_TRY_COMPILE(
118 [#include <sys/types.h>
119 #include <sys/socket.h>
120 #include <net/if.h>
121 #include <net/pfvar.h>],
122 [return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;],
123 [
124 AC_MSG_RESULT(yes)
125 AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1,
126 [define if net/pfvar.h defines PF_NAT through PF_NORDR])
127 ],
128 AC_MSG_RESULT(no))
129 fi
130 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
131 #include <sys/socket.h>])
132 if test "$ac_cv_header_netinet_if_ether_h" != yes; then
133 #
134 # The simple test didn't work.
135 # Do we need to include <net/if.h> first?
136 # Unset ac_cv_header_netinet_if_ether_h so we don't
137 # treat the previous failure as a cached value and
138 # suppress the next test.
139 #
140 AC_MSG_NOTICE([Rechecking with some additional includes])
141 unset ac_cv_header_netinet_if_ether_h
142 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
143 #include <sys/socket.h>
144 #include <netinet/in.h>
145 struct mbuf;
146 struct rtentry;
147 #include <net/if.h>])
148 fi
149
150 case "$host_os" in
151 linux*|uclinux*)
152 AC_CHECK_HEADERS(linux/sockios.h linux/if_bonding.h,,,
153 [
154 #include <sys/socket.h>
155 #include <linux/if.h>
156 ])
157 ;;
158 esac
159
160 AC_LBL_FIXINCLUDES
161
162 AC_CHECK_FUNCS(strerror strlcpy strlcat)
163
164 needsnprintf=no
165 AC_CHECK_FUNCS(vsnprintf snprintf,,
166 [needsnprintf=yes])
167 if test $needsnprintf = yes; then
168 AC_LIBOBJ([snprintf])
169 fi
170
171 needstrtok_r=no
172 AC_CHECK_FUNCS(strtok_r,,
173 [needstrtok_r=yes])
174 if test $needstrtok_r = yes; then
175 AC_LIBOBJ([strtok_r])
176 fi
177
178 #
179 # Do this before checking for ether_hostton(), as it's a
180 # "gethostbyname() -ish function".
181 #
182 AC_LBL_LIBRARY_NET
183
184 #
185 # You are in a twisty little maze of UN*Xes, all different.
186 # Some might not have ether_hostton().
187 # Some might have it, but not declare it in any header file.
188 # Some might have it, but declare it in <netinet/if_ether.h>.
189 # Some might have it, but declare it in <netinet/ether.h>
190 # (And some might have it but document it as something declared in
191 # <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
192 #
193 # Before you is a C compiler.
194 #
195 AC_CHECK_FUNCS(ether_hostton)
196 if test "$ac_cv_func_ether_hostton" = yes; then
197 #
198 # OK, we have ether_hostton(). Do we have <netinet/if_ether.h>?
199 #
200 if test "$ac_cv_header_netinet_if_ether_h" = yes; then
201 #
202 # Yes. Does it declare ether_hostton()?
203 #
204 AC_CHECK_DECL(ether_hostton,
205 [
206 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
207 [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
208 ],,
209 [
210 #include <sys/types.h>
211 #include <sys/socket.h>
212 #include <netinet/in.h>
213 #include <arpa/inet.h>
214 struct mbuf;
215 struct rtentry;
216 #include <net/if.h>
217 #include <netinet/if_ether.h>
218 ])
219 fi
220 #
221 # Did that succeed?
222 #
223 if test "$ac_cv_have_decl_ether_hostton" != yes; then
224 #
225 # No, how about <netinet/ether.h>, as on Linux?
226 #
227 AC_CHECK_HEADERS(netinet/ether.h)
228 if test "$ac_cv_header_netinet_ether_h" = yes; then
229 #
230 # We have it - does it declare ether_hostton()?
231 # Unset ac_cv_have_decl_ether_hostton so we don't
232 # treat the previous failure as a cached value and
233 # suppress the next test.
234 #
235 unset ac_cv_have_decl_ether_hostton
236 AC_CHECK_DECL(ether_hostton,
237 [
238 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
239 [Define to 1 if netinet/ether.h declares `ether_hostton'])
240 ],,
241 [
242 #include <netinet/ether.h>
243 ])
244 fi
245 fi
246 #
247 # Is ether_hostton() declared?
248 #
249 if test "$ac_cv_have_decl_ether_hostton" != yes; then
250 #
251 # No, we'll have to declare it ourselves.
252 # Do we have "struct ether_addr"?
253 #
254 AC_CHECK_TYPES(struct ether_addr,,,
255 [
256 #include <sys/types.h>
257 #include <sys/socket.h>
258 #include <netinet/in.h>
259 #include <arpa/inet.h>
260 struct mbuf;
261 struct rtentry;
262 #include <net/if.h>
263 #include <netinet/if_ether.h>
264 ])
265 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 0,
266 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
267 don't.])
268 else
269 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
270 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
271 don't.])
272 fi
273 fi
274
275 dnl to pacify those who hate protochain insn
276 AC_MSG_CHECKING(if --disable-protochain option is specified)
277 AC_ARG_ENABLE(protochain,
278 AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
279 case "x$enable_protochain" in
280 xyes) enable_protochain=enabled ;;
281 xno) enable_protochain=disabled ;;
282 x) enable_protochain=enabled ;;
283 esac
284
285 if test "$enable_protochain" = "disabled"; then
286 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
287 fi
288 AC_MSG_RESULT(${enable_protochain})
289
290 #
291 # valgrindtest directly uses the native capture mechanism, but
292 # only tests with BPF and PF_PACKET sockets; only enable it if
293 # we have BPF or PF_PACKET sockets.
294 #
295 VALGRINDTEST=
296
297 #
298 # SITA support is mutually exclusive with native capture support;
299 # "--with-sita" selects SITA support.
300 #
301 AC_ARG_WITH(sita,
302 AC_HELP_STRING([--with-sita],[include SITA support]),
303 [
304 if test ! "x$withval" = "xno" ; then
305 AC_DEFINE(SITA,1,[include ACN support])
306 AC_MSG_NOTICE(Enabling SITA ACN support)
307 V_PCAP=sita
308 fi
309 ],
310 [
311 dnl
312 dnl Not all versions of test support -c (character special) but it's a
313 dnl better way of testing since the device might be protected. So we
314 dnl check in our normal order using -r and then check the for the /dev
315 dnl guys again using -c.
316 dnl
317 dnl XXX This could be done for cross-compiling, but for now it's not.
318 dnl
319 if test -z "$with_pcap" && test "$cross_compiling" = yes; then
320 AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)
321 fi
322 AC_ARG_WITH(pcap,
323 AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
324 AC_MSG_CHECKING(packet capture type)
325 if test ! -z "$with_pcap" ; then
326 V_PCAP="$withval"
327 elif test -r /dev/bpf -o -h /dev/bpf ; then
328 #
329 # Cloning BPF device.
330 #
331 V_PCAP=bpf
332 AC_DEFINE(HAVE_CLONING_BPF,1,[define if you have a cloning BPF device])
333
334 #
335 # We have BPF, so build valgrindtest with "make test".
336 #
337 VALGRINDTEST=valgrindtest
338 elif test -r /dev/bpf0 ; then
339 V_PCAP=bpf
340
341 #
342 # We have BPF, so build valgrindtest with "make test".
343 #
344 VALGRINDTEST=valgrindtest
345 elif test -r /usr/include/net/pfilt.h ; then
346 V_PCAP=pf
347 elif test -r /dev/enet ; then
348 V_PCAP=enet
349 elif test -r /dev/nit ; then
350 V_PCAP=snit
351 elif test -r /usr/include/sys/net/nit.h ; then
352 V_PCAP=nit
353 elif test -r /usr/include/linux/socket.h ; then
354 V_PCAP=linux
355
356 #
357 # XXX - this won't work with older kernels that have SOCK_PACKET
358 # sockets but not PF_PACKET sockets.
359 #
360 VALGRINDTEST=valgrindtest
361 elif test -r /usr/include/net/raw.h ; then
362 V_PCAP=snoop
363 elif test -r /usr/include/odmi.h ; then
364 #
365 # On AIX, the BPF devices might not yet be present - they're
366 # created the first time libpcap runs after booting.
367 # We check for odmi.h instead.
368 #
369 V_PCAP=bpf
370 elif test -c /dev/bpf0 ; then # check again in case not readable
371 V_PCAP=bpf
372
373 #
374 # We have BPF, so build valgrindtest with "make test".
375 #
376 VALGRINDTEST=valgrindtest
377 elif test -r /usr/include/sys/dlpi.h ; then
378 V_PCAP=dlpi
379 elif test -c /dev/enet ; then # check again in case not readable
380 V_PCAP=enet
381 elif test -c /dev/nit ; then # check again in case not readable
382 V_PCAP=snit
383 else
384 V_PCAP=null
385 fi
386 AC_MSG_RESULT($V_PCAP)
387 AC_SUBST(VALGRINDTEST)
388
389 #
390 # Do capture-mechanism-dependent tests.
391 #
392 case "$V_PCAP" in
393 dlpi)
394 #
395 # Needed for common functions used by pcap-[dlpi,libdlpi].c
396 #
397 SSRC="dlpisubs.c"
398
399 #
400 # Checks for some header files.
401 #
402 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
403
404 #
405 # Checks to see if Solaris has the public libdlpi(3LIB) library.
406 # Note: The existence of /usr/include/libdlpi.h does not mean it is the
407 # public libdlpi(3LIB) version. Before libdlpi was made public, a
408 # private version also existed, which did not have the same APIs.
409 # Due to a gcc bug, the default search path for 32-bit libraries does
410 # not include /lib, we add it explicitly here.
411 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
412 # Also, due to the bug above applications that link to libpcap with
413 # libdlpi will have to add "-L/lib" option to "configure".
414 #
415 saved_ldflags=$LDFLAGS
416 LDFLAGS="$LIBS -L/lib"
417 AC_CHECK_LIB(dlpi, dlpi_walk,
418 [
419 LIBS="-ldlpi $LIBS"
420 V_PCAP=libdlpi
421 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists])
422 ],
423 V_PCAP=dlpi)
424 LDFLAGS=$saved_ldflags
425
426 #
427 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO
428 # versions of DLPI.
429 #
430 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
431 AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
432 AC_TRY_COMPILE(
433 [
434 #include <sys/types.h>
435 #include <sys/time.h>
436 #include <sys/dlpi.h>
437 ],
438 [int i = DL_PROMISC_PHYS;],
439 ac_cv_sys_dlpi_usable=yes,
440 ac_cv_sys_dlpi_usable=no))
441 AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
442 if test $ac_cv_sys_dlpi_usable = no ; then
443 AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
444 fi
445
446 #
447 # Check whether we have a /dev/dlpi device or have multiple devices.
448 #
449 AC_MSG_CHECKING(for /dev/dlpi device)
450 if test -c /dev/dlpi ; then
451 AC_MSG_RESULT(yes)
452 AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi])
453 else
454 AC_MSG_RESULT(no)
455 dir="/dev/dlpi"
456 AC_MSG_CHECKING(for $dir directory)
457 if test -d $dir ; then
458 AC_MSG_RESULT(yes)
459 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory])
460 else
461 AC_MSG_RESULT(no)
462 fi
463 fi
464
465 #
466 # This check is for Solaris with DLPI support for passive modes.
467 # See dlpi(7P) for more details.
468 #
469 AC_LBL_DL_PASSIVE_REQ_T
470 ;;
471
472 linux)
473 #
474 # Do we have the wireless extensions?
475 #
476 AC_CHECK_HEADERS(linux/wireless.h, [], [],
477 [
478 #include <sys/socket.h>
479 #include <linux/if.h>
480 #include <linux/types.h>
481 ])
482
483 #
484 # Do we have libnl?
485 #
486 AC_ARG_WITH(libnl,
487 AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
488 with_libnl=$withval,,)
489
490 if test x$with_libnl != xno ; then
491 have_any_nl="no"
492
493 incdir=-I/usr/include/libnl3
494 libnldir=
495 if test x$withval != x ; then
496 libnldir=-L${withval}/lib/.libs
497 incdir=-I${withval}/include
498 fi
499
500 #
501 # Try libnl 3.x first.
502 #
503 AC_CHECK_LIB(nl-3, nl_socket_alloc,
504 [
505 #
506 # Yes, we have libnl 3.x.
507 #
508 LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
509 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
510 AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x])
511 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
512 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
513 V_INCLS="$V_INCLS ${incdir}"
514 have_any_nl="yes"
515 ],[], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 )
516
517 if test x$have_any_nl = xno ; then
518 #
519 # Try libnl 2.x
520 #
521 AC_CHECK_LIB(nl, nl_socket_alloc,
522 [
523 #
524 # Yes, we have libnl 2.x.
525 #
526 LIBS="${libnldir} -lnl-genl -lnl $LIBS"
527 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
528 AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
529 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
530 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
531 have_any_nl="yes"
532 ])
533 fi
534
535 if test x$have_any_nl = xno ; then
536 #
537 # No, we don't; do we have libnl 1.x?
538 #
539 AC_CHECK_LIB(nl, nl_handle_alloc,
540 [
541 #
542 # Yes.
543 #
544 LIBS="${libnldir} -lnl $LIBS"
545 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
546 have_any_nl="yes"
547 ])
548 fi
549
550 if test x$have_any_nl = xno ; then
551 #
552 # No, we don't have libnl at all.
553 #
554 if test x$with_libnl = xyes ; then
555 AC_MSG_ERROR([libnl support requested but libnl not found])
556 fi
557 fi
558 fi
559
560 AC_CHECK_HEADERS(linux/ethtool.h,,,
561 [
562 AC_INCLUDES_DEFAULT
563 #include <linux/types.h>
564 ])
565 AC_LBL_TPACKET_STATS
566 AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI
567 ;;
568
569 bpf)
570 #
571 # Check whether we have the *BSD-style ioctls.
572 #
573 AC_CHECK_HEADERS(net/if_media.h)
574
575 AC_MSG_CHECKING(whether the system supports zerocopy BPF)
576 AC_TRY_COMPILE(
577 [#include <sys/socket.h>
578 #include <sys/ioctl.h>
579 #include <net/if.h>
580 #include <net/bpf.h>],
581 [return (BIOCROTZBUF + BPF_BUFMODE_ZBUF);],
582 [
583 AC_MSG_RESULT(yes)
584 AC_DEFINE(HAVE_ZEROCOPY_BPF, 1,
585 [define if the system supports zerocopy BPF])
586 ],
587 AC_MSG_RESULT(no))
588
589 #
590 # Check whether we have struct BPF_TIMEVAL.
591 #
592 AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
593 [
594 #include <sys/types.h>
595 #include <sys/ioctl.h>
596 #ifdef HAVE_SYS_IOCCOM_H
597 #include <sys/ioccom.h>
598 #endif
599 #include <net/bpf.h>
600 ])
601 ;;
602
603 dag)
604 #
605 # --with-pcap=dag is the only way to get here, and it means
606 # "DAG support but nothing else"
607 #
608 V_DEFS="$V_DEFS -DDAG_ONLY"
609 xxx_only=yes
610 ;;
611
612 septel)
613 #
614 # --with-pcap=septel is the only way to get here, and it means
615 # "Septel support but nothing else"
616 #
617 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
618 xxx_only=yes
619 ;;
620
621 snf)
622 #
623 # --with-pcap=snf is the only way to get here, and it means
624 # "SNF support but nothing else"
625 #
626 V_DEFS="$V_DEFS -DSNF_ONLY"
627 xxx_only=yes
628 ;;
629
630 null)
631 AC_MSG_WARN(cannot determine packet capture interface)
632 AC_MSG_WARN((see the INSTALL doc for more info))
633 ;;
634
635 *)
636 AC_MSG_ERROR($V_PCAP is not a valid pcap type)
637 ;;
638 esac
639
640 dnl
641 dnl Now figure out how we get a list of interfaces and addresses,
642 dnl if we support capturing. Don't bother if we don't support
643 dnl capturing.
644 dnl
645 if test "$V_PCAP" != null
646 then
647 AC_CHECK_FUNC(getifaddrs,[
648 #
649 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
650 # as well, just in case some platform is really weird.
651 #
652 AC_CHECK_HEADER(ifaddrs.h,[
653 #
654 # We have the header, so we use "getifaddrs()" to
655 # get the list of interfaces.
656 #
657 V_FINDALLDEVS=fad-getad.c
658 ],[
659 #
660 # We don't have the header - give up.
661 # XXX - we could also fall back on some other
662 # mechanism, but, for now, this'll catch this
663 # problem so that we can at least try to figure
664 # out something to do on systems with "getifaddrs()"
665 # but without "ifaddrs.h", if there is something
666 # we can do on those systems.
667 #
668 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
669 ])
670 ],[
671 #
672 # Well, we don't have "getifaddrs()", so we have to use
673 # some other mechanism; determine what that mechanism is.
674 #
675 # The first thing we use is the type of capture mechanism,
676 # which is somewhat of a proxy for the OS we're using.
677 #
678 case "$V_PCAP" in
679
680 dlpi|libdlpi)
681 #
682 # This might be Solaris 8 or later, with
683 # SIOCGLIFCONF, or it might be some other OS
684 # or some older version of Solaris, with
685 # just SIOCGIFCONF.
686 #
687 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
688 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
689 AC_TRY_COMPILE(
690 [#include <sys/param.h>
691 #include <sys/file.h>
692 #include <sys/ioctl.h>
693 #include <sys/socket.h>
694 #include <sys/sockio.h>],
695 [ioctl(0, SIOCGLIFCONF, (char *)0);],
696 ac_cv_lbl_have_siocglifconf=yes,
697 ac_cv_lbl_have_siocglifconf=no))
698 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
699 if test $ac_cv_lbl_have_siocglifconf = yes ; then
700 V_FINDALLDEVS=fad-glifc.c
701 else
702 V_FINDALLDEVS=fad-gifc.c
703 fi
704 ;;
705
706 *)
707 #
708 # Assume we just have SIOCGIFCONF.
709 # (XXX - on at least later Linux kernels, there's
710 # another mechanism, and we should be using that
711 # instead.)
712 #
713 V_FINDALLDEVS=fad-gifc.c
714 ;;
715 esac])
716 fi
717 ])
718
719 AC_MSG_CHECKING(for socklen_t)
720 AC_TRY_COMPILE([
721 #include <sys/types.h>
722 #include <sys/socket.h>
723 ],
724 [ socklen_t x; ],
725 have_socklen_t=yes,
726 have_socklen_t=no)
727 if test "x$have_socklen_t" = "xyes"; then
728 AC_DEFINE(HAVE_SOCKLEN_T, 1, [define if socklen_t is defined])
729 fi
730 AC_MSG_RESULT($have_socklen_t)
731
732 AC_ARG_ENABLE(ipv6,
733 AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes, if getaddrinfo available@:>@]),
734 [],
735 [enable_ipv6=ifavailable])
736 if test "$enable_ipv6" != "no"; then
737 AC_CHECK_FUNC(getaddrinfo,
738 [
739 AC_DEFINE(INET6,1,[IPv6])
740 ],
741 [
742 if test "$enable_ipv6" != "ifavailable"; then
743 AC_MSG_FAILURE([--enable-ipv6 was given, but getaddrinfo isn't available])
744 fi
745 ])
746 fi
747
748 AC_MSG_CHECKING(whether to build optimizer debugging code)
749 AC_ARG_ENABLE(optimizer-dbg,
750 AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
751 if test "$enable_optimizer_dbg" = "yes"; then
752 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
753 fi
754 AC_MSG_RESULT(${enable_optimizer_dbg-no})
755
756 AC_MSG_CHECKING(whether to build parser debugging code)
757 AC_ARG_ENABLE(yydebug,
758 AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
759 if test "$enable_yydebug" = "yes"; then
760 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
761 fi
762 AC_MSG_RESULT(${enable_yydebug-no})
763
764 # Check for Endace DAG card support.
765 AC_ARG_WITH([dag],
766 AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
767 [
768 if test "$withval" = no
769 then
770 # User doesn't want DAG support.
771 want_dag=no
772 elif test "$withval" = yes
773 then
774 # User wants DAG support but hasn't specified a directory.
775 want_dag=yes
776 else
777 # User wants DAG support and has specified a directory, so use the provided value.
778 want_dag=yes
779 dag_root=$withval
780 fi
781 ],[
782 if test "$V_PCAP" = dag; then
783 # User requested DAG-only libpcap, so we'd better have
784 # the DAG API.
785 want_dag=yes
786 elif test "xxx_only" = yes; then
787 # User requested something-else-only pcap, so they don't
788 # want DAG support.
789 want_dag=no
790 else
791 #
792 # Use DAG API if present, otherwise don't
793 #
794 want_dag=ifpresent
795 fi
796 ])
797
798 AC_ARG_WITH([dag-includes],
799 AC_HELP_STRING([--with-dag-includes=IDIR],[Endace DAG include directory, if not DIR/include]),
800 [
801 # User wants DAG support and has specified a header directory, so use the provided value.
802 want_dag=yes
803 dag_include_dir=$withval
804 ],[])
805
806 AC_ARG_WITH([dag-libraries],
807 AC_HELP_STRING([--with-dag-libraries=LDIR],[Endace DAG library directory, if not DIR/lib]),
808 [
809 # User wants DAG support and has specified a library directory, so use the provided value.
810 want_dag=yes
811 dag_lib_dir=$withval
812 ],[])
813
814 ac_cv_lbl_dag_api=no
815 if test "$want_dag" != no; then
816
817 AC_MSG_CHECKING([whether we have DAG API headers])
818
819 # If necessary, set default paths for DAG API headers and libraries.
820 if test -z "$dag_root"; then
821 dag_root=/usr/local
822 fi
823
824 if test -z "$dag_include_dir"; then
825 dag_include_dir="$dag_root/include"
826 fi
827
828 if test -z "$dag_lib_dir"; then
829 dag_lib_dir="$dag_root/lib"
830 fi
831
832 if test -z "$dag_tools_dir"; then
833 dag_tools_dir="$dag_root/tools"
834 fi
835
836 if test -r $dag_include_dir/dagapi.h; then
837 ac_cv_lbl_dag_api=yes
838 fi
839
840 if test "$ac_cv_lbl_dag_api" = yes; then
841 AC_MSG_RESULT([yes ($dag_include_dir)])
842
843 V_INCLS="$V_INCLS -I$dag_include_dir"
844
845 if test $V_PCAP != dag ; then
846 SSRC="$SSRC pcap-dag.c"
847 fi
848
849 # See if we can find a general version string.
850 # Don't need to save and restore LIBS to prevent -ldag being
851 # included if there's a found-action (arg 3).
852 saved_ldflags=$LDFLAGS
853 LDFLAGS="-L$dag_lib_dir"
854 AC_CHECK_LIB([dag], [dag_attach_stream64], [dag_large_streams="1"], [dag_large_streams="0"])
855 AC_CHECK_LIB([dag],[dag_get_erf_types], [
856 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
857 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
858 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
859
860 LDFLAGS=$saved_ldflags
861
862 if test "$dag_large_streams" = 1; then
863 AC_DEFINE(HAVE_DAG_LARGE_STREAMS_API, 1, [define if you have large streams capable DAG API])
864 LIBS="$LIBS -ldag"
865 LDFLAGS="$LDFLAGS -L$dag_lib_dir"
866
867 AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
868 if test "$ac_dag_have_vdag" = 1; then
869 AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
870 LIBS="$LIBS -lpthread"
871 fi
872 fi
873
874 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
875 else
876 AC_MSG_RESULT(no)
877
878 if test "$V_PCAP" = dag; then
879 # User requested "dag" capture type but we couldn't
880 # find the DAG API support.
881 AC_MSG_ERROR([DAG support requested with --with-pcap=dag, but the DAG headers weren't found at $dag_include_dir: make sure the DAG support is installed, specify a different path or paths if necessary, or don't request DAG support])
882 fi
883
884 if test "$want_dag" = yes; then
885 # User wanted DAG support but we couldn't find it.
886 AC_MSG_ERROR([DAG support requested with --with-dag, but the DAG headers weren't found at $dag_include_dir: make sure the DAG support is installed, specify a different path or paths if necessary, or don't request DAG support])
887 fi
888 fi
889 fi
890
891 AC_ARG_WITH(septel,
892 AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
893 [
894 if test "$withval" = no
895 then
896 want_septel=no
897 elif test "$withval" = yes
898 then
899 want_septel=yes
900 septel_root=
901 else
902 want_septel=yes
903 septel_root=$withval
904 fi
905 ],[
906 if test "$V_PCAP" = septel; then
907 # User requested Septel-only libpcap, so we'd better have
908 # the Septel API.
909 want_septel=yes
910 elif test "xxx_only" = yes; then
911 # User requested something-else-only pcap, so they don't
912 # want Septel support.
913 want_septel=no
914 else
915 #
916 # Use Septel API if present, otherwise don't
917 #
918 want_septel=ifpresent
919 fi
920 ])
921
922 ac_cv_lbl_septel_api=no
923 if test "$with_septel" != no; then
924
925 AC_MSG_CHECKING([whether we have Septel API headers])
926
927 # If necessary, set default paths for Septel API headers and libraries.
928 if test -z "$septel_root"; then
929 septel_root=$srcdir/../septel
930 fi
931
932 septel_tools_dir="$septel_root"
933 septel_include_dir="$septel_root/INC"
934
935 if test -r "$septel_include_dir/msg.h"; then
936 ac_cv_lbl_septel_api=yes
937 fi
938
939 if test "$ac_cv_lbl_septel_api" = yes; then
940 AC_MSG_RESULT([yes ($septel_include_dir)])
941
942 V_INCLS="$V_INCLS -I$septel_include_dir"
943 ADDLOBJS="$ADDLOBJS $septel_tools_dir/asciibin.o $septel_tools_dir/bit2byte.o $septel_tools_dir/confirm.o $septel_tools_dir/fmtmsg.o $septel_tools_dir/gct_unix.o $septel_tools_dir/hqueue.o $septel_tools_dir/ident.o $septel_tools_dir/mem.o $septel_tools_dir/pack.o $septel_tools_dir/parse.o $septel_tools_dir/pool.o $septel_tools_dir/sdlsig.o $septel_tools_dir/strtonum.o $septel_tools_dir/timer.o $septel_tools_dir/trace.o"
944 ADDLARCHIVEOBJS="$ADDLARCHIVEOBJS $septel_tools_dir/asciibin.o $septel_tools_dir/bit2byte.o $septel_tools_dir/confirm.o $septel_tools_dir/fmtmsg.o $septel_tools_dir/gct_unix.o $septel_tools_dir/hqueue.o $septel_tools_dir/ident.o $septel_tools_dir/mem.o $septel_tools_dir/pack.o $septel_tools_dir/parse.o $septel_tools_dir/pool.o $septel_tools_dir/sdlsig.o $septel_tools_dir/strtonum.o $septel_tools_dir/timer.o $septel_tools_dir/trace.o"
945
946 if test "$V_PCAP" != septel ; then
947 SSRC="$SSRC pcap-septel.c"
948 fi
949
950 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have the Septel API])
951 else
952 AC_MSG_RESULT(no)
953
954 if test "$V_PCAP" = septel; then
955 # User requested "septel" capture type but
956 # we couldn't find the Septel API support.
957 AC_MSG_ERROR([Septel support requested with --with-pcap=septel, but the Septel headers weren't found at $septel_include_dir: make sure the Septel support is installed, specify a different path or paths if necessary, or don't request Septel support])
958 fi
959
960 if test "$want_septel" = yes; then
961 # User wanted Septel support but we couldn't find it.
962 AC_MSG_ERROR([Septel support requested with --with-septel, but the Septel headers weren't found at $septel_include_dir: make sure the Septel support is installed, specify a different path or paths if necessary, or don't request Septel support])
963 fi
964 fi
965 fi
966
967 # Check for Myricom SNF support.
968 AC_ARG_WITH([snf],
969 AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
970 [
971 if test "$withval" = no
972 then
973 # User explicitly doesn't want SNF
974 want_snf=no
975 elif test "$withval" = yes
976 then
977 # User wants SNF support but hasn't specified a directory.
978 want_snf=yes
979 else
980 # User wants SNF support with a specified directory.
981 want_snf=yes
982 snf_root=$withval
983 fi
984 ],[
985 if test "$V_PCAP" = snf; then
986 # User requested Sniffer-only libpcap, so we'd better have
987 # the Sniffer API.
988 want_snf=yes
989 elif test "xxx_only" = yes; then
990 # User requested something-else-only pcap, so they don't
991 # want SNF support.
992 want_snf=no
993 else
994 #
995 # Use Sniffer API if present, otherwise don't
996 #
997 want_snf=ifpresent
998 fi
999 ])
1000
1001 AC_ARG_WITH([snf-includes],
1002 AC_HELP_STRING([--with-snf-includes=IDIR],[Myricom SNF include directory, if not DIR/include]),
1003 [
1004 # User wants SNF with specific header directory
1005 want_snf=yes
1006 snf_include_dir=$withval
1007 ],[])
1008
1009 AC_ARG_WITH([snf-libraries],
1010 AC_HELP_STRING([--with-snf-libraries=LDIR],[Myricom SNF library directory, if not DIR/lib]),
1011 [
1012 # User wants SNF with specific lib directory
1013 want_snf=yes
1014 snf_lib_dir=$withval
1015 ],[])
1016
1017 ac_cv_lbl_snf_api=no
1018 if test "$with_snf" != no; then
1019
1020 AC_MSG_CHECKING(whether we have Myricom Sniffer API)
1021
1022 # If necessary, set default paths for Sniffer headers and libraries.
1023 if test -z "$snf_root"; then
1024 snf_root=/opt/snf
1025 fi
1026
1027 if test -z "$snf_include_dir"; then
1028 snf_include_dir="$snf_root/include"
1029 fi
1030
1031 if test -z "$snf_lib_dir"; then
1032 snf_lib_dir="$snf_root/lib"
1033 fi
1034
1035 if test -f "$snf_include_dir/snf.h"; then
1036 # We found a header; make sure we can link with the library
1037 saved_ldflags=$LDFLAGS
1038 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1039 AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"])
1040 LDFLAGS="$saved_ldflags"
1041 if test "$ac_cv_lbl_snf_api" = no; then
1042 AC_MSG_ERROR(SNF API cannot correctly be linked; check config.log)
1043 fi
1044 fi
1045
1046 if test "$ac_cv_lbl_snf_api" = yes; then
1047 AC_MSG_RESULT([yes ($snf_root)])
1048
1049 V_INCLS="$V_INCLS -I$snf_include_dir"
1050 LIBS="$LIBS -lsnf"
1051 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1052
1053 if test "$V_PCAP" != snf ; then
1054 SSRC="$SSRC pcap-snf.c"
1055 fi
1056
1057 AC_DEFINE(HAVE_SNF_API, 1, [define if you have the Myricom SNF API])
1058 else
1059 AC_MSG_RESULT(no)
1060
1061 if test "$want_snf" = yes; then
1062 # User requested "snf" capture type but
1063 # we couldn't find the Sniffer API support.
1064 AC_MSG_ERROR([Myricom Sniffer support requested with --with-pcap=snf, but the Sniffer headers weren't found at $snf_include_dir: make sure the Sniffer support is installed, specify a different path or paths if necessary, or don't request Sniffer support])
1065 fi
1066
1067 if test "$want_snf" = yes; then
1068 AC_MSG_ERROR([Myricom Sniffer support requested with --with-snf, but the Sniffer headers weren't found at $snf_include_dir: make sure the Sniffer support is installed, specify a different path or paths if necessary, or don't request Sniffer support])
1069 fi
1070 fi
1071 fi
1072
1073 # Check for Riverbed TurboCap support.
1074 AC_ARG_WITH([turbocap],
1075 AC_HELP_STRING([--with-turbocap@<:@=DIR@:>@],[include Riverbed TurboCap support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1076 [
1077 if test "$withval" = no
1078 then
1079 # User explicitly doesn't want TurboCap
1080 want_turbocap=no
1081 elif test "$withval" = yes
1082 then
1083 # User wants TurboCap support but hasn't specified a directory.
1084 want_turbocap=yes
1085 else
1086 # User wants TurboCap support with a specified directory.
1087 want_turbocap=yes
1088 turbocap_root=$withval
1089 fi
1090 ],[
1091 if test "xxx_only" = yes; then
1092 # User requested something-else-only pcap, so they don't
1093 # want TurboCap support.
1094 want_turbocap=no
1095 else
1096 #
1097 # Use TurboCap API if present, otherwise don't
1098 #
1099 want_turbocap=ifpresent
1100 fi
1101 ])
1102
1103 ac_cv_lbl_turbocap_api=no
1104 if test "$want_turbocap" != no; then
1105
1106 AC_MSG_CHECKING(whether TurboCap is supported)
1107
1108 save_CFLAGS="$CFLAGS"
1109 save_LIBS="$LIBS"
1110 if test ! -z "$turbocap_root"; then
1111 TURBOCAP_CFLAGS="-I$turbocap_root/include"
1112 TURBOCAP_LIBS="-L$turbocap_root/lib"
1113 CFLAGS="$CFLAGS $TURBOCAP_CFLAGS"
1114 fi
1115
1116 AC_TRY_COMPILE(
1117 [
1118 #include <TcApi.h>
1119 ],
1120 [
1121 TC_INSTANCE a; TC_PORT b; TC_BOARD c;
1122 TC_INSTANCE i;
1123 (void)TcInstanceCreateByName("foo", &i);
1124 ],
1125 ac_cv_lbl_turbocap_api=yes)
1126
1127 CFLAGS="$save_CFLAGS"
1128 if test $ac_cv_lbl_turbocap_api = yes; then
1129 AC_MSG_RESULT(yes)
1130
1131 SSRC="$SSRC pcap-tc.c"
1132 V_INCLS="$V_INCLS $TURBOCAP_CFLAGS"
1133 LIBS="$LIBS $TURBOCAP_LIBS -lTcApi -lpthread -lstdc++"
1134
1135 AC_DEFINE(HAVE_TC_API, 1, [define if you have the TurboCap API])
1136 else
1137 AC_MSG_RESULT(no)
1138
1139 if test "$want_turbocap" = yes; then
1140 # User wanted Turbo support but we couldn't find it.
1141 AC_MSG_ERROR([TurboCap support requested with --with-turbocap, but the TurboCap headers weren't found: make sure the TurboCap support is installed or don't request TurboCap support])
1142 fi
1143 fi
1144 fi
1145
1146 #
1147 # Look for {f}lex.
1148 #
1149 AC_PROG_LEX
1150 if test "$LEX" = ":"; then
1151 AC_MSG_ERROR([Neither flex nor lex was found.])
1152 fi
1153
1154 #
1155 # Make sure {f}lex supports the -P, --header-file, and --nounput flags
1156 # and supports processing our scanner.l.
1157 #
1158 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
1159 if $LEX -P pcap_ --header-file=/dev/null --nounput -t $srcdir/scanner.l > /dev/null 2>&1; then
1160 tcpdump_cv_capable_lex=yes
1161 else
1162 tcpdump_cv_capable_lex=insufficient
1163 fi)
1164 if test $tcpdump_cv_capable_lex = insufficient ; then
1165 AC_MSG_ERROR([$LEX is insufficient to compile libpcap.
1166 libpcap requires Flex 2.5.31 or later, or a compatible version of lex.])
1167 fi
1168
1169 #
1170 # Look for yacc/bison/byacc.
1171 #
1172 AC_PROG_YACC
1173
1174 #
1175 # Make sure it supports the -p flag and supports processing our
1176 # grammar.y.
1177 #
1178 AC_CACHE_CHECK([for capable yacc/bison], tcpdump_cv_capable_yacc,
1179 if $YACC -p pcap_ -o /dev/null $srcdir/grammar.y >/dev/null 2>&1; then
1180 tcpdump_cv_capable_yacc=yes
1181 else
1182 tcpdump_cv_capable_yacc=insufficient
1183 fi)
1184 if test $tcpdump_cv_capable_yacc = insufficient ; then
1185 AC_MSG_ERROR([$YACC is insufficient to compile libpcap.
1186 libpcap requires Bison, Berkeley YACC, or another YACC compatible with them.])
1187 fi
1188
1189 dnl
1190 dnl Allow the user to enable remote capture.
1191 dnl It's off by default, as that increases the attack surface of
1192 dnl libpcap, exposing it to malicious servers.
1193 dnl
1194 AC_MSG_CHECKING([whether to enable remote packet capture])
1195 AC_ARG_ENABLE(remote,
1196 [ --enable-remote enable remote packet capture @<:@default=no@:>@
1197 --disable-remote disable remote packet capture],,
1198 enableval=no)
1199 case "$enableval" in
1200 yes) AC_MSG_RESULT(yes)
1201 AC_WARN([Remote packet capture may expose libpcap-based applications])
1202 AC_WARN([to attacks by malicious remote capture servers!])
1203 AC_DEFINE(HAVE_REMOTE,,
1204 [Define to 1 if remote packet capture is to be supported])
1205 SSRC="$SSRC pcap-new.c pcap-rpcap.c sockutils.c"
1206 RPCAPD=rpcapd
1207 INSTALL_RPCAPD=install-rpcapd
1208 ;;
1209 *) AC_MSG_RESULT(no)
1210 ;;
1211 esac
1212
1213 #
1214 # Assume, by default, no support for shared libraries and V7/BSD convention
1215 # for man pages (file formats in section 5, miscellaneous info in section 7).
1216 # Individual cases can override this.
1217 #
1218 DYEXT="none"
1219 MAN_FILE_FORMATS=5
1220 MAN_MISC_INFO=7
1221 MAN_USERMOD_SECTION=8
1222 case "$host_os" in
1223
1224 aix*)
1225 dnl Workaround to enable certain features
1226 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
1227
1228 #
1229 # AIX makes it fun to build shared and static libraries,
1230 # because they're *both* ".a" archive libraries. We
1231 # build the static library for the benefit of the traditional
1232 # scheme of building libpcap and tcpdump in subdirectories of
1233 # the same directory, with tcpdump statically linked with the
1234 # libpcap in question, but we also build a shared library as
1235 # "libpcap.shareda" and install *it*, rather than the static
1236 # library, as "libpcap.a".
1237 #
1238 DYEXT="shareda"
1239
1240 case "$V_PCAP" in
1241
1242 dlpi)
1243 #
1244 # If we're using DLPI, applications will need to
1245 # use /lib/pse.exp if present, as we use the
1246 # STREAMS routines.
1247 #
1248 pseexe="/lib/pse.exp"
1249 AC_MSG_CHECKING(for $pseexe)
1250 if test -f $pseexe ; then
1251 AC_MSG_RESULT(yes)
1252 LIBS="-I:$pseexe"
1253 fi
1254 ;;
1255
1256 bpf)
1257 #
1258 # If we're using BPF, we need "-lodm" and "-lcfg", as
1259 # we use them to load the BPF module.
1260 #
1261 LIBS="-lodm -lcfg"
1262 ;;
1263 esac
1264 ;;
1265
1266 darwin*)
1267 DYEXT="dylib"
1268 V_CCOPT="$V_CCOPT -fno-common"
1269 AC_ARG_ENABLE(universal,
1270 AC_HELP_STRING([--disable-universal],[don't build universal on macOS]))
1271 if test "$enable_universal" != "no"; then
1272 case "$host_os" in
1273
1274 darwin[0-7].*)
1275 #
1276 # Pre-Tiger. Build only for 32-bit PowerPC; no
1277 # need for any special compiler or linker flags.
1278 #
1279 ;;
1280
1281 darwin8.[0123]*)
1282 #
1283 # Tiger, prior to Intel support. Build for 32-bit
1284 # PowerPC and 64-bit PowerPC, with 32-bit PowerPC
1285 # first. (I'm guessing that's what Apple does.)
1286 #
1287 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64"
1288 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64"
1289 ;;
1290
1291 darwin8.[456]*)
1292 #
1293 # Tiger, subsequent to Intel support but prior to
1294 # x86-64 support. Build for 32-bit PowerPC, 64-bit
1295 # PowerPC, and x86, with 32-bit PowerPC first.
1296 # (I'm guessing that's what Apple does.)
1297 #
1298 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386"
1299 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386"
1300 ;;
1301
1302 darwin8.*)
1303 #
1304 # All other Tiger, so subsequent to x86-64
1305 # support. Build for 32-bit PowerPC, 64-bit
1306 # PowerPC, x86, and x86-64, and with 32-bit PowerPC
1307 # first. (I'm guessing that's what Apple does.)
1308 #
1309 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1310 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1311 ;;
1312
1313 darwin9.*)
1314 #
1315 # Leopard. Build for 32-bit PowerPC, 64-bit
1316 # PowerPC, x86, and x86-64, with 32-bit PowerPC
1317 # first. (That's what Apple does.)
1318 #
1319 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1320 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1321 ;;
1322
1323 darwin10.*)
1324 #
1325 # Snow Leopard. Build for x86-64, x86, and
1326 # 32-bit PowerPC, with x86-64 first. (That's
1327 # what Apple does, even though Snow Leopard
1328 # doesn't run on PPC, so PPC libpcap runs under
1329 # Rosetta, and Rosetta doesn't support BPF
1330 # ioctls, so PPC programs can't do live
1331 # captures.)
1332 #
1333 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386 -arch ppc"
1334 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386 -arch ppc"
1335 ;;
1336
1337 darwin*)
1338 #
1339 # Post-Snow Leopard. Build for x86-64 and
1340 # x86, with x86-64 first. (That's probably what
1341 # Apple does, given that Rosetta is gone.)
1342 # XXX - update if and when Apple drops support
1343 # for 32-bit x86 code.
1344 #
1345 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386"
1346 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386"
1347 ;;
1348 esac
1349 fi
1350 ;;
1351
1352 hpux9*)
1353 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
1354
1355 #
1356 # Use System V conventions for man pages.
1357 #
1358 MAN_FILE_FORMATS=4
1359 MAN_MISC_INFO=5
1360 ;;
1361
1362 hpux10.0*)
1363
1364 #
1365 # Use System V conventions for man pages.
1366 #
1367 MAN_FILE_FORMATS=4
1368 MAN_MISC_INFO=5
1369 ;;
1370
1371 hpux10.1*)
1372
1373 #
1374 # Use System V conventions for man pages.
1375 #
1376 MAN_FILE_FORMATS=4
1377 MAN_MISC_INFO=5
1378 ;;
1379
1380 hpux*)
1381 dnl HPUX 10.20 and above is similar to HPUX 9, but
1382 dnl not the same....
1383 dnl
1384 dnl XXX - DYEXT should be set to "sl" if this is building
1385 dnl for 32-bit PA-RISC, but should be left as "so" for
1386 dnl 64-bit PA-RISC or, I suspect, IA-64.
1387 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
1388 if test "`uname -m`" = "ia64"; then
1389 DYEXT="so"
1390 else
1391 DYEXT="sl"
1392 fi
1393
1394 #
1395 # "-b" builds a shared library; "+h" sets the soname.
1396 #
1397 SHLIB_OPT="-b"
1398 SONAME_OPT="+h"
1399
1400 #
1401 # Use System V conventions for man pages.
1402 #
1403 MAN_FILE_FORMATS=4
1404 MAN_MISC_INFO=5
1405 ;;
1406
1407 irix*)
1408 #
1409 # Use System V conventions for man pages.
1410 #
1411 MAN_FILE_FORMATS=4
1412 MAN_MISC_INFO=5
1413 ;;
1414
1415 linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*)
1416 DYEXT="so"
1417
1418 #
1419 # Compiler assumed to be GCC; run-time linker may require a -R
1420 # flag.
1421 #
1422 if test "$libdir" != "/usr/lib"; then
1423 V_RFLAGS=-Wl,-R$libdir
1424 fi
1425 ;;
1426
1427 osf*)
1428 DYEXT="so"
1429
1430 #
1431 # Use System V conventions for man pages.
1432 #
1433 MAN_FILE_FORMATS=4
1434 MAN_MISC_INFO=5
1435 ;;
1436
1437 sinix*)
1438 AC_MSG_CHECKING(if SINIX compiler defines sinix)
1439 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
1440 AC_TRY_COMPILE(
1441 [],
1442 [int i = sinix;],
1443 ac_cv_cc_sinix_defined=yes,
1444 ac_cv_cc_sinix_defined=no))
1445 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
1446 if test $ac_cv_cc_sinix_defined = no ; then
1447 AC_DEFINE(sinix,1,[on sinix])
1448 fi
1449 ;;
1450
1451 solaris*)
1452 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
1453
1454 DYEXT="so"
1455
1456 case "`uname -r`" in
1457
1458 5.12)
1459 ;;
1460
1461 *)
1462 #
1463 # Use System V conventions for man pages.
1464 #
1465 MAN_USERMOD_SECTION=1m
1466 MAN_FILE_FORMATS=4
1467 MAN_MISC_INFO=5
1468 esac
1469 ;;
1470 esac
1471
1472 AC_ARG_ENABLE(shared,
1473 AC_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@]))
1474 test "x$enable_shared" = "xno" && DYEXT="none"
1475
1476 AC_PROG_RANLIB
1477 AC_CHECK_TOOL([AR], [ar])
1478
1479 AC_PROG_LN_S
1480 AC_SUBST(LN_S)
1481
1482 AC_LBL_DEVEL(V_CCOPT)
1483
1484 AC_LBL_SOCKADDR_SA_LEN
1485
1486 AC_LBL_SOCKADDR_STORAGE
1487
1488 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
1489
1490 AC_LBL_UNALIGNED_ACCESS
1491
1492 rm -f net
1493 ln -s ${srcdir}/bpf/net net
1494
1495 AC_SUBST(V_CCOPT)
1496 AC_SUBST(V_DEFS)
1497 AC_SUBST(V_FINDALLDEVS)
1498 AC_SUBST(V_INCLS)
1499 AC_SUBST(V_LEX)
1500 AC_SUBST(V_PCAP)
1501 AC_SUBST(V_SHLIB_CMD)
1502 AC_SUBST(V_SHLIB_OPT)
1503 AC_SUBST(V_SONAME_OPT)
1504 AC_SUBST(V_RPATH_OPT)
1505 AC_SUBST(V_YACC)
1506 AC_SUBST(ADDLOBJS)
1507 AC_SUBST(ADDLARCHIVEOBJS)
1508 AC_SUBST(SSRC)
1509 AC_SUBST(DYEXT)
1510 AC_SUBST(MAN_FILE_FORMATS)
1511 AC_SUBST(MAN_MISC_INFO)
1512 AC_SUBST(MAN_USERMOD_SECTION)
1513 AC_SUBST(RPCAPD)
1514 AC_SUBST(INSTALL_RPCAPD)
1515
1516 AC_ARG_ENABLE([usb],
1517 [AC_HELP_STRING([--enable-usb],[enable nusb support @<:@default=yes, if support available@:>@])],
1518 [],
1519 [enable_usb=yes])
1520
1521 if test "xxx_only" = yes; then
1522 # User requested something-else-only pcap, so they don't
1523 # want USB support.
1524 enable_usb=no
1525 fi
1526
1527 if test "x$enable_usb" != "xno" ; then
1528 dnl check for USB sniffing support
1529 AC_MSG_CHECKING(for USB sniffing support)
1530 case "$host_os" in
1531 linux*)
1532 AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
1533 USB_SRC=pcap-usb-linux.c
1534 AC_MSG_RESULT(yes)
1535 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
1536 if test $? -ne 0 ; then
1537 ac_usb_dev_name="usbmon"
1538 fi
1539 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
1540 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
1541 #
1542 # Do we have a version of <linux/compiler.h> available?
1543 # If so, we might need it for <linux/usbdevice_fs.h>.
1544 #
1545 AC_CHECK_HEADERS(linux/compiler.h)
1546 if test "$ac_cv_header_linux_compiler_h" = yes; then
1547 #
1548 # Yes - include it when testing for <linux/usbdevice_fs.h>.
1549 #
1550 AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
1551 else
1552 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
1553 fi
1554 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
1555 #
1556 # OK, does it define bRequestType? Older versions of the kernel
1557 # define fields with names like "requesttype, "request", and
1558 # "value", rather than "bRequestType", "bRequest", and
1559 # "wValue".
1560 #
1561 AC_MSG_CHECKING(if usbdevfs_ctrltransfer struct has bRequestType member)
1562 AC_CACHE_VAL(ac_cv_usbdevfs_ctrltransfer_has_bRequestType,
1563 AC_TRY_COMPILE([
1564 AC_INCLUDES_DEFAULT
1565 #ifdef HAVE_SYS_BITYPES_H
1566 #include <sys/bitypes.h>
1567 #endif
1568 #ifdef HAVE_LINUX_COMPILER_H
1569 #include <linux/compiler.h>
1570 #endif
1571 #include <linux/usbdevice_fs.h>],
1572 [u_int i = sizeof(((struct usbdevfs_ctrltransfer *)0)->bRequestType)],
1573 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=yes,
1574 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=no))
1575 AC_MSG_RESULT($ac_cv_usbdevfs_ctrltransfer_has_bRequestType)
1576 if test $ac_cv_usbdevfs_ctrltransfer_has_bRequestType = yes ; then
1577 AC_DEFINE(HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE,1,
1578 [if struct usbdevfs_ctrltransfer has bRequestType])
1579 fi
1580 fi
1581 ;;
1582 freebsd*)
1583 #
1584 # This just uses BPF in FreeBSD 8.4 and later; we don't need
1585 # to check for anything special for capturing.
1586 #
1587 AC_MSG_RESULT([yes, in FreeBSD 8.4 and later])
1588 ;;
1589
1590 *)
1591 AC_MSG_RESULT(no)
1592 ;;
1593 esac
1594 fi
1595 AC_SUBST(PCAP_SUPPORT_USB)
1596 AC_SUBST(USB_SRC)
1597
1598 dnl check for netfilter sniffing support
1599 if test "xxx_only" != yes; then
1600 AC_MSG_CHECKING(whether the platform could support netfilter sniffing)
1601 case "$host_os" in
1602 linux*)
1603 AC_MSG_RESULT(yes)
1604 #
1605 # Life's too short to deal with trying to get this to compile
1606 # if you don't get the right types defined with
1607 # __KERNEL_STRICT_NAMES getting defined by some other include.
1608 #
1609 # Check whether the includes Just Work. If not, don't turn on
1610 # netfilter support.
1611 #
1612 AC_MSG_CHECKING(whether we can compile the netfilter support)
1613 AC_CACHE_VAL(ac_cv_netfilter_can_compile,
1614 AC_TRY_COMPILE([
1615 AC_INCLUDES_DEFAULT
1616 #include <sys/socket.h>
1617 #include <netinet/in.h>
1618 #include <linux/types.h>
1619
1620 #include <linux/netlink.h>
1621 #include <linux/netfilter.h>
1622 #include <linux/netfilter/nfnetlink.h>
1623 #include <linux/netfilter/nfnetlink_log.h>
1624 #include <linux/netfilter/nfnetlink_queue.h>],
1625 [],
1626 ac_cv_netfilter_can_compile=yes,
1627 ac_cv_netfilter_can_compile=no))
1628 AC_MSG_RESULT($ac_cv_netfilter_can_compile)
1629 if test $ac_cv_netfilter_can_compile = yes ; then
1630 AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1,
1631 [target host supports netfilter sniffing])
1632 NETFILTER_SRC=pcap-netfilter-linux.c
1633 fi
1634 ;;
1635 *)
1636 AC_MSG_RESULT(no)
1637 ;;
1638 esac
1639 fi
1640 AC_SUBST(PCAP_SUPPORT_NETFILTER)
1641 AC_SUBST(NETFILTER_SRC)
1642
1643 AC_ARG_ENABLE([netmap],
1644 [AC_HELP_STRING([--enable-netmap],[enable netmap support @<:@default=yes, if support available@:>@])],
1645 [],
1646 [enable_netmap=yes])
1647
1648 if test "x$enable_netmap" != "xno" ; then
1649 dnl check for netmap support
1650 AC_CHECK_HEADER(net/netmap_user.h,
1651 [ AC_DEFINE(PCAP_SUPPORT_NETMAP, 1, [target host supports netmap])
1652 NETMAP_SRC=pcap-netmap.c
1653 AC_MSG_NOTICE(netmap is supported)],
1654 AC_MSG_NOTICE(netmap is not supported),
1655 AC_INCLUDES_DEFAULT
1656 )
1657 AC_SUBST(PCAP_SUPPORT_NETMAP)
1658 AC_SUBST(NETMAP_SRC)
1659 fi
1660
1661
1662 AC_ARG_ENABLE([bluetooth],
1663 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
1664 [],
1665 [enable_bluetooth=ifsupportavailable])
1666
1667 if test "xxx_only" = yes; then
1668 # User requested something-else-only pcap, so they don't
1669 # want Bluetooth support.
1670 enable_bluetooth=no
1671 fi
1672
1673 if test "x$enable_bluetooth" != "xno" ; then
1674 dnl check for Bluetooth sniffing support
1675 case "$host_os" in
1676 linux*)
1677 AC_CHECK_HEADER(bluetooth/bluetooth.h,
1678 [
1679 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
1680 BT_SRC=pcap-bt-linux.c
1681 AC_MSG_NOTICE(Bluetooth sniffing is supported)
1682
1683 #
1684 # OK, does struct sockaddr_hci have an hci_channel
1685 # member?
1686 #
1687 AC_MSG_CHECKING(if struct sockaddr_hci has hci_channel member)
1688 AC_CACHE_VAL(ac_cv_lbl_sockaddr_hci_has_hci_channel,
1689 AC_TRY_COMPILE(
1690 [
1691 #include <bluetooth/bluetooth.h>
1692 #include <bluetooth/hci.h>
1693 ],
1694 [u_int i = sizeof(((struct sockaddr_hci *)0)->hci_channel)],
1695 ac_cv_lbl_sockaddr_hci_has_hci_channel=yes,
1696 ac_cv_lbl_sockaddr_hci_has_hci_channel=no))
1697 AC_MSG_RESULT($ac_cv_lbl_sockaddr_hci_has_hci_channel)
1698 if test $ac_cv_lbl_sockaddr_hci_has_hci_channel = yes ; then
1699 AC_DEFINE(SOCKADDR_HCI_HAS_HCI_CHANNEL,,
1700 [if struct sockaddr_hci has hci_channel member])
1701
1702 #
1703 # OK, is HCI_CHANNEL_MONITOR defined?
1704 #
1705 AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined)
1706 AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined,
1707 AC_TRY_COMPILE(
1708 [
1709 #include <bluetooth/bluetooth.h>
1710 #include <bluetooth/hci.h>
1711 ],
1712 [u_int i = HCI_CHANNEL_MONITOR],
1713 ac_cv_lbl_hci_channel_monitor_is_defined=yes,
1714 ac_cv_lbl_hci_channel_monitor_is_defined=no))
1715 AC_MSG_RESULT($ac_cv_lbl_hci_channel_monitor_is_defined)
1716 if test $ac_cv_lbl_hci_channel_monitor_is_defined = yes ; then
1717 AC_DEFINE(PCAP_SUPPORT_BT_MONITOR,,
1718 [target host supports Bluetooth Monitor])
1719 BT_MONITOR_SRC=pcap-bt-monitor-linux.c
1720 fi
1721 fi
1722 ac_lbl_bluetooth_available=yes
1723 ],
1724 ac_lbl_bluetooth_available=no
1725 )
1726 if test "x$ac_lbl_bluetooth_available" == "xno" ; then
1727 if test "x$enable_bluetooth" = "xyes" ; then
1728 AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
1729 else
1730 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
1731 fi
1732 fi
1733 ;;
1734 *)
1735 if test "x$enable_bluetooth" = "xyes" ; then
1736 AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
1737 else
1738 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
1739 fi
1740 ;;
1741 esac
1742 AC_SUBST(PCAP_SUPPORT_BT)
1743 AC_SUBST(BT_SRC)
1744 AC_SUBST(BT_MONITOR_SRC)
1745 fi
1746
1747 AC_ARG_ENABLE([dbus],
1748 [AC_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])],
1749 [],
1750 [enable_dbus=ifavailable])
1751
1752 if test "xxx_only" = yes; then
1753 # User requested something-else-only pcap, so they don't
1754 # want D-Bus support.
1755 enable_dbus=no
1756 fi
1757
1758 if test "x$enable_dbus" != "xno"; then
1759 if test "x$enable_dbus" = "xyes"; then
1760 case "$host_os" in
1761
1762 darwin*)
1763 #
1764 # We don't support D-Bus sniffing on macOS; see
1765 #
1766 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
1767 #
1768 # The user requested it, so fail.
1769 #
1770 AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on macOS])
1771 esac
1772 else
1773 case "$host_os" in
1774
1775 darwin*)
1776 #
1777 # We don't support D-Bus sniffing on macOS; see
1778 #
1779 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
1780 #
1781 # The user dind't explicitly request it, so just
1782 # silently refuse to enable it.
1783 #
1784 enable_dbus="no"
1785 ;;
1786 esac
1787 fi
1788 fi
1789
1790 if test "x$enable_dbus" != "xno"; then
1791 AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
1792 if test "x$PKGCONFIG" != "xno"; then
1793 AC_MSG_CHECKING([for D-Bus])
1794 if "$PKGCONFIG" dbus-1; then
1795 AC_MSG_RESULT([yes])
1796 DBUS_CFLAGS=`"$PKGCONFIG" --cflags dbus-1`
1797 DBUS_LIBS=`"$PKGCONFIG" --libs dbus-1`
1798 save_CFLAGS="$CFLAGS"
1799 save_LIBS="$LIBS"
1800 CFLAGS="$CFLAGS $DBUS_CFLAGS"
1801 LIBS="$LIBS $DBUS_LIBS"
1802 AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write)
1803 AC_TRY_LINK(
1804 [#include <string.h>
1805
1806 #include <time.h>
1807 #include <sys/time.h>
1808
1809 #include <dbus/dbus.h>],
1810 [return dbus_connection_read_write(NULL, 0);],
1811 [
1812 AC_MSG_RESULT([yes])
1813 AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing])
1814 DBUS_SRC=pcap-dbus.c
1815 V_INCLS="$V_INCLS $DBUS_CFLAGS"
1816 ],
1817 [
1818 AC_MSG_RESULT([no])
1819 if test "x$enable_dbus" = "xyes"; then
1820 AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()])
1821 fi
1822 LIBS="$save_LIBS"
1823 ])
1824 CFLAGS="$save_CFLAGS"
1825 else
1826 AC_MSG_RESULT([no])
1827 if test "x$enable_dbus" = "xyes"; then
1828 AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed])
1829 fi
1830 fi
1831 fi
1832 AC_SUBST(PCAP_SUPPORT_DBUS)
1833 AC_SUBST(DBUS_SRC)
1834 fi
1835
1836 dnl check for hardware timestamp support
1837 case "$host_os" in
1838 linux*)
1839 AC_CHECK_HEADERS([linux/net_tstamp.h])
1840 ;;
1841 *)
1842 AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os)
1843 ;;
1844 esac
1845
1846 dnl The packet ring capture facility of Linux, described in
1847 dnl Documentation/networking/packet_mmap.txt, is not 32/64-bit compatible before
1848 dnl version 2.6.27. A 32-bit kernel requires a 32-bit userland, and likewise for
1849 dnl 64-bit. The effect of this is that a 32-bit libpcap binary will not run
1850 dnl correctly on a 64-bit kernel (the binary will use the wrong offsets into a
1851 dnl kernel struct). This problem was solved in Linux 2.6.27. Use
1852 dnl --disable-packet-ring whenever a 32-bit application must run on a 64-bit
1853 dnl target host, and either the build host or the target host run Linux 2.6.26
1854 dnl or earlier.
1855 AC_ARG_ENABLE([packet-ring],
1856 [AC_HELP_STRING([--enable-packet-ring],[enable Linux packet ring support @<:@default=yes@:>@])],
1857 ,enable_packet_ring=yes)
1858
1859 if test "x$enable_packet_ring" != "xno" ; then
1860 AC_DEFINE(PCAP_SUPPORT_PACKET_RING, 1, [use Linux packet ring capture if available])
1861 AC_SUBST(PCAP_SUPPORT_PACKET_RING)
1862 fi
1863
1864 AC_PROG_INSTALL
1865
1866 AC_CONFIG_HEADER(config.h)
1867
1868 AC_OUTPUT_COMMANDS([if test -f .devel; then
1869 echo timestamp > stamp-h
1870 cat Makefile-devel-adds >> Makefile
1871 make depend
1872 fi])
1873 AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
1874 pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap
1875 pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap
1876 pcap_get_tstamp_precision.3pcap pcap_list_datalinks.3pcap
1877 pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap
1878 pcap_open_offline.3pcap pcap_set_tstamp_precision.3pcap
1879 pcap_set_tstamp_type.3pcap rpcapd/Makefile)
1880 exit 0