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