]> The Tcpdump Group git mirrors - libpcap/blob - configure.in
Another change from Debian.
[libpcap] / configure.in
1 dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.138.2.30 2008-12-23 20:51:13 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 AC_REVISION($Revision: 1.138.2.30 $)
10 AC_PREREQ(2.50)
11 AC_INIT(pcap.c)
12
13 AC_CANONICAL_SYSTEM
14
15 AC_LBL_C_INIT(V_CCOPT, V_INCLS, V_LIBS)
16 AC_LBL_C_INLINE
17 AC_C___ATTRIBUTE__
18
19 AC_LBL_CHECK_TYPE(u_int8_t, u_char)
20 AC_LBL_CHECK_TYPE(u_int16_t, u_short)
21 AC_LBL_CHECK_TYPE(u_int32_t, u_int)
22 AC_LBL_CHECK_TYPE(u_int64_t, unsigned long long)
23
24 #
25 # Try to arrange for large file support.
26 #
27 AC_SYS_LARGEFILE
28 AC_FUNC_FSEEKO
29
30 dnl
31 dnl libpcap doesn't itself use <sys/ioccom.h>; however, the test program
32 dnl in "AC_LBL_FIXINCLUDES" in "aclocal.m4" uses it, so we have to
33 dnl test for it and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
34 dnl "AC_LBL_FIXINCLUDES" won't work on some platforms such as Solaris.
35 dnl
36 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h paths.h)
37 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
38 #include <sys/socket.h>
39 #include <net/if.h>])
40 if test "$ac_cv_header_net_pfvar_h" = yes; then
41 #
42 # Check for various PF actions.
43 #
44 AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR)
45 AC_TRY_COMPILE(
46 [#include <sys/types.h>
47 #include <sys/socket.h>
48 #include <net/if.h>
49 #include <net/pfvar.h>],
50 [return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;],
51 [
52 AC_MSG_RESULT(yes)
53 AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1,
54 [define if net/pfvar.h defines PF_NAT through PF_NORDR])
55 ],
56 AC_MSG_RESULT(no))
57 fi
58 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
59 #include <sys/socket.h>])
60 if test "$ac_cv_header_netinet_if_ether_h" != yes; then
61 #
62 # The simple test didn't work.
63 # Do we need to include <net/if.h> first?
64 # Unset ac_cv_header_netinet_if_ether_h so we don't
65 # treat the previous failure as a cached value and
66 # suppress the next test.
67 #
68 AC_MSG_NOTICE([Rechecking with some additional includes])
69 unset ac_cv_header_netinet_if_ether_h
70 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
71 #include <sys/socket.h>
72 #include <netinet/in.h>
73 struct mbuf;
74 struct rtentry;
75 #include <net/if.h>])
76 fi
77
78 AC_LBL_FIXINCLUDES
79
80 AC_CHECK_FUNCS(strerror strlcpy)
81
82 needsnprintf=no
83 AC_CHECK_FUNCS(vsnprintf snprintf,,
84 [needsnprintf=yes])
85 if test $needsnprintf = yes; then
86 AC_LIBOBJ(snprintf)
87 fi
88
89 #
90 # Do this before checking for ether_hostton(), as it's a
91 # "gethostbyname() -ish function".
92 #
93 AC_LBL_LIBRARY_NET
94
95 #
96 # You are in a twisty little maze of UN*Xes, all different.
97 # Some might not have ether_hostton().
98 # Some might have it, but not declare it in any header file.
99 # Some might have it, but declare it in <netinet/if_ether.h>.
100 # Some might have it, but declare it in <netinet/ether.h>
101 # (And some might have it but document it as something declared in
102 # <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
103 #
104 # Before you is a C compiler.
105 #
106 AC_CHECK_FUNCS(ether_hostton)
107 if test "$ac_cv_func_ether_hostton" = yes; then
108 #
109 # OK, we have ether_hostton(). Do we have <netinet/if_ether.h>?
110 #
111 if test "$ac_cv_header_netinet_if_ether_h" = yes; then
112 #
113 # Yes. Does it declare ether_hostton()?
114 #
115 AC_CHECK_DECL(ether_hostton,
116 [
117 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
118 [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
119 ],,
120 [
121 #include <sys/types.h>
122 #include <sys/socket.h>
123 #include <netinet/in.h>
124 #include <arpa/inet.h>
125 struct mbuf;
126 struct rtentry;
127 #include <net/if.h>
128 #include <netinet/if_ether.h>
129 ])
130 fi
131 #
132 # Did that succeed?
133 #
134 if test "$ac_cv_have_decl_ether_hostton" != yes; then
135 #
136 # No, how about <netinet/ether.h>, as on Linux?
137 #
138 AC_CHECK_HEADERS(netinet/ether.h)
139 if test "$ac_cv_header_netinet_ether_h" = yes; then
140 #
141 # We have it - does it declare ether_hostton()?
142 # Unset ac_cv_have_decl_ether_hostton so we don't
143 # treat the previous failure as a cached value and
144 # suppress the next test.
145 #
146 unset ac_cv_have_decl_ether_hostton
147 AC_CHECK_DECL(ether_hostton,
148 [
149 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
150 [Define to 1 if netinet/ether.h declares `ether_hostton'])
151 ],,
152 [
153 #include <netinet/ether.h>
154 ])
155 fi
156 fi
157 #
158 # Is ether_hostton() declared?
159 #
160 if test "$ac_cv_have_decl_ether_hostton" != yes; then
161 #
162 # No, we'll have to declare it ourselves.
163 # Do we have "struct ether_addr"?
164 #
165 AC_CHECK_TYPES(struct ether_addr,,,
166 [
167 #include <sys/types.h>
168 #include <sys/socket.h>
169 #include <netinet/in.h>
170 #include <arpa/inet.h>
171 struct mbuf;
172 struct rtentry;
173 #include <net/if.h>
174 #include <netinet/if_ether.h>
175 ])
176 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 0,
177 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
178 don't.])
179 else
180 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
181 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
182 don't.])
183 fi
184 fi
185
186 dnl to pacify those who hate protochain insn
187 AC_MSG_CHECKING(if --disable-protochain option is specified)
188 AC_ARG_ENABLE(protochain,
189 AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
190 case "x$enable_protochain" in
191 xyes) enable_protochain=enabled ;;
192 xno) enable_protochain=disabled ;;
193 x) enable_protochain=enabled ;;
194 esac
195
196 if test "$enable_protochain" = "disabled"; then
197 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
198 fi
199 AC_MSG_RESULT(${enable_protochain})
200
201 #
202 # SITA support is mutually exclusive with native capture support;
203 # "--with-sita" selects SITA support.
204 #
205 AC_ARG_WITH(sita,
206 AC_HELP_STRING([--with-sita],[include SITA support]),
207 [
208 if test ! "x$withval" = "xno" ; then
209 AC_DEFINE(SITA,1,[include ACN support])
210 AC_MSG_NOTICE(Enabling SITA ACN support)
211 V_PCAP=sita
212 V_FINDALLDEVS=sita
213 fi
214 ],
215 [
216 dnl
217 dnl Not all versions of test support -c (character special) but it's a
218 dnl better way of testing since the device might be protected. So we
219 dnl check in our normal order using -r and then check the for the /dev
220 dnl guys again using -c.
221 dnl
222 dnl XXX This could be done for cross-compiling, but for now it's not.
223 dnl
224 if test -z "$with_pcap" && test "$cross_compiling" = yes; then
225 AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)
226 fi
227 AC_ARG_WITH(pcap,
228 AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
229 AC_MSG_CHECKING(packet capture type)
230 if test ! -z "$with_pcap" ; then
231 V_PCAP="$withval"
232 elif test -r /dev/bpf ; then
233 #
234 # Cloning BPF device.
235 #
236 V_PCAP=bpf
237 AC_DEFINE(HAVE_CLONING_BPF,1,[define if you have a cloning BPF device])
238 elif test -r /dev/bpf0 ; then
239 V_PCAP=bpf
240 elif test -r /usr/include/net/pfilt.h ; then
241 V_PCAP=pf
242 elif test -r /dev/enet ; then
243 V_PCAP=enet
244 elif test -r /dev/nit ; then
245 V_PCAP=snit
246 elif test -r /usr/include/sys/net/nit.h ; then
247 V_PCAP=nit
248 elif test -r /usr/include/linux/socket.h ; then
249 V_PCAP=linux
250 elif test -r /usr/include/net/raw.h ; then
251 V_PCAP=snoop
252 elif test -r /usr/include/odmi.h ; then
253 #
254 # On AIX, the BPF devices might not yet be present - they're
255 # created the first time libpcap runs after booting.
256 # We check for odmi.h instead.
257 #
258 V_PCAP=bpf
259 elif test -r /usr/include/sys/dlpi.h ; then
260 V_PCAP=dlpi
261 elif test -c /dev/bpf0 ; then # check again in case not readable
262 V_PCAP=bpf
263 elif test -c /dev/enet ; then # check again in case not readable
264 V_PCAP=enet
265 elif test -c /dev/nit ; then # check again in case not readable
266 V_PCAP=snit
267 else
268 V_PCAP=null
269 fi
270 AC_MSG_RESULT($V_PCAP)
271
272 #
273 # Do capture-mechanism-dependent tests.
274 #
275 case "$V_PCAP" in
276 dlpi)
277 #
278 # Checks to see if Solaris has the public libdlpi(3LIB) library.
279 # Note: The existence of /usr/include/libdlpi.h does not mean it is the
280 # public libdlpi(3LIB) version. Before libdlpi was made public, a
281 # private version also existed, which did not have the same APIs.
282 # Due to a gcc bug, the default search path for 32-bit libraries does
283 # not include /lib, we add it explicitly here.
284 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
285 # Also, due to the bug above applications that link to libpcap with
286 # libdlpi will have to add "-L/lib" option to "configure".
287 #
288 saved_ldflags=$LDFLAGS
289 LDFLAGS="$LIBS -L/lib"
290 AC_CHECK_LIB(dlpi, dlpi_walk,
291 LIBS="-ldlpi $LIBS"
292 V_PCAP=libdlpi
293 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists]),
294 V_PCAP=dlpi)
295 LDFLAGS=$saved_ldflags
296
297 #
298 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO
299 # versions of DLPI.
300 #
301 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
302 AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
303 AC_TRY_COMPILE(
304 [
305 #include <sys/types.h>
306 #include <sys/time.h>
307 #include <sys/dlpi.h>
308 ],
309 [int i = DL_PROMISC_PHYS;],
310 ac_cv_sys_dlpi_usable=yes,
311 ac_cv_sys_dlpi_usable=no))
312 AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
313 if test $ac_cv_sys_dlpi_usable = no ; then
314 AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
315 fi
316
317 #
318 # Check whether we have a /dev/dlpi device or have multiple devices.
319 #
320 AC_MSG_CHECKING(for /dev/dlpi device)
321 if test -c /dev/dlpi ; then
322 AC_MSG_RESULT(yes)
323 AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi])
324 else
325 AC_MSG_RESULT(no)
326 dir="/dev/dlpi"
327 AC_MSG_CHECKING(for $dir directory)
328 if test -d $dir ; then
329 AC_MSG_RESULT(yes)
330 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory])
331 else
332 AC_MSG_RESULT(no)
333 fi
334 fi
335
336 #
337 # This check is for Solaris with DLPI support for passive modes.
338 # See dlpi(7P) for more details.
339 #
340 AC_LBL_DL_PASSIVE_REQ_T
341 ;;
342
343 linux)
344 AC_MSG_CHECKING(Linux kernel version)
345 if test "$cross_compiling" = yes; then
346 AC_CACHE_VAL(ac_cv_linux_vers,
347 ac_cv_linux_vers=unknown)
348 else
349 AC_CACHE_VAL(ac_cv_linux_vers,
350 ac_cv_linux_vers=`uname -r 2>&1 | \
351 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
352 fi
353 AC_MSG_RESULT($ac_cv_linux_vers)
354 if test $ac_cv_linux_vers = unknown ; then
355 AC_MSG_ERROR(cannot determine linux version when cross-compiling)
356 fi
357 if test $ac_cv_linux_vers -lt 2 ; then
358 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
359 fi
360 AC_CHECK_HEADERS(linux/wireless.h, [], [],
361 [
362 #include <sys/socket.h>
363 #include <linux/if.h>
364 #include <linux/types.h>
365 ])
366 AC_LBL_TPACKET_STATS
367 AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI
368 ;;
369
370 bpf)
371 #
372 # Check whether we have the *BSD-style ioctls.
373 #
374 AC_CHECK_HEADERS(net/if_media.h)
375
376 AC_MSG_CHECKING(whether the system supports zerocopy BPF)
377 AC_TRY_COMPILE(
378 [#include <sys/socket.h>
379 #include <sys/ioctl.h>
380 #include <net/if.h>
381 #include <net/bpf.h>],
382 [return (BIOCROTZBUF + BPF_BUFMODE_ZBUF);],
383 [
384 AC_MSG_RESULT(yes)
385 AC_DEFINE(HAVE_ZEROCOPY_BPF, 1,
386 [define if the system supports zerocopy BPF])
387 ],
388 AC_MSG_RESULT(no))
389 ;;
390
391 dag)
392 V_DEFS="$V_DEFS -DDAG_ONLY"
393 ;;
394
395 septel)
396 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
397 ;;
398
399 null)
400 AC_MSG_WARN(cannot determine packet capture interface)
401 AC_MSG_WARN((see the INSTALL doc for more info))
402 ;;
403 esac
404
405 dnl
406 dnl Now figure out how we get a list of interfaces and addresses,
407 dnl if we support capturing. Don't bother if we don't support
408 dnl capturing.
409 dnl
410 if test "$V_PCAP" = null
411 then
412 #
413 # We can't capture, so we can't open any capture
414 # devices, so we won't return any interfaces.
415 #
416 V_FINDALLDEVS=null
417 else
418 AC_CHECK_FUNC(getifaddrs,[
419 #
420 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
421 # as well, just in case some platform is really weird.
422 #
423 AC_CHECK_HEADER(ifaddrs.h,[
424 #
425 # We have the header, so we use "getifaddrs()" to
426 # get the list of interfaces.
427 #
428 V_FINDALLDEVS=getad
429 ],[
430 #
431 # We don't have the header - give up.
432 # XXX - we could also fall back on some other
433 # mechanism, but, for now, this'll catch this
434 # problem so that we can at least try to figure
435 # out something to do on systems with "getifaddrs()"
436 # but without "ifaddrs.h", if there is something
437 # we can do on those systems.
438 #
439 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
440 ])
441 ],[
442 #
443 # Well, we don't have "getifaddrs()", so we have to use
444 # some other mechanism; determine what that mechanism is.
445 #
446 # The first thing we use is the type of capture mechanism,
447 # which is somewhat of a proxy for the OS we're using.
448 #
449 case "$V_PCAP" in
450
451 dlpi|libdlpi)
452 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
453 #
454 # This might be Solaris 8 or later, with
455 # SIOCGLIFCONF, or it might be some other OS
456 # or some older version of Solaris, with
457 # just SIOCGIFCONF.
458 #
459 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
460 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
461 AC_TRY_COMPILE(
462 [#include <sys/param.h>
463 #include <sys/file.h>
464 #include <sys/ioctl.h>
465 #include <sys/socket.h>
466 #include <sys/sockio.h>],
467 [ioctl(0, SIOCGLIFCONF, (char *)0);],
468 ac_cv_lbl_have_siocglifconf=yes,
469 ac_cv_lbl_have_siocglifconf=no))
470 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
471 if test $ac_cv_lbl_have_siocglifconf = yes ; then
472 V_FINDALLDEVS=glifc
473 else
474 V_FINDALLDEVS=gifc
475 fi
476 #
477 # Needed for common functions used by pcap-[dlpi,libdlpi].c
478 #
479 SSRC="dlpisubs.c"
480 ;;
481
482 *)
483 #
484 # Assume we just have SIOCGIFCONF.
485 # (XXX - on at least later Linux kernels, there's
486 # another mechanism, and we should be using that
487 # instead.)
488 #
489 V_FINDALLDEVS=gifc
490 ;;
491 esac])
492 fi
493 ])
494
495 AC_MSG_CHECKING(for socklen_t)
496 AC_TRY_COMPILE([
497 #include <sys/types.h>
498 #include <sys/socket.h>
499 ],
500 [ socklen_t x; ],
501 have_socklen_t=yes,
502 have_socklen_t=no)
503 if test "x$have_socklen_t" = "xyes"; then
504 AC_DEFINE(HAVE_SOCKLEN_T, 1, [define if socklen_t is defined])
505 fi
506 AC_MSG_RESULT($have_socklen_t)
507
508 AC_ARG_ENABLE(ipv6,
509 AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes, if getaddrinfo available@:>@]),
510 [],
511 [enable_ipv6=ifavailable])
512 if test "$enable_ipv6" != "no"; then
513 AC_CHECK_FUNC(getaddrinfo,
514 [
515 AC_DEFINE(INET6,1,[IPv6])
516 ],
517 [
518 if test "$enable_ipv6" != "ifavailable"; then
519 AC_MSG_FAILURE([--enable-ipv6 was given, but getaddrinfo isn't available])
520 fi
521 ])
522 fi
523
524 AC_MSG_CHECKING(whether to build optimizer debugging code)
525 AC_ARG_ENABLE(optimizer-dbg,
526 AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
527 if test "$enable_optimizer_dbg" = "yes"; then
528 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
529 fi
530 AC_MSG_RESULT(${enable_optimizer_dbg-no})
531
532 AC_MSG_CHECKING(whether to build parser debugging code)
533 AC_ARG_ENABLE(yydebug,
534 AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
535 if test "$enable_yydebug" = "yes"; then
536 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
537 fi
538 AC_MSG_RESULT(${enable_yydebug-no})
539
540 AC_MSG_CHECKING(whether we have /proc/net/dev)
541 if test -r /proc/net/dev ; then
542 ac_cv_lbl_proc_net_dev=yes
543 else
544 ac_cv_lbl_proc_net_dev=no
545 fi
546 if test $ac_cv_lbl_proc_net_dev = yes; then
547 AC_DEFINE(HAVE_PROC_NET_DEV, 1, [define if you have a /proc/net/dev])
548 fi
549 AC_MSG_RESULT($ac_cv_lbl_proc_net_dev)
550
551 # Check for Endace DAG card support.
552 AC_ARG_WITH([dag],
553 AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support @<:@"yes", "no" or DIR; default="yes" on BSD and Linux if present@:>@]),
554 [
555 if test "$withval" = no
556 then
557 # User doesn't want DAG support.
558 want_dag=no
559 elif test "$withval" = yes
560 then
561 # User wants DAG support but hasn't specified a directory.
562 want_dag=yes
563 else
564 # User wants DAG support and has specified a directory, so use the provided value.
565 want_dag=yes
566 dag_root=$withval
567 fi
568 ],[
569 #
570 # Use DAG API if present, otherwise don't
571 #
572 want_dag=ifpresent
573 ])
574
575 AC_ARG_WITH([dag-includes],
576 AC_HELP_STRING([--with-dag-includes=DIR],[Endace DAG include directory]),
577 [
578 # User wants DAG support and has specified a header directory, so use the provided value.
579 want_dag=yes
580 dag_include_dir=$withval
581 ],[])
582
583 AC_ARG_WITH([dag-libraries],
584 AC_HELP_STRING([--with-dag-libraries=DIR],[Endace DAG library directory]),
585 [
586 # User wants DAG support and has specified a library directory, so use the provided value.
587 want_dag=yes
588 dag_lib_dir=$withval
589 ],[])
590
591 case "$V_PCAP" in
592 linux|bpf|dag)
593 #
594 # We support the DAG API if we're on Linux or BSD, or if we're
595 # building a DAG-only libpcap.
596 #
597 ;;
598 *)
599 #
600 # If the user explicitly requested DAG, tell them it's not
601 # supported.
602 #
603 # If they expressed no preference, don't include it.
604 #
605 if test $want_dag = yes; then
606 AC_MSG_ERROR([DAG support is only available with 'linux' 'bpf' and 'dag' packet capture types])
607 elif test $want_dag = yes; then
608 want_dag=no
609 fi
610 ;;
611 esac
612
613 ac_cv_lbl_dag_api=no
614 if test "$want_dag" != no; then
615
616 AC_MSG_CHECKING([whether we have DAG API headers])
617
618 # If necessary, set default paths for DAG API headers and libraries.
619 if test -z "$dag_root"; then
620 dag_root=/usr/local
621 fi
622
623 if test -z "$dag_include_dir"; then
624 dag_include_dir="$dag_root/include"
625 fi
626
627 if test -z "$dag_lib_dir"; then
628 dag_lib_dir="$dag_root/lib"
629 fi
630
631 if test -z "$dag_tools_dir"; then
632 dag_tools_dir="$dag_root/tools"
633 fi
634
635 if test -r $dag_include_dir/dagapi.h; then
636 ac_cv_lbl_dag_api=yes
637 fi
638 AC_MSG_RESULT([$ac_cv_lbl_dag_api ($dag_include_dir)])
639 fi
640
641 if test $ac_cv_lbl_dag_api = yes; then
642
643 AC_MSG_CHECKING([dagapi.o])
644 dagapi_obj=no
645 if test -r $dag_tools_dir/dagapi.o; then
646 # 2.4.x.
647 dagapi_obj=$dag_tools_dir/dagapi.o
648 elif test -r $dag_lib_dir/dagapi.o; then
649 # 2.5.x.
650 dagapi_obj=$dag_lib_dir/dagapi.o
651 elif test -r $dag_lib_dir/libdag.a; then
652 # 2.5.x.
653 ar x $dag_lib_dir/libdag.a dagapi.o 2>/dev/null
654 if test -r ./dagapi.o; then
655 dagapi_obj=./dagapi.o
656 else
657 ar x $dag_lib_dir/libdag.a libdag_la-dagapi.o 2>/dev/null
658 if test -r ./libdag_la-dagapi.o; then
659 dagapi_obj=./libdag_la-dagapi.o
660 fi
661 fi
662 fi
663
664 if test $dagapi_obj = no; then
665 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)])
666 ac_cv_lbl_dag_api=no
667 else
668 AC_MSG_RESULT([yes ($dagapi_obj)])
669 fi
670 fi
671
672 if test $ac_cv_lbl_dag_api = yes; then
673
674 AC_MSG_CHECKING([dagopts.o])
675 dagopts_obj=no
676 if test -r $dag_tools_dir/dagopts.o; then
677 # 2.4.x.
678 dagopts_obj=$dag_tools_dir/dagopts.o
679 elif test -r $dag_lib_dir/dagopts.o; then
680 # 2.5.x.
681 dagopts_obj=$dag_lib_dir/dagopts.o
682 elif test -r $dag_lib_dir/libdag.a; then
683 # 2.5.x.
684 ar x $dag_lib_dir/libdag.a dagopts.o 2>/dev/null
685 if test -r ./dagopts.o; then
686 dagopts_obj=./dagopts.o
687 else
688 ar x $dag_lib_dir/libdag.a libdag_la-dagopts.o 2>/dev/null
689 if test -r ./libdag_la-dagopts.o; then
690 dagopts_obj=./libdag_la-dagopts.o
691 fi
692 fi
693 fi
694
695 if test $dagopts_obj = no; then
696 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)])
697 ac_cv_lbl_dag_api=no
698 else
699 AC_MSG_RESULT([yes ($dagopts_obj)])
700 fi
701 fi
702
703 if test $ac_cv_lbl_dag_api = yes; then
704 # Under 2.5.x only we need to add dagreg.o.
705 if test -r $dag_include_dir/dagreg.h; then
706 AC_MSG_CHECKING([dagreg.o])
707 dagreg_obj=no
708 if test -r $dag_lib_dir/dagreg.o; then
709 # Object file is ready and waiting.
710 dagreg_obj=$dag_lib_dir/dagreg.o
711 elif test -r $dag_lib_dir/libdag.a; then
712 # Extract from libdag.a.
713 ar x $dag_lib_dir/libdag.a dagreg.o 2>/dev/null
714 if test -r ./dagreg.o; then
715 dagreg_obj=./dagreg.o
716 else
717 ar x $dag_lib_dir/libdag.a libdag_la-dagreg.o 2>/dev/null
718 if test -r ./libdag_la-dagreg.o; then
719 dagreg_obj=./libdag_la-dagreg.o
720 fi
721 fi
722 fi
723
724 if test $dagreg_obj = no; then
725 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_lib_dir/libdag.a)])
726 ac_cv_lbl_dag_api=no
727 else
728 AC_MSG_RESULT([yes ($dagreg_obj)])
729 fi
730 fi
731 fi
732
733 if test $ac_cv_lbl_dag_api = yes; then
734 V_INCLS="$V_INCLS -I$dag_include_dir"
735 V_LIBS="$V_LIBS $dagapi_obj $dagopts_obj $dagreg_obj"
736 if test $V_PCAP != dag ; then
737 SSRC="pcap-dag.c"
738 fi
739
740 # See if we can find a general version string.
741 # Don't need to save and restore LIBS to prevent -ldag being
742 # included if there's a found-action (arg 3).
743 saved_ldflags=$LDFLAGS
744 LDFLAGS="-L$dag_lib_dir"
745 AC_CHECK_LIB([dag], [dag_attach_stream], [dag_streams="1"], [dag_streams="0"])
746 AC_CHECK_LIB([dag],[dag_get_erf_types], [
747 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
748 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
749 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
750 LDFLAGS=$saved_ldflags
751
752 if test "$dag_streams" = 1; then
753 AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API])
754 DAGLIBS="-ldag"
755 fi
756
757 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
758 fi
759
760 AC_MSG_CHECKING(whether we have the DAG API)
761
762 if test $ac_cv_lbl_dag_api = no; then
763 AC_MSG_RESULT(no)
764 if test "$want_dag" = yes; then
765 # User wanted DAG support but we couldn't find it.
766 AC_MSG_ERROR([DAG API requested, but not found at $dag_root: use --without-dag])
767 fi
768
769 if test "$V_PCAP" = dag; then
770 # User requested "dag" capture type but the DAG API wasn't
771 # found.
772 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.)])
773 fi
774 else
775 AC_MSG_RESULT(yes)
776 fi
777
778 AC_ARG_WITH(septel,
779 AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, on Linux, if present@:>@]),
780 [
781 if test "$withval" = no
782 then
783 want_septel=no
784 elif test "$withval" = yes
785 then
786 want_septel=yes
787 septel_root=
788 else
789 want_septel=yes
790 septel_root=$withval
791 fi
792 ],[
793 #
794 # Use Septel API if present, otherwise don't
795 #
796 want_septel=ifpresent
797 septel_root=./../septel
798 ])
799 ac_cv_lbl_septel_api=no
800 case "$V_PCAP" in
801 linux|septel)
802 #
803 # We support the Septel API if we're on Linux, or if we're building
804 # a Septel-only libpcap.
805 #
806 ;;
807 *)
808 #
809 # If the user explicitly requested Septel, tell them it's not
810 # supported.
811 #
812 # If they expressed no preference, don't include it.
813 #
814 if test $want_septel = yes; then
815 AC_MSG_ERROR(Septel support only available with 'linux' and 'septel' packet capture types)
816 elif test $want_septel = yes; then
817 want_septel=no
818 fi
819 ;;
820 esac
821
822 if test "$with_septel" != no; then
823 AC_MSG_CHECKING(whether we have Septel API)
824
825 if test -z "$septel_root"; then
826 septel_root=$srcdir/../septel
827
828 fi
829
830 septel_tools_dir="$septel_root"
831 septel_include_dir="$septel_root/INC"
832 DEF="-DHAVE_SEPTEL_API"
833
834 ac_cv_lbl_septel_api=no
835 if test -r "$septel_include_dir/msg.h"; then
836 V_INCLS="$V_INCLS -I$septel_include_dir"
837 V_DEFS="$V_DEFS $DEF"
838 V_LIBS="$V_LIBS $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 "
839
840 if test "$V_PCAP" != septel ; then
841 SSRC="pcap-septel.c"
842
843 fi
844 ac_cv_lbl_septel_api=yes
845 fi
846
847 AC_MSG_RESULT($ac_cv_lbl_septel_api)
848 if test $ac_cv_lbl_septel_api = no; then
849 if test "$want_septel" = yes; then
850 AC_MSG_ERROR(Septel API not found under directory $septel_root; use --without-septel)
851 fi
852 else
853 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have a Septel API])
854 fi
855 fi
856
857 if test "$V_PCAP" = septel -a "$ac_cv_lbl_septel_api" = no; then
858 AC_MSG_ERROR(Specifying the capture type as 'septel' requires the Septel API to be present; use --with-septel=DIR)
859 fi
860
861
862 AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
863 if test "$V_LEX" = lex ; then
864 # Some versions of lex can't handle the definitions section of scanner.l .
865 # Try lexing it and complain if it can't deal.
866 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
867 if lex -t scanner.l > /dev/null 2>&1; then
868 tcpdump_cv_capable_lex=yes
869 else
870 tcpdump_cv_capable_lex=insufficient
871 fi)
872 if test $tcpdump_cv_capable_lex = insufficient ; then
873 AC_MSG_ERROR([Your operating system's lex is insufficient to compile
874 libpcap. flex is a lex replacement that has many advantages, including
875 being able to compile libpcap. For more information, see
876 http://www.gnu.org/software/flex/flex.html .])
877 fi
878 fi
879
880 #
881 # Assume a.out/ELF convention for shared library names (".so"), and
882 # V7/BSD convention for man pages (file formats in section 5,
883 # miscellaneous info in section 7).
884 #
885 DYEXT="so"
886 MAN_FILE_FORMATS=5
887 MAN_MISC_INFO=7
888 case "$host_os" in
889
890 aix*)
891 dnl Workaround to enable certain features
892 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
893
894 # We need "-lodm" and "-lcfg", as libpcap requires them on
895 # AIX.
896 DEPLIBS="-lodm -lcfg"
897 ;;
898
899 darwin*)
900 DYEXT="dylib"
901 V_CCOPT="$V_CCOPT -fno-common"
902 ;;
903
904 hpux9*)
905 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
906
907 #
908 # Use System V conventions for man pages.
909 #
910 MAN_FILE_FORMATS=4
911 MAN_MISC_INFO=5
912 ;;
913
914 hpux10.0*)
915
916 #
917 # Use System V conventions for man pages.
918 #
919 MAN_FILE_FORMATS=4
920 MAN_MISC_INFO=5
921 ;;
922
923 hpux10.1*)
924
925 #
926 # Use System V conventions for man pages.
927 #
928 MAN_FILE_FORMATS=4
929 MAN_MISC_INFO=5
930 ;;
931
932 hpux*)
933 dnl HPUX 10.20 and above is similar to HPUX 9, but
934 dnl not the same....
935 dnl
936 dnl XXX - DYEXT should be set to "sl" if this is building
937 dnl for 32-bit PA-RISC, but should be left as "so" for
938 dnl 64-bit PA-RISC or, I suspect, IA-64.
939 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
940
941 #
942 # Use System V conventions for man pages.
943 #
944 MAN_FILE_FORMATS=4
945 MAN_MISC_INFO=5
946 ;;
947
948 irix*)
949 #
950 # Use System V conventions for man pages.
951 #
952 MAN_FILE_FORMATS=4
953 MAN_MISC_INFO=5
954 ;;
955
956 linux*)
957 V_CCOPT="$V_CCOPT -fPIC"
958 ;;
959
960 osf*)
961 #
962 # Use System V conventions for man pages.
963 #
964 MAN_FILE_FORMATS=4
965 MAN_MISC_INFO=5
966 ;;
967
968 sinix*)
969 AC_MSG_CHECKING(if SINIX compiler defines sinix)
970 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
971 AC_TRY_COMPILE(
972 [],
973 [int i = sinix;],
974 ac_cv_cc_sinix_defined=yes,
975 ac_cv_cc_sinix_defined=no))
976 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
977 if test $ac_cv_cc_sinix_defined = no ; then
978 AC_DEFINE(sinix,1,[on sinix])
979 fi
980 ;;
981
982 solaris*)
983 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
984
985 #
986 # Use System V conventions for man pages.
987 #
988 MAN_FILE_FORMATS=4
989 MAN_MISC_INFO=5
990 ;;
991 esac
992
993 AC_PROG_RANLIB
994
995 AC_LBL_DEVEL(V_CCOPT)
996
997 AC_LBL_SOCKADDR_SA_LEN
998
999 AC_LBL_SOCKADDR_STORAGE
1000
1001 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
1002
1003 AC_LBL_UNALIGNED_ACCESS
1004
1005 #
1006 # Makefile.in includes rules to generate version.h, so we assume
1007 # that it will be generated if autoconf is used.
1008 #
1009 AC_DEFINE(HAVE_VERSION_H, 1, [define if version.h is generated in the build procedure])
1010
1011 rm -f net
1012 ln -s ${srcdir}/bpf/net net
1013
1014 AC_SUBST(V_CCOPT)
1015 AC_SUBST(V_DEFS)
1016 AC_SUBST(V_INCLS)
1017 AC_SUBST(V_LIBS)
1018 AC_SUBST(V_LEX)
1019 AC_SUBST(V_PCAP)
1020 AC_SUBST(V_FINDALLDEVS)
1021 AC_SUBST(V_YACC)
1022 AC_SUBST(SSRC)
1023 AC_SUBST(DYEXT)
1024 AC_SUBST(DAGLIBS)
1025 AC_SUBST(DEPLIBS)
1026 AC_SUBST(MAN_FILE_FORMATS)
1027 AC_SUBST(MAN_MISC_INFO)
1028
1029 dnl check for USB sniffing support
1030 AC_MSG_CHECKING(for USB sniffing support)
1031 case "$host_os" in
1032 linux*)
1033 AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
1034 USB_SRC=pcap-usb-linux.c
1035 AC_MSG_RESULT(yes)
1036 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
1037 if test $? -ne 0 ; then
1038 ac_usb_dev_name="usbmon"
1039 fi
1040 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
1041 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
1042 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
1043 ;;
1044 *)
1045 AC_MSG_RESULT(no)
1046 ;;
1047 esac
1048 AC_SUBST(PCAP_SUPPORT_USB)
1049 AC_SUBST(USB_SRC)
1050
1051 AC_ARG_ENABLE([bluetooth],
1052 [AC_HELP_STRING([--enable-bluetooth],[enable bluetooth support @<:@default=yes, if support available@:>@])],
1053 ,enable_bluetooth=yes)
1054
1055 if test "x$enable_bluetooth" != "xno" ; then
1056 dnl check for bluetooth sniffing support
1057 case "$host_os" in
1058 linux*)
1059 AC_CHECK_HEADER(bluetooth/bluetooth.h,
1060 [
1061 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
1062 BT_SRC=pcap-bt-linux.c
1063 AC_MSG_NOTICE(Bluetooth sniffing is supported)
1064 ],
1065 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
1066 )
1067 ;;
1068 *)
1069 AC_MSG_NOTICE(no Bluetooth sniffing support)
1070 ;;
1071 esac
1072 AC_SUBST(PCAP_SUPPORT_BT)
1073 AC_SUBST(BT_SRC)
1074 fi
1075
1076 AC_PROG_INSTALL
1077
1078 AC_CONFIG_HEADER(config.h)
1079
1080 AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
1081 pcap-savefile.manfile pcap.3pcap pcap_compile.3pcap
1082 pcap_datalink.3pcap pcap_dump_open.3pcap
1083 pcap_list_datalinks.3pcap pcap_open_dead.3pcap
1084 pcap_open_offline.3pcap)
1085
1086 if test -f .devel ; then
1087 make depend
1088 fi
1089 exit 0