]> The Tcpdump Group git mirrors - libpcap/blob - configure.in
Moving DAG support to 'pcap-config' method for external dependencies.
[libpcap] / configure.in
1 dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.168 2008-12-23 20:49:26 guy Exp $ (LBL)
2 dnl
3 dnl Copyright (c) 1994, 1995, 1996, 1997
4 dnl The Regents of the University of California. All rights reserved.
5 dnl
6 dnl Process this file with autoconf to produce a configure script.
7 dnl
8
9 #
10 # See
11 #
12 # http://ftp.gnu.org/gnu/config/README
13 #
14 # for the URLs to use to fetch new versions of config.guess and
15 # config.sub.
16 #
17
18 AC_REVISION($Revision: 1.168 $)
19 AC_PREREQ(2.50)
20 AC_INIT(pcap.c)
21
22 AC_CANONICAL_SYSTEM
23
24 AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
25 AC_PROG_CC
26 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
27 AC_LBL_SHLIBS_INIT
28 AC_LBL_C_INLINE
29 AC_C___ATTRIBUTE__
30
31 AC_CHECK_HEADERS(sys/bitypes.h)
32
33 AC_CHECK_TYPE([int8_t], ,
34 [AC_DEFINE([int8_t], [signed char],
35 [Define to `signed char' if int8_t not defined.])],
36 [AC_INCLUDES_DEFAULT
37 #ifdef HAVE_SYS_BITYPES_H
38 #include <sys/bitypes.h>
39 #endif])
40 AC_CHECK_TYPE([u_int8_t], ,
41 [AC_DEFINE([u_int8_t], [unsigned char],
42 [Define to `unsigned char' if u_int8_t not defined.])],
43 [AC_INCLUDES_DEFAULT
44 #ifdef HAVE_SYS_BITYPES_H
45 #include <sys/bitypes.h>
46 #endif])
47 AC_CHECK_TYPE([int16_t], ,
48 [AC_DEFINE([int16_t], [short],
49 [Define to `short' if int16_t not defined.])]
50 [AC_INCLUDES_DEFAULT
51 #ifdef HAVE_SYS_BITYPES_H
52 #include <sys/bitypes.h>
53 #endif])
54 AC_CHECK_TYPE([u_int16_t], ,
55 [AC_DEFINE([u_int16_t], [unsigned short],
56 [Define to `unsigned short' if u_int16_t not defined.])],
57 [AC_INCLUDES_DEFAULT
58 #ifdef HAVE_SYS_BITYPES_H
59 #include <sys/bitypes.h>
60 #endif])
61 AC_CHECK_TYPE([int32_t], ,
62 [AC_DEFINE([int32_t], [int],
63 [Define to `int' if int32_t not defined.])],
64 [AC_INCLUDES_DEFAULT
65 #ifdef HAVE_SYS_BITYPES_H
66 #include <sys/bitypes.h>
67 #endif])
68 AC_CHECK_TYPE([u_int32_t], ,
69 [AC_DEFINE([u_int32_t], [unsigned int],
70 [Define to `unsigned int' if u_int32_t not defined.])],
71 [AC_INCLUDES_DEFAULT
72 #ifdef HAVE_SYS_BITYPES_H
73 #include <sys/bitypes.h>
74 #endif])
75 AC_CHECK_TYPE([int64_t], ,
76 [AC_DEFINE([int64_t], [long long],
77 [Define to `long long' if int64_t not defined.])],
78 [AC_INCLUDES_DEFAULT
79 #ifdef HAVE_SYS_BITYPES_H
80 #include <sys/bitypes.h>
81 #endif])
82 AC_CHECK_TYPE([u_int64_t], ,
83 [AC_DEFINE([u_int64_t], [unsigned long long],
84 [Define to `unsigned long long' if u_int64_t not defined.])],
85 [AC_INCLUDES_DEFAULT
86 #ifdef HAVE_SYS_BITYPES_H
87 #include <sys/bitypes.h>
88 #endif])
89
90 #
91 # Try to arrange for large file support.
92 #
93 AC_SYS_LARGEFILE
94 AC_FUNC_FSEEKO
95
96 dnl
97 dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to
98 dnl include <sys/ioccom.h>, and we were to drop support for older
99 dnl releases without that fix, so that pcap-bpf.c doesn't need to
100 dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES"
101 dnl in "aclocal.m4" uses it, so we would still have to test for it
102 dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
103 dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris.
104 dnl
105 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h paths.h)
106 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
107 #include <sys/socket.h>
108 #include <net/if.h>])
109 if test "$ac_cv_header_net_pfvar_h" = yes; then
110 #
111 # Check for various PF actions.
112 #
113 AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR)
114 AC_TRY_COMPILE(
115 [#include <sys/types.h>
116 #include <sys/socket.h>
117 #include <net/if.h>
118 #include <net/pfvar.h>],
119 [return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;],
120 [
121 AC_MSG_RESULT(yes)
122 AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1,
123 [define if net/pfvar.h defines PF_NAT through PF_NORDR])
124 ],
125 AC_MSG_RESULT(no))
126 fi
127 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
128 #include <sys/socket.h>])
129 if test "$ac_cv_header_netinet_if_ether_h" != yes; then
130 #
131 # The simple test didn't work.
132 # Do we need to include <net/if.h> first?
133 # Unset ac_cv_header_netinet_if_ether_h so we don't
134 # treat the previous failure as a cached value and
135 # suppress the next test.
136 #
137 AC_MSG_NOTICE([Rechecking with some additional includes])
138 unset ac_cv_header_netinet_if_ether_h
139 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
140 #include <sys/socket.h>
141 #include <netinet/in.h>
142 struct mbuf;
143 struct rtentry;
144 #include <net/if.h>])
145 fi
146
147 AC_LBL_FIXINCLUDES
148
149 AC_CHECK_FUNCS(strerror strlcpy)
150
151 needsnprintf=no
152 AC_CHECK_FUNCS(vsnprintf snprintf,,
153 [needsnprintf=yes])
154 if test $needsnprintf = yes; then
155 AC_LIBOBJ(snprintf)
156 fi
157
158 #
159 # Do this before checking for ether_hostton(), as it's a
160 # "gethostbyname() -ish function".
161 #
162 AC_LBL_LIBRARY_NET
163
164 #
165 # You are in a twisty little maze of UN*Xes, all different.
166 # Some might not have ether_hostton().
167 # Some might have it, but not declare it in any header file.
168 # Some might have it, but declare it in <netinet/if_ether.h>.
169 # Some might have it, but declare it in <netinet/ether.h>
170 # (And some might have it but document it as something declared in
171 # <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
172 #
173 # Before you is a C compiler.
174 #
175 AC_CHECK_FUNCS(ether_hostton)
176 if test "$ac_cv_func_ether_hostton" = yes; then
177 #
178 # OK, we have ether_hostton(). Do we have <netinet/if_ether.h>?
179 #
180 if test "$ac_cv_header_netinet_if_ether_h" = yes; then
181 #
182 # Yes. Does it declare ether_hostton()?
183 #
184 AC_CHECK_DECL(ether_hostton,
185 [
186 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
187 [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
188 ],,
189 [
190 #include <sys/types.h>
191 #include <sys/socket.h>
192 #include <netinet/in.h>
193 #include <arpa/inet.h>
194 struct mbuf;
195 struct rtentry;
196 #include <net/if.h>
197 #include <netinet/if_ether.h>
198 ])
199 fi
200 #
201 # Did that succeed?
202 #
203 if test "$ac_cv_have_decl_ether_hostton" != yes; then
204 #
205 # No, how about <netinet/ether.h>, as on Linux?
206 #
207 AC_CHECK_HEADERS(netinet/ether.h)
208 if test "$ac_cv_header_netinet_ether_h" = yes; then
209 #
210 # We have it - does it declare ether_hostton()?
211 # Unset ac_cv_have_decl_ether_hostton so we don't
212 # treat the previous failure as a cached value and
213 # suppress the next test.
214 #
215 unset ac_cv_have_decl_ether_hostton
216 AC_CHECK_DECL(ether_hostton,
217 [
218 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
219 [Define to 1 if netinet/ether.h declares `ether_hostton'])
220 ],,
221 [
222 #include <netinet/ether.h>
223 ])
224 fi
225 fi
226 #
227 # Is ether_hostton() declared?
228 #
229 if test "$ac_cv_have_decl_ether_hostton" != yes; then
230 #
231 # No, we'll have to declare it ourselves.
232 # Do we have "struct ether_addr"?
233 #
234 AC_CHECK_TYPES(struct ether_addr,,,
235 [
236 #include <sys/types.h>
237 #include <sys/socket.h>
238 #include <netinet/in.h>
239 #include <arpa/inet.h>
240 struct mbuf;
241 struct rtentry;
242 #include <net/if.h>
243 #include <netinet/if_ether.h>
244 ])
245 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 0,
246 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
247 don't.])
248 else
249 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
250 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
251 don't.])
252 fi
253 fi
254
255 dnl to pacify those who hate protochain insn
256 AC_MSG_CHECKING(if --disable-protochain option is specified)
257 AC_ARG_ENABLE(protochain,
258 AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
259 case "x$enable_protochain" in
260 xyes) enable_protochain=enabled ;;
261 xno) enable_protochain=disabled ;;
262 x) enable_protochain=enabled ;;
263 esac
264
265 if test "$enable_protochain" = "disabled"; then
266 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
267 fi
268 AC_MSG_RESULT(${enable_protochain})
269
270 #
271 # SITA support is mutually exclusive with native capture support;
272 # "--with-sita" selects SITA support.
273 #
274 AC_ARG_WITH(sita,
275 AC_HELP_STRING([--with-sita],[include SITA support]),
276 [
277 if test ! "x$withval" = "xno" ; then
278 AC_DEFINE(SITA,1,[include ACN support])
279 AC_MSG_NOTICE(Enabling SITA ACN support)
280 V_PCAP=sita
281 V_FINDALLDEVS=sita
282 fi
283 ],
284 [
285 dnl
286 dnl Not all versions of test support -c (character special) but it's a
287 dnl better way of testing since the device might be protected. So we
288 dnl check in our normal order using -r and then check the for the /dev
289 dnl guys again using -c.
290 dnl
291 dnl XXX This could be done for cross-compiling, but for now it's not.
292 dnl
293 if test -z "$with_pcap" && test "$cross_compiling" = yes; then
294 AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)
295 fi
296 AC_ARG_WITH(pcap,
297 AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
298 AC_MSG_CHECKING(packet capture type)
299 if test ! -z "$with_pcap" ; then
300 V_PCAP="$withval"
301 elif test -r /dev/bpf -o -h /dev/bpf ; then
302 #
303 # Cloning BPF device.
304 #
305 V_PCAP=bpf
306 AC_DEFINE(HAVE_CLONING_BPF,1,[define if you have a cloning BPF device])
307 elif test -r /dev/bpf0 ; then
308 V_PCAP=bpf
309 elif test -r /usr/include/net/pfilt.h ; then
310 V_PCAP=pf
311 elif test -r /dev/enet ; then
312 V_PCAP=enet
313 elif test -r /dev/nit ; then
314 V_PCAP=snit
315 elif test -r /usr/include/sys/net/nit.h ; then
316 V_PCAP=nit
317 elif test -r /usr/include/linux/socket.h ; then
318 V_PCAP=linux
319 elif test -r /usr/include/net/raw.h ; then
320 V_PCAP=snoop
321 elif test -r /usr/include/odmi.h ; then
322 #
323 # On AIX, the BPF devices might not yet be present - they're
324 # created the first time libpcap runs after booting.
325 # We check for odmi.h instead.
326 #
327 V_PCAP=bpf
328 elif test -c /dev/bpf0 ; then # check again in case not readable
329 V_PCAP=bpf
330 elif test -r /usr/include/sys/dlpi.h ; then
331 V_PCAP=dlpi
332 elif test -c /dev/enet ; then # check again in case not readable
333 V_PCAP=enet
334 elif test -c /dev/nit ; then # check again in case not readable
335 V_PCAP=snit
336 else
337 V_PCAP=null
338 fi
339 AC_MSG_RESULT($V_PCAP)
340
341 #
342 # Do capture-mechanism-dependent tests.
343 #
344 case "$V_PCAP" in
345 dlpi)
346 #
347 # Checks to see if Solaris has the public libdlpi(3LIB) library.
348 # Note: The existence of /usr/include/libdlpi.h does not mean it is the
349 # public libdlpi(3LIB) version. Before libdlpi was made public, a
350 # private version also existed, which did not have the same APIs.
351 # Due to a gcc bug, the default search path for 32-bit libraries does
352 # not include /lib, we add it explicitly here.
353 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
354 # Also, due to the bug above applications that link to libpcap with
355 # libdlpi will have to add "-L/lib" option to "configure".
356 #
357 saved_ldflags=$LDFLAGS
358 LDFLAGS="$LIBS -L/lib"
359 AC_CHECK_LIB(dlpi, dlpi_walk,
360 LIBS="-ldlpi $LIBS"
361 V_PCAP=libdlpi
362 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists]),
363 V_PCAP=dlpi)
364 LDFLAGS=$saved_ldflags
365
366 #
367 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO
368 # versions of DLPI.
369 #
370 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
371 AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
372 AC_TRY_COMPILE(
373 [
374 #include <sys/types.h>
375 #include <sys/time.h>
376 #include <sys/dlpi.h>
377 ],
378 [int i = DL_PROMISC_PHYS;],
379 ac_cv_sys_dlpi_usable=yes,
380 ac_cv_sys_dlpi_usable=no))
381 AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
382 if test $ac_cv_sys_dlpi_usable = no ; then
383 AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
384 fi
385
386 #
387 # Check whether we have a /dev/dlpi device or have multiple devices.
388 #
389 AC_MSG_CHECKING(for /dev/dlpi device)
390 if test -c /dev/dlpi ; then
391 AC_MSG_RESULT(yes)
392 AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi])
393 else
394 AC_MSG_RESULT(no)
395 dir="/dev/dlpi"
396 AC_MSG_CHECKING(for $dir directory)
397 if test -d $dir ; then
398 AC_MSG_RESULT(yes)
399 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory])
400 else
401 AC_MSG_RESULT(no)
402 fi
403 fi
404
405 #
406 # This check is for Solaris with DLPI support for passive modes.
407 # See dlpi(7P) for more details.
408 #
409 AC_LBL_DL_PASSIVE_REQ_T
410 ;;
411
412 linux)
413 AC_MSG_CHECKING(Linux kernel version)
414 if test "$cross_compiling" = yes; then
415 AC_CACHE_VAL(ac_cv_linux_vers,
416 ac_cv_linux_vers=unknown)
417 else
418 AC_CACHE_VAL(ac_cv_linux_vers,
419 ac_cv_linux_vers=`uname -r 2>&1 | \
420 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
421 fi
422 AC_MSG_RESULT($ac_cv_linux_vers)
423 if test $ac_cv_linux_vers = unknown ; then
424 AC_MSG_ERROR(cannot determine linux version when cross-compiling)
425 fi
426 if test $ac_cv_linux_vers -lt 2 ; then
427 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
428 fi
429
430 #
431 # Do we have the wireless extensions?
432 #
433 AC_CHECK_HEADERS(linux/wireless.h, [], [],
434 [
435 #include <sys/socket.h>
436 #include <linux/if.h>
437 #include <linux/types.h>
438 ])
439
440 #
441 # Do we have libnl?
442 #
443 AC_ARG_WITH(libnl,
444 AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
445 with_libnl=$withval,,)
446
447 if test x$with_libnl != xno ; then
448 #
449 # Try libnl 2.x first.
450 #
451 AC_CHECK_LIB(nl, nl_socket_alloc,
452 [
453 #
454 # Yes, we have libnl 2.x.
455 #
456 LIBS="-lnl-genl -lnl $LIBS"
457 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
458 AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
459 ],
460 [
461 #
462 # No, we don't; do we have libnl 1.x?
463 #
464 AC_CHECK_LIB(nl, nl_handle_alloc,
465 [
466 #
467 # Yes.
468 #
469 LIBS="-lnl $LIBS"
470 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
471 ],
472 [
473 #
474 # No, we don't have libnl at all.
475 #
476 if test x$with_libnl = xyes ; then
477 AC_MSG_ERROR([libnl support requested but libnl not found])
478 fi
479 ])
480 ])
481 fi
482
483 AC_LBL_TPACKET_STATS
484 AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI
485 ;;
486
487 bpf)
488 #
489 # Check whether we have the *BSD-style ioctls.
490 #
491 AC_CHECK_HEADERS(net/if_media.h)
492
493 AC_MSG_CHECKING(whether the system supports zerocopy BPF)
494 AC_TRY_COMPILE(
495 [#include <sys/socket.h>
496 #include <sys/ioctl.h>
497 #include <net/if.h>
498 #include <net/bpf.h>],
499 [return (BIOCROTZBUF + BPF_BUFMODE_ZBUF);],
500 [
501 AC_MSG_RESULT(yes)
502 AC_DEFINE(HAVE_ZEROCOPY_BPF, 1,
503 [define if the system supports zerocopy BPF])
504 ],
505 AC_MSG_RESULT(no))
506
507 #
508 # Check whether we have struct BPF_TIMEVAL.
509 #
510 AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
511 [
512 #include <sys/types.h>
513 #include <sys/ioctl.h>
514 #ifdef HAVE_SYS_IOCCOM_H
515 #include <sys/ioccom.h>
516 #endif
517 #include <net/bpf.h>
518 ])
519 ;;
520
521 dag)
522 V_DEFS="$V_DEFS -DDAG_ONLY"
523 ;;
524
525 septel)
526 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
527 ;;
528
529 snf)
530 V_DEFS="$V_DEFS -DSNF_ONLY"
531 ;;
532
533 null)
534 AC_MSG_WARN(cannot determine packet capture interface)
535 AC_MSG_WARN((see the INSTALL doc for more info))
536 ;;
537 esac
538
539 dnl
540 dnl Now figure out how we get a list of interfaces and addresses,
541 dnl if we support capturing. Don't bother if we don't support
542 dnl capturing.
543 dnl
544 if test "$V_PCAP" = null
545 then
546 #
547 # We can't capture, so we can't open any capture
548 # devices, so we won't return any interfaces.
549 #
550 V_FINDALLDEVS=null
551 else
552 AC_CHECK_FUNC(getifaddrs,[
553 #
554 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
555 # as well, just in case some platform is really weird.
556 #
557 AC_CHECK_HEADER(ifaddrs.h,[
558 #
559 # We have the header, so we use "getifaddrs()" to
560 # get the list of interfaces.
561 #
562 V_FINDALLDEVS=getad
563 ],[
564 #
565 # We don't have the header - give up.
566 # XXX - we could also fall back on some other
567 # mechanism, but, for now, this'll catch this
568 # problem so that we can at least try to figure
569 # out something to do on systems with "getifaddrs()"
570 # but without "ifaddrs.h", if there is something
571 # we can do on those systems.
572 #
573 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
574 ])
575 ],[
576 #
577 # Well, we don't have "getifaddrs()", so we have to use
578 # some other mechanism; determine what that mechanism is.
579 #
580 # The first thing we use is the type of capture mechanism,
581 # which is somewhat of a proxy for the OS we're using.
582 #
583 case "$V_PCAP" in
584
585 dlpi|libdlpi)
586 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
587 #
588 # This might be Solaris 8 or later, with
589 # SIOCGLIFCONF, or it might be some other OS
590 # or some older version of Solaris, with
591 # just SIOCGIFCONF.
592 #
593 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
594 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
595 AC_TRY_COMPILE(
596 [#include <sys/param.h>
597 #include <sys/file.h>
598 #include <sys/ioctl.h>
599 #include <sys/socket.h>
600 #include <sys/sockio.h>],
601 [ioctl(0, SIOCGLIFCONF, (char *)0);],
602 ac_cv_lbl_have_siocglifconf=yes,
603 ac_cv_lbl_have_siocglifconf=no))
604 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
605 if test $ac_cv_lbl_have_siocglifconf = yes ; then
606 V_FINDALLDEVS=glifc
607 else
608 V_FINDALLDEVS=gifc
609 fi
610 #
611 # Needed for common functions used by pcap-[dlpi,libdlpi].c
612 #
613 SSRC="dlpisubs.c"
614 ;;
615
616 *)
617 #
618 # Assume we just have SIOCGIFCONF.
619 # (XXX - on at least later Linux kernels, there's
620 # another mechanism, and we should be using that
621 # instead.)
622 #
623 V_FINDALLDEVS=gifc
624 ;;
625 esac])
626 fi
627 ])
628
629 AC_MSG_CHECKING(for socklen_t)
630 AC_TRY_COMPILE([
631 #include <sys/types.h>
632 #include <sys/socket.h>
633 ],
634 [ socklen_t x; ],
635 have_socklen_t=yes,
636 have_socklen_t=no)
637 if test "x$have_socklen_t" = "xyes"; then
638 AC_DEFINE(HAVE_SOCKLEN_T, 1, [define if socklen_t is defined])
639 fi
640 AC_MSG_RESULT($have_socklen_t)
641
642 AC_ARG_ENABLE(ipv6,
643 AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes, if getaddrinfo available@:>@]),
644 [],
645 [enable_ipv6=ifavailable])
646 if test "$enable_ipv6" != "no"; then
647 AC_CHECK_FUNC(getaddrinfo,
648 [
649 AC_DEFINE(INET6,1,[IPv6])
650 ],
651 [
652 if test "$enable_ipv6" != "ifavailable"; then
653 AC_MSG_FAILURE([--enable-ipv6 was given, but getaddrinfo isn't available])
654 fi
655 ])
656 fi
657
658 AC_MSG_CHECKING(whether to build optimizer debugging code)
659 AC_ARG_ENABLE(optimizer-dbg,
660 AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
661 if test "$enable_optimizer_dbg" = "yes"; then
662 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
663 fi
664 AC_MSG_RESULT(${enable_optimizer_dbg-no})
665
666 AC_MSG_CHECKING(whether to build parser debugging code)
667 AC_ARG_ENABLE(yydebug,
668 AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
669 if test "$enable_yydebug" = "yes"; then
670 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
671 fi
672 AC_MSG_RESULT(${enable_yydebug-no})
673
674 # Check for Endace DAG card support.
675 AC_ARG_WITH([dag],
676 AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support @<:@"yes", "no" or DIR; default="yes" on BSD and Linux if present@:>@]),
677 [
678 if test "$withval" = no
679 then
680 # User doesn't want DAG support.
681 want_dag=no
682 elif test "$withval" = yes
683 then
684 # User wants DAG support but hasn't specified a directory.
685 want_dag=yes
686 else
687 # User wants DAG support and has specified a directory, so use the provided value.
688 want_dag=yes
689 dag_root=$withval
690 fi
691 ],[
692 #
693 # Use DAG API if present, otherwise don't
694 #
695 want_dag=ifpresent
696 ])
697
698 AC_ARG_WITH([dag-includes],
699 AC_HELP_STRING([--with-dag-includes=DIR],[Endace DAG include directory]),
700 [
701 # User wants DAG support and has specified a header directory, so use the provided value.
702 want_dag=yes
703 dag_include_dir=$withval
704 ],[])
705
706 AC_ARG_WITH([dag-libraries],
707 AC_HELP_STRING([--with-dag-libraries=DIR],[Endace DAG library directory]),
708 [
709 # User wants DAG support and has specified a library directory, so use the provided value.
710 want_dag=yes
711 dag_lib_dir=$withval
712 ],[])
713
714 case "$V_PCAP" in
715 linux|bpf|dag)
716 #
717 # We support the DAG API if we're on Linux or BSD, or if we're
718 # building a DAG-only libpcap.
719 #
720 ;;
721 *)
722 #
723 # If the user explicitly requested DAG, tell them it's not
724 # supported.
725 #
726 # If they expressed no preference, don't include it.
727 #
728 if test $want_dag = yes; then
729 AC_MSG_ERROR([DAG support is only available with 'linux' 'bpf' and 'dag' packet capture types])
730 elif test $want_dag = yes; then
731 want_dag=no
732 fi
733 ;;
734 esac
735
736 ac_cv_lbl_dag_api=no
737 if test "$want_dag" != no; then
738
739 AC_MSG_CHECKING([whether we have DAG API headers])
740
741 # If necessary, set default paths for DAG API headers and libraries.
742 if test -z "$dag_root"; then
743 dag_root=/usr/local
744 fi
745
746 if test -z "$dag_include_dir"; then
747 dag_include_dir="$dag_root/include"
748 fi
749
750 if test -z "$dag_lib_dir"; then
751 dag_lib_dir="$dag_root/lib"
752 fi
753
754 if test -z "$dag_tools_dir"; then
755 dag_tools_dir="$dag_root/tools"
756 fi
757
758 if test -r $dag_include_dir/dagapi.h; then
759 ac_cv_lbl_dag_api=yes
760 fi
761 AC_MSG_RESULT([$ac_cv_lbl_dag_api ($dag_include_dir)])
762 fi
763
764 if test $ac_cv_lbl_dag_api = yes; then
765 V_INCLS="$V_INCLS -I$dag_include_dir"
766
767 if test $V_PCAP != dag ; then
768 SSRC="pcap-dag.c"
769 fi
770
771 # See if we can find a general version string.
772 # Don't need to save and restore LIBS to prevent -ldag being
773 # included if there's a found-action (arg 3).
774 saved_ldflags=$LDFLAGS
775 LDFLAGS="-L$dag_lib_dir"
776 AC_CHECK_LIB([dag], [dag_attach_stream], [dag_streams="1"], [dag_streams="0"])
777 AC_CHECK_LIB([dag],[dag_get_erf_types], [
778 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
779 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
780 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
781
782 if test "$dag_streams" = 1; then
783 AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API])
784 LIBS="$LIBS -ldag"
785
786 AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
787 if test "$ac_dag_have_vdag" = 1; then
788 AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
789 LIBS="$LIBS -lpthread"
790 fi
791 fi
792
793 LDFLAGS=$saved_ldflags
794
795 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
796 fi
797
798 AC_MSG_CHECKING(whether we have the DAG API)
799
800 if test $ac_cv_lbl_dag_api = no; then
801 AC_MSG_RESULT(no)
802 if test "$want_dag" = yes; then
803 # User wanted DAG support but we couldn't find it.
804 AC_MSG_ERROR([DAG API requested, but not found at $dag_root: use --without-dag])
805 fi
806
807 if test "$V_PCAP" = dag; then
808 # User requested "dag" capture type but the DAG API wasn't
809 # found.
810 AC_MSG_ERROR([Specifying the capture type as "dag" requires the DAG API to be present; use the --with-dag options to specify the location. (Try "./configure --help" for more information.)])
811 fi
812 else
813 AC_MSG_RESULT(yes)
814 fi
815
816 AC_ARG_WITH(septel,
817 AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, on Linux, if present@:>@]),
818 [
819 if test "$withval" = no
820 then
821 want_septel=no
822 elif test "$withval" = yes
823 then
824 want_septel=yes
825 septel_root=
826 else
827 want_septel=yes
828 septel_root=$withval
829 fi
830 ],[
831 #
832 # Use Septel API if present, otherwise don't
833 #
834 want_septel=ifpresent
835 septel_root=./../septel
836 ])
837 ac_cv_lbl_septel_api=no
838 case "$V_PCAP" in
839 linux|septel)
840 #
841 # We support the Septel API if we're on Linux, or if we're building
842 # a Septel-only libpcap.
843 #
844 ;;
845 *)
846 #
847 # If the user explicitly requested Septel, tell them it's not
848 # supported.
849 #
850 # If they expressed no preference, don't include it.
851 #
852 if test $want_septel = yes; then
853 AC_MSG_ERROR(Septel support only available with 'linux' and 'septel' packet capture types)
854 elif test $want_septel = yes; then
855 want_septel=no
856 fi
857 ;;
858 esac
859
860 if test "$with_septel" != no; then
861 AC_MSG_CHECKING(whether we have Septel API)
862
863 if test -z "$septel_root"; then
864 septel_root=$srcdir/../septel
865 fi
866
867 septel_tools_dir="$septel_root"
868 septel_include_dir="$septel_root/INC"
869
870 ac_cv_lbl_septel_api=no
871 if test -r "$septel_include_dir/msg.h"; then
872 V_INCLS="$V_INCLS -I$septel_include_dir"
873 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"
874 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"
875
876 if test "$V_PCAP" != septel ; then
877 SSRC="pcap-septel.c"
878 fi
879 ac_cv_lbl_septel_api=yes
880 fi
881
882 AC_MSG_RESULT($ac_cv_lbl_septel_api)
883 if test $ac_cv_lbl_septel_api = no; then
884 if test "$want_septel" = yes; then
885 AC_MSG_ERROR(Septel API not found under directory $septel_root; use --without-septel)
886 fi
887 else
888 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have a Septel API])
889 fi
890 fi
891
892 if test "$V_PCAP" = septel -a "$ac_cv_lbl_septel_api" = no; then
893 AC_MSG_ERROR(Specifying the capture type as 'septel' requires the Septel API to be present; use --with-septel=DIR)
894 fi
895
896 # Check for Myricom SNF support.
897 AC_ARG_WITH([snf],
898 AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support @<:@"yes", "no" or DIR; default="yes" on BSD and Linux if present@:>@]),
899 [
900 if test "$withval" = no
901 then
902 # User explicitly doesn't want SNF
903 want_snf=no
904 elif test "$withval" = yes
905 then
906 # User wants SNF support but hasn't specific a directory.
907 want_snf=yes
908 else
909 # User wants SNF support with a specified directory.
910 want_snf=yes
911 snf_root=$withval
912 fi
913 ],[
914 #
915 # Use Sniffer API if present, otherwise don't
916 #
917 want_snf=ifpresent
918 ])
919
920 AC_ARG_WITH([snf-includes],
921 AC_HELP_STRING([--with-snf-includes=DIR],[Myricom SNF include directory]),
922 [
923 # User wants SNF with specific header directory
924 want_snf=yes
925 snf_include_dir=$withval
926 ],[])
927
928 AC_ARG_WITH([snf-libraries],
929 AC_HELP_STRING([--with-snf-libraries=DIR],[Myricom SNF library directory]),
930 [
931 # User wants SNF with specific lib directory
932 want_snf=yes
933 snf_lib_dir=$withval
934 ],[])
935
936 case "$V_PCAP" in
937 bpf|linux|snf)
938 #
939 # We support the Sniffer API if we're on BSD, Linux, or if we're
940 # building a Sniffer-only libpcap.
941 #
942 ;;
943 *)
944 #
945 # If the user explicitly requested Sniffer, tell them it's not
946 # supported.
947 #
948 # If they expressed no preference, don't include it.
949 #
950 if test $want_snf = yes; then
951 AC_MSG_ERROR(Myricom SNF support only available with 'bpf' 'linux' and 'snf' packet capture types)
952 elif test $want_snf = yes; then
953 want_snf=no
954 fi
955 ;;
956 esac
957
958 ac_cv_lbl_snf_api=no
959 if test "$with_snf" != no; then
960
961 AC_MSG_CHECKING(whether we have Myricom Sniffer API)
962
963 if test -z "$snf_root"; then
964 snf_root=/opt/snf
965 fi
966
967 if test -z "$snf_include_dir"; then
968 snf_include_dir="$snf_root/include"
969 fi
970
971 if test -z "$snf_lib_dir"; then
972 snf_lib_dir="$snf_root/lib"
973 fi
974
975 if test -f "$snf_include_dir/snf.h"; then
976 ac_cv_lbl_snf_api=yes
977 fi
978 AC_MSG_RESULT([$ac_cv_lbl_snf_api ($snf_root)])
979
980 if test $ac_cv_lbl_snf_api = no; then
981 if test "$want_snf" = yes; then
982 AC_MSG_ERROR(SNF API headers not found under $snf_include_dir; use --without-snf)
983 fi
984 else
985 saved_ldflags=$LDFLAGS
986 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
987 AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"], [ac_cv_lbl_snf_api="no"])
988 LDFLAGS="$saved_ldflags"
989
990 if test $ac_cv_lbl_snf_api = no; then
991 if test "$want_snf" = yes; then
992 AC_MSG_ERROR(SNF API cannot correctly be linked check config.log; use --without-snf)
993 fi
994 else
995 V_INCLS="$V_INCLS -I$snf_include_dir"
996 LIBS="$LIBS -lsnf"
997 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
998 if test "$V_PCAP" != snf ; then
999 SSRC="pcap-snf.c"
1000 fi
1001 AC_DEFINE(HAVE_SNF_API, 1, [define if you have Myricom SNF API])
1002 fi
1003 fi
1004 fi
1005
1006 if test "$V_PCAP" = snf -a "$ac_cv_lbl_snf_api" = no; then
1007 AC_MSG_ERROR(Specifying the capture type as 'snf' requires the Myricom Sniffer API to be present; use --with-snf=DIR)
1008 fi
1009
1010 AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
1011 if test "$V_LEX" = lex ; then
1012 # Some versions of lex can't handle the definitions section of scanner.l .
1013 # Try lexing it and complain if it can't deal.
1014 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
1015 if lex -t scanner.l > /dev/null 2>&1; then
1016 tcpdump_cv_capable_lex=yes
1017 else
1018 tcpdump_cv_capable_lex=insufficient
1019 fi)
1020 if test $tcpdump_cv_capable_lex = insufficient ; then
1021 AC_MSG_ERROR([Your operating system's lex is insufficient to compile
1022 libpcap. flex is a lex replacement that has many advantages, including
1023 being able to compile libpcap. For more information, see
1024 http://www.gnu.org/software/flex/flex.html .])
1025 fi
1026 fi
1027
1028 #
1029 # Assume, by default, no support for shared libraries and V7/BSD convention
1030 # for man pages (file formats in section 5, miscellaneous info in section 7).
1031 # Individual cases can override this.
1032 #
1033 DYEXT="none"
1034 MAN_FILE_FORMATS=5
1035 MAN_MISC_INFO=7
1036 case "$host_os" in
1037
1038 aix*)
1039 dnl Workaround to enable certain features
1040 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
1041
1042 #
1043 # AIX makes it fun to build shared and static libraries,
1044 # because they're *both* ".a" archive libraries. We
1045 # build the static library for the benefit of the traditional
1046 # scheme of building libpcap and tcpdump in subdirectories of
1047 # the same directory, with tcpdump statically linked with the
1048 # libpcap in question, but we also build a shared library as
1049 # "libpcap.shareda" and install *it*, rather than the static
1050 # library, as "libpcap.a".
1051 #
1052 DYEXT="shareda"
1053
1054 case "$V_PCAP" in
1055
1056 dlpi)
1057 #
1058 # If we're using DLPI, applications will need to
1059 # use /lib/pse.exp if present, as we use the
1060 # STREAMS routines.
1061 #
1062 pseexe="/lib/pse.exp"
1063 AC_MSG_CHECKING(for $pseexe)
1064 if test -f $pseexe ; then
1065 AC_MSG_RESULT(yes)
1066 LIBS="-I:$pseexe"
1067 fi
1068 ;;
1069
1070 bpf)
1071 #
1072 # If we're using BPF, we need "-lodm" and "-lcfg", as
1073 # we use them to load the BPF module.
1074 #
1075 LIBS="-lodm -lcfg"
1076 ;;
1077 esac
1078 ;;
1079
1080 darwin*)
1081 DYEXT="dylib"
1082 V_CCOPT="$V_CCOPT -fno-common"
1083 AC_ARG_ENABLE(universal,
1084 AC_HELP_STRING([--disable-universal],[don't build universal on OS X]))
1085 if test "$enable_universal" != "no"; then
1086 case "$host_os" in
1087
1088 darwin9.*)
1089 #
1090 # Leopard. Build for 32-bit PowerPC, 64-bit
1091 # PowerPC, x86, and x86-64, with 32-bit PowerPC
1092 # first. (That's what Apple does.)
1093 #
1094 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1095 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1096 ;;
1097
1098 darwin10.*)
1099 #
1100 # Snow Leopard. Build for x86-64, x86, and
1101 # 32-bit PowerPC, with x86-64 first. (That's
1102 # what Apple does, even though Snow Leopard
1103 # doesn't run on PPC, so PPC libpcap runs under
1104 # Rosetta, and Rosetta doesn't support BPF
1105 # ioctls, so PPC programs can't do live
1106 # captures.)
1107 #
1108 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386 -arch ppc"
1109 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386 -arch ppc"
1110 ;;
1111 esac
1112 fi
1113 ;;
1114
1115 hpux9*)
1116 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
1117
1118 #
1119 # Use System V conventions for man pages.
1120 #
1121 MAN_FILE_FORMATS=4
1122 MAN_MISC_INFO=5
1123 ;;
1124
1125 hpux10.0*)
1126
1127 #
1128 # Use System V conventions for man pages.
1129 #
1130 MAN_FILE_FORMATS=4
1131 MAN_MISC_INFO=5
1132 ;;
1133
1134 hpux10.1*)
1135
1136 #
1137 # Use System V conventions for man pages.
1138 #
1139 MAN_FILE_FORMATS=4
1140 MAN_MISC_INFO=5
1141 ;;
1142
1143 hpux*)
1144 dnl HPUX 10.20 and above is similar to HPUX 9, but
1145 dnl not the same....
1146 dnl
1147 dnl XXX - DYEXT should be set to "sl" if this is building
1148 dnl for 32-bit PA-RISC, but should be left as "so" for
1149 dnl 64-bit PA-RISC or, I suspect, IA-64.
1150 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
1151 if test "`uname -m`" = "ia64"; then
1152 DYEXT="so"
1153 else
1154 DYEXT="sl"
1155 fi
1156
1157 #
1158 # "-b" builds a shared library; "+h" sets the soname.
1159 #
1160 SHLIB_OPT="-b"
1161 SONAME_OPT="+h"
1162
1163 #
1164 # Use System V conventions for man pages.
1165 #
1166 MAN_FILE_FORMATS=4
1167 MAN_MISC_INFO=5
1168 ;;
1169
1170 irix*)
1171 #
1172 # Use System V conventions for man pages.
1173 #
1174 MAN_FILE_FORMATS=4
1175 MAN_MISC_INFO=5
1176 ;;
1177
1178 linux*|freebsd*|netbsd*|openbsd*|dragonfly*)
1179 DYEXT="so"
1180
1181 #
1182 # Compiler assumed to be GCC; run-time linker may require a -R
1183 # flag.
1184 #
1185 if test "$libdir" != "/usr/lib"; then
1186 V_RFLAGS=-Wl,-R$libdir
1187 fi
1188 ;;
1189
1190 osf*)
1191 DYEXT="so"
1192
1193 #
1194 # Use System V conventions for man pages.
1195 #
1196 MAN_FILE_FORMATS=4
1197 MAN_MISC_INFO=5
1198 ;;
1199
1200 sinix*)
1201 AC_MSG_CHECKING(if SINIX compiler defines sinix)
1202 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
1203 AC_TRY_COMPILE(
1204 [],
1205 [int i = sinix;],
1206 ac_cv_cc_sinix_defined=yes,
1207 ac_cv_cc_sinix_defined=no))
1208 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
1209 if test $ac_cv_cc_sinix_defined = no ; then
1210 AC_DEFINE(sinix,1,[on sinix])
1211 fi
1212 ;;
1213
1214 solaris*)
1215 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
1216
1217 DYEXT="so"
1218 #
1219 # Use System V conventions for man pages.
1220 #
1221 MAN_FILE_FORMATS=4
1222 MAN_MISC_INFO=5
1223 ;;
1224 esac
1225
1226 AC_PROG_RANLIB
1227 AC_CHECK_TOOL([AR], [ar])
1228
1229 AC_LBL_DEVEL(V_CCOPT)
1230
1231 AC_LBL_SOCKADDR_SA_LEN
1232
1233 AC_LBL_SOCKADDR_STORAGE
1234
1235 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
1236
1237 AC_LBL_UNALIGNED_ACCESS
1238
1239 #
1240 # Makefile.in includes rules to generate version.h, so we assume
1241 # that it will be generated if autoconf is used.
1242 #
1243 AC_DEFINE(HAVE_VERSION_H, 1, [define if version.h is generated in the build procedure])
1244
1245 rm -f net
1246 ln -s ${srcdir}/bpf/net net
1247
1248 AC_SUBST(V_CCOPT)
1249 AC_SUBST(V_DEFS)
1250 AC_SUBST(V_FINDALLDEVS)
1251 AC_SUBST(V_INCLS)
1252 AC_SUBST(V_LEX)
1253 AC_SUBST(V_PCAP)
1254 AC_SUBST(V_SHLIB_CMD)
1255 AC_SUBST(V_SHLIB_OPT)
1256 AC_SUBST(V_SONAME_OPT)
1257 AC_SUBST(V_RPATH_OPT)
1258 AC_SUBST(V_YACC)
1259 AC_SUBST(ADDLOBJS)
1260 AC_SUBST(ADDLARCHIVEOBJS)
1261 AC_SUBST(SSRC)
1262 AC_SUBST(DYEXT)
1263 AC_SUBST(MAN_FILE_FORMATS)
1264 AC_SUBST(MAN_MISC_INFO)
1265
1266 dnl check for USB sniffing support
1267 AC_MSG_CHECKING(for USB sniffing support)
1268 case "$host_os" in
1269 linux*)
1270 AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
1271 USB_SRC=pcap-usb-linux.c
1272 AC_MSG_RESULT(yes)
1273 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
1274 if test $? -ne 0 ; then
1275 ac_usb_dev_name="usbmon"
1276 fi
1277 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
1278 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
1279 #
1280 # Do we have a version of <linux/compiler.h> available?
1281 # If so, we might need it for <linux/usbdevice_fs.h>.
1282 #
1283 AC_CHECK_HEADERS(linux/compiler.h)
1284 if test "$ac_cv_header_linux_compiler_h" = yes; then
1285 #
1286 # Yes - include it when testing for <linux/usbdevice_fs.h>.
1287 #
1288 AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
1289 else
1290 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
1291 fi
1292 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
1293 #
1294 # OK, does it define bRequestType? Older versions of the kernel
1295 # define fields with names like "requesttype, "request", and
1296 # "value", rather than "bRequestType", "bRequest", and
1297 # "wValue".
1298 #
1299 AC_MSG_CHECKING(if usbdevfs_ctrltransfer struct has bRequestType member)
1300 AC_CACHE_VAL(ac_cv_usbdevfs_ctrltransfer_has_bRequestType,
1301 AC_TRY_COMPILE([
1302 AC_INCLUDES_DEFAULT
1303 #ifdef HAVE_SYS_BITYPES_H
1304 #include <sys/bitypes.h>
1305 #endif
1306 #ifdef HAVE_LINUX_COMPILER_H
1307 #include <linux/compiler.h>
1308 #endif
1309 # include <linux/usbdevice_fs.h>],
1310 [u_int i = sizeof(((struct usbdevfs_ctrltransfer *)0)->bRequestType)],
1311 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=yes,
1312 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=no))
1313 AC_MSG_RESULT($ac_cv_usbdevfs_ctrltransfer_has_bRequestType)
1314 if test $ac_cv_usbdevfs_ctrltransfer_has_bRequestType = yes ; then
1315 AC_DEFINE(HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE,1,
1316 [if struct usbdevfs_ctrltransfer has bRequestType])
1317 fi
1318 fi
1319 ;;
1320 *)
1321 AC_MSG_RESULT(no)
1322 ;;
1323 esac
1324 AC_SUBST(PCAP_SUPPORT_USB)
1325 AC_SUBST(USB_SRC)
1326
1327 AC_ARG_ENABLE([bluetooth],
1328 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
1329 ,enable_bluetooth=yes)
1330
1331 if test "x$enable_bluetooth" != "xno" ; then
1332 dnl check for Bluetooth sniffing support
1333 case "$host_os" in
1334 linux*)
1335 AC_CHECK_HEADER(bluetooth/bluetooth.h,
1336 [
1337 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
1338 BT_SRC=pcap-bt-linux.c
1339 AC_MSG_NOTICE(Bluetooth sniffing is supported)
1340 ],
1341 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
1342 )
1343 ;;
1344 *)
1345 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
1346 ;;
1347 esac
1348 AC_SUBST(PCAP_SUPPORT_BT)
1349 AC_SUBST(BT_SRC)
1350 fi
1351
1352 AC_ARG_ENABLE([can],
1353 [AC_HELP_STRING([--enable-can],[enable CAN support @<:@default=yes, if support available@:>@])],
1354 ,enable_can=yes)
1355
1356 if test "x$enable_can" != "xno" ; then
1357 dnl check for CAN sniffing support
1358 case "$host_os" in
1359 linux*)
1360 AC_CHECK_HEADER(linux/can.h,
1361 [ AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing])
1362 CAN_SRC=pcap-can-linux.c
1363 AC_MSG_NOTICE(CAN sniffing is supported)],
1364 AC_MSG_NOTICE(CAN sniffing is not supported),
1365 [#include <sys/socket.h>]
1366 )
1367 ;;
1368 *)
1369 AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os)
1370 ;;
1371 esac
1372 AC_SUBST(PCAP_SUPPORT_CAN)
1373 AC_SUBST(CAN_SRC)
1374 fi
1375
1376 dnl check for hardware timestamp support
1377 case "$host_os" in
1378 linux*)
1379 AC_CHECK_HEADERS([linux/net_tstamp.h])
1380 ;;
1381 *)
1382 AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os)
1383 ;;
1384 esac
1385
1386 AC_PROG_INSTALL
1387
1388 AC_CONFIG_HEADER(config.h)
1389
1390 AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
1391 pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap
1392 pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap
1393 pcap_list_datalinks.3pcap pcap_list_tstamp_types.3pcap
1394 pcap_open_dead.3pcap pcap_open_offline.3pcap
1395 pcap_set_tstamp_type.3pcap)
1396
1397 if test -f .devel ; then
1398 make depend
1399 fi
1400 exit 0