]> The Tcpdump Group git mirrors - libpcap/blob - configure.in
Pick up changes from NetBSD:
[libpcap] / configure.in
1 dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.120.2.11 2007-06-11 09:52:04 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.120.2.11 $)
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
23 dnl
24 dnl libpcap doesn't itself use <sys/ioccom.h>; however, the test program
25 dnl in "AC_LBL_FIXINCLUDES" in "aclocal.m4" uses it, so we have to
26 dnl test for it and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
27 dnl "AC_LBL_FIXINCLUDES" won't work on some platforms such as Solaris.
28 dnl
29 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h paths.h)
30 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
31 #include <sys/socket.h>])
32 if test "$ac_cv_header_netinet_if_ether_h" != yes; then
33 #
34 # The simple test didn't work.
35 # Do we need to include <net/if.h> first?
36 # Unset ac_cv_header_netinet_if_ether_h so we don't
37 # treat the previous failure as a cached value and
38 # suppress the next test.
39 #
40 AC_MSG_NOTICE([Rechecking with some additional includes])
41 unset ac_cv_header_netinet_if_ether_h
42 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
43 #include <sys/socket.h>
44 #include <netinet/in.h>
45 struct mbuf;
46 struct rtentry;
47 #include <net/if.h>])
48 fi
49
50 AC_LBL_FIXINCLUDES
51
52 AC_CHECK_FUNCS(strerror strlcpy)
53
54 needsnprintf=no
55 AC_CHECK_FUNCS(vsnprintf snprintf,,
56 [needsnprintf=yes])
57 if test $needsnprintf = yes; then
58 AC_LIBOBJ(snprintf)
59 fi
60
61 #
62 # Do this before checking for ether_hostton(), as it's a
63 # "gethostbyname() -ish function".
64 #
65 AC_LBL_LIBRARY_NET
66
67 #
68 # You are in a twisty little maze of UN*Xes, all different.
69 # Some might not have ether_hostton().
70 # Some might have it, but not declare it in any header file.
71 # Some might have it, but declare it in <netinet/if_ether.h>.
72 # Some might have it, but declare it in <netinet/ether.h>
73 # (And some might have it but document it as something declared in
74 # <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
75 #
76 # Before you is a C compiler.
77 #
78 AC_CHECK_FUNCS(ether_hostton)
79 if test "$ac_cv_func_ether_hostton" = yes; then
80 #
81 # OK, we have ether_hostton(). Do we have <netinet/if_ether.h>?
82 #
83 if test "$ac_cv_header_netinet_if_ether_h" = yes; then
84 #
85 # Yes. Does it declare ether_hostton()?
86 #
87 AC_CHECK_DECL(ether_hostton,
88 [
89 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
90 [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
91 ],,
92 [
93 #include <sys/types.h>
94 #include <sys/socket.h>
95 #include <netinet/in.h>
96 #include <arpa/inet.h>
97 struct mbuf;
98 struct rtentry;
99 #include <net/if.h>
100 #include <netinet/if_ether.h>
101 ])
102 fi
103 #
104 # Did that succeed?
105 #
106 if test "$ac_cv_have_decl_ether_hostton" != yes; then
107 #
108 # No, how about <netinet/ether.h>, as on Linux?
109 #
110 AC_CHECK_HEADERS(netinet/ether.h)
111 if test "$ac_cv_header_netinet_ether_h" = yes; then
112 #
113 # We have it - does it declare ether_hostton()?
114 # Unset ac_cv_have_decl_ether_hostton so we don't
115 # treat the previous failure as a cached value and
116 # suppress the next test.
117 #
118 unset ac_cv_have_decl_ether_hostton
119 AC_CHECK_DECL(ether_hostton,
120 [
121 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
122 [Define to 1 if netinet/ether.h declares `ether_hostton'])
123 ],,
124 [
125 #include <netinet/ether.h>
126 ])
127 fi
128 fi
129 #
130 # Is ether_hostton() declared?
131 #
132 if test "$ac_cv_have_decl_ether_hostton" != yes; then
133 #
134 # No, we'll have to declare it ourselves.
135 # Do we have "struct ether_addr"?
136 #
137 AC_CHECK_TYPES(struct ether_addr,,,
138 [
139 #include <sys/types.h>
140 #include <sys/socket.h>
141 #include <netinet/in.h>
142 #include <arpa/inet.h>
143 struct mbuf;
144 struct rtentry;
145 #include <net/if.h>
146 #include <netinet/if_ether.h>
147 ])
148 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 0,
149 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
150 don't.])
151 else
152 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
153 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
154 don't.])
155 fi
156 fi
157
158 dnl to pacify those who hate protochain insn
159 AC_MSG_CHECKING(if --disable-protochain option is specified)
160 AC_ARG_ENABLE(protochain, [ --disable-protochain disable \"protochain\" insn])
161 case "x$enable_protochain" in
162 xyes) enable_protochain=enabled ;;
163 xno) enable_protochain=disabled ;;
164 x) enable_protochain=enabled ;;
165 esac
166
167 if test "$enable_protochain" = "disabled"; then
168 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
169 fi
170 AC_MSG_RESULT(${enable_protochain})
171
172 dnl
173 dnl Not all versions of test support -c (character special) but it's a
174 dnl better way of testing since the device might be protected. So we
175 dnl check in our normal order using -r and then check the for the /dev
176 dnl guys again using -c.
177 dnl
178 dnl XXX This could be done for cross-compiling, but for now it's not.
179 dnl
180 if test -z "$with_pcap" && test "$cross_compiling" = yes; then
181 AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)
182 fi
183 AC_ARG_WITH(pcap, [ --with-pcap=TYPE use packet capture TYPE])
184 AC_MSG_CHECKING(packet capture type)
185 if test ! -z "$with_pcap" ; then
186 V_PCAP="$withval"
187 elif test -r /dev/bpf0 ; then
188 V_PCAP=bpf
189 elif test -r /usr/include/net/pfilt.h ; then
190 V_PCAP=pf
191 elif test -r /dev/enet ; then
192 V_PCAP=enet
193 elif test -r /dev/nit ; then
194 V_PCAP=snit
195 elif test -r /usr/include/sys/net/nit.h ; then
196 V_PCAP=nit
197 elif test -r /usr/include/linux/socket.h ; then
198 V_PCAP=linux
199 elif test -r /usr/include/net/raw.h ; then
200 V_PCAP=snoop
201 elif test -r /usr/include/odmi.h ; then
202 #
203 # On AIX, the BPF devices might not yet be present - they're
204 # created the first time libpcap runs after booting.
205 # We check for odmi.h instead.
206 #
207 V_PCAP=bpf
208 elif test -r /usr/include/sys/dlpi.h ; then
209 V_PCAP=dlpi
210 elif test -c /dev/bpf0 ; then # check again in case not readable
211 V_PCAP=bpf
212 elif test -c /dev/enet ; then # check again in case not readable
213 V_PCAP=enet
214 elif test -c /dev/nit ; then # check again in case not readable
215 V_PCAP=snit
216 else
217 V_PCAP=null
218 fi
219 AC_MSG_RESULT($V_PCAP)
220
221 dnl
222 dnl Now figure out how we get a list of interfaces and addresses,
223 dnl if we support capturing. Don't bother if we don't support
224 dnl capturing.
225 dnl
226 if test "$V_PCAP" = null
227 then
228 #
229 # We can't capture, so we can't open any capture
230 # devices, so we won't return any interfaces.
231 #
232 V_FINDALLDEVS=null
233 else
234 AC_CHECK_FUNC(getifaddrs,[
235 #
236 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
237 # as well, just in case some platform is really weird.
238 #
239 AC_CHECK_HEADER(ifaddrs.h,[
240 #
241 # We have the header, so we use "getifaddrs()" to
242 # get the list of interfaces.
243 #
244 V_FINDALLDEVS=getad
245 ],[
246 #
247 # We don't have the header - give up.
248 # XXX - we could also fall back on some other
249 # mechanism, but, for now, this'll catch this
250 # problem so that we can at least try to figure
251 # out something to do on systems with "getifaddrs()"
252 # but without "ifaddrs.h", if there is something
253 # we can do on those systems.
254 #
255 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
256 ])
257 ],[
258 #
259 # Well, we don't have "getifaddrs()", so we have to use
260 # some other mechanism; determine what that mechanism is.
261 #
262 # The first thing we use is the type of capture mechanism,
263 # which is somewhat of a proxy for the OS we're using.
264 #
265 case "$V_PCAP" in
266
267 dlpi)
268 #
269 # This might be Solaris 8 or later, with
270 # SIOCGLIFCONF, or it might be some other OS
271 # or some older version of Solaris, with
272 # just SIOCGIFCONF.
273 #
274 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
275 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
276 AC_TRY_COMPILE(
277 [#include <sys/param.h>
278 #include <sys/file.h>
279 #include <sys/ioctl.h>
280 #include <sys/socket.h>
281 #include <sys/sockio.h>],
282 [ioctl(0, SIOCGLIFCONF, (char *)0);],
283 ac_cv_lbl_have_siocglifconf=yes,
284 ac_cv_lbl_have_siocglifconf=no))
285 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
286 if test $ac_cv_lbl_have_siocglifconf = yes ; then
287 V_FINDALLDEVS=glifc
288 else
289 V_FINDALLDEVS=gifc
290 fi
291 ;;
292
293 *)
294 #
295 # Assume we just have SIOCGIFCONF.
296 # (XXX - on at least later Linux kernels, there's
297 # another mechanism, and we should be using that
298 # instead.)
299 #
300 V_FINDALLDEVS=gifc
301 ;;
302 esac])
303 fi
304
305 AC_MSG_CHECKING(if --enable-ipv6 option is specified)
306 AC_ARG_ENABLE(ipv6, [ --enable-ipv6 build IPv6-capable version])
307 if test "$enable_ipv6" = "yes"; then
308 AC_DEFINE(INET6,1,[IPv6])
309 fi
310 AC_MSG_RESULT(${enable_ipv6-no})
311
312 AC_MSG_CHECKING(whether to build optimizer debugging code)
313 AC_ARG_ENABLE(optimizer-dbg, [ --enable-optimizer-dbg build optimizer debugging code])
314 if test "$enable_optimizer_dbg" = "yes"; then
315 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
316 fi
317 AC_MSG_RESULT(${enable_optimizer_dbg-no})
318
319 AC_MSG_CHECKING(whether to build parser debugging code)
320 AC_ARG_ENABLE(yydebug, [ --enable-yydebug build parser debugging code])
321 if test "$enable_yydebug" = "yes"; then
322 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
323 fi
324 AC_MSG_RESULT(${enable_yydebug-no})
325
326 case "$V_PCAP" in
327
328 dlpi)
329 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
330 AC_MSG_CHECKING(for /dev/dlpi device)
331 if test -c /dev/dlpi ; then
332 AC_MSG_RESULT(yes)
333 AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi])
334 else
335 AC_MSG_RESULT(no)
336 dir="/dev/dlpi"
337 AC_MSG_CHECKING(for $dir directory)
338 if test -d $dir ; then
339 AC_MSG_RESULT(yes)
340 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory])
341 else
342 AC_MSG_RESULT(no)
343 fi
344 fi
345 ;;
346
347 linux)
348 AC_MSG_CHECKING(Linux kernel version)
349 if test "$cross_compiling" = yes; then
350 AC_CACHE_VAL(ac_cv_linux_vers,
351 ac_cv_linux_vers=unknown)
352 else
353 AC_CACHE_VAL(ac_cv_linux_vers,
354 ac_cv_linux_vers=`uname -r 2>&1 | \
355 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
356 fi
357 AC_MSG_RESULT($ac_cv_linux_vers)
358 if test $ac_cv_linux_vers = unknown ; then
359 AC_MSG_ERROR(cannot determine linux version when cross-compiling)
360 fi
361 if test $ac_cv_linux_vers -lt 2 ; then
362 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
363 fi
364 AC_LBL_TPACKET_STATS
365 ;;
366
367 dag)
368 V_DEFS="$V_DEFS -DDAG_ONLY"
369 ;;
370
371 septel)
372 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
373 ;;
374
375 null)
376 AC_MSG_WARN(cannot determine packet capture interface)
377 AC_MSG_WARN((see the INSTALL doc for more info))
378 ;;
379
380 esac
381
382 AC_MSG_CHECKING(whether we have /proc/net/dev)
383 if test -r /proc/net/dev ; then
384 ac_cv_lbl_proc_net_dev=yes
385 else
386 ac_cv_lbl_proc_net_dev=no
387 fi
388 if test $ac_cv_lbl_proc_net_dev = yes; then
389 AC_DEFINE(HAVE_PROC_NET_DEV, 1, [define if you have a /proc/net/dev])
390 fi
391 AC_MSG_RESULT($ac_cv_lbl_proc_net_dev)
392
393 # Check for Endace DAG card support.
394 AC_ARG_WITH([dag], [ --with-dag[[=DIR]] include Endace DAG support ("yes", "no" or DIR; default="yes" on BSD and Linux if present)],
395 [
396 if test "$withval" = no
397 then
398 # User doesn't want DAG support.
399 want_dag=no
400 elif test "$withval" = yes
401 then
402 # User wants DAG support but hasn't specified a directory.
403 want_dag=yes
404 else
405 # User wants DAG support and has specified a directory, so use the provided value.
406 want_dag=yes
407 dag_root=$withval
408 fi
409 ],[
410 #
411 # Use DAG API if present, otherwise don't
412 #
413 want_dag=ifpresent
414 ])
415
416 AC_ARG_WITH([dag-includes], [ --with-dag-includes=DIR Endace DAG include directory],
417 [
418 # User wants DAG support and has specified a header directory, so use the provided value.
419 want_dag=yes
420 dag_include_dir=$withval
421 ],[])
422
423 AC_ARG_WITH([dag-libraries], [ --with-dag-libraries=DIR Endace DAG library directory],
424 [
425 # User wants DAG support and has specified a library directory, so use the provided value.
426 want_dag=yes
427 dag_lib_dir=$withval
428 ],[])
429
430 case "$V_PCAP" in
431 linux|bpf|dag)
432 #
433 # We support the DAG API if we're on Linux or BSD, or if we're
434 # building a DAG-only libpcap.
435 #
436 ;;
437 *)
438 #
439 # If the user explicitly requested DAG, tell them it's not
440 # supported.
441 #
442 # If they expressed no preference, don't include it.
443 #
444 if test $want_dag = yes; then
445 AC_MSG_ERROR([DAG support is only available with 'linux' 'bpf' and 'dag' packet capture types])
446 elif test $want_dag = yes; then
447 want_dag=no
448 fi
449 ;;
450 esac
451
452 ac_cv_lbl_dag_api=no
453 if test "$want_dag" != no; then
454
455 AC_MSG_CHECKING([whether we have DAG API headers])
456
457 # If necessary, set default paths for DAG API headers and libraries.
458 if test -z "$dag_root"; then
459 dag_root=/usr/local
460 fi
461
462 if test -z "$dag_include_dir"; then
463 dag_include_dir="$dag_root/include"
464 fi
465
466 if test -z "$dag_lib_dir"; then
467 dag_lib_dir="$dag_root/lib"
468 fi
469
470 if test -z "$dag_tools_dir"; then
471 dag_tools_dir="$dag_root/tools"
472 fi
473
474 if test -r $dag_include_dir/dagapi.h; then
475 ac_cv_lbl_dag_api=yes
476 fi
477 AC_MSG_RESULT([$ac_cv_lbl_dag_api ($dag_include_dir)])
478 fi
479
480 if test $ac_cv_lbl_dag_api = yes; then
481
482 AC_MSG_CHECKING([dagapi.o])
483 dagapi_obj=no
484 if test -r $dag_tools_dir/dagapi.o; then
485 # 2.4.x.
486 dagapi_obj=$dag_tools_dir/dagapi.o
487 elif test -r $dag_lib_dir/dagapi.o; then
488 # 2.5.x.
489 dagapi_obj=$dag_lib_dir/dagapi.o
490 elif test -r $dag_lib_dir/libdag.a; then
491 # 2.5.x.
492 ar x $dag_lib_dir/libdag.a dagapi.o
493 if test -r ./dagapi.o; then
494 dagapi_obj=./dagapi.o
495 else
496 ar x $dag_lib_dir/libdag.a libdag_la-dagapi.o
497 if test -r ./libdag_la-dagapi.o; then
498 dagapi_obj=./libdag_la-dagapi.o
499 fi
500 fi
501 fi
502
503 if test $dagapi_obj = no; then
504 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)])
505 ac_cv_lbl_dag_api=no
506 else
507 AC_MSG_RESULT([yes ($dagapi_obj)])
508 fi
509 fi
510
511 if test $ac_cv_lbl_dag_api = yes; then
512
513 AC_MSG_CHECKING([dagopts.o])
514 dagopts_obj=no
515 if test -r $dag_tools_dir/dagopts.o; then
516 # 2.4.x.
517 dagopts_obj=$dag_tools_dir/dagopts.o
518 elif test -r $dag_lib_dir/dagopts.o; then
519 # 2.5.x.
520 dagopts_obj=$dag_lib_dir/dagopts.o
521 elif test -r $dag_lib_dir/libdag.a; then
522 # 2.5.x.
523 ar x $dag_lib_dir/libdag.a dagopts.o
524 if test -r ./dagopts.o; then
525 dagopts_obj=./dagopts.o
526 else
527 ar x $dag_lib_dir/libdag.a libdag_la-dagopts.o
528 if test -r ./libdag_la-dagopts.o; then
529 dagopts_obj=./libdag_la-dagopts.o
530 fi
531 fi
532 fi
533
534 if test $dagopts_obj = no; then
535 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)])
536 ac_cv_lbl_dag_api=no
537 else
538 AC_MSG_RESULT([yes ($dagopts_obj)])
539 fi
540 fi
541
542 if test $ac_cv_lbl_dag_api = yes; then
543 # Under 2.5.x only we need to add dagreg.o.
544 if test -r $dag_include_dir/dagreg.h; then
545 AC_MSG_CHECKING([dagreg.o])
546 dagreg_obj=no
547 if test -r $dag_lib_dir/dagreg.o; then
548 # Object file is ready and waiting.
549 dagreg_obj=$dag_lib_dir/dagreg.o
550 elif test -r $dag_lib_dir/libdag.a; then
551 # Extract from libdag.a.
552 ar x $dag_lib_dir/libdag.a dagreg.o
553 if test -r ./dagreg.o; then
554 dagreg_obj=./dagreg.o
555 else
556 ar x $dag_lib_dir/libdag.a libdag_la-dagreg.o
557 if test -r ./libdag_la-dagreg.o; then
558 dagreg_obj=./libdag_la-dagreg.o
559 fi
560 fi
561 fi
562
563 if test $dagreg_obj = no; then
564 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_lib_dir/libdag.a)])
565 ac_cv_lbl_dag_api=no
566 else
567 AC_MSG_RESULT([yes ($dagreg_obj)])
568 fi
569 fi
570 fi
571
572 if test $ac_cv_lbl_dag_api = yes; then
573 V_INCLS="$V_INCLS -I$dag_include_dir"
574 V_LIBS="$V_LIBS $dagapi_obj $dagopts_obj $dagreg_obj"
575 if test $V_PCAP != dag ; then
576 SSRC="pcap-dag.c"
577 fi
578
579 # See if we can find a general version string.
580 # Don't need to save and restore LIBS to prevent -ldag being
581 # included if there's a found-action (arg 3).
582 saved_ldflags=$LDFLAGS
583 LDFLAGS="-L$dag_lib_dir"
584 AC_CHECK_LIB([dag], [dag_attach_stream], [dag_version="2.5.x"], [dag_version="2.4.x"])
585 AC_CHECK_LIB([dag],[dag_get_erf_types], [
586 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])]
587 )
588 LDFLAGS=$saved_ldflags
589
590 if test "$dag_version" = 2.5.x; then
591 AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API])
592 DAGLIBS="-ldag"
593 fi
594
595 # See if we can find a specific version string.
596 AC_MSG_CHECKING([the DAG API version])
597 if test -r "$dag_root/VERSION"; then
598 dag_version="`cat $dag_root/VERSION`"
599 fi
600 AC_MSG_RESULT([$dag_version])
601 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
602 fi
603
604 if test $ac_cv_lbl_dag_api = no; then
605 if test "$want_dag" = yes; then
606 # User wanted DAG support but we couldn't find it.
607 AC_MSG_ERROR([DAG API requested, but not found at $dag_root: use --without-dag])
608 fi
609
610 if test "$V_PCAP" = dag; then
611 # User requested "dag" capture type but the DAG API wasn't
612 # found.
613 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.)])
614 fi
615 fi
616
617 AC_ARG_WITH(septel, [ --with-septel[[=DIR]] include Septel support (located in directory DIR, if supplied). [default=yes, on Linux, if present]],
618 [
619 if test "$withval" = no
620 then
621 want_septel=no
622 elif test "$withval" = yes
623 then
624 want_septel=yes
625 septel_root=
626 else
627 want_septel=yes
628 septel_root=$withval
629 fi
630 ],[
631 #
632 # Use Septel API if present, otherwise don't
633 #
634 want_septel=ifpresent
635 septel_root=./../septel
636 ])
637 ac_cv_lbl_septel_api=no
638 case "$V_PCAP" in
639 linux|septel)
640 #
641 # We support the Septel API if we're on Linux, or if we're building
642 # a Septel-only libpcap.
643 #
644 ;;
645 *)
646 #
647 # If the user explicitly requested Septel, tell them it's not
648 # supported.
649 #
650 # If they expressed no preference, don't include it.
651 #
652 if test $want_septel = yes; then
653 AC_MSG_ERROR(Septel support only available with 'linux' and 'septel' packet capture types)
654 elif test $want_septel = yes; then
655 want_septel=no
656 fi
657 ;;
658 esac
659
660 if test "$with_septel" != no; then
661 AC_MSG_CHECKING(whether we have Septel API)
662
663 if test -z "$septel_root"; then
664 septel_root=$srcdir/../septel
665
666 fi
667
668 septel_tools_dir="$septel_root"
669 septel_include_dir="$septel_root/INC"
670 DEF="-DHAVE_SEPTEL_API"
671
672 ac_cv_lbl_septel_api=no
673 if test -r "$septel_include_dir/msg.h"; then
674 V_INCLS="$V_INCLS -I$septel_include_dir"
675 V_DEFS="$V_DEFS $DEF"
676 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 "
677
678 if test "$V_PCAP" != septel ; then
679 SSRC="pcap-septel.c"
680
681 fi
682 ac_cv_lbl_septel_api=yes
683 fi
684
685 AC_MSG_RESULT($ac_cv_lbl_septel_api)
686 if test $ac_cv_lbl_septel_api = no; then
687 if test "$want_septel" = yes; then
688 AC_MSG_ERROR(Septel API not found under directory $septel_root; use --without-septel)
689 fi
690 else
691 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have a Septel API])
692 fi
693 fi
694
695 if test "$V_PCAP" = septel -a "$ac_cv_lbl_septel_api" = no; then
696 AC_MSG_ERROR(Specifying the capture type as 'septel' requires the Septel API to be present; use --with-septel=DIR)
697 fi
698
699
700 AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
701 if test "$V_LEX" = lex ; then
702 # Some versions of lex can't handle the definitions section of scanner.l .
703 # Try lexing it and complain if it can't deal.
704 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
705 if lex -t scanner.l > /dev/null 2>&1; then
706 tcpdump_cv_capable_lex=yes
707 else
708 tcpdump_cv_capable_lex=insufficient
709 fi)
710 if test $tcpdump_cv_capable_lex = insufficient ; then
711 AC_MSG_ERROR([Your operating system's lex is insufficient to compile
712 libpcap. flex is a lex replacement that has many advantages, including
713 being able to compile libpcap. For more information, see
714 http://www.gnu.org/software/flex/flex.html .])
715 fi
716 fi
717
718 DYEXT="so"
719 case "$host_os" in
720
721 aix*)
722 dnl Workaround to enable certain features
723 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
724 ;;
725
726 hpux9*)
727 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
728 ;;
729
730 hpux10.0*)
731 ;;
732
733 hpux10.1*)
734 ;;
735
736 hpux*)
737 dnl HPUX 10.20 and above is similar to HPUX 9, but
738 dnl not the same....
739 dnl
740 dnl XXX - DYEXT should be set to "sl" if this is building
741 dnl for 32-bit PA-RISC, but should be left as "so" for
742 dnl 64-bit PA-RISC or, I suspect, IA-64.
743 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
744 ;;
745
746 sinix*)
747 AC_MSG_CHECKING(if SINIX compiler defines sinix)
748 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
749 AC_TRY_COMPILE(
750 [],
751 [int i = sinix;],
752 ac_cv_cc_sinix_defined=yes,
753 ac_cv_cc_sinix_defined=no))
754 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
755 if test $ac_cv_cc_sinix_defined = no ; then
756 AC_DEFINE(sinix,1,[on sinix])
757 fi
758 ;;
759
760 solaris*)
761 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
762 ;;
763
764 darwin*)
765 DYEXT="dylib"
766 V_CCOPT="$V_CCOPT -fno-common"
767 ;;
768
769 linux*)
770 V_CCOPT="$V_CCOPT -fPIC"
771 ;;
772
773 esac
774
775 AC_PROG_RANLIB
776
777 AC_LBL_DEVEL(V_CCOPT)
778
779 AC_LBL_SOCKADDR_SA_LEN
780
781 AC_LBL_SOCKADDR_STORAGE
782
783 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
784
785 AC_LBL_UNALIGNED_ACCESS
786
787 #
788 # Makefile.in includes rules to generate version.h, so we assume
789 # that it will be generated if autoconf is used.
790 #
791 AC_DEFINE(HAVE_VERSION_H, 1, [define if version.h is generated in the build procedure])
792
793 rm -f net
794 ln -s ${srcdir}/bpf/net net
795
796 AC_SUBST(V_CCOPT)
797 AC_SUBST(V_DEFS)
798 AC_SUBST(V_INCLS)
799 AC_SUBST(V_LIBS)
800 AC_SUBST(V_LEX)
801 AC_SUBST(V_PCAP)
802 AC_SUBST(V_FINDALLDEVS)
803 AC_SUBST(V_RANLIB)
804 AC_SUBST(V_YACC)
805 AC_SUBST(SSRC)
806 AC_SUBST(DYEXT)
807 AC_SUBST(DAGLIBS)
808
809 AC_PROG_INSTALL
810
811 AC_CONFIG_HEADER(config.h)
812
813 AC_OUTPUT(Makefile)
814
815 if test -f .devel ; then
816 make depend
817 fi
818 exit 0