]> The Tcpdump Group git mirrors - libpcap/blob - configure.in
9d25a84d05afeb0b27bafa9aed3c1c1993ff722a
[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 #
414 # Do we have the wireless extensions?
415 #
416 AC_CHECK_HEADERS(linux/wireless.h, [], [],
417 [
418 #include <sys/socket.h>
419 #include <linux/if.h>
420 #include <linux/types.h>
421 ])
422
423 #
424 # Do we have libnl?
425 #
426 AC_ARG_WITH(libnl,
427 AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
428 with_libnl=$withval,,)
429
430 if test x$with_libnl != xno ; then
431 #
432 # Try libnl 2.x first.
433 #
434 AC_CHECK_LIB(nl, nl_socket_alloc,
435 [
436 #
437 # Yes, we have libnl 2.x.
438 #
439 LIBS="-lnl-genl -lnl $LIBS"
440 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
441 AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
442 ],
443 [
444 #
445 # No, we don't; do we have libnl 1.x?
446 #
447 AC_CHECK_LIB(nl, nl_handle_alloc,
448 [
449 #
450 # Yes.
451 #
452 LIBS="-lnl $LIBS"
453 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
454 ],
455 [
456 #
457 # No, we don't have libnl at all.
458 #
459 if test x$with_libnl = xyes ; then
460 AC_MSG_ERROR([libnl support requested but libnl not found])
461 fi
462 ])
463 ])
464 fi
465
466 AC_LBL_TPACKET_STATS
467 AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI
468 ;;
469
470 bpf)
471 #
472 # Check whether we have the *BSD-style ioctls.
473 #
474 AC_CHECK_HEADERS(net/if_media.h)
475
476 AC_MSG_CHECKING(whether the system supports zerocopy BPF)
477 AC_TRY_COMPILE(
478 [#include <sys/socket.h>
479 #include <sys/ioctl.h>
480 #include <net/if.h>
481 #include <net/bpf.h>],
482 [return (BIOCROTZBUF + BPF_BUFMODE_ZBUF);],
483 [
484 AC_MSG_RESULT(yes)
485 AC_DEFINE(HAVE_ZEROCOPY_BPF, 1,
486 [define if the system supports zerocopy BPF])
487 ],
488 AC_MSG_RESULT(no))
489
490 #
491 # Check whether we have struct BPF_TIMEVAL.
492 #
493 AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
494 [
495 #include <sys/types.h>
496 #include <sys/ioctl.h>
497 #ifdef HAVE_SYS_IOCCOM_H
498 #include <sys/ioccom.h>
499 #endif
500 #include <net/bpf.h>
501 ])
502 ;;
503
504 dag)
505 V_DEFS="$V_DEFS -DDAG_ONLY"
506 ;;
507
508 septel)
509 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
510 ;;
511
512 snf)
513 V_DEFS="$V_DEFS -DSNF_ONLY"
514 ;;
515
516 null)
517 AC_MSG_WARN(cannot determine packet capture interface)
518 AC_MSG_WARN((see the INSTALL doc for more info))
519 ;;
520 esac
521
522 dnl
523 dnl Now figure out how we get a list of interfaces and addresses,
524 dnl if we support capturing. Don't bother if we don't support
525 dnl capturing.
526 dnl
527 if test "$V_PCAP" = null
528 then
529 #
530 # We can't capture, so we can't open any capture
531 # devices, so we won't return any interfaces.
532 #
533 V_FINDALLDEVS=null
534 else
535 AC_CHECK_FUNC(getifaddrs,[
536 #
537 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
538 # as well, just in case some platform is really weird.
539 #
540 AC_CHECK_HEADER(ifaddrs.h,[
541 #
542 # We have the header, so we use "getifaddrs()" to
543 # get the list of interfaces.
544 #
545 V_FINDALLDEVS=getad
546 ],[
547 #
548 # We don't have the header - give up.
549 # XXX - we could also fall back on some other
550 # mechanism, but, for now, this'll catch this
551 # problem so that we can at least try to figure
552 # out something to do on systems with "getifaddrs()"
553 # but without "ifaddrs.h", if there is something
554 # we can do on those systems.
555 #
556 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
557 ])
558 ],[
559 #
560 # Well, we don't have "getifaddrs()", so we have to use
561 # some other mechanism; determine what that mechanism is.
562 #
563 # The first thing we use is the type of capture mechanism,
564 # which is somewhat of a proxy for the OS we're using.
565 #
566 case "$V_PCAP" in
567
568 dlpi|libdlpi)
569 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
570 #
571 # This might be Solaris 8 or later, with
572 # SIOCGLIFCONF, or it might be some other OS
573 # or some older version of Solaris, with
574 # just SIOCGIFCONF.
575 #
576 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
577 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
578 AC_TRY_COMPILE(
579 [#include <sys/param.h>
580 #include <sys/file.h>
581 #include <sys/ioctl.h>
582 #include <sys/socket.h>
583 #include <sys/sockio.h>],
584 [ioctl(0, SIOCGLIFCONF, (char *)0);],
585 ac_cv_lbl_have_siocglifconf=yes,
586 ac_cv_lbl_have_siocglifconf=no))
587 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
588 if test $ac_cv_lbl_have_siocglifconf = yes ; then
589 V_FINDALLDEVS=glifc
590 else
591 V_FINDALLDEVS=gifc
592 fi
593 #
594 # Needed for common functions used by pcap-[dlpi,libdlpi].c
595 #
596 SSRC="dlpisubs.c"
597 ;;
598
599 *)
600 #
601 # Assume we just have SIOCGIFCONF.
602 # (XXX - on at least later Linux kernels, there's
603 # another mechanism, and we should be using that
604 # instead.)
605 #
606 V_FINDALLDEVS=gifc
607 ;;
608 esac])
609 fi
610 ])
611
612 AC_MSG_CHECKING(for socklen_t)
613 AC_TRY_COMPILE([
614 #include <sys/types.h>
615 #include <sys/socket.h>
616 ],
617 [ socklen_t x; ],
618 have_socklen_t=yes,
619 have_socklen_t=no)
620 if test "x$have_socklen_t" = "xyes"; then
621 AC_DEFINE(HAVE_SOCKLEN_T, 1, [define if socklen_t is defined])
622 fi
623 AC_MSG_RESULT($have_socklen_t)
624
625 AC_ARG_ENABLE(ipv6,
626 AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes, if getaddrinfo available@:>@]),
627 [],
628 [enable_ipv6=ifavailable])
629 if test "$enable_ipv6" != "no"; then
630 AC_CHECK_FUNC(getaddrinfo,
631 [
632 AC_DEFINE(INET6,1,[IPv6])
633 ],
634 [
635 if test "$enable_ipv6" != "ifavailable"; then
636 AC_MSG_FAILURE([--enable-ipv6 was given, but getaddrinfo isn't available])
637 fi
638 ])
639 fi
640
641 AC_MSG_CHECKING(whether to build optimizer debugging code)
642 AC_ARG_ENABLE(optimizer-dbg,
643 AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
644 if test "$enable_optimizer_dbg" = "yes"; then
645 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
646 fi
647 AC_MSG_RESULT(${enable_optimizer_dbg-no})
648
649 AC_MSG_CHECKING(whether to build parser debugging code)
650 AC_ARG_ENABLE(yydebug,
651 AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
652 if test "$enable_yydebug" = "yes"; then
653 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
654 fi
655 AC_MSG_RESULT(${enable_yydebug-no})
656
657 # Check for Endace DAG card support.
658 AC_ARG_WITH([dag],
659 AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support @<:@"yes", "no" or DIR; default="yes" on BSD and Linux if present@:>@]),
660 [
661 if test "$withval" = no
662 then
663 # User doesn't want DAG support.
664 want_dag=no
665 elif test "$withval" = yes
666 then
667 # User wants DAG support but hasn't specified a directory.
668 want_dag=yes
669 else
670 # User wants DAG support and has specified a directory, so use the provided value.
671 want_dag=yes
672 dag_root=$withval
673 fi
674 ],[
675 #
676 # Use DAG API if present, otherwise don't
677 #
678 want_dag=ifpresent
679 ])
680
681 AC_ARG_WITH([dag-includes],
682 AC_HELP_STRING([--with-dag-includes=DIR],[Endace DAG include directory]),
683 [
684 # User wants DAG support and has specified a header directory, so use the provided value.
685 want_dag=yes
686 dag_include_dir=$withval
687 ],[])
688
689 AC_ARG_WITH([dag-libraries],
690 AC_HELP_STRING([--with-dag-libraries=DIR],[Endace DAG library directory]),
691 [
692 # User wants DAG support and has specified a library directory, so use the provided value.
693 want_dag=yes
694 dag_lib_dir=$withval
695 ],[])
696
697 case "$V_PCAP" in
698 linux|bpf|dag)
699 #
700 # We support the DAG API if we're on Linux or BSD, or if we're
701 # building a DAG-only libpcap.
702 #
703 ;;
704 *)
705 #
706 # If the user explicitly requested DAG, tell them it's not
707 # supported.
708 #
709 # If they expressed no preference, don't include it.
710 #
711 if test $want_dag = yes; then
712 AC_MSG_ERROR([DAG support is only available with 'linux' 'bpf' and 'dag' packet capture types])
713 elif test $want_dag = yes; then
714 want_dag=no
715 fi
716 ;;
717 esac
718
719 ac_cv_lbl_dag_api=no
720 if test "$want_dag" != no; then
721
722 AC_MSG_CHECKING([whether we have DAG API headers])
723
724 # If necessary, set default paths for DAG API headers and libraries.
725 if test -z "$dag_root"; then
726 dag_root=/usr/local
727 fi
728
729 if test -z "$dag_include_dir"; then
730 dag_include_dir="$dag_root/include"
731 fi
732
733 if test -z "$dag_lib_dir"; then
734 dag_lib_dir="$dag_root/lib"
735 fi
736
737 if test -z "$dag_tools_dir"; then
738 dag_tools_dir="$dag_root/tools"
739 fi
740
741 if test -r $dag_include_dir/dagapi.h; then
742 ac_cv_lbl_dag_api=yes
743 fi
744 AC_MSG_RESULT([$ac_cv_lbl_dag_api ($dag_include_dir)])
745 fi
746
747 if test $ac_cv_lbl_dag_api = yes; then
748 V_INCLS="$V_INCLS -I$dag_include_dir"
749
750 if test $V_PCAP != dag ; then
751 SSRC="pcap-dag.c"
752 fi
753
754 # See if we can find a general version string.
755 # Don't need to save and restore LIBS to prevent -ldag being
756 # included if there's a found-action (arg 3).
757 saved_ldflags=$LDFLAGS
758 LDFLAGS="-L$dag_lib_dir"
759 AC_CHECK_LIB([dag], [dag_attach_stream], [dag_streams="1"], [dag_streams="0"])
760 AC_CHECK_LIB([dag],[dag_get_erf_types], [
761 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
762 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
763 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
764
765 LDFLAGS=$saved_ldflags
766
767 if test "$dag_streams" = 1; then
768 AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API])
769 LIBS="$LIBS -ldag"
770 LDFLAGS="$LDFLAGS -L$dag_lib_dir"
771
772 AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
773 if test "$ac_dag_have_vdag" = 1; then
774 AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
775 LIBS="$LIBS -lpthread"
776 fi
777 fi
778
779 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
780 fi
781
782 AC_MSG_CHECKING(whether we have the DAG API)
783
784 if test $ac_cv_lbl_dag_api = no; then
785 AC_MSG_RESULT(no)
786 if test "$want_dag" = yes; then
787 # User wanted DAG support but we couldn't find it.
788 AC_MSG_ERROR([DAG API requested, but not found at $dag_root: use --without-dag])
789 fi
790
791 if test "$V_PCAP" = dag; then
792 # User requested "dag" capture type but the DAG API wasn't
793 # found.
794 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.)])
795 fi
796 else
797 AC_MSG_RESULT(yes)
798 fi
799
800 AC_ARG_WITH(septel,
801 AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, on Linux, if present@:>@]),
802 [
803 if test "$withval" = no
804 then
805 want_septel=no
806 elif test "$withval" = yes
807 then
808 want_septel=yes
809 septel_root=
810 else
811 want_septel=yes
812 septel_root=$withval
813 fi
814 ],[
815 #
816 # Use Septel API if present, otherwise don't
817 #
818 want_septel=ifpresent
819 septel_root=./../septel
820 ])
821 ac_cv_lbl_septel_api=no
822 case "$V_PCAP" in
823 linux|septel)
824 #
825 # We support the Septel API if we're on Linux, or if we're building
826 # a Septel-only libpcap.
827 #
828 ;;
829 *)
830 #
831 # If the user explicitly requested Septel, tell them it's not
832 # supported.
833 #
834 # If they expressed no preference, don't include it.
835 #
836 if test $want_septel = yes; then
837 AC_MSG_ERROR(Septel support only available with 'linux' and 'septel' packet capture types)
838 elif test $want_septel = yes; then
839 want_septel=no
840 fi
841 ;;
842 esac
843
844 if test "$with_septel" != no; then
845 AC_MSG_CHECKING(whether we have Septel API)
846
847 if test -z "$septel_root"; then
848 septel_root=$srcdir/../septel
849 fi
850
851 septel_tools_dir="$septel_root"
852 septel_include_dir="$septel_root/INC"
853
854 ac_cv_lbl_septel_api=no
855 if test -r "$septel_include_dir/msg.h"; then
856 V_INCLS="$V_INCLS -I$septel_include_dir"
857 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"
858 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"
859
860 if test "$V_PCAP" != septel ; then
861 SSRC="pcap-septel.c"
862 fi
863 ac_cv_lbl_septel_api=yes
864 fi
865
866 AC_MSG_RESULT($ac_cv_lbl_septel_api)
867 if test $ac_cv_lbl_septel_api = no; then
868 if test "$want_septel" = yes; then
869 AC_MSG_ERROR(Septel API not found under directory $septel_root; use --without-septel)
870 fi
871 else
872 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have a Septel API])
873 fi
874 fi
875
876 if test "$V_PCAP" = septel -a "$ac_cv_lbl_septel_api" = no; then
877 AC_MSG_ERROR(Specifying the capture type as 'septel' requires the Septel API to be present; use --with-septel=DIR)
878 fi
879
880 # Check for Myricom SNF support.
881 AC_ARG_WITH([snf],
882 AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support @<:@"yes", "no" or DIR; default="yes" on BSD and Linux if present@:>@]),
883 [
884 if test "$withval" = no
885 then
886 # User explicitly doesn't want SNF
887 want_snf=no
888 elif test "$withval" = yes
889 then
890 # User wants SNF support but hasn't specific a directory.
891 want_snf=yes
892 else
893 # User wants SNF support with a specified directory.
894 want_snf=yes
895 snf_root=$withval
896 fi
897 ],[
898 #
899 # Use Sniffer API if present, otherwise don't
900 #
901 want_snf=ifpresent
902 ])
903
904 AC_ARG_WITH([snf-includes],
905 AC_HELP_STRING([--with-snf-includes=DIR],[Myricom SNF include directory]),
906 [
907 # User wants SNF with specific header directory
908 want_snf=yes
909 snf_include_dir=$withval
910 ],[])
911
912 AC_ARG_WITH([snf-libraries],
913 AC_HELP_STRING([--with-snf-libraries=DIR],[Myricom SNF library directory]),
914 [
915 # User wants SNF with specific lib directory
916 want_snf=yes
917 snf_lib_dir=$withval
918 ],[])
919
920 case "$V_PCAP" in
921 bpf|linux|snf)
922 #
923 # We support the Sniffer API if we're on BSD, Linux, or if we're
924 # building a Sniffer-only libpcap.
925 #
926 ;;
927 *)
928 #
929 # If the user explicitly requested Sniffer, tell them it's not
930 # supported.
931 #
932 # If they expressed no preference, don't include it.
933 #
934 if test $want_snf = yes; then
935 AC_MSG_ERROR(Myricom SNF support only available with 'bpf' 'linux' and 'snf' packet capture types)
936 elif test $want_snf = yes; then
937 want_snf=no
938 fi
939 ;;
940 esac
941
942 ac_cv_lbl_snf_api=no
943 if test "$with_snf" != no; then
944
945 AC_MSG_CHECKING(whether we have Myricom Sniffer API)
946
947 if test -z "$snf_root"; then
948 snf_root=/opt/snf
949 fi
950
951 if test -z "$snf_include_dir"; then
952 snf_include_dir="$snf_root/include"
953 fi
954
955 if test -z "$snf_lib_dir"; then
956 snf_lib_dir="$snf_root/lib"
957 fi
958
959 if test -f "$snf_include_dir/snf.h"; then
960 ac_cv_lbl_snf_api=yes
961 fi
962 AC_MSG_RESULT([$ac_cv_lbl_snf_api ($snf_root)])
963
964 if test $ac_cv_lbl_snf_api = no; then
965 if test "$want_snf" = yes; then
966 AC_MSG_ERROR(SNF API headers not found under $snf_include_dir; use --without-snf)
967 fi
968 else
969 saved_ldflags=$LDFLAGS
970 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
971 AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"], [ac_cv_lbl_snf_api="no"])
972 LDFLAGS="$saved_ldflags"
973
974 if test $ac_cv_lbl_snf_api = no; then
975 if test "$want_snf" = yes; then
976 AC_MSG_ERROR(SNF API cannot correctly be linked check config.log; use --without-snf)
977 fi
978 else
979 V_INCLS="$V_INCLS -I$snf_include_dir"
980 LIBS="$LIBS -lsnf"
981 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
982 if test "$V_PCAP" != snf ; then
983 SSRC="pcap-snf.c"
984 fi
985 AC_DEFINE(HAVE_SNF_API, 1, [define if you have Myricom SNF API])
986 fi
987 fi
988 fi
989
990 if test "$V_PCAP" = snf -a "$ac_cv_lbl_snf_api" = no; then
991 AC_MSG_ERROR(Specifying the capture type as 'snf' requires the Myricom Sniffer API to be present; use --with-snf=DIR)
992 fi
993
994 AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
995 if test "$V_LEX" = lex ; then
996 # Some versions of lex can't handle the definitions section of scanner.l .
997 # Try lexing it and complain if it can't deal.
998 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
999 if lex -t scanner.l > /dev/null 2>&1; then
1000 tcpdump_cv_capable_lex=yes
1001 else
1002 tcpdump_cv_capable_lex=insufficient
1003 fi)
1004 if test $tcpdump_cv_capable_lex = insufficient ; then
1005 AC_MSG_ERROR([Your operating system's lex is insufficient to compile
1006 libpcap. flex is a lex replacement that has many advantages, including
1007 being able to compile libpcap. For more information, see
1008 http://www.gnu.org/software/flex/flex.html .])
1009 fi
1010 fi
1011
1012 #
1013 # Assume, by default, no support for shared libraries and V7/BSD convention
1014 # for man pages (file formats in section 5, miscellaneous info in section 7).
1015 # Individual cases can override this.
1016 #
1017 DYEXT="none"
1018 MAN_FILE_FORMATS=5
1019 MAN_MISC_INFO=7
1020 case "$host_os" in
1021
1022 aix*)
1023 dnl Workaround to enable certain features
1024 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
1025
1026 #
1027 # AIX makes it fun to build shared and static libraries,
1028 # because they're *both* ".a" archive libraries. We
1029 # build the static library for the benefit of the traditional
1030 # scheme of building libpcap and tcpdump in subdirectories of
1031 # the same directory, with tcpdump statically linked with the
1032 # libpcap in question, but we also build a shared library as
1033 # "libpcap.shareda" and install *it*, rather than the static
1034 # library, as "libpcap.a".
1035 #
1036 DYEXT="shareda"
1037
1038 case "$V_PCAP" in
1039
1040 dlpi)
1041 #
1042 # If we're using DLPI, applications will need to
1043 # use /lib/pse.exp if present, as we use the
1044 # STREAMS routines.
1045 #
1046 pseexe="/lib/pse.exp"
1047 AC_MSG_CHECKING(for $pseexe)
1048 if test -f $pseexe ; then
1049 AC_MSG_RESULT(yes)
1050 LIBS="-I:$pseexe"
1051 fi
1052 ;;
1053
1054 bpf)
1055 #
1056 # If we're using BPF, we need "-lodm" and "-lcfg", as
1057 # we use them to load the BPF module.
1058 #
1059 LIBS="-lodm -lcfg"
1060 ;;
1061 esac
1062 ;;
1063
1064 darwin*)
1065 DYEXT="dylib"
1066 V_CCOPT="$V_CCOPT -fno-common"
1067 AC_ARG_ENABLE(universal,
1068 AC_HELP_STRING([--disable-universal],[don't build universal on OS X]))
1069 if test "$enable_universal" != "no"; then
1070 case "$host_os" in
1071
1072 darwin9.*)
1073 #
1074 # Leopard. Build for 32-bit PowerPC, 64-bit
1075 # PowerPC, x86, and x86-64, with 32-bit PowerPC
1076 # first. (That's what Apple does.)
1077 #
1078 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1079 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1080 ;;
1081
1082 darwin10.*)
1083 #
1084 # Snow Leopard. Build for x86-64, x86, and
1085 # 32-bit PowerPC, with x86-64 first. (That's
1086 # what Apple does, even though Snow Leopard
1087 # doesn't run on PPC, so PPC libpcap runs under
1088 # Rosetta, and Rosetta doesn't support BPF
1089 # ioctls, so PPC programs can't do live
1090 # captures.)
1091 #
1092 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386 -arch ppc"
1093 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386 -arch ppc"
1094 ;;
1095 esac
1096 fi
1097 ;;
1098
1099 hpux9*)
1100 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
1101
1102 #
1103 # Use System V conventions for man pages.
1104 #
1105 MAN_FILE_FORMATS=4
1106 MAN_MISC_INFO=5
1107 ;;
1108
1109 hpux10.0*)
1110
1111 #
1112 # Use System V conventions for man pages.
1113 #
1114 MAN_FILE_FORMATS=4
1115 MAN_MISC_INFO=5
1116 ;;
1117
1118 hpux10.1*)
1119
1120 #
1121 # Use System V conventions for man pages.
1122 #
1123 MAN_FILE_FORMATS=4
1124 MAN_MISC_INFO=5
1125 ;;
1126
1127 hpux*)
1128 dnl HPUX 10.20 and above is similar to HPUX 9, but
1129 dnl not the same....
1130 dnl
1131 dnl XXX - DYEXT should be set to "sl" if this is building
1132 dnl for 32-bit PA-RISC, but should be left as "so" for
1133 dnl 64-bit PA-RISC or, I suspect, IA-64.
1134 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
1135 if test "`uname -m`" = "ia64"; then
1136 DYEXT="so"
1137 else
1138 DYEXT="sl"
1139 fi
1140
1141 #
1142 # "-b" builds a shared library; "+h" sets the soname.
1143 #
1144 SHLIB_OPT="-b"
1145 SONAME_OPT="+h"
1146
1147 #
1148 # Use System V conventions for man pages.
1149 #
1150 MAN_FILE_FORMATS=4
1151 MAN_MISC_INFO=5
1152 ;;
1153
1154 irix*)
1155 #
1156 # Use System V conventions for man pages.
1157 #
1158 MAN_FILE_FORMATS=4
1159 MAN_MISC_INFO=5
1160 ;;
1161
1162 linux*|freebsd*|netbsd*|openbsd*|dragonfly*)
1163 DYEXT="so"
1164
1165 #
1166 # Compiler assumed to be GCC; run-time linker may require a -R
1167 # flag.
1168 #
1169 if test "$libdir" != "/usr/lib"; then
1170 V_RFLAGS=-Wl,-R$libdir
1171 fi
1172 ;;
1173
1174 osf*)
1175 DYEXT="so"
1176
1177 #
1178 # Use System V conventions for man pages.
1179 #
1180 MAN_FILE_FORMATS=4
1181 MAN_MISC_INFO=5
1182 ;;
1183
1184 sinix*)
1185 AC_MSG_CHECKING(if SINIX compiler defines sinix)
1186 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
1187 AC_TRY_COMPILE(
1188 [],
1189 [int i = sinix;],
1190 ac_cv_cc_sinix_defined=yes,
1191 ac_cv_cc_sinix_defined=no))
1192 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
1193 if test $ac_cv_cc_sinix_defined = no ; then
1194 AC_DEFINE(sinix,1,[on sinix])
1195 fi
1196 ;;
1197
1198 solaris*)
1199 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
1200
1201 DYEXT="so"
1202 #
1203 # Use System V conventions for man pages.
1204 #
1205 MAN_FILE_FORMATS=4
1206 MAN_MISC_INFO=5
1207 ;;
1208 esac
1209
1210 AC_PROG_RANLIB
1211 AC_CHECK_TOOL([AR], [ar])
1212
1213 AC_LBL_DEVEL(V_CCOPT)
1214
1215 AC_LBL_SOCKADDR_SA_LEN
1216
1217 AC_LBL_SOCKADDR_STORAGE
1218
1219 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
1220
1221 AC_LBL_UNALIGNED_ACCESS
1222
1223 #
1224 # Makefile.in includes rules to generate version.h, so we assume
1225 # that it will be generated if autoconf is used.
1226 #
1227 AC_DEFINE(HAVE_VERSION_H, 1, [define if version.h is generated in the build procedure])
1228
1229 rm -f net
1230 ln -s ${srcdir}/bpf/net net
1231
1232 AC_SUBST(V_CCOPT)
1233 AC_SUBST(V_DEFS)
1234 AC_SUBST(V_FINDALLDEVS)
1235 AC_SUBST(V_INCLS)
1236 AC_SUBST(V_LEX)
1237 AC_SUBST(V_PCAP)
1238 AC_SUBST(V_SHLIB_CMD)
1239 AC_SUBST(V_SHLIB_OPT)
1240 AC_SUBST(V_SONAME_OPT)
1241 AC_SUBST(V_RPATH_OPT)
1242 AC_SUBST(V_YACC)
1243 AC_SUBST(ADDLOBJS)
1244 AC_SUBST(ADDLARCHIVEOBJS)
1245 AC_SUBST(SSRC)
1246 AC_SUBST(DYEXT)
1247 AC_SUBST(MAN_FILE_FORMATS)
1248 AC_SUBST(MAN_MISC_INFO)
1249
1250 dnl check for USB sniffing support
1251 AC_MSG_CHECKING(for USB sniffing support)
1252 case "$host_os" in
1253 linux*)
1254 AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
1255 USB_SRC=pcap-usb-linux.c
1256 AC_MSG_RESULT(yes)
1257 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
1258 if test $? -ne 0 ; then
1259 ac_usb_dev_name="usbmon"
1260 fi
1261 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
1262 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
1263 #
1264 # Do we have a version of <linux/compiler.h> available?
1265 # If so, we might need it for <linux/usbdevice_fs.h>.
1266 #
1267 AC_CHECK_HEADERS(linux/compiler.h)
1268 if test "$ac_cv_header_linux_compiler_h" = yes; then
1269 #
1270 # Yes - include it when testing for <linux/usbdevice_fs.h>.
1271 #
1272 AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
1273 else
1274 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
1275 fi
1276 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
1277 #
1278 # OK, does it define bRequestType? Older versions of the kernel
1279 # define fields with names like "requesttype, "request", and
1280 # "value", rather than "bRequestType", "bRequest", and
1281 # "wValue".
1282 #
1283 AC_MSG_CHECKING(if usbdevfs_ctrltransfer struct has bRequestType member)
1284 AC_CACHE_VAL(ac_cv_usbdevfs_ctrltransfer_has_bRequestType,
1285 AC_TRY_COMPILE([
1286 AC_INCLUDES_DEFAULT
1287 #ifdef HAVE_SYS_BITYPES_H
1288 #include <sys/bitypes.h>
1289 #endif
1290 #ifdef HAVE_LINUX_COMPILER_H
1291 #include <linux/compiler.h>
1292 #endif
1293 # include <linux/usbdevice_fs.h>],
1294 [u_int i = sizeof(((struct usbdevfs_ctrltransfer *)0)->bRequestType)],
1295 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=yes,
1296 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=no))
1297 AC_MSG_RESULT($ac_cv_usbdevfs_ctrltransfer_has_bRequestType)
1298 if test $ac_cv_usbdevfs_ctrltransfer_has_bRequestType = yes ; then
1299 AC_DEFINE(HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE,1,
1300 [if struct usbdevfs_ctrltransfer has bRequestType])
1301 fi
1302 fi
1303 ;;
1304 *)
1305 AC_MSG_RESULT(no)
1306 ;;
1307 esac
1308 AC_SUBST(PCAP_SUPPORT_USB)
1309 AC_SUBST(USB_SRC)
1310
1311 AC_ARG_ENABLE([bluetooth],
1312 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
1313 ,enable_bluetooth=yes)
1314
1315 if test "x$enable_bluetooth" != "xno" ; then
1316 dnl check for Bluetooth sniffing support
1317 case "$host_os" in
1318 linux*)
1319 AC_CHECK_HEADER(bluetooth/bluetooth.h,
1320 [
1321 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
1322 BT_SRC=pcap-bt-linux.c
1323 AC_MSG_NOTICE(Bluetooth sniffing is supported)
1324 ],
1325 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
1326 )
1327 ;;
1328 *)
1329 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
1330 ;;
1331 esac
1332 AC_SUBST(PCAP_SUPPORT_BT)
1333 AC_SUBST(BT_SRC)
1334 fi
1335
1336 AC_ARG_ENABLE([can],
1337 [AC_HELP_STRING([--enable-can],[enable CAN support @<:@default=yes, if support available@:>@])],
1338 ,enable_can=yes)
1339
1340 if test "x$enable_can" != "xno" ; then
1341 dnl check for CAN sniffing support
1342 case "$host_os" in
1343 linux*)
1344 AC_CHECK_HEADER(linux/can.h,
1345 [ AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing])
1346 CAN_SRC=pcap-can-linux.c
1347 AC_MSG_NOTICE(CAN sniffing is supported)],
1348 AC_MSG_NOTICE(CAN sniffing is not supported),
1349 [#include <sys/socket.h>]
1350 )
1351 ;;
1352 *)
1353 AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os)
1354 ;;
1355 esac
1356 AC_SUBST(PCAP_SUPPORT_CAN)
1357 AC_SUBST(CAN_SRC)
1358 fi
1359
1360 dnl check for hardware timestamp support
1361 case "$host_os" in
1362 linux*)
1363 AC_CHECK_HEADERS([linux/net_tstamp.h])
1364 ;;
1365 *)
1366 AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os)
1367 ;;
1368 esac
1369
1370 AC_PROG_INSTALL
1371
1372 AC_CONFIG_HEADER(config.h)
1373
1374 AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
1375 pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap
1376 pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap
1377 pcap_list_datalinks.3pcap pcap_list_tstamp_types.3pcap
1378 pcap_open_dead.3pcap pcap_open_offline.3pcap
1379 pcap_set_tstamp_type.3pcap)
1380
1381 if test -f .devel ; then
1382 make depend
1383 fi
1384 exit 0