]> The Tcpdump Group git mirrors - libpcap/blob - configure.ac
Remove some workarounds for old compilers.
[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.64)
18
19 AC_INIT(pcap, m4_esyscmd_s([cat VERSION]))
20 AC_CONFIG_SRCDIR(pcap.c)
21 AC_SUBST(PACKAGE_NAME)
22
23 AC_CANONICAL_SYSTEM
24
25 AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
26 #
27 # Try to enable as many C99 features as we can.
28 # At minimum, we want C++/C99-style // comments.
29 #
30 AC_PROG_CC_C99
31 if test "$ac_cv_prog_cc_c99" = "no"; then
32 AC_MSG_WARN([The C compiler does not support C99; there may be compiler errors])
33 fi
34 case "$host_os" in
35 haiku*)
36 #
37 # Haiku's platform file is in C++.
38 #
39 AC_PROG_CXX
40 ;;
41 esac
42
43 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
44 AC_LBL_SHLIBS_INIT
45 AC_LBL_C_INLINE
46
47 #
48 # Try to arrange for large file support.
49 #
50 AC_SYS_LARGEFILE
51 AC_FUNC_FSEEKO
52
53 dnl
54 dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to
55 dnl include <sys/ioccom.h>, and we were to drop support for older
56 dnl releases without that fix, so that pcap-bpf.c doesn't need to
57 dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES"
58 dnl in "aclocal.m4" uses it, so we would still have to test for it
59 dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
60 dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris.
61 dnl
62 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h)
63 AC_CHECK_HEADERS(netpacket/packet.h)
64 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
65 #include <sys/socket.h>
66 #include <net/if.h>])
67 if test "$ac_cv_header_net_pfvar_h" = yes; then
68 #
69 # Check for various PF actions.
70 #
71 AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR)
72 AC_TRY_COMPILE(
73 [#include <sys/types.h>
74 #include <sys/socket.h>
75 #include <net/if.h>
76 #include <net/pfvar.h>],
77 [return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;],
78 [
79 AC_MSG_RESULT(yes)
80 AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1,
81 [define if net/pfvar.h defines PF_NAT through PF_NORDR])
82 ],
83 AC_MSG_RESULT(no))
84 fi
85
86 case "$host_os" in
87 linux*|uclinux*)
88 #
89 # linux/if_bonding.h requires sys/socket.h.
90 #
91 AC_CHECK_HEADERS(linux/sockios.h linux/if_bonding.h,,,
92 [
93 #include <sys/socket.h>
94 #include <linux/if.h>
95 ])
96
97 #
98 # Check for the eventfd header.
99 #
100 AC_CHECK_HEADERS(sys/eventfd.h)
101 ;;
102
103 haiku*)
104 #
105 # Haiku needs _BSD_SOURCE for the _IO* macros because it doesn't use them.
106 #
107 CFLAGS="$CFLAGS -D_BSD_SOURCE"
108 ;;
109 esac
110
111 AC_LBL_FIXINCLUDES
112
113 AC_CHECK_FUNCS(strerror)
114 AC_CHECK_FUNC(strerror_r,
115 [
116 #
117 # We have strerror_r; if we define _GNU_SOURCE, is it a
118 # POSIX-compliant strerror_r() or a GNU strerror_r()?
119 #
120 AC_MSG_CHECKING(whether strerror_r is GNU-style)
121 AC_COMPILE_IFELSE(
122 [
123 AC_LANG_SOURCE(
124 #define _GNU_SOURCE
125 #include <string.h>
126
127 /* Define it GNU-style; that will cause an error if it's not GNU-style */
128 extern char *strerror_r(int, char *, size_t);
129
130 int
131 main(void)
132 {
133 return 0;
134 }
135 )
136 ],
137 [
138 # GNU-style
139 AC_MSG_RESULT(yes)
140 AC_DEFINE(HAVE_GNU_STRERROR_R,,
141 [Define to 1 if you have a GNU-style `strerror_r' function.])
142 ],
143 [
144 AC_MSG_RESULT(no)
145 AC_DEFINE(HAVE_POSIX_STRERROR_R,,
146 [Define to 1 if you have a POSIX-style `strerror_r' function.])
147 ])
148 ],
149 [
150 #
151 # We don't have strerror_r; do we have strerror_s?
152 #
153 AC_CHECK_FUNCS(strerror_s)
154 ])
155
156 #
157 # Thanks, IBM, for not providing vsyslog() in AIX!
158 #
159 AC_CHECK_FUNCS(vsyslog)
160
161 #
162 # Make sure we have vsnprintf() and snprintf(); we require them.
163 #
164 AC_CHECK_FUNC(vsnprintf,,
165 AC_MSG_ERROR([vsnprintf() is required but wasn't found]))
166 AC_CHECK_FUNC(snprintf,,
167 AC_MSG_ERROR([snprintf() is required but wasn't found]))
168
169 needasprintf=no
170 AC_CHECK_FUNCS(vasprintf asprintf,,
171 [needasprintf=yes])
172 if test $needasprintf = yes; then
173 AC_LIBOBJ([asprintf])
174 fi
175
176 needstrlcat=no
177 AC_CHECK_FUNCS(strlcat,,
178 [needstrlcat=yes])
179 if test $needstrlcat = yes; then
180 AC_LIBOBJ([strlcat])
181 fi
182
183 needstrlcpy=no
184 AC_CHECK_FUNCS(strlcpy,,
185 [needstrlcpy=yes])
186 if test $needstrlcpy = yes; then
187 AC_LIBOBJ([strlcpy])
188 fi
189
190 needstrtok_r=no
191 AC_CHECK_FUNCS(strtok_r,,
192 [needstrtok_r=yes])
193 if test $needstrtok_r = yes; then
194 AC_LIBOBJ([strtok_r])
195 fi
196
197 #
198 # Do we have ffs(), and is it declared in <strings.h>?
199 #
200 AC_CHECK_FUNCS(ffs)
201 if test "$ac_cv_func_ffs" = yes; then
202 #
203 # We have ffs(); is it declared in <strings.h>?
204 #
205 # This test fails if we don't have <strings.h> or if we do
206 # but it doesn't declare ffs().
207 #
208 AC_CHECK_DECL(ffs,
209 [
210 AC_DEFINE(STRINGS_H_DECLARES_FFS,,
211 [Define to 1 if strings.h declares `ffs'])
212 ],,
213 [
214 #include <strings.h>
215 ])
216 fi
217
218 #
219 # Do this before checking for ether_hostton(), as it's a
220 # "getaddrinfo()-ish function".
221 #
222 AC_LBL_LIBRARY_NET
223
224 #
225 # Check for reentrant versions of getnetbyname_r(), as provided by
226 # Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!).
227 # If we don't find one, we just use getnetbyname(), which uses
228 # thread-specific data on many platforms, but doesn't use it on
229 # NetBSD or OpenBSD, and may not use it on older versions of other
230 # platforms.
231 #
232 # Only do the check if we have a declaration of getnetbyname_r();
233 # without it, we can't check which API it has. (We assume that
234 # if there's a declaration, it has a prototype, so that the API
235 # can be checked.)
236 #
237 AC_CHECK_DECL(getnetbyname_r,
238 [
239 AC_MSG_CHECKING([for the Linux getnetbyname_r()])
240 AC_TRY_LINK(
241 [#include <netdb.h>],
242 [
243 struct netent netent_buf;
244 char buf[1024];
245 struct netent *resultp;
246 int h_errnoval;
247
248 return getnetbyname_r((const char *)0, &netent_buf, buf, sizeof buf, &resultp, &h_errnoval);
249 ],
250 [
251 AC_MSG_RESULT(yes)
252 AC_DEFINE(HAVE_LINUX_GETNETBYNAME_R, 1,
253 [define if we have the Linux getnetbyname_r()])
254 ],
255 [
256 AC_MSG_RESULT(no)
257
258 AC_MSG_CHECKING([for Solaris/IRIX getnetbyname_r()])
259 AC_TRY_LINK(
260 [#include <netdb.h>],
261 [
262 struct netent netent_buf;
263 char buf[1024];
264
265 return getnetbyname_r((const char *)0, &netent_buf, buf, (int)sizeof buf) != NULL;
266 ],
267 [
268 AC_MSG_RESULT(yes)
269 AC_DEFINE(HAVE_SOLARIS_IRIX_GETNETBYNAME_R, 1,
270 [define if we have the Solaris/IRIX getnetbyname_r()])
271 ],
272 [
273 AC_MSG_RESULT(no)
274
275 AC_MSG_CHECKING([for AIX getnetbyname_r()])
276 AC_TRY_LINK(
277 [#include <netdb.h>],
278 [
279 struct netent netent_buf;
280 struct netent_data net_data;
281
282 return getnetbyname_r((const char *)0, &netent_buf, &net_data);
283 ],
284 [
285 AC_MSG_RESULT(yes)
286 AC_DEFINE(HAVE_AIX_GETNETBYNAME_R, 1,
287 [define if we have the AIX getnetbyname_r()])
288 ],
289 [
290 AC_MSG_RESULT(no)
291 ])
292 ])
293 ])
294 ],,[#include <netdb.h>])
295
296 #
297 # Check for reentrant versions of getprotobyname_r(), as provided by
298 # Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!).
299 # If we don't find one, we just use getprotobyname(), which uses
300 # thread-specific data on many platforms, but doesn't use it on
301 # NetBSD or OpenBSD, and may not use it on older versions of other
302 # platforms.
303 #
304 # Only do the check if we have a declaration of getprotobyname_r();
305 # without it, we can't check which API it has. (We assume that
306 # if there's a declaration, it has a prototype, so that the API
307 # can be checked.)
308 #
309 AC_CHECK_DECL(getprotobyname_r,
310 [
311 AC_MSG_CHECKING([for the Linux getprotobyname_r()])
312 AC_TRY_LINK(
313 [#include <netdb.h>],
314 [
315 struct protoent protoent_buf;
316 char buf[1024];
317 struct protoent *resultp;
318
319 return getprotobyname_r((const char *)0, &protoent_buf, buf, sizeof buf, &resultp);
320 ],
321 [
322 AC_MSG_RESULT(yes)
323 AC_DEFINE(HAVE_LINUX_GETPROTOBYNAME_R, 1,
324 [define if we have the Linux getprotobyname_r()])
325 ],
326 [
327 AC_MSG_RESULT(no)
328
329 AC_MSG_CHECKING([for Solaris/IRIX getprotobyname_r()])
330 AC_TRY_LINK(
331 [#include <netdb.h>],
332 [
333 struct protoent protoent_buf;
334 char buf[1024];
335
336 return getprotobyname_r((const char *)0, &protoent_buf, buf, (int)sizeof buf) != NULL;
337 ],
338 [
339 AC_MSG_RESULT(yes)
340 AC_DEFINE(HAVE_SOLARIS_IRIX_GETPROTOBYNAME_R, 1,
341 [define if we have the Solaris/IRIX getprotobyname_r()])
342 ],
343 [
344 AC_MSG_RESULT(no)
345
346 AC_MSG_CHECKING([for AIX getprotobyname_r()])
347 AC_TRY_LINK(
348 [#include <netdb.h>],
349 [
350 struct protoent protoent_buf;
351 struct protoent_data proto_data;
352
353 return getprotobyname_r((const char *)0, &protoent_buf, &proto_data);
354 ],
355 [
356 AC_MSG_RESULT(yes)
357 AC_DEFINE(HAVE_AIX_GETPROTOBYNAME_R, 1,
358 [define if we have the AIX getprotobyname_r()])
359 ],
360 [
361 AC_MSG_RESULT(no)
362 ])
363 ])
364 ])
365 ],,[#include <netdb.h>])
366
367 #
368 # You are in a twisty little maze of UN*Xes, all different.
369 # Some might not have ether_hostton().
370 # Some might have it and declare it in <net/ethernet.h>.
371 # Some might have it and declare it in <netinet/ether.h>
372 # Some might have it and declare it in <sys/ethernet.h>.
373 # Some might have it and declare it in <arpa/inet.h>.
374 # Some might have it and declare it in <netinet/if_ether.h>.
375 # Some might have it and not declare it in any header file.
376 #
377 # Before you is a C compiler.
378 #
379 AC_CHECK_FUNCS(ether_hostton)
380 if test "$ac_cv_func_ether_hostton" = yes; then
381 #
382 # OK, we have ether_hostton(). Is it declared in <net/ethernet.h>?
383 #
384 # This test fails if we don't have <net/ethernet.h> or if we do
385 # but it doesn't declare ether_hostton().
386 #
387 AC_CHECK_DECL(ether_hostton,
388 [
389 AC_DEFINE(NET_ETHERNET_H_DECLARES_ETHER_HOSTTON,,
390 [Define to 1 if net/ethernet.h declares `ether_hostton'])
391 ],,
392 [
393 #include <net/ethernet.h>
394 ])
395 #
396 # Did that succeed?
397 #
398 if test "$ac_cv_have_decl_ether_hostton" != yes; then
399 #
400 # No, how about <netinet/ether.h>, as on Linux?
401 #
402 # This test fails if we don't have <netinet/ether.h>
403 # or if we do but it doesn't declare ether_hostton().
404 #
405 # Unset ac_cv_have_decl_ether_hostton so we don't
406 # treat the previous failure as a cached value and
407 # suppress the next test.
408 #
409 unset ac_cv_have_decl_ether_hostton
410 AC_CHECK_DECL(ether_hostton,
411 [
412 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
413 [Define to 1 if netinet/ether.h declares `ether_hostton'])
414 ],,
415 [
416 #include <netinet/ether.h>
417 ])
418 fi
419 #
420 # Did that succeed?
421 #
422 if test "$ac_cv_have_decl_ether_hostton" != yes; then
423 #
424 # No, how about <sys/ethernet.h>, as on Solaris 10
425 # and later?
426 #
427 # This test fails if we don't have <sys/ethernet.h>
428 # or if we do but it doesn't declare ether_hostton().
429 #
430 # Unset ac_cv_have_decl_ether_hostton so we don't
431 # treat the previous failure as a cached value and
432 # suppress the next test.
433 #
434 unset ac_cv_have_decl_ether_hostton
435 AC_CHECK_DECL(ether_hostton,
436 [
437 AC_DEFINE(SYS_ETHERNET_H_DECLARES_ETHER_HOSTTON,,
438 [Define to 1 if sys/ethernet.h declares `ether_hostton'])
439 ],,
440 [
441 #include <sys/ethernet.h>
442 ])
443 fi
444 #
445 # Did that succeed?
446 #
447 if test "$ac_cv_have_decl_ether_hostton" != yes; then
448 #
449 # No, how about <arpa/inet.h>, as in AIX?
450 #
451 # This test fails if we don't have <arpa/inet.h>
452 # (if we have ether_hostton(), we should have
453 # networking, and if we have networking, we should
454 # have <arapa/inet.h>) or if we do but it doesn't
455 # declare ether_hostton().
456 #
457 # Unset ac_cv_have_decl_ether_hostton so we don't
458 # treat the previous failure as a cached value and
459 # suppress the next test.
460 #
461 unset ac_cv_have_decl_ether_hostton
462 AC_CHECK_DECL(ether_hostton,
463 [
464 AC_DEFINE(ARPA_INET_H_DECLARES_ETHER_HOSTTON,,
465 [Define to 1 if arpa/inet.h declares `ether_hostton'])
466 ],,
467 [
468 #include <arpa/inet.h>
469 ])
470 fi
471 #
472 # Did that succeed?
473 #
474 if test "$ac_cv_have_decl_ether_hostton" != yes; then
475 #
476 # No, how about <netinet/if_ether.h>?
477 # On some platforms, it requires <net/if.h> and
478 # <netinet/in.h>, and we always include it with
479 # both of them, so test it with both of them.
480 #
481 # This test fails if we don't have <netinet/if_ether.h>
482 # and the headers we include before it, or if we do but
483 # <netinet/if_ether.h> doesn't declare ether_hostton().
484 #
485 # Unset ac_cv_have_decl_ether_hostton so we don't
486 # treat the previous failure as a cached value and
487 # suppress the next test.
488 #
489 unset ac_cv_have_decl_ether_hostton
490 AC_CHECK_DECL(ether_hostton,
491 [
492 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
493 [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
494 ],,
495 [
496 #include <sys/types.h>
497 #include <sys/socket.h>
498 #include <net/if.h>
499 #include <netinet/in.h>
500 #include <netinet/if_ether.h>
501 ])
502 fi
503 #
504 # After all that, is ether_hostton() declared?
505 #
506 if test "$ac_cv_have_decl_ether_hostton" = yes; then
507 #
508 # Yes.
509 #
510 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
511 [Define to 1 if you have the declaration of `ether_hostton'])
512 else
513 #
514 # No, we'll have to declare it ourselves.
515 # Do we have "struct ether_addr" if we include
516 # <netinet/if_ether.h>?
517 #
518 AC_CHECK_TYPES(struct ether_addr,,,
519 [
520 #include <sys/types.h>
521 #include <sys/socket.h>
522 #include <net/if.h>
523 #include <netinet/in.h>
524 #include <netinet/if_ether.h>
525 ])
526 fi
527 fi
528
529 #
530 # For various things that might use pthreads.
531 #
532 AC_CHECK_HEADER(pthread.h,
533 [
534 #
535 # OK, we have pthread.h. Do we have pthread_create in the
536 # system libraries?
537 #
538 AC_CHECK_FUNC(pthread_create,
539 [
540 #
541 # Yes.
542 #
543 ac_lbl_have_pthreads="found"
544 ],
545 [
546 #
547 # No - do we have it in -lpthreads?
548 #
549 AC_CHECK_LIB(pthreads, pthread_create,
550 [
551 #
552 # Yes - add -lpthreads.
553 #
554 ac_lbl_have_pthreads="found"
555 PTHREAD_LIBS="$PTHREAD_LIBS -lpthreads"
556 ],
557 [
558 #
559 # No - do we have it in -lpthread?
560 #
561 AC_CHECK_LIB(pthread, pthread_create,
562 [
563 #
564 # Yes - add -lpthread.
565 #
566 ac_lbl_have_pthreads="found"
567 PTHREAD_LIBS="$PTHREAD_LIBS -lpthread"
568 ],
569 [
570 #
571 # No.
572 #
573 ac_lbl_have_pthreads="not found"
574 ])
575 ])
576 ])
577 ],
578 [
579 #
580 # We didn't find pthread.h.
581 #
582 ac_lbl_have_pthreads="not found"
583 ]
584 )
585
586 dnl to pacify those who hate protochain insn
587 AC_MSG_CHECKING(if --disable-protochain option is specified)
588 AC_ARG_ENABLE(protochain,
589 AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
590 case "x$enable_protochain" in
591 xyes) enable_protochain=enabled ;;
592 xno) enable_protochain=disabled ;;
593 x) enable_protochain=enabled ;;
594 esac
595
596 if test "$enable_protochain" = "disabled"; then
597 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
598 fi
599 AC_MSG_RESULT(${enable_protochain})
600
601 #
602 # valgrindtest directly uses the native capture mechanism, but
603 # only tests with BPF and PF_PACKET sockets; only enable it if
604 # we have BPF or PF_PACKET sockets.
605 #
606 VALGRINDTEST_SRC=
607
608 AC_ARG_WITH(pcap,
609 AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
610 if test ! -z "$with_pcap" ; then
611 V_PCAP="$withval"
612 else
613 #
614 # Check for a bunch of headers for various packet
615 # capture mechanisms.
616 #
617 AC_CHECK_HEADERS(net/bpf.h)
618 if test "$ac_cv_header_net_bpf_h" = yes; then
619 #
620 # Does it define BIOCSETIF?
621 # I.e., is it a header for an LBL/BSD-style capture
622 # mechanism, or is it just a header for a BPF filter
623 # engine? Some versions of Arch Linux, for example,
624 # have a net/bpf.h that doesn't define BIOCSETIF;
625 # as it's a Linux, it should use packet sockets,
626 # instead.
627 #
628 # We need:
629 #
630 # sys/types.h, because FreeBSD 10's net/bpf.h
631 # requires that various BSD-style integer types
632 # be defined;
633 #
634 # sys/time.h, because AIX 5.2 and 5.3's net/bpf.h
635 # doesn't include it but does use struct timeval
636 # in ioctl definitions;
637 #
638 # sys/ioctl.h and, if we have it, sys/ioccom.h,
639 # because net/bpf.h defines ioctls;
640 #
641 # net/if.h, because it defines some structures
642 # used in ioctls defined by net/bpf.h;
643 #
644 # sys/socket.h, because OpenBSD 5.9's net/bpf.h
645 # defines some structure fields as being
646 # struct sockaddrs;
647 #
648 # and net/bpf.h doesn't necessarily include all
649 # of those headers itself.
650 #
651 AC_MSG_CHECKING(if net/bpf.h defines BIOCSETIF)
652 AC_CACHE_VAL(ac_cv_lbl_bpf_h_defines_biocsetif,
653 AC_TRY_COMPILE(
654 [
655 #include <sys/types.h>
656 #include <sys/time.h>
657 #include <sys/ioctl.h>
658 #include <sys/socket.h>
659 #ifdef HAVE_SYS_IOCCOM_H
660 #include <sys/ioccom.h>
661 #endif
662 #include <net/bpf.h>
663 #include <net/if.h>
664 ],
665 [u_int i = BIOCSETIF;],
666 ac_cv_lbl_bpf_h_defines_biocsetif=yes,
667 ac_cv_lbl_bpf_h_defines_biocsetif=no))
668 AC_MSG_RESULT($ac_cv_lbl_bpf_h_defines_biocsetif)
669 fi
670 AC_CHECK_HEADERS(net/pfilt.h net/enet.h)
671 AC_CHECK_HEADERS(net/nit.h sys/net/nit.h)
672 AC_CHECK_HEADERS(linux/socket.h net/raw.h sys/dlpi.h)
673 AC_CHECK_HEADERS(config/HaikuConfig.h)
674
675 if test "$ac_cv_lbl_bpf_h_defines_biocsetif" = yes; then
676 #
677 # BPF.
678 # Check this before DLPI, so that we pick BPF on
679 # Solaris 11 and later.
680 #
681 V_PCAP=bpf
682
683 #
684 # We have BPF, so build valgrindtest with "make test"
685 # on macOS and FreeBSD (add your OS once there's a
686 # valgrind for it).
687 #
688 case "$host_os" in
689
690 freebsd*|darwin*|linux*)
691 VALGRINDTEST_SRC=valgrindtest.c
692 ;;
693 esac
694 elif test "$ac_cv_header_linux_socket_h" = yes; then
695 #
696 # No prizes for guessing this one.
697 #
698 V_PCAP=linux
699
700 #
701 # XXX - this won't work with older kernels that have
702 # SOCK_PACKET sockets but not PF_PACKET sockets.
703 #
704 VALGRINDTEST_SRC=valgrindtest.c
705 elif test "$ac_cv_header_net_pfilt_h" = yes; then
706 #
707 # DEC OSF/1, Digital UNIX, Tru64 UNIX
708 #
709 V_PCAP=pf
710 elif test "$ac_cv_header_net_enet_h" = yes; then
711 #
712 # Stanford Enetfilter.
713 #
714 V_PCAP=enet
715 elif test "$ac_cv_header_net_nit_h" = yes; then
716 #
717 # SunOS 4.x STREAMS NIT.
718 #
719 V_PCAP=snit
720 elif test "$ac_cv_header_sys_net_nit_h" = yes; then
721 #
722 # Pre-SunOS 4.x non-STREAMS NIT.
723 #
724 V_PCAP=nit
725 elif test "$ac_cv_header_net_raw_h" = yes; then
726 #
727 # IRIX snoop.
728 #
729 V_PCAP=snoop
730 elif test "$ac_cv_header_sys_dlpi_h" = yes; then
731 #
732 # DLPI on pre-Solaris 11 SunOS 5, HP-UX, possibly others.
733 #
734 V_PCAP=dlpi
735 elif test "$ac_cv_header_config_HaikuConfig_h" = yes; then
736 #
737 # Haiku.
738 #
739 V_PCAP=haiku
740 else
741 #
742 # Nothing we support.
743 #
744 V_PCAP=null
745 AC_MSG_WARN(cannot determine packet capture interface)
746 AC_MSG_WARN((see the INSTALL doc for more info))
747 fi
748 fi
749 AC_MSG_CHECKING(packet capture type)
750 AC_MSG_RESULT($V_PCAP)
751 AC_SUBST(VALGRINDTEST_SRC)
752
753 #
754 # Handle each capture type.
755 #
756 case "$V_PCAP" in
757 dlpi)
758 #
759 # Checks for some header files.
760 #
761 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
762
763 #
764 # Checks to see if Solaris has the public libdlpi(3LIB) library.
765 # Note: The existence of /usr/include/libdlpi.h does not mean it is the
766 # public libdlpi(3LIB) version. Before libdlpi was made public, a
767 # private version also existed, which did not have the same APIs.
768 # Due to a gcc bug, the default search path for 32-bit libraries does
769 # not include /lib, we add it explicitly here.
770 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
771 # Also, due to the bug above applications that link to libpcap with
772 # libdlpi will have to add "-L/lib" option to "configure".
773 #
774 saved_ldflags=$LDFLAGS
775 LDFLAGS="$LIBS -L/lib"
776 AC_CHECK_LIB(dlpi, dlpi_walk,
777 [
778 LIBS="-ldlpi $LIBS"
779 V_PCAP=libdlpi
780
781 #
782 # Capture module plus common code needed for
783 # common functions used by pcap-[dlpi,libdlpi].c
784 #
785 PLATFORM_C_SRC="pcap-libdlpi.c dlpisubs.c"
786 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists])
787 ],
788 [
789 V_PCAP=dlpi
790
791 #
792 # Capture module plus common code needed for
793 # common functions used by pcap-[dlpi,libdlpi].c
794 #
795 PLATFORM_C_SRC="pcap-dlpi.c dlpisubs.c"
796 ])
797 LDFLAGS=$saved_ldflags
798
799 #
800 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO
801 # versions of DLPI.
802 #
803 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
804 AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
805 AC_TRY_COMPILE(
806 [
807 #include <sys/types.h>
808 #include <sys/time.h>
809 #include <sys/dlpi.h>
810 ],
811 [int i = DL_PROMISC_PHYS;],
812 ac_cv_sys_dlpi_usable=yes,
813 ac_cv_sys_dlpi_usable=no))
814 AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
815 if test $ac_cv_sys_dlpi_usable = no ; then
816 AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
817 fi
818
819 #
820 # Check to see if Solaris has the dl_passive_req_t struct defined
821 # in <sys/dlpi.h>.
822 # This check is for DLPI support for passive modes.
823 # See dlpi(7P) for more details.
824 #
825 AC_CHECK_TYPES(dl_passive_req_t,,,
826 [
827 #include <sys/types.h>
828 #include <sys/dlpi.h>
829 ])
830 ;;
831
832 enet)
833 #
834 # Capture module
835 #
836 PLATFORM_C_SRC="pcap-enet.c"
837 ;;
838
839 haiku)
840 #
841 # Capture module
842 #
843 PLATFORM_CXX_SRC="pcap-haiku.cpp"
844
845 #
846 # Just for the sake of it.
847 #
848 AC_CHECK_HEADERS(net/if.h net/if_dl.h net/if_types.h)
849 ;;
850
851 linux)
852 #
853 # Capture module
854 #
855 PLATFORM_C_SRC="pcap-linux.c"
856
857 #
858 # Do we have the wireless extensions?
859 #
860 AC_CHECK_HEADERS(linux/wireless.h, [], [],
861 [
862 #include <sys/socket.h>
863 #include <linux/if.h>
864 #include <linux/types.h>
865 ])
866
867 #
868 # Do we have libnl?
869 #
870 AC_ARG_WITH(libnl,
871 AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
872 with_libnl=$withval,with_libnl=if_available)
873
874 if test x$with_libnl != xno ; then
875 have_any_nl="no"
876
877 incdir=-I/usr/include/libnl3
878 libnldir=
879 case "$with_libnl" in
880
881 yes|if_available)
882 ;;
883
884 *)
885 if test -d $withval; then
886 libnldir=-L${withval}/lib/.libs
887 incdir=-I${withval}/include
888 fi
889 ;;
890 esac
891
892 #
893 # Try libnl 3.x first.
894 #
895 AC_CHECK_LIB(nl-3, nl_socket_alloc,
896 [
897 #
898 # Yes, we have libnl 3.x.
899 #
900 LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
901 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
902 AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x])
903 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
904 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
905 V_INCLS="$V_INCLS ${incdir}"
906 have_any_nl="yes"
907 ],[], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 )
908
909 if test x$have_any_nl = xno ; then
910 #
911 # Try libnl 2.x
912 #
913 AC_CHECK_LIB(nl, nl_socket_alloc,
914 [
915 #
916 # Yes, we have libnl 2.x.
917 #
918 LIBS="${libnldir} -lnl-genl -lnl $LIBS"
919 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
920 AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
921 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
922 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
923 have_any_nl="yes"
924 ])
925 fi
926
927 if test x$have_any_nl = xno ; then
928 #
929 # No, we don't; do we have libnl 1.x?
930 #
931 AC_CHECK_LIB(nl, nl_handle_alloc,
932 [
933 #
934 # Yes.
935 #
936 LIBS="${libnldir} -lnl $LIBS"
937 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
938 have_any_nl="yes"
939 ])
940 fi
941
942 if test x$have_any_nl = xno ; then
943 #
944 # No, we don't have libnl at all.
945 #
946 if test x$with_libnl = xyes ; then
947 AC_MSG_ERROR([libnl support requested but libnl not found])
948 fi
949 fi
950 fi
951
952 AC_CHECK_HEADERS(linux/ethtool.h,,,
953 [
954 AC_INCLUDES_DEFAULT
955 #include <linux/types.h>
956 ])
957
958 #
959 # Check to see if struct tpacket_stats is defined in
960 # <linux/if_packet.h>. If so, then pcap-linux.c can use this
961 # to report proper statistics.
962 #
963 # -Scott Barron
964 #
965 AC_CHECK_TYPES(struct tpacket_stats,,,
966 [
967 #include <linux/if_packet.h>
968 ])
969
970 #
971 # Check to see if the tpacket_auxdata struct has a tp_vlan_tci member.
972 #
973 # NOTE: any failure means we conclude that it doesn't have that
974 # member, so if we don't have tpacket_auxdata, we conclude it
975 # doesn't have that member (which is OK, as either we won't be
976 # using code that would use that member, or we wouldn't compile
977 # in any case).
978 AC_CHECK_MEMBERS([struct tpacket_auxdata.tp_vlan_tci],,,
979 [
980 #include <sys/types.h>
981 #include <linux/if_packet.h>
982 ])
983 ;;
984
985 bpf)
986 #
987 # Capture module
988 #
989 PLATFORM_C_SRC="pcap-bpf.c"
990
991 #
992 # Check whether we have the *BSD-style ioctls.
993 #
994 AC_CHECK_HEADERS(net/if_media.h)
995
996 #
997 # Check whether we have struct BPF_TIMEVAL.
998 #
999 AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
1000 [
1001 #include <sys/types.h>
1002 #include <sys/ioctl.h>
1003 #ifdef HAVE_SYS_IOCCOM_H
1004 #include <sys/ioccom.h>
1005 #endif
1006 #include <net/bpf.h>
1007 ])
1008 ;;
1009
1010 pf)
1011 #
1012 # Capture module
1013 #
1014 PLATFORM_C_SRC="pcap-pf.c"
1015 ;;
1016
1017 snit)
1018 #
1019 # Capture module
1020 #
1021 PLATFORM_C_SRC="pcap-snit.c"
1022 ;;
1023
1024 snoop)
1025 #
1026 # Capture module
1027 #
1028 PLATFORM_C_SRC="pcap-snoop.c"
1029 ;;
1030
1031 dag)
1032 #
1033 # --with-pcap=dag is the only way to get here, and it means
1034 # "DAG support but nothing else"
1035 #
1036 V_DEFS="$V_DEFS -DDAG_ONLY"
1037 PLATFORM_C_SRC="pcap-dag.c"
1038 xxx_only=yes
1039 ;;
1040
1041 dpdk)
1042 #
1043 # --with-pcap=dpdk is the only way to get here, and it means
1044 # "DPDK support but nothing else"
1045 #
1046 V_DEFS="$V_DEFS -DDPDK_ONLY"
1047 PLATFORM_C_SRC="pcap-dpdk.c"
1048 xxx_only=yes
1049 ;;
1050
1051 septel)
1052 #
1053 # --with-pcap=septel is the only way to get here, and it means
1054 # "Septel support but nothing else"
1055 #
1056 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
1057 PLATFORM_C_SRC="pcap-septel.c"
1058 xxx_only=yes
1059 ;;
1060
1061 snf)
1062 #
1063 # --with-pcap=snf is the only way to get here, and it means
1064 # "SNF support but nothing else"
1065 #
1066 V_DEFS="$V_DEFS -DSNF_ONLY"
1067 PLATFORM_C_SRC="pcap-snf.c"
1068 xxx_only=yes
1069 ;;
1070
1071 null)
1072 #
1073 # Capture module
1074 #
1075 PLATFORM_C_SRC="pcap-null.c"
1076 ;;
1077
1078 *)
1079 AC_MSG_ERROR($V_PCAP is not a valid pcap type)
1080 ;;
1081 esac
1082
1083 dnl
1084 dnl Now figure out how we get a list of interfaces and addresses,
1085 dnl if we support capturing. Don't bother if we don't support
1086 dnl capturing.
1087 dnl
1088 if test "$V_PCAP" != null
1089 then
1090 AC_CHECK_FUNC(getifaddrs,[
1091 #
1092 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
1093 # as well, just in case some platform is really weird.
1094 #
1095 AC_CHECK_HEADER(ifaddrs.h,[
1096 #
1097 # We have the header, so we use "getifaddrs()" to
1098 # get the list of interfaces.
1099 #
1100 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-getad.c"
1101 ],[
1102 #
1103 # We don't have the header - give up.
1104 # XXX - we could also fall back on some other
1105 # mechanism, but, for now, this'll catch this
1106 # problem so that we can at least try to figure
1107 # out something to do on systems with "getifaddrs()"
1108 # but without "ifaddrs.h", if there is something
1109 # we can do on those systems.
1110 #
1111 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
1112 ])
1113 ],[
1114 #
1115 # Well, we don't have "getifaddrs()", at least not with the
1116 # libraries with which we've decided we need to link
1117 # libpcap with, so we have to use some other mechanism.
1118 #
1119 # Note that this may happen on Solaris, which has
1120 # getifaddrs(), but in -lsocket, not in -lxnet, so we
1121 # won't find it if we link with -lxnet, which we want
1122 # to do for other reasons.
1123 #
1124 # For now, we use either the SIOCGIFCONF ioctl or the
1125 # SIOCGLIFCONF ioctl, preferring the latter if we have
1126 # it; the latter is a Solarisism that first appeared
1127 # in Solaris 8. (Solaris's getifaddrs() appears to
1128 # be built atop SIOCGLIFCONF; using it directly
1129 # avoids a not-all-that-useful middleman.)
1130 #
1131 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
1132 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
1133 AC_TRY_COMPILE(
1134 [#include <sys/param.h>
1135 #include <sys/file.h>
1136 #include <sys/ioctl.h>
1137 #include <sys/socket.h>
1138 #include <sys/sockio.h>],
1139 [ioctl(0, SIOCGLIFCONF, (char *)0);],
1140 ac_cv_lbl_have_siocglifconf=yes,
1141 ac_cv_lbl_have_siocglifconf=no))
1142 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
1143 if test $ac_cv_lbl_have_siocglifconf = yes ; then
1144 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-glifc.c"
1145 else
1146 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-gifc.c"
1147 fi
1148 ])
1149 fi
1150
1151 dnl check for hardware timestamp support
1152 case "$host_os" in
1153 linux*)
1154 AC_CHECK_HEADERS([linux/net_tstamp.h])
1155 ;;
1156 *)
1157 AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os)
1158 ;;
1159 esac
1160
1161 AC_ARG_ENABLE([packet-ring],
1162 [AC_HELP_STRING([--enable-packet-ring],[enable packet ring support on Linux @<:@default=yes@:>@])],
1163 ,enable_packet_ring=yes)
1164
1165 if test "x$enable_packet_ring" != "xno" ; then
1166 AC_DEFINE(PCAP_SUPPORT_PACKET_RING, 1, [use packet ring capture support on Linux if available])
1167 AC_SUBST(PCAP_SUPPORT_PACKET_RING)
1168 fi
1169
1170 #
1171 # Check for socklen_t.
1172 #
1173 AC_CHECK_TYPES(socklen_t,,,
1174 [
1175 #include <sys/types.h>
1176 #include <sys/socket.h>
1177 ])
1178
1179 AC_ARG_ENABLE(ipv6,
1180 AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes@:>@]),
1181 [],
1182 [enable_ipv6=yes])
1183 if test "$enable_ipv6" != "no"; then
1184 #
1185 # We've already made sure we have getaddrinfo above in
1186 # AC_LBL_LIBRARY_NET.
1187 #
1188 AC_DEFINE(INET6,1,[IPv6])
1189 fi
1190
1191 #
1192 # Do we have pkg-config?
1193 #
1194 AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
1195
1196 # Check for Endace DAG card support.
1197 AC_ARG_WITH([dag],
1198 AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1199 [
1200 if test "$withval" = no
1201 then
1202 # User doesn't want DAG support.
1203 want_dag=no
1204 elif test "$withval" = yes
1205 then
1206 # User wants DAG support but hasn't specified a directory.
1207 want_dag=yes
1208 else
1209 # User wants DAG support and has specified a directory, so use the provided value.
1210 want_dag=yes
1211 dag_root=$withval
1212 fi
1213 ],[
1214 if test "$V_PCAP" = dag; then
1215 # User requested DAG-only libpcap, so we'd better have
1216 # the DAG API.
1217 want_dag=yes
1218 elif test "xxx_only" = yes; then
1219 # User requested something-else-only pcap, so they don't
1220 # want DAG support.
1221 want_dag=no
1222 else
1223 #
1224 # Use DAG API if present, otherwise don't
1225 #
1226 want_dag=ifpresent
1227 fi
1228 ])
1229
1230 AC_ARG_WITH([dag-includes],
1231 AC_HELP_STRING([--with-dag-includes=IDIR],[Endace DAG include directory, if not DIR/include]),
1232 [
1233 # User wants DAG support and has specified a header directory, so use the provided value.
1234 want_dag=yes
1235 dag_include_dir=$withval
1236 ],[])
1237
1238 AC_ARG_WITH([dag-libraries],
1239 AC_HELP_STRING([--with-dag-libraries=LDIR],[Endace DAG library directory, if not DIR/lib]),
1240 [
1241 # User wants DAG support and has specified a library directory, so use the provided value.
1242 want_dag=yes
1243 dag_lib_dir=$withval
1244 ],[])
1245
1246 if test "$want_dag" != no; then
1247
1248 # If necessary, set default paths for DAG API headers and libraries.
1249 if test -z "$dag_root"; then
1250 dag_root=/usr/local
1251 fi
1252
1253 if test -z "$dag_include_dir"; then
1254 dag_include_dir="$dag_root/include"
1255 fi
1256
1257 if test -z "$dag_lib_dir"; then
1258 dag_lib_dir="$dag_root/lib"
1259 fi
1260
1261 V_INCLS="$V_INCLS -I$dag_include_dir"
1262
1263 AC_CHECK_HEADERS([dagapi.h])
1264
1265 if test "$ac_cv_header_dagapi_h" = yes; then
1266
1267 if test $V_PCAP != dag ; then
1268 MODULE_C_SRC="$MODULE_C_SRC pcap-dag.c"
1269 fi
1270
1271 # Check for various DAG API functions.
1272 # Don't need to save and restore LIBS to prevent -ldag being
1273 # included if there's a found-action (arg 3).
1274 saved_ldflags=$LDFLAGS
1275 LDFLAGS="-L$dag_lib_dir"
1276 AC_CHECK_LIB([dag], [dag_attach_stream],
1277 [],
1278 [AC_MSG_ERROR(DAG library lacks streams support)])
1279 AC_CHECK_LIB([dag], [dag_attach_stream64], [dag_large_streams="1"], [dag_large_streams="0"])
1280 AC_CHECK_LIB([dag],[dag_get_erf_types], [
1281 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
1282 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
1283 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
1284
1285 LDFLAGS=$saved_ldflags
1286
1287 #
1288 # We assume that if we have libdag we have libdagconf,
1289 # as they're installed at the same time from the same
1290 # package.
1291 #
1292 LIBS="$LIBS -ldag -ldagconf"
1293 LDFLAGS="$LDFLAGS -L$dag_lib_dir"
1294
1295 if test "$dag_large_streams" = 1; then
1296 AC_DEFINE(HAVE_DAG_LARGE_STREAMS_API, 1, [define if you have large streams capable DAG API])
1297 AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
1298 if test "$ac_dag_have_vdag" = 1; then
1299 AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
1300 if test "$ac_lbl_have_pthreads" != "found"; then
1301 AC_MSG_ERROR([DAG requires pthreads, but we didn't find them])
1302 fi
1303 LIBS="$LIBS $PTHREAD_LIBS"
1304 fi
1305 fi
1306
1307 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
1308 else
1309
1310 if test "$V_PCAP" = dag; then
1311 # User requested "dag" capture type but we couldn't
1312 # find the DAG API support.
1313 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])
1314 fi
1315
1316 if test "$want_dag" = yes; then
1317 # User wanted DAG support but we couldn't find it.
1318 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])
1319 fi
1320 fi
1321 fi
1322
1323 AC_ARG_WITH(septel,
1324 AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1325 [
1326 if test "$withval" = no
1327 then
1328 want_septel=no
1329 elif test "$withval" = yes
1330 then
1331 want_septel=yes
1332 septel_root=
1333 else
1334 want_septel=yes
1335 septel_root=$withval
1336 fi
1337 ],[
1338 if test "$V_PCAP" = septel; then
1339 # User requested Septel-only libpcap, so we'd better have
1340 # the Septel API.
1341 want_septel=yes
1342 elif test "xxx_only" = yes; then
1343 # User requested something-else-only pcap, so they don't
1344 # want Septel support.
1345 want_septel=no
1346 else
1347 #
1348 # Use Septel API if present, otherwise don't
1349 #
1350 want_septel=ifpresent
1351 fi
1352 ])
1353
1354 ac_cv_lbl_septel_api=no
1355 if test "$with_septel" != no; then
1356
1357 AC_MSG_CHECKING([whether we have Septel API headers])
1358
1359 # If necessary, set default paths for Septel API headers and libraries.
1360 if test -z "$septel_root"; then
1361 septel_root=$srcdir/../septel
1362 fi
1363
1364 septel_tools_dir="$septel_root"
1365 septel_include_dir="$septel_root/INC"
1366
1367 if test -r "$septel_include_dir/msg.h"; then
1368 ac_cv_lbl_septel_api=yes
1369 fi
1370
1371 if test "$ac_cv_lbl_septel_api" = yes; then
1372 AC_MSG_RESULT([yes ($septel_include_dir)])
1373
1374 V_INCLS="$V_INCLS -I$septel_include_dir"
1375 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"
1376 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"
1377
1378 if test "$V_PCAP" != septel ; then
1379 MODULE_C_SRC="$MODULE_C_SRC pcap-septel.c"
1380 fi
1381
1382 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have the Septel API])
1383 else
1384 AC_MSG_RESULT(no)
1385
1386 if test "$V_PCAP" = septel; then
1387 # User requested "septel" capture type but
1388 # we couldn't find the Septel API support.
1389 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])
1390 fi
1391
1392 if test "$want_septel" = yes; then
1393 # User wanted Septel support but we couldn't find it.
1394 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])
1395 fi
1396 fi
1397 fi
1398
1399 # Check for Myricom SNF support.
1400 AC_ARG_WITH([snf],
1401 AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1402 [
1403 if test "$withval" = no
1404 then
1405 # User explicitly doesn't want SNF
1406 want_snf=no
1407 elif test "$withval" = yes
1408 then
1409 # User wants SNF support but hasn't specified a directory.
1410 want_snf=yes
1411 else
1412 # User wants SNF support with a specified directory.
1413 want_snf=yes
1414 snf_root=$withval
1415 fi
1416 ],[
1417 if test "$V_PCAP" = snf; then
1418 # User requested Sniffer-only libpcap, so we'd better have
1419 # the Sniffer API.
1420 want_snf=yes
1421 elif test "xxx_only" = yes; then
1422 # User requested something-else-only pcap, so they don't
1423 # want SNF support.
1424 want_snf=no
1425 else
1426 #
1427 # Use Sniffer API if present, otherwise don't
1428 #
1429 want_snf=ifpresent
1430 fi
1431 ])
1432
1433 AC_ARG_WITH([snf-includes],
1434 AC_HELP_STRING([--with-snf-includes=IDIR],[Myricom SNF include directory, if not DIR/include]),
1435 [
1436 # User wants SNF with specific header directory
1437 want_snf=yes
1438 snf_include_dir=$withval
1439 ],[])
1440
1441 AC_ARG_WITH([snf-libraries],
1442 AC_HELP_STRING([--with-snf-libraries=LDIR],[Myricom SNF library directory, if not DIR/lib]),
1443 [
1444 # User wants SNF with specific lib directory
1445 want_snf=yes
1446 snf_lib_dir=$withval
1447 ],[])
1448
1449 ac_cv_lbl_snf_api=no
1450 if test "$with_snf" != no; then
1451
1452 AC_MSG_CHECKING(whether we have Myricom Sniffer API)
1453
1454 # If necessary, set default paths for Sniffer headers and libraries.
1455 if test -z "$snf_root"; then
1456 snf_root=/opt/snf
1457 fi
1458
1459 if test -z "$snf_include_dir"; then
1460 snf_include_dir="$snf_root/include"
1461 fi
1462
1463 if test -z "$snf_lib_dir"; then
1464 snf_lib_dir="$snf_root/lib"
1465 fi
1466
1467 if test -f "$snf_include_dir/snf.h"; then
1468 # We found a header; make sure we can link with the library
1469 saved_ldflags=$LDFLAGS
1470 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1471 AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"])
1472 LDFLAGS="$saved_ldflags"
1473 if test "$ac_cv_lbl_snf_api" = no; then
1474 AC_MSG_ERROR(SNF API cannot correctly be linked; check config.log)
1475 fi
1476 fi
1477
1478 if test "$ac_cv_lbl_snf_api" = yes; then
1479 AC_MSG_RESULT([yes ($snf_root)])
1480
1481 V_INCLS="$V_INCLS -I$snf_include_dir"
1482 LIBS="$LIBS -lsnf"
1483 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1484
1485 if test "$V_PCAP" != snf ; then
1486 MODULE_C_SRC="$MODULE_C_SRC pcap-snf.c"
1487 fi
1488
1489 AC_DEFINE(HAVE_SNF_API, 1, [define if you have the Myricom SNF API])
1490 else
1491 AC_MSG_RESULT(no)
1492
1493 if test "$want_snf" = yes; then
1494 # User requested "snf" capture type but
1495 # we couldn't find the Sniffer API support.
1496 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])
1497 fi
1498
1499 if test "$want_snf" = yes; then
1500 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])
1501 fi
1502 fi
1503 fi
1504
1505 # Check for Riverbed TurboCap support.
1506 AC_ARG_WITH([turbocap],
1507 AC_HELP_STRING([--with-turbocap@<:@=DIR@:>@],[include Riverbed TurboCap support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1508 [
1509 if test "$withval" = no
1510 then
1511 # User explicitly doesn't want TurboCap
1512 want_turbocap=no
1513 elif test "$withval" = yes
1514 then
1515 # User wants TurboCap support but hasn't specified a directory.
1516 want_turbocap=yes
1517 else
1518 # User wants TurboCap support with a specified directory.
1519 want_turbocap=yes
1520 turbocap_root=$withval
1521 fi
1522 ],[
1523 if test "xxx_only" = yes; then
1524 # User requested something-else-only pcap, so they don't
1525 # want TurboCap support.
1526 want_turbocap=no
1527 else
1528 #
1529 # Use TurboCap API if present, otherwise don't
1530 #
1531 want_turbocap=ifpresent
1532 fi
1533 ])
1534
1535 ac_cv_lbl_turbocap_api=no
1536 if test "$want_turbocap" != no; then
1537
1538 AC_MSG_CHECKING(whether TurboCap is supported)
1539
1540 save_CFLAGS="$CFLAGS"
1541 save_LIBS="$LIBS"
1542 if test ! -z "$turbocap_root"; then
1543 TURBOCAP_CFLAGS="-I$turbocap_root/include"
1544 TURBOCAP_LIBS="-L$turbocap_root/lib"
1545 CFLAGS="$CFLAGS $TURBOCAP_CFLAGS"
1546 fi
1547
1548 AC_TRY_COMPILE(
1549 [
1550 #include <TcApi.h>
1551 ],
1552 [
1553 TC_INSTANCE a; TC_PORT b; TC_BOARD c;
1554 TC_INSTANCE i;
1555 (void)TcInstanceCreateByName("foo", &i);
1556 ],
1557 ac_cv_lbl_turbocap_api=yes)
1558
1559 CFLAGS="$save_CFLAGS"
1560 if test $ac_cv_lbl_turbocap_api = yes; then
1561 AC_MSG_RESULT(yes)
1562
1563 MODULE_C_SRC="$MODULE_C_SRC pcap-tc.c"
1564 V_INCLS="$V_INCLS $TURBOCAP_CFLAGS"
1565 LIBS="$LIBS $TURBOCAP_LIBS -lTcApi -lpthread -lstdc++"
1566
1567 AC_DEFINE(HAVE_TC_API, 1, [define if you have the TurboCap API])
1568 else
1569 AC_MSG_RESULT(no)
1570
1571 if test "$want_turbocap" = yes; then
1572 # User wanted Turbo support but we couldn't find it.
1573 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])
1574 fi
1575 fi
1576 fi
1577
1578 dnl
1579 dnl Allow the user to enable remote capture.
1580 dnl It's off by default, as that increases the attack surface of
1581 dnl libpcap, exposing it to malicious servers.
1582 dnl
1583 AC_MSG_CHECKING([whether to enable remote packet capture])
1584 AC_ARG_ENABLE(remote,
1585 [ --enable-remote enable remote packet capture @<:@default=no@:>@
1586 --disable-remote disable remote packet capture],,
1587 enableval=no)
1588 case "$enableval" in
1589 yes) AC_MSG_RESULT(yes)
1590 AC_WARN([Remote packet capture may expose libpcap-based applications])
1591 AC_WARN([to attacks by malicious remote capture servers!])
1592 #
1593 # rpcapd requires pthreads on UN*X.
1594 #
1595 if test "$ac_lbl_have_pthreads" != "found"; then
1596 AC_MSG_ERROR([rpcapd requires pthreads, but we didn't find them])
1597 fi
1598 #
1599 # It also requires crypt().
1600 # Do we have it in the system libraries?
1601 #
1602 AC_CHECK_FUNC(crypt,,
1603 [
1604 #
1605 # No. Do we have it in -lcrypt?
1606 #
1607 AC_CHECK_LIB(crypt, crypt,
1608 [
1609 #
1610 # Yes; add -lcrypt to the libraries for rpcapd.
1611 #
1612 RPCAPD_LIBS="$RPCAPD_LIBS -lcrypt"
1613 ],
1614 [
1615 AC_MSG_ERROR([rpcapd requires crypt(), but we didn't find it])
1616 ])
1617 ])
1618
1619 #
1620 # OK, we have crypt(). Do we have getspnam()?
1621 #
1622 AC_CHECK_FUNCS(getspnam)
1623
1624 #
1625 # Check for various members of struct msghdr.
1626 #
1627 AC_CHECK_MEMBERS([struct msghdr.msg_control],,,
1628 [
1629 #include "ftmacros.h"
1630 #include <sys/socket.h>
1631 ])
1632 AC_CHECK_MEMBERS([struct msghdr.msg_flags],,,
1633 [
1634 #include "ftmacros.h"
1635 #include <sys/socket.h>
1636 ])
1637
1638 #
1639 # Optionally, we may want to support SSL.
1640 # Check for OpenSSL/libressl.
1641 #
1642 # First, try looking for it as a regular system library.
1643 # Make sure we can find SSL_library_init() using the
1644 # standard headers, just in case we're running a version
1645 # of macOS that ships with the OpenSSL library but not
1646 # the OpenSSL headers, and have also installed another
1647 # version of OpenSSL with headers.
1648 #
1649 save_LIBS="$LIBS"
1650 LIBS="-lssl -lcrypto"
1651 AC_MSG_CHECKING(whether we have a system OpenSSL/libressl that we can use)
1652 AC_TRY_LINK(
1653 [
1654 #include <openssl/ssl.h>
1655 ],
1656 [
1657 SSL_library_init();
1658 return 0;
1659 ],
1660 [
1661 AC_MSG_RESULT(yes)
1662 HAVE_OPENSSL=yes
1663 OPENSSL_LIBS="-lssl -lcrypto"
1664 ],
1665 AC_MSG_RESULT(no))
1666 LIBS="$save_LIBS"
1667
1668 #
1669 # If we didn't find it, check for it with pkg-config.
1670 #
1671 if test "x$HAVE_OPENSSL" != "xyes"; then
1672 if test "x$PKGCONFIG" != "xno"; then
1673 #
1674 # We have pkg-config; see if we have OpenSSL/
1675 # libressl installed as a package.
1676 #
1677 AC_MSG_CHECKING([for OpenSSL/libressl with pkg-config])
1678 if "$PKGCONFIG" openssl; then
1679 AC_MSG_RESULT([found])
1680 HAVE_OPENSSL=yes
1681 OPENSSL_CFLAGS=`"$PKGCONFIG" --cflags openssl`
1682 OPENSSL_LIBS=`"$PKGCONFIG" --libs openssl`
1683 else
1684 AC_MSG_RESULT([not found])
1685 fi
1686 fi
1687 fi
1688
1689 #
1690 # OK, did we find it?
1691 #
1692 if test "x$HAVE_OPENSSL" = "xyes"; then
1693 AC_DEFINE([HAVE_OPENSSL], [1], [Use OpenSSL])
1694 CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
1695 LIBS="$LIBS $OPENSSL_LIBS"
1696 else
1697 AC_MSG_NOTICE(OpenSSL not found)
1698 fi
1699
1700 AC_DEFINE(ENABLE_REMOTE,,
1701 [Define to 1 if remote packet capture is to be supported])
1702 REMOTE_C_SRC="$REMOTE_C_SRC pcap-new.c pcap-rpcap.c rpcap-protocol.c sockutils.c sslutils.c"
1703 BUILD_RPCAPD=build-rpcapd
1704 INSTALL_RPCAPD=install-rpcapd
1705 ;;
1706 *) AC_MSG_RESULT(no)
1707 ;;
1708 esac
1709
1710 AC_MSG_CHECKING(whether to build optimizer debugging code)
1711 AC_ARG_ENABLE(optimizer-dbg,
1712 AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
1713 if test "$enable_optimizer_dbg" = "yes"; then
1714 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
1715 fi
1716 AC_MSG_RESULT(${enable_optimizer_dbg-no})
1717
1718 AC_MSG_CHECKING(whether to build parser debugging code)
1719 AC_ARG_ENABLE(yydebug,
1720 AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
1721 if test "$enable_yydebug" = "yes"; then
1722 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
1723 fi
1724 AC_MSG_RESULT(${enable_yydebug-no})
1725
1726 #
1727 # Look for {f}lex.
1728 #
1729 AC_PROG_LEX
1730 if test "$LEX" = ":"; then
1731 AC_MSG_ERROR([Neither flex nor lex was found.])
1732 fi
1733
1734 #
1735 # Make sure {f}lex supports the -P, --header-file, and --nounput flags
1736 # and supports processing our scanner.l.
1737 #
1738 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
1739 if $LEX -P pcap_ --header-file=/dev/null --nounput -t $srcdir/scanner.l > /dev/null 2>&1; then
1740 tcpdump_cv_capable_lex=yes
1741 else
1742 tcpdump_cv_capable_lex=insufficient
1743 fi)
1744 if test $tcpdump_cv_capable_lex = insufficient ; then
1745 AC_MSG_ERROR([$LEX is insufficient to compile libpcap.
1746 libpcap requires Flex 2.5.31 or later, or a compatible version of lex.])
1747 fi
1748
1749 #
1750 # Look for yacc/bison/byacc.
1751 #
1752 AC_PROG_YACC
1753
1754 #
1755 # Make sure it supports the -p flag and supports processing our
1756 # grammar.y.
1757 #
1758 AC_CACHE_CHECK([for capable yacc/bison], tcpdump_cv_capable_yacc,
1759 if $YACC -p pcap_ -o /dev/null $srcdir/grammar.y >/dev/null 2>&1; then
1760 tcpdump_cv_capable_yacc=yes
1761 else
1762 tcpdump_cv_capable_yacc=insufficient
1763 fi)
1764 if test $tcpdump_cv_capable_yacc = insufficient ; then
1765 AC_MSG_ERROR([$YACC is insufficient to compile libpcap.
1766 libpcap requires Bison, a newer version of Berkeley YACC with support
1767 for reentrant parsers, or another YACC compatible with them.])
1768 fi
1769
1770 #
1771 # Do various checks for various OSes and versions of those OSes.
1772 #
1773 # Assume, by default, no support for shared libraries and V7/BSD
1774 # convention for man pages (devices in section 4, file formats in
1775 # section 5, miscellaneous info in section 7, administrative commands
1776 # and daemons in section 8). Individual cases can override this.
1777 #
1778 DYEXT="none"
1779 MAN_DEVICES=4
1780 MAN_FILE_FORMATS=5
1781 MAN_MISC_INFO=7
1782 MAN_ADMIN_COMMANDS=8
1783 case "$host_os" in
1784
1785 aix*)
1786 dnl Workaround to enable certain features
1787 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
1788
1789 #
1790 # AIX makes it fun to build shared and static libraries,
1791 # because they're *both* ".a" archive libraries. We
1792 # build the static library for the benefit of the traditional
1793 # scheme of building libpcap and tcpdump in subdirectories of
1794 # the same directory, with tcpdump statically linked with the
1795 # libpcap in question, but we also build a shared library as
1796 # "libpcap.shareda" and install *it*, rather than the static
1797 # library, as "libpcap.a".
1798 #
1799 DYEXT="shareda"
1800
1801 case "$V_PCAP" in
1802
1803 dlpi)
1804 #
1805 # If we're using DLPI, applications will need to
1806 # use /lib/pse.exp if present, as we use the
1807 # STREAMS routines.
1808 #
1809 pseexe="/lib/pse.exp"
1810 AC_MSG_CHECKING(for $pseexe)
1811 if test -f $pseexe ; then
1812 AC_MSG_RESULT(yes)
1813 LIBS="-I:$pseexe"
1814 fi
1815 ;;
1816
1817 bpf)
1818 #
1819 # If we're using BPF, we need "-lodm" and "-lcfg", as
1820 # we use them to load the BPF module.
1821 #
1822 LIBS="-lodm -lcfg"
1823 ;;
1824 esac
1825 ;;
1826
1827 darwin*)
1828 DYEXT="dylib"
1829 V_CCOPT="$V_CCOPT -fno-common"
1830 AC_ARG_ENABLE(universal,
1831 AC_HELP_STRING([--disable-universal],[don't build universal on macOS]))
1832 if test "$enable_universal" != "no"; then
1833 case "$host_os" in
1834
1835 darwin[[0-7]].*)
1836 #
1837 # Pre-Tiger. Build only for 32-bit PowerPC; no
1838 # need for any special compiler or linker flags.
1839 #
1840 ;;
1841
1842 darwin8.[[0123]]|darwin8.[[0123]].*)
1843 #
1844 # Tiger, prior to Intel support. Build
1845 # libraries and executables for 32-bit PowerPC
1846 # and 64-bit PowerPC, with 32-bit PowerPC first.
1847 # (I'm guessing that's what Apple does.)
1848 #
1849 # (The double brackets are needed because
1850 # autotools/m4 use brackets as a quoting
1851 # character; the double brackets turn into
1852 # single brackets in the generated configure
1853 # file.)
1854 #
1855 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64"
1856 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64"
1857 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64"
1858 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64"
1859 ;;
1860
1861 darwin8.[[456]]|darwin.[[456]].*)
1862 #
1863 # Tiger, subsequent to Intel support but prior
1864 # to x86-64 support. Build libraries and
1865 # executables for 32-bit PowerPC, 64-bit
1866 # PowerPC, and 32-bit x86, with 32-bit PowerPC
1867 # first. (I'm guessing that's what Apple does.)
1868 #
1869 # (The double brackets are needed because
1870 # autotools/m4 use brackets as a quoting
1871 # character; the double brackets turn into
1872 # single brackets in the generated configure
1873 # file.)
1874 #
1875 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
1876 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
1877 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
1878 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
1879 ;;
1880
1881 darwin8.*)
1882 #
1883 # All other Tiger, so subsequent to x86-64
1884 # support. Build libraries and executables for
1885 # 32-bit PowerPC, 64-bit PowerPC, 32-bit x86,
1886 # and x86-64, with 32-bit PowerPC first. (I'm
1887 # guessing that's what Apple does.)
1888 #
1889 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1890 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1891 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1892 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1893 ;;
1894
1895 darwin9.*)
1896 #
1897 # Leopard. Build libraries for 32-bit PowerPC,
1898 # 64-bit PowerPC, 32-bit x86, and x86-64, with
1899 # 32-bit PowerPC first, and build executables
1900 # for 32-bit x86 and 32-bit PowerPC, with 32-bit
1901 # x86 first. (That's what Apple does.)
1902 #
1903 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1904 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1905 V_PROG_CCOPT_FAT="-arch i386 -arch ppc"
1906 V_PROG_LDFLAGS_FAT="-arch i386 -arch ppc"
1907 ;;
1908
1909 darwin10.*)
1910 #
1911 # Snow Leopard. Build libraries for x86-64,
1912 # 32-bit x86, and 32-bit PowerPC, with x86-64
1913 # first, and build executables for x86-64 and
1914 # 32-bit x86, with x86-64 first. (That's what
1915 # Apple does, even though Snow Leopard doesn't
1916 # run on PPC, so PPC libpcap runs under Rosetta,
1917 # and Rosetta doesn't support BPF ioctls, so PPC
1918 # programs can't do live captures.)
1919 #
1920 V_LIB_CCOPT_FAT="-arch x86_64 -arch i386 -arch ppc"
1921 V_LIB_LDFLAGS_FAT="-arch x86_64 -arch i386 -arch ppc"
1922 V_PROG_CCOPT_FAT="-arch x86_64 -arch i386"
1923 V_PROG_LDFLAGS_FAT="-arch x86_64 -arch i386"
1924 ;;
1925
1926 darwin*)
1927 #
1928 # Post-Snow Leopard. Build libraries for x86-64
1929 # and 32-bit x86, with x86-64 first, and build
1930 # executables only for x86-64. (That's what
1931 # Apple does.) This requires no special flags
1932 # for programs.
1933 # XXX - update if and when Apple drops support
1934 # for 32-bit x86 code and if and when Apple adds
1935 # ARM-based Macs. (You're on your own for iOS
1936 # etc.)
1937 #
1938 # XXX - check whether we *can* build for
1939 # i386 and, if not, suggest that the user
1940 # install the /usr/include headers if they
1941 # want to build fat.
1942 #
1943 AC_MSG_CHECKING(whether building for 32-bit x86 is supported)
1944 save_CFLAGS="$CFLAGS"
1945 CFLAGS="$CFLAGS -arch i386"
1946 AC_TRY_COMPILE(
1947 [],
1948 [return 0;],
1949 [
1950 AC_MSG_RESULT(yes)
1951 V_LIB_CCOPT_FAT="-arch x86_64"
1952 V_LIB_LDFLAGS_FAT="-arch x86_64"
1953
1954 #
1955 # OpenSSL installation on macOS seems
1956 # to install only the libs for 64-bit
1957 # x86 - at least that's what Brew does:
1958 # only configure 32-bit builds if we
1959 # don't have OpenSSL.
1960 #
1961 if test "$HAVE_OPENSSL" != yes; then
1962 V_LIB_CCOPT_FAT="$V_LIB_CCOPT_FAT -arch i386"
1963 V_LIB_LDFLAGS_FAT="$V_LIB_LDFLAGS_FAT -arch i386"
1964 fi
1965 ],
1966 [
1967 AC_MSG_RESULT(no)
1968 V_LIB_CCOPT_FAT="-arch x86_64"
1969 V_LIB_LDFLAGS_FAT="-arch x86_64"
1970 case "$host_os" in
1971
1972 darwin18.*)
1973 #
1974 # Mojave; you need to install the
1975 # /usr/include headers to get
1976 # 32-bit x86 builds to work.
1977 #
1978 AC_MSG_WARN([Compiling for 32-bit x86 gives an error; try installing the command-line tools and, after that, installing the /usr/include headers from the /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg package])
1979 ;;
1980
1981 *)
1982 #
1983 # Pre-Mojave; the command-line
1984 # tools should be sufficient to
1985 # enable 32-bit x86 builds.
1986 #
1987 AC_MSG_WARN([Compiling for 32-bit x86 gives an error; try installing the command-line tools])
1988 ;;
1989 esac
1990 ])
1991 CFLAGS="$save_CFLAGS"
1992 if test "$HAVE_OPENSSL" = yes; then
1993 #
1994 # If all else fails, look for OpenSSL in
1995 # /usr/local/opt.
1996 #
1997 CFLAGS="$CFLAGS -I/usr/local/opt/openssl/include"
1998 LIBS="$LIBS -L/usr/local/opt/openssl/lib"
1999 fi
2000 ;;
2001 esac
2002 fi
2003 ;;
2004
2005 hpux9*)
2006 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
2007
2008 #
2009 # Use System V conventions for man pages.
2010 #
2011 MAN_ADMIN_COMMANDS=1m
2012 MAN_FILE_FORMATS=4
2013 MAN_MISC_INFO=5
2014 ;;
2015
2016 hpux10.0*)
2017
2018 #
2019 # Use System V conventions for man pages.
2020 #
2021 MAN_ADMIN_COMMANDS=1m
2022 MAN_FILE_FORMATS=4
2023 MAN_MISC_INFO=5
2024 ;;
2025
2026 hpux10.1*)
2027
2028 #
2029 # Use System V conventions for man pages.
2030 #
2031 MAN_ADMIN_COMMANDS=1m
2032 MAN_FILE_FORMATS=4
2033 MAN_MISC_INFO=5
2034 ;;
2035
2036 hpux*)
2037 dnl HPUX 10.20 and above is similar to HPUX 9, but
2038 dnl not the same....
2039 dnl
2040 dnl XXX - DYEXT should be set to "sl" if this is building
2041 dnl for 32-bit PA-RISC, but should be left as "so" for
2042 dnl 64-bit PA-RISC or, I suspect, IA-64.
2043 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
2044 if test "`uname -m`" = "ia64"; then
2045 DYEXT="so"
2046 else
2047 DYEXT="sl"
2048 fi
2049
2050 #
2051 # "-b" builds a shared library; "+h" sets the soname.
2052 #
2053 SHLIB_OPT="-b"
2054 SONAME_OPT="+h"
2055
2056 #
2057 # Use System V conventions for man pages.
2058 #
2059 MAN_FILE_FORMATS=4
2060 MAN_MISC_INFO=5
2061 ;;
2062
2063 irix*)
2064 #
2065 # Use IRIX conventions for man pages; they're the same as the
2066 # System V conventions, except that they use section 8 for
2067 # administrative commands and daemons.
2068 #
2069 MAN_FILE_FORMATS=4
2070 MAN_MISC_INFO=5
2071 ;;
2072
2073 linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*|haiku*|midipix*)
2074 DYEXT="so"
2075
2076 #
2077 # Compiler assumed to be GCC; run-time linker may require a -R
2078 # flag.
2079 #
2080 if test "$libdir" != "/usr/lib"; then
2081 V_RFLAGS=-Wl,-R$libdir
2082 fi
2083 ;;
2084
2085 osf*)
2086 DYEXT="so"
2087
2088 #
2089 # DEC OSF/1, a/k/a Digial UNIX, a/k/a Tru64 UNIX.
2090 # Use Tru64 UNIX conventions for man pages; they're the same as
2091 # the System V conventions except that they use section 8 for
2092 # administrative commands and daemons.
2093 #
2094 MAN_FILE_FORMATS=4
2095 MAN_MISC_INFO=5
2096 MAN_DEVICES=7
2097 ;;
2098
2099 sinix*)
2100 AC_MSG_CHECKING(if SINIX compiler defines sinix)
2101 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
2102 AC_TRY_COMPILE(
2103 [],
2104 [int i = sinix;],
2105 ac_cv_cc_sinix_defined=yes,
2106 ac_cv_cc_sinix_defined=no))
2107 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
2108 if test $ac_cv_cc_sinix_defined = no ; then
2109 AC_DEFINE(sinix,1,[on sinix])
2110 fi
2111 ;;
2112
2113 solaris*)
2114 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
2115
2116 DYEXT="so"
2117
2118 #
2119 # Make sure errno is thread-safe, in case we're called in
2120 # a multithreaded program. We don't guarantee that two
2121 # threads can use the *same* pcap_t safely, but the
2122 # current version does guarantee that you can use different
2123 # pcap_t's in different threads, and even that pcap_compile()
2124 # is thread-safe (it wasn't thread-safe in some older versions).
2125 #
2126 V_CCOPT="$V_CCOPT -D_TS_ERRNO"
2127
2128 case "`uname -r`" in
2129
2130 5.12)
2131 ;;
2132
2133 *)
2134 #
2135 # Use System V conventions for man pages.
2136 #
2137 MAN_ADMIN_COMMANDS=1m
2138 MAN_FILE_FORMATS=4
2139 MAN_MISC_INFO=5
2140 MAN_DEVICES=7D
2141 esac
2142 ;;
2143 esac
2144
2145 AC_ARG_ENABLE(shared,
2146 AC_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@]))
2147 test "x$enable_shared" = "xno" && DYEXT="none"
2148
2149 AC_PROG_RANLIB
2150 AC_CHECK_TOOL([AR], [ar])
2151
2152 AC_PROG_LN_S
2153 AC_SUBST(LN_S)
2154
2155 AC_LBL_DEVEL(V_CCOPT)
2156
2157 #
2158 # Check to see if the sockaddr struct has the 4.4 BSD sa_len member.
2159 #
2160 AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,
2161 [
2162 #include <sys/types.h>
2163 #include <sys/socket.h>
2164 ])
2165
2166 #
2167 # Check to see if there's a sockaddr_storage structure.
2168 #
2169 AC_CHECK_TYPES(struct sockaddr_storage,,,
2170 [
2171 #include <sys/types.h>
2172 #include <sys/socket.h>
2173 ])
2174
2175 #
2176 # Check to see if the dl_hp_ppa_info_t struct has the HP-UX 11.00
2177 # dl_module_id_1 member.
2178 #
2179 # NOTE: any failure means we conclude that it doesn't have that member,
2180 # so if we don't have DLPI, don't have a <sys/dlpi_ext.h> header, or
2181 # have one that doesn't declare a dl_hp_ppa_info_t type, we conclude
2182 # it doesn't have that member (which is OK, as either we won't be
2183 # using code that would use that member, or we wouldn't compile in
2184 # any case).
2185 #
2186 AC_CHECK_MEMBERS([dl_hp_ppa_info_t.dl_module_id_1],,,
2187 [
2188 #include <sys/types.h>
2189 #include <sys/dlpi.h>
2190 #include <sys/dlpi_ext.h>
2191 ])
2192
2193 AC_SUBST(V_CCOPT)
2194 AC_SUBST(V_LIB_CCOPT_FAT)
2195 AC_SUBST(V_LIB_LDFLAGS_FAT)
2196 AC_SUBST(V_PROG_CCOPT_FAT)
2197 AC_SUBST(V_PROG_LDFLAGS_FAT)
2198 AC_SUBST(V_DEFS)
2199 AC_SUBST(V_INCLS)
2200 AC_SUBST(V_LEX)
2201 AC_SUBST(V_SHLIB_CCOPT)
2202 AC_SUBST(V_SHLIB_CMD)
2203 AC_SUBST(V_SHLIB_OPT)
2204 AC_SUBST(V_SONAME_OPT)
2205 AC_SUBST(V_RPATH_OPT)
2206 AC_SUBST(V_YACC)
2207 AC_SUBST(ADDLOBJS)
2208 AC_SUBST(ADDLARCHIVEOBJS)
2209 AC_SUBST(PLATFORM_C_SRC)
2210 AC_SUBST(PLATFORM_CXX_SRC)
2211 AC_SUBST(MODULE_C_SRC)
2212 AC_SUBST(REMOTE_C_SRC)
2213 AC_SUBST(DYEXT)
2214 AC_SUBST(MAN_DEVICES)
2215 AC_SUBST(MAN_FILE_FORMATS)
2216 AC_SUBST(MAN_MISC_INFO)
2217 AC_SUBST(MAN_ADMIN_COMMANDS)
2218 AC_SUBST(PTHREAD_LIBS)
2219 AC_SUBST(BUILD_RPCAPD)
2220 AC_SUBST(INSTALL_RPCAPD)
2221 AC_SUBST(RPCAPD_LIBS)
2222 AC_SUBST(EXTRA_NETWORK_LIBS)
2223
2224 AC_ARG_ENABLE([usb],
2225 [AC_HELP_STRING([--enable-usb],[enable USB capture support @<:@default=yes, if support available@:>@])],
2226 [],
2227 [enable_usb=yes])
2228
2229 if test "xxx_only" = yes; then
2230 # User requested something-else-only pcap, so they don't
2231 # want USB support.
2232 enable_usb=no
2233 fi
2234
2235 if test "x$enable_usb" != "xno" ; then
2236 dnl check for USB sniffing support
2237 AC_MSG_CHECKING(for USB sniffing support)
2238 case "$host_os" in
2239 linux*)
2240 AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
2241 MODULE_C_SRC="$MODULE_C_SRC pcap-usb-linux.c"
2242 AC_MSG_RESULT(yes)
2243 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
2244 if test $? -ne 0 ; then
2245 ac_usb_dev_name="usbmon"
2246 fi
2247 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
2248 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
2249 #
2250 # Do we have a version of <linux/compiler.h> available?
2251 # If so, we might need it for <linux/usbdevice_fs.h>.
2252 #
2253 AC_CHECK_HEADERS(linux/compiler.h)
2254 if test "$ac_cv_header_linux_compiler_h" = yes; then
2255 #
2256 # Yes - include it when testing for <linux/usbdevice_fs.h>.
2257 #
2258 AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
2259 else
2260 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
2261 fi
2262 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
2263 #
2264 # OK, does it define bRequestType? Older versions of the kernel
2265 # define fields with names like "requesttype, "request", and
2266 # "value", rather than "bRequestType", "bRequest", and
2267 # "wValue".
2268 #
2269 AC_CHECK_MEMBERS([struct usbdevfs_ctrltransfer.bRequestType],,,
2270 [
2271 AC_INCLUDES_DEFAULT
2272 #ifdef HAVE_LINUX_COMPILER_H
2273 #include <linux/compiler.h>
2274 #endif
2275 #include <linux/usbdevice_fs.h>
2276 ])
2277 fi
2278 ;;
2279 freebsd*)
2280 #
2281 # This just uses BPF in FreeBSD 8.4 and later; we don't need
2282 # to check for anything special for capturing.
2283 #
2284 AC_MSG_RESULT([yes, in FreeBSD 8.4 and later])
2285 ;;
2286
2287 *)
2288 AC_MSG_RESULT(no)
2289 ;;
2290 esac
2291 fi
2292 AC_SUBST(PCAP_SUPPORT_USB)
2293
2294 dnl check for netfilter sniffing support
2295 if test "xxx_only" != yes; then
2296 AC_MSG_CHECKING(whether the platform could support netfilter sniffing)
2297 case "$host_os" in
2298 linux*)
2299 AC_MSG_RESULT(yes)
2300 #
2301 # Life's too short to deal with trying to get this to compile
2302 # if you don't get the right types defined with
2303 # __KERNEL_STRICT_NAMES getting defined by some other include.
2304 #
2305 # Check whether the includes Just Work. If not, don't turn on
2306 # netfilter support.
2307 #
2308 AC_MSG_CHECKING(whether we can compile the netfilter support)
2309 AC_CACHE_VAL(ac_cv_netfilter_can_compile,
2310 AC_TRY_COMPILE([
2311 AC_INCLUDES_DEFAULT
2312 #include <sys/socket.h>
2313 #include <netinet/in.h>
2314 #include <linux/types.h>
2315
2316 #include <linux/netlink.h>
2317 #include <linux/netfilter.h>
2318 #include <linux/netfilter/nfnetlink.h>
2319 #include <linux/netfilter/nfnetlink_log.h>
2320 #include <linux/netfilter/nfnetlink_queue.h>],
2321 [],
2322 ac_cv_netfilter_can_compile=yes,
2323 ac_cv_netfilter_can_compile=no))
2324 AC_MSG_RESULT($ac_cv_netfilter_can_compile)
2325 if test $ac_cv_netfilter_can_compile = yes ; then
2326 AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1,
2327 [target host supports netfilter sniffing])
2328 MODULE_C_SRC="$MODULE_C_SRC pcap-netfilter-linux.c"
2329 fi
2330 ;;
2331 *)
2332 AC_MSG_RESULT(no)
2333 ;;
2334 esac
2335 fi
2336 AC_SUBST(PCAP_SUPPORT_NETFILTER)
2337
2338 AC_ARG_ENABLE([netmap],
2339 [AC_HELP_STRING([--enable-netmap],[enable netmap support @<:@default=yes, if support available@:>@])],
2340 [],
2341 [enable_netmap=yes])
2342
2343 if test "x$enable_netmap" != "xno" ; then
2344 #
2345 # Check whether net/netmap_user.h is usable if NETMAP_WITH_LIBS is
2346 # defined; it's not usable on DragonFly BSD 4.6 if NETMAP_WITH_LIBS
2347 # is defined, for example, as it includes a non-existent malloc.h
2348 # header.
2349 #
2350 AC_MSG_CHECKING(whether we can compile the netmap support)
2351 AC_CACHE_VAL(ac_cv_net_netmap_user_can_compile,
2352 AC_TRY_COMPILE([
2353 AC_INCLUDES_DEFAULT
2354 #define NETMAP_WITH_LIBS
2355 #include <net/netmap_user.h>],
2356 [],
2357 ac_cv_net_netmap_user_can_compile=yes,
2358 ac_cv_net_netmap_user_can_compile=no))
2359 AC_MSG_RESULT($ac_cv_net_netmap_user_can_compile)
2360 if test $ac_cv_net_netmap_user_can_compile = yes ; then
2361 AC_DEFINE(PCAP_SUPPORT_NETMAP, 1,
2362 [target host supports netmap])
2363 MODULE_C_SRC="$MODULE_C_SRC pcap-netmap.c"
2364 fi
2365 AC_SUBST(PCAP_SUPPORT_NETMAP)
2366 fi
2367
2368 # Check for DPDK support.
2369 AC_ARG_WITH([dpdk],
2370 AC_HELP_STRING([--with-dpdk@<:@=DIR@:>@],[include DPDK support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
2371 [
2372 if test "$withval" = no
2373 then
2374 # User doesn't want DPDK support.
2375 want_dpdk=no
2376 elif test "$withval" = yes
2377 then
2378 # User wants DPDK support but hasn't specified a directory.
2379 want_dpdk=yes
2380 else
2381 # User wants DPDK support and has specified a directory,
2382 # so use the provided value.
2383 want_dpdk=yes
2384 dpdk_dir=$withval
2385 fi
2386 ],[
2387 if test "$V_PCAP" = dpdk; then
2388 # User requested DPDK-only libpcap, so we'd better have
2389 # the DPDK API.
2390 want_dpdk=yes
2391 elif test "xxx_only" = yes; then
2392 # User requested something-else-only pcap, so they don't
2393 # want DPDK support.
2394 want_dpdk=no
2395 else
2396 #
2397 # Use DPDK API if present, otherwise don't
2398 #
2399 want_dpdk=ifpresent
2400 fi
2401 ])
2402
2403 if test "$want_dpdk" != no; then
2404 if test -z "$dpdk_dir"; then
2405 #
2406 # The user didn't specify a directory containing
2407 # the DPDK headers and libraries. If we find
2408 # a /usr/local/include/dpdk directory, assume
2409 # it's /usr/local, otherwise assume it's /usr.
2410 #
2411 if test -d "/usr/local/include/dpdk"; then
2412 dpdk_dir="/usr/local"
2413 else
2414 dpdk_dir="/usr"
2415 fi
2416 fi
2417 #
2418 # The convention appears to be that 1) there's a "dpdk"
2419 # subdirectory of the include directory, containing DPDK
2420 # headers (at least in the installation on Ubuntu with
2421 # the system DPDK packages) and 2) includes of DPDK
2422 # headers don't use "dpdk/{header}" (at least from the
2423 # way the DPDK documentation is written).
2424 #
2425 # So we add "/dpdk" to the include directory, and always
2426 # add that to the list of include directories to search.
2427 #
2428 dpdk_inc_dir="$dpdk_dir/include/dpdk"
2429 dpdk_lib_dir="$dpdk_dir/lib"
2430 DPDK_MACHINE_CFLAGS="-march=native"
2431 DPDK_CFLAGS="$DPDK_MACHINE_CFLAGS -I$dpdk_inc_dir"
2432 DPDK_LDFLAGS="-L$dpdk_lib_dir -ldpdk -lrt -lm -lnuma -ldl -pthread"
2433
2434 save_CFLAGS="$CFLAGS"
2435 save_LIBS="$LIBS"
2436 save_LDFLAGS="$LDFLAGS"
2437 CFLAGS="$CFLAGS $DPDK_CFLAGS"
2438 LIBS="$LIBS $DPDK_LDFLAGS"
2439 LDFLAGS="$LDFLAGS $DPDK_LDFLAGS"
2440
2441 AC_MSG_CHECKING(whether we can compile the DPDK support)
2442 AC_CACHE_VAL(ac_cv_dpdk_can_compile,
2443 AC_TRY_COMPILE([
2444 AC_INCLUDES_DEFAULT
2445 #include <rte_common.h>],
2446 [],
2447 ac_cv_dpdk_can_compile=yes,
2448 ac_cv_dpdk_can_compile=no))
2449 AC_MSG_RESULT($ac_cv_dpdk_can_compile)
2450
2451 #
2452 # We include rte_bus.h, and older versions of DPDK
2453 # didn't have it, so check for it.
2454 #
2455 if test "$ac_cv_dpdk_can_compile" = yes; then
2456 AC_CHECK_HEADERS(rte_bus.h)
2457 fi
2458
2459 CFLAGS="$save_CFLAGS"
2460 LIBS="$save_LIBS"
2461 LDFLAGS="$save_LDFLAGS"
2462
2463 if test "$ac_cv_header_rte_bus_h" = yes; then
2464 CFLAGS="$CFLAGS $DPDK_CFLAGS"
2465 LIBS="$LIBS $DPDK_LDFLAGS"
2466 LDFLAGS="$LDFLAGS $DPDK_LDFLAGS"
2467 V_INCLS="$V_INCLS $DPDK_CFLAGS"
2468 AC_DEFINE(PCAP_SUPPORT_DPDK, 1, [target host supports DPDK])
2469 if test $V_PCAP != dpdk ; then
2470 MODULE_C_SRC="$MODULE_C_SRC pcap-dpdk.c"
2471 fi
2472 else
2473 if test "$V_PCAP" = dpdk; then
2474 # User requested "dpdk" capture type but we couldn't
2475 # find the DPDK API support.
2476 AC_MSG_ERROR([DPDK support requested with --with-pcap=dpdk, but the DPDK headers weren't found at $dpdk_inc_dir: make sure the DPDK support is installed, specify a different path or paths if necessary, or don't request DPDK support])
2477 fi
2478
2479 if test "$want_dpdk" = yes; then
2480 # User wanted DPDK support but we couldn't find it.
2481 AC_MSG_ERROR([DPDK support requested with --with-pcap=dpdk, but the DPDK headers weren't found at $dpdk_inc_dir: make sure the DPDK support is installed, specify a different path or paths if necessary, or don't request DPDK support])
2482 fi
2483 fi
2484 fi
2485 AC_SUBST(PCAP_SUPPORT_DPDK)
2486
2487 AC_ARG_ENABLE([bluetooth],
2488 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
2489 [],
2490 [enable_bluetooth=ifsupportavailable])
2491
2492 if test "xxx_only" = yes; then
2493 # User requested something-else-only pcap, so they don't
2494 # want Bluetooth support.
2495 enable_bluetooth=no
2496 fi
2497
2498 if test "x$enable_bluetooth" != "xno" ; then
2499 dnl check for Bluetooth sniffing support
2500 case "$host_os" in
2501 linux*)
2502 AC_CHECK_HEADER(bluetooth/bluetooth.h,
2503 [
2504 #
2505 # We have bluetooth.h, so we support Bluetooth
2506 # sniffing.
2507 #
2508 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
2509 MODULE_C_SRC="$MODULE_C_SRC pcap-bt-linux.c"
2510 AC_MSG_NOTICE(Bluetooth sniffing is supported)
2511 ac_lbl_bluetooth_available=yes
2512
2513 #
2514 # OK, does struct sockaddr_hci have an hci_channel
2515 # member?
2516 #
2517 AC_CHECK_MEMBERS([struct sockaddr_hci.hci_channel],
2518 [
2519 #
2520 # Yes; is HCI_CHANNEL_MONITOR defined?
2521 #
2522 AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined)
2523 AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined,
2524 AC_TRY_COMPILE(
2525 [
2526 #include <bluetooth/bluetooth.h>
2527 #include <bluetooth/hci.h>
2528 ],
2529 [
2530 u_int i = HCI_CHANNEL_MONITOR;
2531 ],
2532 [
2533 AC_MSG_RESULT(yes)
2534 AC_DEFINE(PCAP_SUPPORT_BT_MONITOR,,
2535 [target host supports Bluetooth Monitor])
2536 MODULE_C_SRC="$MODULE_C_SRC pcap-bt-monitor-linux.c"
2537 ],
2538 [
2539 AC_MSG_RESULT(no)
2540 ]))
2541 ],,
2542 [
2543 #include <bluetooth/bluetooth.h>
2544 #include <bluetooth/hci.h>
2545 ])
2546 ],
2547 [
2548 #
2549 # We don't have bluetooth.h, so we don't support
2550 # Bluetooth sniffing.
2551 #
2552 if test "x$enable_bluetooth" = "xyes" ; then
2553 AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
2554 else
2555 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
2556 fi
2557 ])
2558 ;;
2559 *)
2560 if test "x$enable_bluetooth" = "xyes" ; then
2561 AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
2562 else
2563 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
2564 fi
2565 ;;
2566 esac
2567 AC_SUBST(PCAP_SUPPORT_BT)
2568 fi
2569
2570 AC_ARG_ENABLE([dbus],
2571 [AC_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])],
2572 [],
2573 [enable_dbus=ifavailable])
2574
2575 if test "xxx_only" = yes; then
2576 # User requested something-else-only pcap, so they don't
2577 # want D-Bus support.
2578 enable_dbus=no
2579 fi
2580
2581 if test "x$enable_dbus" != "xno"; then
2582 if test "x$enable_dbus" = "xyes"; then
2583 case "$host_os" in
2584
2585 darwin*)
2586 #
2587 # We don't support D-Bus sniffing on macOS; see
2588 #
2589 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
2590 #
2591 # The user requested it, so fail.
2592 #
2593 AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on macOS])
2594 esac
2595 else
2596 case "$host_os" in
2597
2598 darwin*)
2599 #
2600 # We don't support D-Bus sniffing on macOS; see
2601 #
2602 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
2603 #
2604 # The user dind't explicitly request it, so just
2605 # silently refuse to enable it.
2606 #
2607 enable_dbus="no"
2608 ;;
2609 esac
2610 fi
2611 fi
2612
2613 if test "x$enable_dbus" != "xno"; then
2614 if test "x$PKGCONFIG" != "xno"; then
2615 AC_MSG_CHECKING([for D-Bus])
2616 if "$PKGCONFIG" dbus-1; then
2617 AC_MSG_RESULT([yes])
2618 DBUS_CFLAGS=`"$PKGCONFIG" --cflags dbus-1`
2619 DBUS_LIBS=`"$PKGCONFIG" --libs dbus-1`
2620 save_CFLAGS="$CFLAGS"
2621 save_LIBS="$LIBS"
2622 CFLAGS="$CFLAGS $DBUS_CFLAGS"
2623 LIBS="$LIBS $DBUS_LIBS"
2624 AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write)
2625 AC_TRY_LINK(
2626 [#include <string.h>
2627
2628 #include <time.h>
2629 #include <sys/time.h>
2630
2631 #include <dbus/dbus.h>],
2632 [return dbus_connection_read_write(NULL, 0);],
2633 [
2634 AC_MSG_RESULT([yes])
2635 AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing])
2636 MODULE_C_SRC="$MODULE_C_SRC pcap-dbus.c"
2637 V_INCLS="$V_INCLS $DBUS_CFLAGS"
2638 ],
2639 [
2640 AC_MSG_RESULT([no])
2641 if test "x$enable_dbus" = "xyes"; then
2642 AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()])
2643 fi
2644 LIBS="$save_LIBS"
2645 ])
2646 CFLAGS="$save_CFLAGS"
2647 else
2648 AC_MSG_RESULT([no])
2649 if test "x$enable_dbus" = "xyes"; then
2650 AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed])
2651 fi
2652 fi
2653 fi
2654 AC_SUBST(PCAP_SUPPORT_DBUS)
2655 fi
2656
2657 AC_ARG_ENABLE([rdma],
2658 [AC_HELP_STRING([--enable-rdma],[enable RDMA capture support @<:@default=yes, if support available@:>@])],
2659 [],
2660 [enable_rdma=ifavailable])
2661
2662 if test "xxx_only" = yes; then
2663 # User requested something-else-only pcap, so they don't
2664 # want RDMA support.
2665 enable_rdma=no
2666 fi
2667
2668 if test "x$enable_rdma" != "xno"; then
2669 AC_CHECK_LIB(ibverbs, ibv_get_device_list, [
2670 AC_CHECK_HEADER(infiniband/verbs.h, [
2671 #
2672 # ibv_create_flow may be defined as a static inline
2673 # function in infiniband/verbs.h, so we can't
2674 # use AC_CHECK_LIB.
2675 #
2676 # Too bad autoconf has no AC_SYMBOL_EXISTS()
2677 # macro that works like CMake's check_symbol_exists()
2678 # function, to check do a compile check like
2679 # this (they do a clever trick to avoid having
2680 # to know the function's signature).
2681 #
2682 AC_MSG_CHECKING(whether libibverbs defines ibv_create_flow)
2683 AC_TRY_LINK(
2684 [
2685 #include <infiniband/verbs.h>
2686 ],
2687 [
2688 (void) ibv_create_flow((struct ibv_qp *) NULL,
2689 (struct ibv_flow_attr *) NULL);
2690 ],
2691 [
2692 AC_MSG_RESULT([yes])
2693 AC_DEFINE(PCAP_SUPPORT_RDMASNIFF, , [target host supports RDMA sniffing])
2694 MODULE_C_SRC="$MODULE_C_SRC pcap-rdmasniff.c"
2695 LIBS="-libverbs $LIBS"
2696 ],
2697 [
2698 AC_MSG_RESULT([no])
2699 ]
2700 )
2701 ])
2702 ])
2703 AC_SUBST(PCAP_SUPPORT_RDMASNIFF)
2704 fi
2705
2706 AC_PROG_INSTALL
2707
2708 AC_CONFIG_HEADER(config.h)
2709
2710 AC_OUTPUT_COMMANDS([if test -f .devel; then
2711 echo timestamp > stamp-h
2712 cat $srcdir/Makefile-devel-adds >> Makefile
2713 make depend
2714 fi])
2715 AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
2716 pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap
2717 pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap
2718 pcap_get_tstamp_precision.3pcap pcap_list_datalinks.3pcap
2719 pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap
2720 pcap_open_offline.3pcap pcap_set_immediate_mode.3pcap
2721 pcap_set_tstamp_precision.3pcap pcap_set_tstamp_type.3pcap
2722 rpcapd/Makefile rpcapd/rpcapd.manadmin rpcapd/rpcapd-config.manfile
2723 testprogs/Makefile)
2724 exit 0