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
17 AC_INIT(tcpdump, m4_esyscmd_s([cat VERSION]))
18 AC_CONFIG_SRCDIR(tcpdump.c)
22 AC_LBL_C_INIT_BEFORE_CC(V_INCLS)
24 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
27 AC_CHECK_HEADERS(fcntl.h rpc/rpc.h rpc/rpcent.h net/if.h)
28 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
29 #include <sys/socket.h>
31 if test "$ac_cv_header_net_pfvar_h" = yes; then
32 AC_CHECK_HEADERS(net/if_pflog.h, , , [#include <sys/types.h>
33 #include <sys/socket.h>
35 #include <net/pfvar.h>])
36 if test "$ac_cv_header_net_if_pflog_h" = yes; then
37 LOCALSRC="print-pflog.c $LOCALSRC"
44 AC_ARG_ENABLE(universal,
45 AC_HELP_STRING([--disable-universal],[don't build universal on macOS]))
46 if test "$enable_universal" != "no"; then
51 # Leopard. Build for x86 and 32-bit PowerPC, with
52 # x86 first. (That's what Apple does.)
54 V_CCOPT="$V_CCOPT -arch i386 -arch ppc"
55 LDFLAGS="$LDFLAGS -arch i386 -arch ppc"
60 # Snow Leopard. Build for x86-64 and x86, with
61 # x86-64 first. (That's what Apple does.)
63 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386"
64 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386"
73 [ --with-smi link with libsmi (allows to load MIBs on the fly to decode SNMP packets. [default=yes]
74 --without-smi don't link with libsmi],,
77 if test "x$with_smi" != "xno" ; then
78 AC_CHECK_HEADER(smi.h,
81 # OK, we found smi.h. Do we have libsmi with smiInit?
83 AC_CHECK_LIB(smi, smiInit,
86 # OK, we have libsmi with smiInit. Can we use it?
88 AC_MSG_CHECKING([whether to enable libsmi])
93 /* libsmi available check */
97 int current, revision, age, n;
98 const int required = 2;
101 if (strcmp(SMI_LIBRARY_VERSION, smi_library_version))
103 n = sscanf(smi_library_version, "%d:%d:%d", ¤t, &revision, &age);
106 if (required < current - age || required > current)
113 AC_DEFINE(USE_LIBSMI, 1,
114 [Define if you enable support for libsmi])
117 dnl autoconf documentation says that
118 dnl $? contains the exit value.
119 dnl reality is that it does not.
120 dnl We leave this in just in case
121 dnl autoconf ever comes back to
122 dnl match the documentation.
124 1) AC_MSG_RESULT(no - smiInit failed) ;;
125 2) AC_MSG_RESULT(no - header/library version mismatch) ;;
126 3) AC_MSG_RESULT(no - can't determine library version) ;;
127 4) AC_MSG_RESULT(no - too old) ;;
128 *) AC_MSG_RESULT(no) ;;
133 AC_MSG_RESULT(not when cross-compiling)
141 AC_MSG_CHECKING([whether to enable the possibly-buggy SMB printer])
143 [ --enable-smb enable possibly-buggy SMB printer [default=yes]
144 --disable-smb disable possibly-buggy SMB printer],,
147 yes) AC_MSG_RESULT(yes)
148 AC_WARN([The SMB printer may have exploitable buffer overflows!!!])
149 AC_DEFINE(ENABLE_SMB, 1,
150 [define if you want to build the possibly-buggy SMB printer])
151 LOCALSRC="print-smb.c smbutil.c $LOCALSRC"
157 AC_ARG_WITH(user, [ --with-user=USERNAME drop privileges by default to USERNAME])
158 AC_MSG_CHECKING([whether to drop root privileges by default])
159 if test ! -z "$with_user" ; then
160 AC_DEFINE_UNQUOTED(WITH_USER, "$withval",
161 [define if should drop privileges by default])
162 AC_MSG_RESULT(to \"$withval\")
167 AC_ARG_WITH(chroot, [ --with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY])
168 AC_MSG_CHECKING([whether to chroot])
169 if test ! -z "$with_chroot" && test "$with_chroot" != "no" ; then
170 AC_DEFINE_UNQUOTED(WITH_CHROOT, "$withval",
171 [define if should chroot when dropping privileges])
172 AC_MSG_RESULT(to \"$withval\")
177 AC_ARG_WITH(sandbox-capsicum,
178 AS_HELP_STRING([--with-sandbox-capsicum],
179 [use Capsicum security functions @<:@default=yes, if available@:>@]))
181 # Check whether various functions are available. If any are, set
182 # ac_lbl_capsicum_function_seen to yes; if any are not, set
183 # ac_lbl_capsicum_function_not_seen to yes.
185 # We don't check cap_rights_init(), as it's a macro, wrapping another
186 # function, in at least some versions of FreeBSD, and AC_CHECK_FUNCS()
187 # doesn't handle that.
189 # All of the ones we check for must be available in order to enable
190 # capsicum sandboxing.
192 # XXX - do we need to check for all of them, or are there some that, if
193 # present, imply others are present?
195 if test ! -z "$with_sandbox-capsicum" && test "$with_sandbox-capsicum" != "no" ; then
196 AC_CHECK_FUNCS(cap_enter cap_rights_limit cap_ioctls_limit openat,
197 ac_lbl_capsicum_function_seen=yes,
198 ac_lbl_capsicum_function_not_seen=yes)
199 AC_CHECK_LIB(casper, cap_init, LIBS="$LIBS -lcasper")
200 AC_CHECK_LIB(cap_dns, cap_gethostbyaddr, LIBS="$LIBS -lcap_dns")
202 AC_MSG_CHECKING([whether to sandbox using capsicum])
203 if test "x$ac_lbl_capsicum_function_seen" = "xyes" -a "x$ac_lbl_capsicum_function_not_seen" != "xyes"; then
204 AC_DEFINE(HAVE_CAPSICUM, 1, [capsicum support available])
209 AC_MSG_CHECKING([whether to sandbox using Casper library])
210 if test "x$ac_cv_lib_casper_cap_init" = "xyes" -a "x$ac_cv_lib_cap_dns_cap_gethostbyaddr" = "xyes"; then
211 AC_DEFINE(HAVE_CASPER, 1, [Casper support available])
218 # We must check this before checking whether to check the OS's IPv6,
219 # support because, on some platforms (such as SunOS 5.x), the test
220 # program requires the extra networking libraries.
225 # Check whether AF_INET6 and struct in6_addr are defined.
226 # If they aren't both defined, we don't have sufficient OS
227 # support for IPv6, so we don't look for IPv6 support libraries,
228 # and we define AF_INET6 and struct in6_addr ourselves.
230 AC_MSG_CHECKING([whether the operating system supports IPv6])
235 /* AF_INET6 available check */
236 #include <sys/types.h>
238 #include <ws2tcpip.h>
240 #include <sys/socket.h>
241 #include <netinet/in.h>
245 foo(struct in6_addr *addr)
247 memset(addr, 0, sizeof (struct in6_addr));
250 #error "AF_INET6 not defined"
256 AC_DEFINE(HAVE_OS_IPV6_SUPPORT, 1,
257 [define if the OS provides AF_INET6 and struct in6_addr])
270 if test "$ipv6" = "yes"; then
271 AC_MSG_CHECKING([ipv6 stack type])
272 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
275 dnl http://www.kame.net/
277 [#include <netinet/in.h>
278 #ifdef IPV6_INRIA_VERSION
284 dnl http://www.kame.net/
286 [#include <netinet/in.h>
292 ipv6libdir=/usr/local/v6/lib;
296 dnl http://www.v6.linux.or.jp/
298 [#include <features.h>
299 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
305 dnl http://www.v6.linux.or.jp/
307 dnl This also matches Solaris 8 and Tru64 UNIX 5.1,
308 dnl and possibly other versions of those OSes
310 if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
313 ipv6libdir=/usr/inet6/lib
315 CFLAGS="-I/usr/inet6/include $CFLAGS"
320 [#include <sys/param.h>
321 #ifdef _TOSHIBA_INET6
326 ipv6libdir=/usr/local/v6/lib])
330 [#include </usr/local/v6/include/sys/v6config.h>
336 ipv6libdir=/usr/local/v6/lib;
337 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
341 [#include <sys/param.h>
342 #ifdef _ZETA_MINAMI_INET6
347 ipv6libdir=/usr/local/v6/lib])
350 if test "$ipv6type" != "unknown"; then
354 AC_MSG_RESULT($ipv6type)
357 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
358 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
359 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
360 echo "You have $ipv6lib library, using it"
362 if test "$ipv6trylibc" = "yes"; then
363 echo "You do not have $ipv6lib library, using libc"
365 echo 'Fatal: no $ipv6lib library found. cannot continue.'
366 echo "You need to fetch lib$ipv6lib.a from appropriate"
367 echo 'ipv6 kit and compile beforehand.'
373 AC_SEARCH_LIBS(dnet_htoa, dnet,
375 AC_DEFINE(HAVE_DNET_HTOA, 1,
376 [define if you have the dnet_htoa function])
378 # OK, we have dnet_htoa(). Do we have netdnet/dnetdb.h?
380 AC_CHECK_HEADERS(netdnet/dnetdb.h)
381 if test "$ac_cv_header_netdnet_dnetdb_h" = "yes"; then
383 # Yes. Does it declare dnet_htoa()?
385 AC_CHECK_DECL(dnet_htoa,
388 AC_DEFINE(NETDNET_DNETDB_H_DECLARES_DNET_HTOA,,
389 [Define to 1 if netenet/dnetdb.h declares `dnet_htoa'])
393 #include <netdnet/dnetdb.h>
398 # Do we have netdnet/dn.h?
400 AC_CHECK_HEADERS(netdnet/dn.h)
401 if test "$ac_cv_header_netdnet_dn_h" = "yes"; then
403 # Yes. Does it declare struct dn_naddr?
405 AC_CHECK_TYPES(struct dn_naddr,,,
407 #include <netdnet/dn.h>
412 AC_REPLACE_FUNCS(strlcat strlcpy strdup strsep getservent getopt_long)
413 AC_CHECK_FUNCS(fork vfork strftime)
414 AC_CHECK_FUNCS(setlinebuf)
417 AC_CHECK_FUNCS(vsnprintf snprintf,,
419 if test $needsnprintf = yes; then
423 AC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpc
425 dnl Some platforms may need -lnsl for getrpcbynumber.
426 AC_SEARCH_LIBS(getrpcbynumber, nsl,
427 AC_DEFINE(HAVE_GETRPCBYNUMBER, 1, [define if you have getrpcbynumber()]))
429 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
432 # Check for these after AC_LBL_LIBPCAP, so we link with the appropriate
433 # libraries (e.g., "-lsocket -lnsl" on Solaris).
435 # You are in a twisty little maze of UN*Xes, all different.
436 # Some might not have ether_ntohost().
437 # Some might have it and declare it in <net/ethernet.h>.
438 # Some might have it and declare it in <netinet/ether.h>
439 # Some might have it and declare it in <sys/ethernet.h>.
440 # Some might have it and declare it in <arpa/inet.h>.
441 # Some might have it and declare it in <netinet/if_ether.h>.
442 # Some might have it and not declare it in any header file.
444 # Before you is a C compiler.
446 AC_CHECK_FUNCS(ether_ntohost, [
447 AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
450 #include <sys/types.h>
451 #include <sys/param.h>
452 #include <sys/socket.h>
455 main(int argc, char **argv)
457 u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
458 char name[MAXHOSTNAMELEN];
460 ether_ntohost(name, (struct ether_addr *)ea);
463 ], [ac_cv_buggy_ether_ntohost=no],
464 [ac_cv_buggy_ether_ntohost=yes],
465 [ac_cv_buggy_ether_ntohost="not while cross-compiling"])])
466 if test "$ac_cv_buggy_ether_ntohost" = "no"; then
467 AC_DEFINE(USE_ETHER_NTOHOST, 1,
468 [define if you have ether_ntohost() and it works])
471 if test "$ac_cv_func_ether_ntohost" = yes -a \
472 "$ac_cv_buggy_ether_ntohost" = "no"; then
474 # OK, we have ether_ntohost(). Is it declared in <net/ethernet.h>?
476 # This test fails if we don't have <net/ethernet.h> or if we do
477 # but it doesn't declare ether_ntohost().
479 AC_CHECK_DECL(ether_ntohost,
481 AC_DEFINE(NET_ETHERNET_H_DECLARES_ETHER_NTOHOST,,
482 [Define to 1 if net/ethernet.h declares `ether_ntohost'])
485 #include <net/ethernet.h>
490 if test "$ac_cv_have_decl_ether_ntohost" != yes; then
492 # No, how about <netinet/ether.h>, as on Linux?
494 # This test fails if we don't have <netinet/ether.h>
495 # or if we do but it doesn't declare ether_ntohost().
497 # Unset ac_cv_have_decl_ether_ntohost so we don't
498 # treat the previous failure as a cached value and
499 # suppress the next test.
501 unset ac_cv_have_decl_ether_ntohost
502 AC_CHECK_DECL(ether_ntohost,
504 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,,
505 [Define to 1 if netinet/ether.h declares `ether_ntohost'])
508 #include <netinet/ether.h>
514 if test "$ac_cv_have_decl_ether_ntohost" != yes; then
516 # No, how about <sys/ethernet.h>, as on Solaris 10
519 # This test fails if we don't have <sys/ethernet.h>
520 # or if we do but it doesn't declare ether_ntohost().
522 # Unset ac_cv_have_decl_ether_ntohost so we don't
523 # treat the previous failure as a cached value and
524 # suppress the next test.
526 unset ac_cv_have_decl_ether_ntohost
527 AC_CHECK_DECL(ether_ntohost,
529 AC_DEFINE(SYS_ETHERNET_H_DECLARES_ETHER_NTOHOST,,
530 [Define to 1 if sys/ethernet.h declares `ether_ntohost'])
533 #include <sys/ethernet.h>
539 if test "$ac_cv_have_decl_ether_ntohost" != yes; then
541 # No, how about <arpa/inet.h>, as in AIX?
543 # This test fails if we don't have <arpa/inet.h>
544 # (if we have ether_ntohost(), we should have
545 # networking, and if we have networking, we should
546 # have <arapa/inet.h>) or if we do but it doesn't
547 # declare ether_ntohost().
549 # Unset ac_cv_have_decl_ether_ntohost so we don't
550 # treat the previous failure as a cached value and
551 # suppress the next test.
553 unset ac_cv_have_decl_ether_ntohost
554 AC_CHECK_DECL(ether_ntohost,
556 AC_DEFINE(ARPA_INET_H_DECLARES_ETHER_NTOHOST,,
557 [Define to 1 if arpa/inet.h declares `ether_ntohost'])
560 #include <arpa/inet.h>
566 if test "$ac_cv_have_decl_ether_ntohost" != yes; then
568 # No, how about <netinet/if_ether.h>?
569 # On some platforms, it requires <net/if.h> and
570 # <netinet/in.h>, and we always include it with
571 # both of them, so test it with both of them.
573 # This test fails if we don't have <netinet/if_ether.h>
574 # and the headers we include before it, or if we do but
575 # <netinet/if_ether.h> doesn't declare ether_hostton().
577 # Unset ac_cv_have_decl_ether_ntohost so we don't
578 # treat the previous failure as a cached value and
579 # suppress the next test.
581 unset ac_cv_have_decl_ether_ntohost
582 AC_CHECK_DECL(ether_ntohost,
584 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST,,
585 [Define to 1 if netinet/if_ether.h declares `ether_ntohost'])
588 #include <sys/types.h>
589 #include <sys/socket.h>
591 #include <netinet/in.h>
592 #include <netinet/if_ether.h>
596 # After all that, is ether_ntohost() declared?
598 if test "$ac_cv_have_decl_ether_ntohost" = yes; then
602 AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 1,
603 [Define to 1 if you have the declaration of `ether_ntohost'])
606 # No, we'll have to declare it ourselves.
607 # Do we have "struct ether_addr" if we include
608 # <netinet/if_ether.h>?
610 AC_CHECK_TYPES(struct ether_addr,,,
612 #include <sys/types.h>
613 #include <sys/socket.h>
615 #include <netinet/in.h>
616 #include <netinet/if_ether.h>
622 dnl Check for "pcap_list_datalinks()" and use a substitute version if
623 dnl it's not present. If it is present, check for "pcap_free_datalinks()";
624 dnl if it's not present, we don't replace it for now. (We could do so
625 dnl on UN*X, but not on Windows, where hilarity ensues if a program
626 dnl built with one version of the MSVC support library tries to free
627 dnl something allocated by a library built with another version of
628 dnl the MSVC support library.)
630 AC_CHECK_FUNC(pcap_list_datalinks,
632 AC_DEFINE(HAVE_PCAP_LIST_DATALINKS, 1,
633 [define if libpcap has pcap_list_datalinks()])
634 AC_CHECK_FUNCS(pcap_free_datalinks)
641 dnl Check for "pcap_datalink_name_to_val()", and use a substitute
642 dnl version if it's not present. If it is present, check for
643 dnl "pcap_datalink_val_to_description()", and if we don't have it,
644 dnl use a substitute version.
646 AC_CHECK_FUNC(pcap_datalink_name_to_val,
648 AC_DEFINE(HAVE_PCAP_DATALINK_NAME_TO_VAL, 1,
649 [define if libpcap has pcap_datalink_name_to_val()])
650 AC_CHECK_FUNC(pcap_datalink_val_to_description,
651 AC_DEFINE(HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION, 1,
652 [define if libpcap has pcap_datalink_val_to_description()]),
662 dnl Check for "pcap_set_datalink()"; you can't substitute for it if
663 dnl it's absent (it has hooks into libpcap), so just define the
664 dnl HAVE_ value if it's there.
666 AC_CHECK_FUNCS(pcap_set_datalink)
669 dnl Check for "pcap_breakloop()"; you can't substitute for it if
670 dnl it's absent (it has hooks into the live capture routines),
671 dnl so just define the HAVE_ value if it's there.
673 AC_CHECK_FUNCS(pcap_breakloop)
676 dnl Check for "pcap_dump_ftell()" and use a substitute version
677 dnl if it's not present.
679 AC_CHECK_FUNC(pcap_dump_ftell,
680 AC_DEFINE(HAVE_PCAP_DUMP_FTELL, 1,
681 [define if libpcap has pcap_dump_ftell()]),
683 AC_LIBOBJ(pcap_dump_ftell)
687 # Do we have the new open API? Check for pcap_create, and assume that,
688 # if we do, we also have pcap_activate() and the other new routines
689 # introduced in libpcap 1.0.0.
691 AC_CHECK_FUNCS(pcap_create)
692 if test $ac_cv_func_pcap_create = "yes" ; then
694 # OK, do we have pcap_set_tstamp_type? If so, assume we have
695 # pcap_list_tstamp_types and pcap_free_tstamp_types as well.
697 AC_CHECK_FUNCS(pcap_set_tstamp_type)
699 # And do we have pcap_set_tstamp_precision? If so, we assume
700 # we also have pcap_open_offline_with_tstamp_precision.
702 AC_CHECK_FUNCS(pcap_set_tstamp_precision)
706 # Check for a miscellaneous collection of functions which we use
709 AC_CHECK_FUNCS(pcap_findalldevs)
710 if test $ac_cv_func_pcap_findalldevs = "yes" ; then
711 dnl Check for libpcap having pcap_findalldevs() but the pcap.h header
712 dnl not having pcap_if_t; some versions of Mac OS X shipped with pcap.h
713 dnl from 0.6 and libpcap 0.8, so that libpcap had pcap_findalldevs but
714 dnl pcap.h didn't have pcap_if_t.
715 savedcppflags="$CPPFLAGS"
716 CPPFLAGS="$CPPFLAGS $V_INCLS"
717 AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>])
718 CPPFLAGS="$savedcppflags"
720 AC_CHECK_FUNCS(pcap_dump_flush pcap_lib_version)
721 if test $ac_cv_func_pcap_lib_version = "no" ; then
722 AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
725 extern char pcap_version[];
727 return (int)pcap_version;
729 ac_lbl_cv_pcap_version_defined=yes,
730 ac_lbl_cv_pcap_version_defined=no)
731 if test "$ac_lbl_cv_pcap_version_defined" = yes ; then
733 AC_DEFINE(HAVE_PCAP_VERSION, 1, [define if libpcap has pcap_version])
738 AC_CHECK_FUNCS(pcap_setdirection pcap_set_immediate_mode pcap_dump_ftell64)
739 AC_CHECK_FUNCS(pcap_open pcap_findalldevs_ex)
742 # Check for special debugging functions
744 AC_CHECK_FUNCS(pcap_set_parser_debug)
745 if test "$ac_cv_func_pcap_set_parser_debug" = "no" ; then
747 # OK, we don't have pcap_set_parser_debug() to set the libpcap
748 # filter expression parser debug flag; can we directly set the
750 AC_MSG_CHECKING(whether pcap_debug is defined by libpcap)
753 extern int pcap_debug;
757 ac_lbl_cv_pcap_debug_defined=yes,
758 ac_lbl_cv_pcap_debug_defined=no)
759 if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then
761 AC_DEFINE(HAVE_PCAP_DEBUG, 1, [define if libpcap has pcap_debug])
765 # OK, what about "yydebug"?
767 AC_MSG_CHECKING(whether yydebug is defined by libpcap)
774 ac_lbl_cv_yydebug_defined=yes,
775 ac_lbl_cv_yydebug_defined=no)
776 if test "$ac_lbl_cv_yydebug_defined" = yes ; then
778 AC_DEFINE(HAVE_YYDEBUG, 1, [define if libpcap has yydebug])
784 AC_CHECK_FUNCS(pcap_set_optimizer_debug)
785 AC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6
788 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
792 # Assume V7/BSD convention for man pages (file formats in section 5,
793 # miscellaneous info in section 7).
800 dnl Workaround to enable certain features
801 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
806 # Use System V conventions for man pages.
816 # Use System V conventions for man pages.
826 # Use System V conventions for man pages.
836 # Use System V conventions for man pages.
843 if test -f /dev/bpf0 ; then
848 # Make sure we have a definition for C99's uintptr_t (regardless of
849 # whether the environment is a C99 environment or not).
854 # Check whether we have pcap/pcap-inttypes.h.
855 # If we do, we use that to get the C99 types defined.
857 savedcppflags="$CPPFLAGS"
858 CPPFLAGS="$CPPFLAGS $V_INCLS"
859 AC_CHECK_HEADERS(pcap/pcap-inttypes.h)
860 CPPFLAGS="$savedcppflags"
863 # Define the old BSD specified-width types in terms of the C99 types;
864 # we may need them with libpcap include files.
866 AC_CHECK_TYPE([u_int8_t], ,
867 [AC_DEFINE([u_int8_t], [uint8_t],
868 [Define to `uint8_t' if u_int8_t not defined.])],
870 #include <sys/types.h>
872 AC_CHECK_TYPE([u_int16_t], ,
873 [AC_DEFINE([u_int16_t], [uint16_t],
874 [Define to `uint16_t' if u_int16_t not defined.])],
876 #include <sys/types.h>
878 AC_CHECK_TYPE([u_int32_t], ,
879 [AC_DEFINE([u_int32_t], [uint32_t],
880 [Define to `uint32_t' if u_int32_t not defined.])],
882 #include <sys/types.h>
884 AC_CHECK_TYPE([u_int64_t], ,
885 [AC_DEFINE([u_int64_t], [uint64_t],
886 [Define to `uint64_t' if u_int64_t not defined.])],
888 #include <sys/types.h>
892 AC_CHECK_TOOL([AR], [ar])
894 AC_LBL_DEVEL(V_CCOPT)
896 # Check for OpenSSL/libressl libcrypto
897 AC_MSG_CHECKING(whether to use OpenSSL/libressl libcrypto)
898 # Specify location for both includes and libraries.
899 want_libcrypto=ifavailable
901 AS_HELP_STRING([--with-crypto]@<:@=DIR@:>@,
902 [use OpenSSL/libressl libcrypto (located in directory DIR, if specified) @<:@default=yes, if available@:>@]),
904 if test $withval = no
906 # User doesn't want to link with libcrypto.
909 elif test $withval = yes
911 # User wants to link with libcrypto but hasn't specified
916 # User wants to link with libcrypto and has specified
917 # a directory, so use the provided value.
919 libcrypto_root=$withval
920 AC_MSG_RESULT([yes, using the version installed in $withval])
923 # Put the subdirectories of the libcrypto root directory
924 # at the front of the header and library search path.
926 CFLAGS="-I$withval/include $CFLAGS"
927 LIBS="-L$withval/lib $LIBS"
931 # Use libcrypto if it's present, otherwise don't; no directory
934 want_libcrypto=ifavailable
935 AC_MSG_RESULT([yes, if available])
937 if test "$want_libcrypto" != "no"; then
939 # Don't check for libcrypto unless we have its headers;
940 # Apple, bless their pointy little heads, apparently ship
941 # libcrypto as a library, but not the header files, in
942 # El Capitan, probably because they don't want you writing
943 # nasty portable code that could run on other UN*Xes, they
944 # want you writing code that uses their Shiny New Crypto
945 # Library and that only runs on macOS.
947 AC_CHECK_HEADER(openssl/crypto.h,
949 AC_CHECK_LIB(crypto, DES_cbc_encrypt)
950 if test "$ac_cv_lib_crypto_DES_cbc_encrypt" = "yes"; then
951 AC_CHECK_HEADERS(openssl/evp.h)
955 # 1) do we have EVP_CIPHER_CTX_new?
956 # If so, we use it to allocate an
957 # EVP_CIPHER_CTX, as EVP_CIPHER_CTX may be
958 # opaque; otherwise, we allocate it ourselves.
960 # 2) do we have EVP_CipherInit_ex()?
961 # If so, we use it, because we need to be
962 # able to make two "initialize the cipher"
963 # calls, one with the cipher and key, and
964 # one with the IV, and, as of OpenSSL 1.1,
965 # You Can't Do That with EVP_CipherInit(),
966 # because a call to EVP_CipherInit() will
967 # unconditionally clear the context, and
968 # if you don't supply a cipher, it'll
969 # clear the cipher, rendering the context
970 # unusable and causing a crash.
972 AC_CHECK_FUNCS(EVP_CIPHER_CTX_new EVP_CipherInit_ex)
977 # Check for libcap-ng
978 AC_MSG_CHECKING(whether to use libcap-ng)
979 # Specify location for both includes and libraries.
980 want_libcap_ng=ifavailable
982 AS_HELP_STRING([--with-cap-ng],
983 [use libcap-ng @<:@default=yes, if available@:>@]),
985 if test $withval = no
989 elif test $withval = yes
996 # Use libcap-ng if it's present, otherwise don't.
998 want_libcap_ng=ifavailable
999 AC_MSG_RESULT([yes, if available])
1001 if test "$want_libcap_ng" != "no"; then
1002 AC_CHECK_LIB(cap-ng, capng_change_id)
1003 AC_CHECK_HEADERS(cap-ng.h)
1007 dnl set additional include path if necessary
1008 if test "$missing_includes" = "yes"; then
1009 CPPFLAGS="$CPPFLAGS -I$srcdir/missing"
1010 V_INCLS="$V_INCLS -I$srcdir/missing"
1019 AC_SUBST(MAN_FILE_FORMATS)
1020 AC_SUBST(MAN_MISC_INFO)
1024 AC_CONFIG_HEADER(config.h)
1026 AC_OUTPUT_COMMANDS([if test -f .devel; then
1027 echo timestamp > stamp-h
1028 cat Makefile-devel-adds >> Makefile
1031 AC_OUTPUT(Makefile tcpdump.1)