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