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