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