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