]> The Tcpdump Group git mirrors - libpcap/blob - configure.in
Catch another place where you could get told "no, you may not open that
[libpcap] / configure.in
1 dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.138.2.12 2008-04-05 04:56:59 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.12 $)
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, [ --disable-protochain disable \"protochain\" insn])
189 case "x$enable_protochain" in
190 xyes) enable_protochain=enabled ;;
191 xno) enable_protochain=disabled ;;
192 x) enable_protochain=enabled ;;
193 esac
194
195 if test "$enable_protochain" = "disabled"; then
196 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
197 fi
198 AC_MSG_RESULT(${enable_protochain})
199
200 #
201 # SITA support is mutually exclusive with native capture support;
202 # "--with-sita" selects SITA support.
203 #
204 AC_ARG_WITH(sita, [ --with-sita include SITA support],
205 [
206 AC_DEFINE(SITA,1,[include ACN support])
207 AC_MSG_NOTICE(Enabling SITA ACN support)
208 V_PCAP=sita
209 V_FINDALLDEVS=sita
210 ],
211 [
212 dnl
213 dnl Not all versions of test support -c (character special) but it's a
214 dnl better way of testing since the device might be protected. So we
215 dnl check in our normal order using -r and then check the for the /dev
216 dnl guys again using -c.
217 dnl
218 dnl XXX This could be done for cross-compiling, but for now it's not.
219 dnl
220 if test -z "$with_pcap" && test "$cross_compiling" = yes; then
221 AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)
222 fi
223 AC_ARG_WITH(pcap, [ --with-pcap=TYPE use packet capture TYPE])
224 AC_MSG_CHECKING(packet capture type)
225 if test ! -z "$with_pcap" ; then
226 V_PCAP="$withval"
227 elif test -r /dev/bpf ; then
228 #
229 # Cloning BPF device.
230 #
231 V_PCAP=bpf
232 AC_DEFINE(HAVE_CLONING_BPF,1,[define if you have a cloning BPF device])
233 elif test -r /dev/bpf0 ; then
234 V_PCAP=bpf
235 elif test -r /usr/include/net/pfilt.h ; then
236 V_PCAP=pf
237 elif test -r /dev/enet ; then
238 V_PCAP=enet
239 elif test -r /dev/nit ; then
240 V_PCAP=snit
241 elif test -r /usr/include/sys/net/nit.h ; then
242 V_PCAP=nit
243 elif test -r /usr/include/linux/socket.h ; then
244 V_PCAP=linux
245 elif test -r /usr/include/net/raw.h ; then
246 V_PCAP=snoop
247 elif test -r /usr/include/odmi.h ; then
248 #
249 # On AIX, the BPF devices might not yet be present - they're
250 # created the first time libpcap runs after booting.
251 # We check for odmi.h instead.
252 #
253 V_PCAP=bpf
254 elif test -r /usr/include/sys/dlpi.h ; then
255 V_PCAP=dlpi
256 elif test -c /dev/bpf0 ; then # check again in case not readable
257 V_PCAP=bpf
258 elif test -c /dev/enet ; then # check again in case not readable
259 V_PCAP=enet
260 elif test -c /dev/nit ; then # check again in case not readable
261 V_PCAP=snit
262 else
263 V_PCAP=null
264 fi
265 AC_MSG_RESULT($V_PCAP)
266
267 if test "$V_PCAP" = dlpi
268 then
269 #
270 # Checks to see if Solaris has the public libdlpi(3LIB) library.
271 # Note: The existence of /usr/include/libdlpi.h does not mean it is the
272 # public libdlpi(3LIB) version. Before libdlpi was made public, a
273 # private version also existed, which did not have the same APIs.
274 # Due to a gcc bug, the default search path for 32-bit libraries does
275 # not include /lib, we add it explicitly here.
276 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
277 # Also, due to the bug above applications that link to libpcap with
278 # libdlpi will have to add "-L/lib" option to "configure".
279 #
280 saved_ldflags=$LDFLAGS
281 LDFLAGS="$LIBS -L/lib"
282 AC_CHECK_LIB(dlpi, dlpi_walk,
283 LIBS="-ldlpi $LIBS"
284 V_PCAP=libdlpi
285 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists]),
286 V_PCAP=dlpi)
287 LDFLAGS=$saved_ldflags
288 fi
289
290 dnl
291 dnl Now figure out how we get a list of interfaces and addresses,
292 dnl if we support capturing. Don't bother if we don't support
293 dnl capturing.
294 dnl
295 if test "$V_PCAP" = null
296 then
297 #
298 # We can't capture, so we can't open any capture
299 # devices, so we won't return any interfaces.
300 #
301 V_FINDALLDEVS=null
302 else
303 AC_CHECK_FUNC(getifaddrs,[
304 #
305 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
306 # as well, just in case some platform is really weird.
307 #
308 AC_CHECK_HEADER(ifaddrs.h,[
309 #
310 # We have the header, so we use "getifaddrs()" to
311 # get the list of interfaces.
312 #
313 V_FINDALLDEVS=getad
314 ],[
315 #
316 # We don't have the header - give up.
317 # XXX - we could also fall back on some other
318 # mechanism, but, for now, this'll catch this
319 # problem so that we can at least try to figure
320 # out something to do on systems with "getifaddrs()"
321 # but without "ifaddrs.h", if there is something
322 # we can do on those systems.
323 #
324 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
325 ])
326 ],[
327 #
328 # Well, we don't have "getifaddrs()", so we have to use
329 # some other mechanism; determine what that mechanism is.
330 #
331 # The first thing we use is the type of capture mechanism,
332 # which is somewhat of a proxy for the OS we're using.
333 #
334 case "$V_PCAP" in
335
336 dlpi|libdlpi)
337 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
338 #
339 # This might be Solaris 8 or later, with
340 # SIOCGLIFCONF, or it might be some other OS
341 # or some older version of Solaris, with
342 # just SIOCGIFCONF.
343 #
344 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
345 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
346 AC_TRY_COMPILE(
347 [#include <sys/param.h>
348 #include <sys/file.h>
349 #include <sys/ioctl.h>
350 #include <sys/socket.h>
351 #include <sys/sockio.h>],
352 [ioctl(0, SIOCGLIFCONF, (char *)0);],
353 ac_cv_lbl_have_siocglifconf=yes,
354 ac_cv_lbl_have_siocglifconf=no))
355 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
356 if test $ac_cv_lbl_have_siocglifconf = yes ; then
357 V_FINDALLDEVS=glifc
358 else
359 V_FINDALLDEVS=gifc
360 fi
361 #
362 # Needed for common functions used by pcap-[dlpi,libdlpi].c
363 #
364 SSRC="dlpisubs.c"
365 ;;
366
367 *)
368 #
369 # Assume we just have SIOCGIFCONF.
370 # (XXX - on at least later Linux kernels, there's
371 # another mechanism, and we should be using that
372 # instead.)
373 #
374 V_FINDALLDEVS=gifc
375 ;;
376 esac])
377 fi
378 ])
379
380 AC_MSG_CHECKING(for socklen_t)
381 AC_TRY_COMPILE([
382 #include <sys/types.h>
383 #include <sys/socket.h>
384 ],
385 [ socklen_t x; ],
386 have_socklen_t=yes,
387 have_socklen_t=no)
388 if test "x$have_socklen_t" = "xyes"; then
389 AC_DEFINE(HAVE_SOCKLEN_T, 1, [define if socklen_t is defined])
390 fi
391 AC_MSG_RESULT($have_socklen_t)
392
393 AC_MSG_CHECKING(if --enable-ipv6 option is specified)
394 AC_ARG_ENABLE(ipv6, [ --enable-ipv6 build IPv6-capable version])
395 if test "$enable_ipv6" = "yes"; then
396 AC_DEFINE(INET6,1,[IPv6])
397 fi
398 AC_MSG_RESULT(${enable_ipv6-no})
399
400 AC_MSG_CHECKING(whether to build optimizer debugging code)
401 AC_ARG_ENABLE(optimizer-dbg, [ --enable-optimizer-dbg build optimizer debugging code])
402 if test "$enable_optimizer_dbg" = "yes"; then
403 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
404 fi
405 AC_MSG_RESULT(${enable_optimizer_dbg-no})
406
407 AC_MSG_CHECKING(whether to build parser debugging code)
408 AC_ARG_ENABLE(yydebug, [ --enable-yydebug build parser debugging code])
409 if test "$enable_yydebug" = "yes"; then
410 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
411 fi
412 AC_MSG_RESULT(${enable_yydebug-no})
413
414 case "$V_PCAP" in
415
416 dlpi)
417 AC_MSG_CHECKING(for /dev/dlpi device)
418 if test -c /dev/dlpi ; then
419 AC_MSG_RESULT(yes)
420 AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi])
421 else
422 AC_MSG_RESULT(no)
423 dir="/dev/dlpi"
424 AC_MSG_CHECKING(for $dir directory)
425 if test -d $dir ; then
426 AC_MSG_RESULT(yes)
427 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory])
428 else
429 AC_MSG_RESULT(no)
430 fi
431 fi
432 #
433 # This check is for Solaris with DLPI support for passive modes.
434 # See dlpi(7P) for more details.
435 #
436 AC_LBL_DL_PASSIVE_REQ_T
437 ;;
438
439 linux)
440 AC_MSG_CHECKING(Linux kernel version)
441 if test "$cross_compiling" = yes; then
442 AC_CACHE_VAL(ac_cv_linux_vers,
443 ac_cv_linux_vers=unknown)
444 else
445 AC_CACHE_VAL(ac_cv_linux_vers,
446 ac_cv_linux_vers=`uname -r 2>&1 | \
447 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
448 fi
449 AC_MSG_RESULT($ac_cv_linux_vers)
450 if test $ac_cv_linux_vers = unknown ; then
451 AC_MSG_ERROR(cannot determine linux version when cross-compiling)
452 fi
453 if test $ac_cv_linux_vers -lt 2 ; then
454 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
455 fi
456 AC_CHECK_HEADERS(linux/wireless.h, [], [],
457 [
458 #include <sys/socket.h>
459 #include <net/if.h>
460 #include <linux/types.h>
461 ])
462 AC_CHECK_HEADERS()
463 AC_LBL_TPACKET_STATS
464 ;;
465
466 bpf)
467 #
468 # Check whether we have the *BSD-style ioctls.
469 #
470 AC_CHECK_HEADERS(net/if_media.h)
471 ;;
472
473 dag)
474 V_DEFS="$V_DEFS -DDAG_ONLY"
475 ;;
476
477 septel)
478 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
479 ;;
480
481 null)
482 AC_MSG_WARN(cannot determine packet capture interface)
483 AC_MSG_WARN((see the INSTALL doc for more info))
484 ;;
485
486 esac
487
488 AC_MSG_CHECKING(whether we have /proc/net/dev)
489 if test -r /proc/net/dev ; then
490 ac_cv_lbl_proc_net_dev=yes
491 else
492 ac_cv_lbl_proc_net_dev=no
493 fi
494 if test $ac_cv_lbl_proc_net_dev = yes; then
495 AC_DEFINE(HAVE_PROC_NET_DEV, 1, [define if you have a /proc/net/dev])
496 fi
497 AC_MSG_RESULT($ac_cv_lbl_proc_net_dev)
498
499 # Check for Endace DAG card support.
500 AC_ARG_WITH([dag], [ --with-dag[[=DIR]] include Endace DAG support ("yes", "no" or DIR; default="yes" on BSD and Linux if present)],
501 [
502 if test "$withval" = no
503 then
504 # User doesn't want DAG support.
505 want_dag=no
506 elif test "$withval" = yes
507 then
508 # User wants DAG support but hasn't specified a directory.
509 want_dag=yes
510 else
511 # User wants DAG support and has specified a directory, so use the provided value.
512 want_dag=yes
513 dag_root=$withval
514 fi
515 ],[
516 #
517 # Use DAG API if present, otherwise don't
518 #
519 want_dag=ifpresent
520 ])
521
522 AC_ARG_WITH([dag-includes], [ --with-dag-includes=DIR Endace DAG include directory],
523 [
524 # User wants DAG support and has specified a header directory, so use the provided value.
525 want_dag=yes
526 dag_include_dir=$withval
527 ],[])
528
529 AC_ARG_WITH([dag-libraries], [ --with-dag-libraries=DIR Endace DAG library directory],
530 [
531 # User wants DAG support and has specified a library directory, so use the provided value.
532 want_dag=yes
533 dag_lib_dir=$withval
534 ],[])
535
536 case "$V_PCAP" in
537 linux|bpf|dag)
538 #
539 # We support the DAG API if we're on Linux or BSD, or if we're
540 # building a DAG-only libpcap.
541 #
542 ;;
543 *)
544 #
545 # If the user explicitly requested DAG, tell them it's not
546 # supported.
547 #
548 # If they expressed no preference, don't include it.
549 #
550 if test $want_dag = yes; then
551 AC_MSG_ERROR([DAG support is only available with 'linux' 'bpf' and 'dag' packet capture types])
552 elif test $want_dag = yes; then
553 want_dag=no
554 fi
555 ;;
556 esac
557
558 ac_cv_lbl_dag_api=no
559 if test "$want_dag" != no; then
560
561 AC_MSG_CHECKING([whether we have DAG API headers])
562
563 # If necessary, set default paths for DAG API headers and libraries.
564 if test -z "$dag_root"; then
565 dag_root=/usr/local
566 fi
567
568 if test -z "$dag_include_dir"; then
569 dag_include_dir="$dag_root/include"
570 fi
571
572 if test -z "$dag_lib_dir"; then
573 dag_lib_dir="$dag_root/lib"
574 fi
575
576 if test -z "$dag_tools_dir"; then
577 dag_tools_dir="$dag_root/tools"
578 fi
579
580 if test -r $dag_include_dir/dagapi.h; then
581 ac_cv_lbl_dag_api=yes
582 fi
583 AC_MSG_RESULT([$ac_cv_lbl_dag_api ($dag_include_dir)])
584 fi
585
586 if test $ac_cv_lbl_dag_api = yes; then
587
588 AC_MSG_CHECKING([dagapi.o])
589 dagapi_obj=no
590 if test -r $dag_tools_dir/dagapi.o; then
591 # 2.4.x.
592 dagapi_obj=$dag_tools_dir/dagapi.o
593 elif test -r $dag_lib_dir/dagapi.o; then
594 # 2.5.x.
595 dagapi_obj=$dag_lib_dir/dagapi.o
596 elif test -r $dag_lib_dir/libdag.a; then
597 # 2.5.x.
598 ar x $dag_lib_dir/libdag.a dagapi.o 2>/dev/null
599 if test -r ./dagapi.o; then
600 dagapi_obj=./dagapi.o
601 else
602 ar x $dag_lib_dir/libdag.a libdag_la-dagapi.o 2>/dev/null
603 if test -r ./libdag_la-dagapi.o; then
604 dagapi_obj=./libdag_la-dagapi.o
605 fi
606 fi
607 fi
608
609 if test $dagapi_obj = no; then
610 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)])
611 ac_cv_lbl_dag_api=no
612 else
613 AC_MSG_RESULT([yes ($dagapi_obj)])
614 fi
615 fi
616
617 if test $ac_cv_lbl_dag_api = yes; then
618
619 AC_MSG_CHECKING([dagopts.o])
620 dagopts_obj=no
621 if test -r $dag_tools_dir/dagopts.o; then
622 # 2.4.x.
623 dagopts_obj=$dag_tools_dir/dagopts.o
624 elif test -r $dag_lib_dir/dagopts.o; then
625 # 2.5.x.
626 dagopts_obj=$dag_lib_dir/dagopts.o
627 elif test -r $dag_lib_dir/libdag.a; then
628 # 2.5.x.
629 ar x $dag_lib_dir/libdag.a dagopts.o 2>/dev/null
630 if test -r ./dagopts.o; then
631 dagopts_obj=./dagopts.o
632 else
633 ar x $dag_lib_dir/libdag.a libdag_la-dagopts.o 2>/dev/null
634 if test -r ./libdag_la-dagopts.o; then
635 dagopts_obj=./libdag_la-dagopts.o
636 fi
637 fi
638 fi
639
640 if test $dagopts_obj = no; then
641 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)])
642 ac_cv_lbl_dag_api=no
643 else
644 AC_MSG_RESULT([yes ($dagopts_obj)])
645 fi
646 fi
647
648 if test $ac_cv_lbl_dag_api = yes; then
649 # Under 2.5.x only we need to add dagreg.o.
650 if test -r $dag_include_dir/dagreg.h; then
651 AC_MSG_CHECKING([dagreg.o])
652 dagreg_obj=no
653 if test -r $dag_lib_dir/dagreg.o; then
654 # Object file is ready and waiting.
655 dagreg_obj=$dag_lib_dir/dagreg.o
656 elif test -r $dag_lib_dir/libdag.a; then
657 # Extract from libdag.a.
658 ar x $dag_lib_dir/libdag.a dagreg.o 2>/dev/null
659 if test -r ./dagreg.o; then
660 dagreg_obj=./dagreg.o
661 else
662 ar x $dag_lib_dir/libdag.a libdag_la-dagreg.o 2>/dev/null
663 if test -r ./libdag_la-dagreg.o; then
664 dagreg_obj=./libdag_la-dagreg.o
665 fi
666 fi
667 fi
668
669 if test $dagreg_obj = no; then
670 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_lib_dir/libdag.a)])
671 ac_cv_lbl_dag_api=no
672 else
673 AC_MSG_RESULT([yes ($dagreg_obj)])
674 fi
675 fi
676 fi
677
678 if test $ac_cv_lbl_dag_api = yes; then
679 V_INCLS="$V_INCLS -I$dag_include_dir"
680 V_LIBS="$V_LIBS $dagapi_obj $dagopts_obj $dagreg_obj"
681 if test $V_PCAP != dag ; then
682 SSRC="pcap-dag.c"
683 fi
684
685 # See if we can find a general version string.
686 # Don't need to save and restore LIBS to prevent -ldag being
687 # included if there's a found-action (arg 3).
688 saved_ldflags=$LDFLAGS
689 LDFLAGS="-L$dag_lib_dir"
690 AC_CHECK_LIB([dag], [dag_attach_stream], [dag_streams="1"], [dag_streams="0"])
691 AC_CHECK_LIB([dag],[dag_get_erf_types], [
692 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
693 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
694 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
695 LDFLAGS=$saved_ldflags
696
697 if test "$dag_streams" = 1; then
698 AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API])
699 DAGLIBS="-ldag"
700 fi
701
702 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
703 fi
704
705 AC_MSG_CHECKING(whether we have the DAG API)
706
707 if test $ac_cv_lbl_dag_api = no; then
708 AC_MSG_RESULT(no)
709 if test "$want_dag" = yes; then
710 # User wanted DAG support but we couldn't find it.
711 AC_MSG_ERROR([DAG API requested, but not found at $dag_root: use --without-dag])
712 fi
713
714 if test "$V_PCAP" = dag; then
715 # User requested "dag" capture type but the DAG API wasn't
716 # found.
717 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.)])
718 fi
719 else
720 AC_MSG_RESULT(yes)
721 fi
722
723 AC_ARG_WITH(septel, [ --with-septel[[=DIR]] include Septel support (located in directory DIR, if supplied). [default=yes, on Linux, if present]],
724 [
725 if test "$withval" = no
726 then
727 want_septel=no
728 elif test "$withval" = yes
729 then
730 want_septel=yes
731 septel_root=
732 else
733 want_septel=yes
734 septel_root=$withval
735 fi
736 ],[
737 #
738 # Use Septel API if present, otherwise don't
739 #
740 want_septel=ifpresent
741 septel_root=./../septel
742 ])
743 ac_cv_lbl_septel_api=no
744 case "$V_PCAP" in
745 linux|septel)
746 #
747 # We support the Septel API if we're on Linux, or if we're building
748 # a Septel-only libpcap.
749 #
750 ;;
751 *)
752 #
753 # If the user explicitly requested Septel, tell them it's not
754 # supported.
755 #
756 # If they expressed no preference, don't include it.
757 #
758 if test $want_septel = yes; then
759 AC_MSG_ERROR(Septel support only available with 'linux' and 'septel' packet capture types)
760 elif test $want_septel = yes; then
761 want_septel=no
762 fi
763 ;;
764 esac
765
766 if test "$with_septel" != no; then
767 AC_MSG_CHECKING(whether we have Septel API)
768
769 if test -z "$septel_root"; then
770 septel_root=$srcdir/../septel
771
772 fi
773
774 septel_tools_dir="$septel_root"
775 septel_include_dir="$septel_root/INC"
776 DEF="-DHAVE_SEPTEL_API"
777
778 ac_cv_lbl_septel_api=no
779 if test -r "$septel_include_dir/msg.h"; then
780 V_INCLS="$V_INCLS -I$septel_include_dir"
781 V_DEFS="$V_DEFS $DEF"
782 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 "
783
784 if test "$V_PCAP" != septel ; then
785 SSRC="pcap-septel.c"
786
787 fi
788 ac_cv_lbl_septel_api=yes
789 fi
790
791 AC_MSG_RESULT($ac_cv_lbl_septel_api)
792 if test $ac_cv_lbl_septel_api = no; then
793 if test "$want_septel" = yes; then
794 AC_MSG_ERROR(Septel API not found under directory $septel_root; use --without-septel)
795 fi
796 else
797 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have a Septel API])
798 fi
799 fi
800
801 if test "$V_PCAP" = septel -a "$ac_cv_lbl_septel_api" = no; then
802 AC_MSG_ERROR(Specifying the capture type as 'septel' requires the Septel API to be present; use --with-septel=DIR)
803 fi
804
805
806 AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
807 if test "$V_LEX" = lex ; then
808 # Some versions of lex can't handle the definitions section of scanner.l .
809 # Try lexing it and complain if it can't deal.
810 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
811 if lex -t scanner.l > /dev/null 2>&1; then
812 tcpdump_cv_capable_lex=yes
813 else
814 tcpdump_cv_capable_lex=insufficient
815 fi)
816 if test $tcpdump_cv_capable_lex = insufficient ; then
817 AC_MSG_ERROR([Your operating system's lex is insufficient to compile
818 libpcap. flex is a lex replacement that has many advantages, including
819 being able to compile libpcap. For more information, see
820 http://www.gnu.org/software/flex/flex.html .])
821 fi
822 fi
823
824 DYEXT="so"
825 case "$host_os" in
826
827 aix*)
828 dnl Workaround to enable certain features
829 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
830 ;;
831
832 hpux9*)
833 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
834 ;;
835
836 hpux10.0*)
837 ;;
838
839 hpux10.1*)
840 ;;
841
842 hpux*)
843 dnl HPUX 10.20 and above is similar to HPUX 9, but
844 dnl not the same....
845 dnl
846 dnl XXX - DYEXT should be set to "sl" if this is building
847 dnl for 32-bit PA-RISC, but should be left as "so" for
848 dnl 64-bit PA-RISC or, I suspect, IA-64.
849 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
850 ;;
851
852 sinix*)
853 AC_MSG_CHECKING(if SINIX compiler defines sinix)
854 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
855 AC_TRY_COMPILE(
856 [],
857 [int i = sinix;],
858 ac_cv_cc_sinix_defined=yes,
859 ac_cv_cc_sinix_defined=no))
860 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
861 if test $ac_cv_cc_sinix_defined = no ; then
862 AC_DEFINE(sinix,1,[on sinix])
863 fi
864 ;;
865
866 solaris*)
867 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
868 ;;
869
870 darwin*)
871 DYEXT="dylib"
872 V_CCOPT="$V_CCOPT -fno-common"
873 ;;
874
875 linux*)
876 V_CCOPT="$V_CCOPT -fPIC"
877 ;;
878
879 esac
880
881 AC_PROG_RANLIB
882
883 AC_LBL_DEVEL(V_CCOPT)
884
885 AC_LBL_SOCKADDR_SA_LEN
886
887 AC_LBL_SOCKADDR_STORAGE
888
889 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
890
891 AC_LBL_UNALIGNED_ACCESS
892
893 #
894 # Makefile.in includes rules to generate version.h, so we assume
895 # that it will be generated if autoconf is used.
896 #
897 AC_DEFINE(HAVE_VERSION_H, 1, [define if version.h is generated in the build procedure])
898
899 rm -f net
900 ln -s ${srcdir}/bpf/net net
901
902 AC_SUBST(V_CCOPT)
903 AC_SUBST(V_DEFS)
904 AC_SUBST(V_INCLS)
905 AC_SUBST(V_LIBS)
906 AC_SUBST(V_LEX)
907 AC_SUBST(V_PCAP)
908 AC_SUBST(V_FINDALLDEVS)
909 AC_SUBST(V_YACC)
910 AC_SUBST(SSRC)
911 AC_SUBST(DYEXT)
912 AC_SUBST(DAGLIBS)
913
914 dnl check for USB sniffing support
915 AC_MSG_CHECKING(for USB sniffing support)
916 case "$host_os" in
917 linux*)
918 AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
919 USB_SRC=pcap-usb-linux.c
920 AC_MSG_RESULT(yes)
921 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
922 if test $? -ne 0 ; then
923 ac_usb_dev_name="usbmon"
924 fi
925 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
926 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
927 ;;
928 *)
929 AC_MSG_RESULT(no)
930 ;;
931 esac
932 AC_SUBST(PCAP_SUPPORT_USB)
933 AC_SUBST(USB_SRC)
934
935 dnl check for bluetooth sniffing support
936 case "$host_os" in
937 linux*)
938 AC_CHECK_HEADER(bluetooth/bluetooth.h,
939 [
940 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
941 BT_SRC=pcap-bt-linux.c
942 AC_MSG_NOTICE(Bluetooth sniffing is supported)
943 ],
944 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
945 )
946 ;;
947 *)
948 AC_MSG_NOTICE(no Bluetooth sniffing support)
949 ;;
950 esac
951 AC_SUBST(PCAP_SUPPORT_BT)
952 AC_SUBST(BT_SRC)
953
954 AC_PROG_INSTALL
955
956 AC_CONFIG_HEADER(config.h)
957
958 AC_OUTPUT(Makefile)
959
960 if test -f .devel ; then
961 make depend
962 fi
963 exit 0