1 dnl Copyright (c) 1994, 1995, 1996, 1997
2 dnl The Regents of the University of California. All rights reserved.
4 dnl Process this file with autoconf to produce a configure script.
10 # http://ftp.gnu.org/gnu/config/README
12 # for the URLs to use to fetch new versions of config.guess and
21 AC_LBL_C_INIT_BEFORE_CC(V_INCLS)
23 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
26 if test "$ac_cv___attribute__" = "yes"; then
27 AC_C___ATTRIBUTE___UNUSED
28 AC_C___ATTRIBUTE___NORETURN_FUNCTION_POINTER
29 AC_C___ATTRIBUTE___FORMAT
30 if test "$ac_cv___attribute___format" = "yes"; then
31 AC_C___ATTRIBUTE___FORMAT_FUNCTION_POINTER
35 AC_CHECK_HEADERS(fcntl.h rpc/rpc.h rpc/rpcent.h netdnet/dnetdb.h)
36 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
37 #include <sys/socket.h>
39 if test "$ac_cv_header_net_pfvar_h" = yes; then
40 LOCALSRC="print-pflog.c $LOCALSRC"
42 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
43 #include <sys/socket.h>])
44 if test "$ac_cv_header_netinet_if_ether_h" != yes; then
46 # The simple test didn't work.
47 # Do we need to include <net/if.h> first?
48 # Unset ac_cv_header_netinet_if_ether_h so we don't
49 # treat the previous failure as a cached value and
50 # suppress the next test.
52 AC_MSG_NOTICE([Rechecking with some additional includes])
53 unset ac_cv_header_netinet_if_ether_h
54 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
55 #include <sys/socket.h>
56 #include <netinet/in.h>
67 AC_ARG_ENABLE(universal,
68 AC_HELP_STRING([--disable-universal],[don't build universal on OS X]))
69 if test "$enable_universal" != "no"; then
74 # Leopard. Build for x86 and 32-bit PowerPC, with
75 # x86 first. (That's what Apple does.)
77 V_CCOPT="$V_CCOPT -arch i386 -arch ppc"
78 LDFLAGS="$LDFLAGS -arch i386 -arch ppc"
83 # Snow Leopard. Build for x86-64 and x86, with
84 # x86-64 first. (That's what Apple does.)
86 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386"
87 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386"
96 [ --with-smi link with libsmi (allows to load MIBs on the fly to decode SNMP packets. [default=yes]
97 --without-smi don't link with libsmi],,
100 if test "x$with_smi" != "xno" ; then
101 AC_CHECK_HEADER(smi.h,
104 # OK, we found smi.h. Do we have libsmi with smiInit?
106 AC_CHECK_LIB(smi, smiInit,
109 # OK, we have libsmi with smiInit. Can we use it?
111 AC_MSG_CHECKING([whether to enable libsmi])
116 /* libsmi available check */
120 int current, revision, age, n;
121 const int required = 2;
124 if (strcmp(SMI_LIBRARY_VERSION, smi_library_version))
126 n = sscanf(smi_library_version, "%d:%d:%d", ¤t, &revision, &age);
129 if (required < current - age || required > current)
136 AC_DEFINE(USE_LIBSMI, 1,
137 [Define if you enable support for libsmi])
140 dnl autoconf documentation says that
141 dnl $? contains the exit value.
142 dnl reality is that it does not.
143 dnl We leave this in just in case
144 dnl autoconf ever comes back to
145 dnl match the documentation.
147 1) AC_MSG_RESULT(no - smiInit failed) ;;
148 2) AC_MSG_RESULT(no - header/library version mismatch) ;;
149 3) AC_MSG_RESULT(no - can't determine library version) ;;
150 4) AC_MSG_RESULT(no - too old) ;;
151 *) AC_MSG_RESULT(no) ;;
156 AC_MSG_RESULT(not when cross-compiling)
164 AC_MSG_CHECKING([whether to enable the possibly-buggy SMB printer])
166 [ --enable-smb enable possibly-buggy SMB printer [default=yes]
167 --disable-smb disable possibly-buggy SMB printer],,
170 yes) AC_MSG_RESULT(yes)
171 AC_WARN([The SMB printer may have exploitable buffer overflows!!!])
172 AC_DEFINE(TCPDUMP_DO_SMB, 1,
173 [define if you want to build the possibly-buggy SMB printer])
174 LOCALSRC="print-smb.c smbutil.c $LOCALSRC"
180 AC_ARG_WITH(user, [ --with-user=USERNAME drop privileges by default to USERNAME])
181 AC_MSG_CHECKING([whether to drop root privileges by default])
182 if test ! -z "$with_user" ; then
183 AC_DEFINE_UNQUOTED(WITH_USER, "$withval",
184 [define if should drop privileges by default])
185 AC_MSG_RESULT(to \"$withval\")
190 AC_ARG_WITH(chroot, [ --with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY])
191 AC_MSG_CHECKING([whether to chroot])
192 if test ! -z "$with_chroot" && test "$with_chroot" != "no" ; then
193 AC_DEFINE_UNQUOTED(WITH_CHROOT, "$withval",
194 [define if should chroot when dropping privileges])
195 AC_MSG_RESULT(to \"$withval\")
200 AC_ARG_WITH(sandbox-capsicum,
201 AS_HELP_STRING([--with-sandbox-capsicum],
202 [use Capsicum security functions @<:@default=yes, if available@:>@]))
204 # Check whether various functions are available. If any are, set
205 # ac_lbl_capsicum_function_seen to yes; if any are not, set
206 # ac_lbl_capsicum_function_not_seen to yes.
208 # We don't check cap_rights_init(), as it's a macro, wrapping another
209 # function, in at least some versions of FreeBSD, and AC_CHECK_FUNCS()
210 # doesn't handle that.
212 # All of the ones we check for must be available in order to enable
213 # capsicum sandboxing.
215 # XXX - do we need to check for all of them, or are there some that, if
216 # present, imply others are present?
218 if test ! -z "$with_sandbox-capsicum" && test "$with_sandbox-capsicum" != "no" ; then
219 AC_CHECK_FUNCS(cap_enter cap_rights_limit cap_ioctls_limit openat,
220 ac_lbl_capsicum_function_seen=yes,
221 ac_lbl_capsicum_function_not_seen=yes)
223 AC_MSG_CHECKING([whether to sandbox using capsicum])
224 if test "x$ac_lbl_capsicum_function_seen" = "xyes" -a "x$ac_lbl_capsicum_function_not_seen" != "xyes"; then
225 AC_DEFINE(HAVE_CAPSICUM, 1, [capsicum support available])
232 # We must check this before checking whether to enable IPv6, because,
233 # on some platforms (such as SunOS 5.x), the test program requires
234 # the extra networking libraries.
238 AC_MSG_CHECKING([whether to enable ipv6])
240 [ --enable-ipv6 enable ipv6 (with ipv4) support
241 --disable-ipv6 disable ipv6 support],
242 [ case "$enableval" in
243 yes) AC_MSG_RESULT(yes)
244 LOCALSRC="print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c print-babel.c $LOCALSRC"
245 AC_DEFINE(INET6, 1, [Define if you enable IPv6 support])
257 [[/* AF_INET6 available check */
258 #include <sys/types.h>
259 #include <sys/socket.h>
260 #include <netinet/in.h>
263 foo(struct in6_addr *addr)
265 memset(addr, 0, sizeof (struct in6_addr));
268 #error "AF_INET6 not defined"
273 LOCALSRC="print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c print-babel.c $LOCALSRC"
274 AC_DEFINE(INET6, 1, [Define if you enable IPv6 support])
286 if test "$ipv6" = "yes"; then
287 AC_MSG_CHECKING([ipv6 stack type])
288 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
291 dnl http://www.kame.net/
293 [#include <netinet/in.h>
294 #ifdef IPV6_INRIA_VERSION
298 CFLAGS="-DINET6 $CFLAGS"])
301 dnl http://www.kame.net/
303 [#include <netinet/in.h>
309 ipv6libdir=/usr/local/v6/lib;
311 CFLAGS="-DINET6 $CFLAGS"])
314 dnl http://www.v6.linux.or.jp/
316 [#include <features.h>
317 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
321 CFLAGS="-DINET6 $CFLAGS"])
324 dnl http://www.v6.linux.or.jp/
326 dnl This also matches Solaris 8 and Tru64 UNIX 5.1,
327 dnl and possibly other versions of those OSes
329 if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
332 ipv6libdir=/usr/inet6/lib
334 CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
339 [#include <sys/param.h>
340 #ifdef _TOSHIBA_INET6
345 ipv6libdir=/usr/local/v6/lib;
346 CFLAGS="-DINET6 $CFLAGS"])
350 [#include </usr/local/v6/include/sys/v6config.h>
356 ipv6libdir=/usr/local/v6/lib;
357 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
361 [#include <sys/param.h>
362 #ifdef _ZETA_MINAMI_INET6
367 ipv6libdir=/usr/local/v6/lib;
368 CFLAGS="-DINET6 $CFLAGS"])
371 if test "$ipv6type" != "unknown"; then
375 AC_MSG_RESULT($ipv6type)
378 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
379 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
380 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
381 echo "You have $ipv6lib library, using it"
383 if test "$ipv6trylibc" = "yes"; then
384 echo "You do not have $ipv6lib library, using libc"
386 echo 'Fatal: no $ipv6lib library found. cannot continue.'
387 echo "You need to fetch lib$ipv6lib.a from appropriate"
388 echo 'ipv6 kit and compile beforehand.'
395 if test "$ipv6" = "yes"; then
397 # XXX - on Tru64 UNIX 5.1, there is no "getaddrinfo()"
398 # function in libc; there are "ngetaddrinfo()" and
399 # "ogetaddrinfo()" functions, and <netdb.h> #defines
400 # "getaddrinfo" to be either "ngetaddrinfo" or
401 # "ogetaddrinfo", depending on whether _SOCKADDR_LEN
402 # or _XOPEN_SOURCE_EXTENDED are defined or not.
404 # So this test doesn't work on Tru64 5.1, and possibly
405 # on other 5.x releases. This causes the configure
406 # script to become confused, and results in libpcap
409 AC_SEARCH_LIBS(getaddrinfo, socket, [dnl
410 AC_MSG_CHECKING(getaddrinfo bug)
411 AC_CACHE_VAL(td_cv_buggygetaddrinfo, [AC_TRY_RUN([
412 #include <sys/types.h>
415 #include <sys/socket.h>
416 #include <netinet/in.h>
420 int passive, gaierr, inet4 = 0, inet6 = 0;
421 struct addrinfo hints, *ai, *aitop;
422 char straddr[INET6_ADDRSTRLEN], strport[16];
424 for (passive = 0; passive <= 1; passive++) {
425 memset(&hints, 0, sizeof(hints));
426 hints.ai_family = AF_UNSPEC;
427 hints.ai_flags = passive ? AI_PASSIVE : 0;
428 hints.ai_socktype = SOCK_STREAM;
429 hints.ai_protocol = IPPROTO_TCP;
430 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
431 (void)gai_strerror(gaierr);
434 for (ai = aitop; ai; ai = ai->ai_next) {
435 if (ai->ai_addr == NULL ||
436 ai->ai_addrlen == 0 ||
437 getnameinfo(ai->ai_addr, ai->ai_addrlen,
438 straddr, sizeof(straddr), strport, sizeof(strport),
439 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
442 switch (ai->ai_family) {
444 if (strcmp(strport, "54321") != 0) {
448 if (strcmp(straddr, "0.0.0.0") != 0) {
452 if (strcmp(straddr, "127.0.0.1") != 0) {
459 if (strcmp(strport, "54321") != 0) {
463 if (strcmp(straddr, "::") != 0) {
467 if (strcmp(straddr, "::1") != 0) {
484 /* another family support? */
490 /* supported family should be 2, unsupported family should be 0 */
491 if (!(inet4 == 0 || inet4 == 2))
493 if (!(inet6 == 0 || inet6 == 2))
506 td_cv_buggygetaddrinfo=no,
507 td_cv_buggygetaddrinfo=yes,
508 td_cv_buggygetaddrinfo=unknown)])
509 if test "$td_cv_buggygetaddrinfo" = no; then
511 elif test "$td_cv_buggygetaddrinfo" = unknown; then
512 AC_MSG_RESULT([unknown (cross-compiling)])
517 if test "$td_cv_buggygetaddrinfo" = "yes"; then
519 # XXX - it doesn't appear that "ipv6type" can ever be
520 # set to "linux". Should this be testing for
521 # "linux-glibc", or for that *or* "linux-libinet6"?
522 # If the latter, note that "linux-libinet6" is also
523 # the type given to some non-Linux OSes.
525 if test "$ipv6type" != "linux"; then
526 echo 'Fatal: You must get working getaddrinfo() function.'
527 echo ' or you can specify "--disable-ipv6"'.
530 echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
531 echo ' Better upgrade your system library to newest version'
532 echo ' of GNU C library (aka glibc).'
536 AC_REPLACE_FUNCS(getnameinfo)
539 AC_CACHE_CHECK([for dnet_htoa declaration in netdnet/dnetdb.h],
540 [td_cv_decl_netdnet_dnetdb_h_dnet_htoa],
541 [AC_EGREP_HEADER(dnet_htoa, netdnet/dnetdb.h,
542 td_cv_decl_netdnet_dnetdb_h_dnet_htoa=yes,
543 td_cv_decl_netdnet_dnetdb_h_dnet_htoa=no)])
544 if test "$td_cv_decl_netdnet_dnetdb_h_dnet_htoa" = yes; then
545 AC_DEFINE(HAVE_NETDNET_DNETDB_H_DNET_HTOA, 1,
546 [define if you have a dnet_htoa declaration in <netdnet/dnetdb.h>])
550 dnl Checks for addrinfo structure
551 AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
552 if test "$ac_cv_addrinfo" = no; then
557 dnl Checks for NI_MAXSERV
558 AC_NI_MAXSERV(ac_cv_maxserv)
559 if test "$ac_cv_maxserv" = no; then
564 dnl Checks for NI_NAMEREQD
565 AC_NI_NAMEREQD(ac_cv_namereqd)
566 if test "$ac_cv_namereqd" = no; then
570 AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup strsep getopt_long)
571 AC_CHECK_FUNCS(fork vfork strftime)
572 AC_CHECK_FUNCS(setlinebuf alarm)
575 AC_CHECK_FUNCS(vsnprintf snprintf,,
577 if test $needsnprintf = yes; then
583 AC_SEARCH_LIBS(dnet_htoa, dnet,
584 AC_DEFINE(HAVE_DNET_HTOA, 1, [define if you have the dnet_htoa function]))
586 AC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpc
588 dnl Some platforms may need -lnsl for getrpcbynumber.
589 AC_SEARCH_LIBS(getrpcbynumber, nsl,
590 AC_DEFINE(HAVE_GETRPCBYNUMBER, 1, [define if you have getrpcbynumber()]))
592 dnl AC_CHECK_LIB(z, uncompress)
593 dnl AC_CHECK_HEADERS(zlib.h)
595 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
598 # Check for these after AC_LBL_LIBPCAP, so we link with the appropriate
599 # libraries (e.g., "-lsocket -lnsl" on Solaris).
601 # We don't use AC_REPLACE_FUNCS because that uses AC_CHECK_FUNCS which
602 # use AC_CHECK_FUNC which doesn't let us specify the right #includes
603 # to make this work on BSD/OS 4.x. BSD/OS 4.x ships with the BIND8
604 # resolver, and the way it defines inet_{ntop,pton} is rather strange;
605 # it does not ship with a libc symbol "inet_ntop()", it ships with
606 # "_inet_ntop()", and has a #define macro in one of the system headers
609 dnl AC_TRY_COMPILE(inet_ntop inet_pton inet_aton)
610 AC_MSG_CHECKING(for inet_ntop)
611 AC_TRY_LINK([#include <sys/types.h>
612 #include <sys/socket.h>
613 #include <netinet/in.h>
614 #include <arpa/inet.h>], [char src[4], dst[128];
615 inet_ntop(AF_INET, src, dst, sizeof(dst));],
616 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
617 AC_LIBOBJ(inet_ntop)])
618 AC_MSG_CHECKING(for inet_pton)
619 AC_TRY_LINK([#include <sys/types.h>
620 #include <sys/socket.h>
621 #include <netinet/in.h>
622 #include <arpa/inet.h>], [char src[128], dst[4];
623 inet_pton(AF_INET, src, dst);],
624 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
625 AC_LIBOBJ(inet_pton)])
626 AC_MSG_CHECKING(for inet_aton)
627 AC_TRY_LINK([#include <sys/types.h>
628 #include <netinet/in.h>
629 #include <arpa/inet.h>], [char src[128];
631 inet_aton(src, &dst);],
632 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
633 AC_LIBOBJ(inet_aton)])
636 # Check for these after AC_LBL_LIBPCAP, for the same reason.
638 # You are in a twisty little maze of UN*Xes, all different.
639 # Some might not have ether_ntohost().
640 # Some might have it, but not declare it in any header file.
641 # Some might have it, but declare it in <netinet/if_ether.h>.
642 # Some might have it, but declare it in <netinet/ether.h>
643 # (And some might have it but document it as something declared in
644 # <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
646 # Before you is a C compiler.
648 AC_CHECK_FUNCS(ether_ntohost, [
649 AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
652 #include <sys/types.h>
653 #include <sys/param.h>
654 #include <sys/socket.h>
657 main(int argc, char **argv)
659 u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
660 char name[MAXHOSTNAMELEN];
662 ether_ntohost(name, (struct ether_addr *)ea);
665 ], [ac_cv_buggy_ether_ntohost=no],
666 [ac_cv_buggy_ether_ntohost=yes],
667 [ac_cv_buggy_ether_ntohost="not while cross-compiling"])])
668 if test "$ac_cv_buggy_ether_ntohost" = "no"; then
669 AC_DEFINE(USE_ETHER_NTOHOST, 1,
670 [define if you have ether_ntohost() and it works])
673 if test "$ac_cv_func_ether_ntohost" = yes -a \
674 "$ac_cv_buggy_ether_ntohost" = "no"; then
676 # OK, we have ether_ntohost(). Do we have <netinet/if_ether.h>?
678 if test "$ac_cv_header_netinet_if_ether_h" = yes; then
680 # Yes. Does it declare ether_ntohost()?
682 AC_CHECK_DECL(ether_ntohost,
684 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST,,
685 [Define to 1 if netinet/if_ether.h declares `ether_ntohost'])
688 #include <sys/types.h>
689 #include <sys/socket.h>
690 #include <netinet/in.h>
691 #include <arpa/inet.h>
695 #include <netinet/if_ether.h>
701 if test "$ac_cv_have_decl_ether_ntohost" != yes; then
703 # No, how about <netinet/ether.h>, as on Linux?
705 AC_CHECK_HEADERS(netinet/ether.h)
706 if test "$ac_cv_header_netinet_ether_h" = yes; then
708 # We have it - does it declare ether_ntohost()?
709 # Unset ac_cv_have_decl_ether_ntohost so we don't
710 # treat the previous failure as a cached value and
711 # suppress the next test.
713 unset ac_cv_have_decl_ether_ntohost
714 AC_CHECK_DECL(ether_ntohost,
716 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,,
717 [Define to 1 if netinet/ether.h declares `ether_ntohost'])
720 #include <netinet/ether.h>
725 # Is ether_ntohost() declared?
727 if test "$ac_cv_have_decl_ether_ntohost" != yes; then
729 # No, we'll have to declare it ourselves.
730 # Do we have "struct ether_addr"?
732 AC_CHECK_TYPES(struct ether_addr,,,
734 #include <sys/types.h>
735 #include <sys/socket.h>
736 #include <netinet/in.h>
737 #include <arpa/inet.h>
741 #include <netinet/if_ether.h>
743 AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 0,
744 [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
747 AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 1,
748 [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
753 # libdlpi is needed for Solaris 11 and later.
754 AC_CHECK_LIB(dlpi, dlpi_walk, LIBS="$LIBS -ldlpi" LDFLAGS="-L/lib $LDFLAGS", ,-L/lib)
756 dnl portability macros for getaddrinfo/getnameinfo
759 AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
760 if test "$ac_cv_sockaddr_has_sa_len" = no; then
765 # Do we have the new open API? Check for pcap_create, and assume that,
766 # if we do, we also have pcap_activate() and the other new routines
767 # introduced in libpcap 1.0.0.
769 AC_CHECK_FUNCS(pcap_create)
770 if test $ac_cv_func_pcap_create = "yes" ; then
772 # OK, do we have pcap_set_tstamp_type? If so, assume we have
773 # pcap_list_tstamp_types and pcap_free_tstamp_types as well.
775 AC_CHECK_FUNCS(pcap_set_tstamp_type)
777 # And do we have pcap_set_tstamp_precision? If so, we assume
778 # we also have pcap_open_offline_with_tstamp_precision.
780 AC_CHECK_FUNCS(pcap_set_tstamp_precision)
783 AC_CHECK_FUNCS(pcap_findalldevs pcap_dump_flush pcap_lib_version pcap_setdirection)
784 if test $ac_cv_func_pcap_findalldevs = "yes" ; then
785 dnl Check for Mac OS X, which may ship pcap.h from 0.6 but libpcap may
786 dnl be 0.8; this means that lib has pcap_findalldevs but header doesn't
788 savedcppflags="$CPPFLAGS"
789 CPPFLAGS="$CPPFLAGS $V_INCLS"
790 AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>])
791 CPPFLAGS="$savedcppflags"
794 if test $ac_cv_func_pcap_lib_version = "no" ; then
795 AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
798 extern char pcap_version[];
800 return (int)pcap_version;
802 ac_lbl_cv_pcap_version_defined=yes,
803 ac_lbl_cv_pcap_version_defined=no)
804 if test "$ac_lbl_cv_pcap_version_defined" = yes ; then
806 AC_DEFINE(HAVE_PCAP_VERSION, 1, [define if libpcap has pcap_version])
811 AC_MSG_CHECKING(whether pcap_debug is defined by libpcap)
814 extern int pcap_debug;
818 ac_lbl_cv_pcap_debug_defined=yes,
819 ac_lbl_cv_pcap_debug_defined=no)
820 if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then
822 AC_DEFINE(HAVE_PCAP_DEBUG, 1, [define if libpcap has pcap_debug])
826 # OK, what about "yydebug"?
828 AC_MSG_CHECKING(whether yydebug is defined by libpcap)
835 ac_lbl_cv_yydebug_defined=yes,
836 ac_lbl_cv_yydebug_defined=no)
837 if test "$ac_lbl_cv_yydebug_defined" = yes ; then
839 AC_DEFINE(HAVE_YYDEBUG, 1, [define if libpcap has yydebug])
844 AC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6
847 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
851 # Assume V7/BSD convention for man pages (file formats in section 5,
852 # miscellaneous info in section 7).
859 dnl Workaround to enable certain features
860 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
865 # Use System V conventions for man pages.
875 # Use System V conventions for man pages.
885 # Use System V conventions for man pages.
895 # Use System V conventions for man pages.
902 if test -f /dev/bpf0 ; then
907 # Make sure we have definitions for all the C99 specified-width types
908 # (regardless of whether the environment is a C99 environment or not).
920 # Define the old BSD specified-width types in terms of the C99 types;
921 # we may need them with libpcap include files.
923 AC_CHECK_TYPE([u_int8_t], ,
924 [AC_DEFINE([u_int8_t], [uint8_t],
925 [Define to `uint8_t' if u_int8_t not defined.])],
927 #include <sys/types.h>
929 AC_CHECK_TYPE([u_int16_t], ,
930 [AC_DEFINE([u_int16_t], [uint16_t],
931 [Define to `uint16_t' if u_int16_t not defined.])],
933 #include <sys/types.h>
935 AC_CHECK_TYPE([u_int32_t], ,
936 [AC_DEFINE([u_int32_t], [uint32_t],
937 [Define to `uint32_t' if u_int32_t not defined.])],
939 #include <sys/types.h>
941 AC_CHECK_TYPE([u_int64_t], ,
942 [AC_DEFINE([u_int64_t], [uint64_t],
943 [Define to `uint64_t' if u_int64_t not defined.])],
945 #include <sys/types.h>
949 # Check for <inttypes.h>
951 AC_CHECK_HEADERS(inttypes.h,
954 # OK, we have inttypes.h, but does it define all the PRI[doxu]64 macros?
955 # Some systems have an inttypes.h that doesn't define all of them.
957 AC_MSG_CHECKING([[whether inttypes.h defines the PRI[doxu]64 macros]])
962 #include <inttypes.h>
964 #include <sys/types.h>
968 printf("%" PRId64 "\n", (uint64_t)1);
969 printf("%" PRIo64 "\n", (uint64_t)1);
970 printf("%" PRIx64 "\n", (uint64_t)1);
971 printf("%" PRIu64 "\n", (uint64_t)1);
977 ac_lbl_inttypes_h_defines_formats=yes
981 ac_lbl_inttypes_h_defines_formats=no
986 # We don't have inttypes.h, so it obviously can't define those
989 ac_lbl_inttypes_h_defines_formats=no
991 if test "$ac_lbl_inttypes_h_defines_formats" = no; then
992 AC_LBL_CHECK_64BIT_FORMAT(l,
994 AC_LBL_CHECK_64BIT_FORMAT(ll,
996 AC_LBL_CHECK_64BIT_FORMAT(L,
998 AC_LBL_CHECK_64BIT_FORMAT(q,
1000 AC_MSG_ERROR([neither %llx nor %Lx nor %qx worked on a 64-bit integer])
1008 # Check for some headers introduced in later versions of libpcap
1009 # and used by some printers.
1011 # Those headers use the {u_}intN_t types, so we must do this after
1012 # we check for what's needed to get them defined.
1014 savedcppflags="$CPPFLAGS"
1015 CPPFLAGS="$CPPFLAGS $V_INCLS"
1016 AC_CHECK_HEADERS(pcap/bluetooth.h,,,[#include "tcpdump-stdinc.h"])
1017 AC_CHECK_HEADERS(pcap/nflog.h,,,[#include "tcpdump-stdinc.h"])
1018 AC_CHECK_HEADERS(pcap/usb.h,,,[#include "tcpdump-stdinc.h"])
1019 CPPFLAGS="$savedcppflags"
1022 AC_CHECK_TOOL([AR], [ar])
1024 AC_LBL_DEVEL(V_CCOPT)
1026 AC_LBL_SOCKADDR_SA_LEN
1028 AC_LBL_UNALIGNED_ACCESS
1032 # Check for OpenSSL libcrypto
1033 AC_MSG_CHECKING(whether to use OpenSSL libcrypto)
1034 # Specify location for both includes and libraries.
1035 want_libcrypto=ifavailable
1037 AS_HELP_STRING([--with-crypto],
1038 [use OpenSSL libcrypto @<:@default=yes, if available@:>@]),
1040 if test $withval = no
1044 elif test $withval = yes
1051 # Use libcrypto if it's present, otherwise don't.
1053 want_libcrypto=ifavailable
1054 AC_MSG_RESULT([yes, if available])
1056 if test "$want_libcrypto" != "no"; then
1057 AC_CHECK_LIB(crypto, DES_cbc_encrypt)
1058 AC_CHECK_HEADERS(openssl/evp.h)
1062 dnl set additional include path if necessary
1063 if test "$missing_includes" = "yes"; then
1064 CPPFLAGS="$CPPFLAGS -I$srcdir/missing"
1065 V_INCLS="$V_INCLS -I$srcdir/missing"
1074 AC_SUBST(MAN_FILE_FORMATS)
1075 AC_SUBST(MAN_MISC_INFO)
1079 AC_CONFIG_HEADER(config.h)
1081 AC_OUTPUT_COMMANDS([if test -f .devel; then
1082 echo timestamp > stamp-h
1083 cat Makefile-devel-adds >> Makefile
1086 AC_OUTPUT(Makefile tcpdump.1)