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 if test "$ac_cv___attribute__" = "yes"; then
28 AC_C___ATTRIBUTE___UNUSED
29 AC_C___ATTRIBUTE___FALLTHROUGH
32 AC_CHECK_HEADERS(fcntl.h rpc/rpc.h rpc/rpcent.h)
33 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
34 #include <sys/socket.h>
36 if test "$ac_cv_header_net_pfvar_h" = yes; then
37 AC_CHECK_HEADERS(net/if_pflog.h, , , [#include <sys/types.h>
38 #include <sys/socket.h>
40 #include <net/pfvar.h>])
41 if test "$ac_cv_header_net_if_pflog_h" = yes; then
42 LOCALSRC="print-pflog.c $LOCALSRC"
45 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
46 #include <sys/socket.h>])
47 if test "$ac_cv_header_netinet_if_ether_h" != yes; then
49 # The simple test didn't work.
50 # Do we need to include <net/if.h> first?
51 # Unset ac_cv_header_netinet_if_ether_h so we don't
52 # treat the previous failure as a cached value and
53 # suppress the next test.
55 AC_MSG_NOTICE([Rechecking with some additional includes])
56 unset ac_cv_header_netinet_if_ether_h
57 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
58 #include <sys/socket.h>
59 #include <netinet/in.h>
68 AC_ARG_ENABLE(universal,
69 AC_HELP_STRING([--disable-universal],[don't build universal on macOS]))
70 if test "$enable_universal" != "no"; then
75 # Leopard. Build for x86 and 32-bit PowerPC, with
76 # x86 first. (That's what Apple does.)
78 V_CCOPT="$V_CCOPT -arch i386 -arch ppc"
79 LDFLAGS="$LDFLAGS -arch i386 -arch ppc"
84 # Snow Leopard. Build for x86-64 and x86, with
85 # x86-64 first. (That's what Apple does.)
87 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386"
88 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386"
97 [ --with-smi link with libsmi (allows to load MIBs on the fly to decode SNMP packets. [default=yes]
98 --without-smi don't link with libsmi],,
101 if test "x$with_smi" != "xno" ; then
102 AC_CHECK_HEADER(smi.h,
105 # OK, we found smi.h. Do we have libsmi with smiInit?
107 AC_CHECK_LIB(smi, smiInit,
110 # OK, we have libsmi with smiInit. Can we use it?
112 AC_MSG_CHECKING([whether to enable libsmi])
117 /* libsmi available check */
121 int current, revision, age, n;
122 const int required = 2;
125 if (strcmp(SMI_LIBRARY_VERSION, smi_library_version))
127 n = sscanf(smi_library_version, "%d:%d:%d", ¤t, &revision, &age);
130 if (required < current - age || required > current)
137 AC_DEFINE(USE_LIBSMI, 1,
138 [Define if you enable support for libsmi])
141 dnl autoconf documentation says that
142 dnl $? contains the exit value.
143 dnl reality is that it does not.
144 dnl We leave this in just in case
145 dnl autoconf ever comes back to
146 dnl match the documentation.
148 1) AC_MSG_RESULT(no - smiInit failed) ;;
149 2) AC_MSG_RESULT(no - header/library version mismatch) ;;
150 3) AC_MSG_RESULT(no - can't determine library version) ;;
151 4) AC_MSG_RESULT(no - too old) ;;
152 *) AC_MSG_RESULT(no) ;;
157 AC_MSG_RESULT(not when cross-compiling)
165 AC_MSG_CHECKING([whether to enable the possibly-buggy SMB printer])
167 [ --enable-smb enable possibly-buggy SMB printer [default=yes]
168 --disable-smb disable possibly-buggy SMB printer],,
171 yes) AC_MSG_RESULT(yes)
172 AC_WARN([The SMB printer may have exploitable buffer overflows!!!])
173 AC_DEFINE(ENABLE_SMB, 1,
174 [define if you want to build the possibly-buggy SMB printer])
175 LOCALSRC="print-smb.c smbutil.c $LOCALSRC"
181 AC_ARG_WITH(user, [ --with-user=USERNAME drop privileges by default to USERNAME])
182 AC_MSG_CHECKING([whether to drop root privileges by default])
183 if test ! -z "$with_user" ; then
184 AC_DEFINE_UNQUOTED(WITH_USER, "$withval",
185 [define if should drop privileges by default])
186 AC_MSG_RESULT(to \"$withval\")
191 AC_ARG_WITH(chroot, [ --with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY])
192 AC_MSG_CHECKING([whether to chroot])
193 if test ! -z "$with_chroot" && test "$with_chroot" != "no" ; then
194 AC_DEFINE_UNQUOTED(WITH_CHROOT, "$withval",
195 [define if should chroot when dropping privileges])
196 AC_MSG_RESULT(to \"$withval\")
201 AC_ARG_WITH(sandbox-capsicum,
202 AS_HELP_STRING([--with-sandbox-capsicum],
203 [use Capsicum security functions @<:@default=yes, if available@:>@]))
205 # Check whether various functions are available. If any are, set
206 # ac_lbl_capsicum_function_seen to yes; if any are not, set
207 # ac_lbl_capsicum_function_not_seen to yes.
209 # We don't check cap_rights_init(), as it's a macro, wrapping another
210 # function, in at least some versions of FreeBSD, and AC_CHECK_FUNCS()
211 # doesn't handle that.
213 # All of the ones we check for must be available in order to enable
214 # capsicum sandboxing.
216 # XXX - do we need to check for all of them, or are there some that, if
217 # present, imply others are present?
219 if test ! -z "$with_sandbox-capsicum" && test "$with_sandbox-capsicum" != "no" ; then
220 AC_CHECK_FUNCS(cap_enter cap_rights_limit cap_ioctls_limit openat,
221 ac_lbl_capsicum_function_seen=yes,
222 ac_lbl_capsicum_function_not_seen=yes)
223 AC_CHECK_LIB(casper, cap_init, LIBS="$LIBS -lcasper")
224 AC_CHECK_LIB(cap_dns, cap_gethostbyaddr, LIBS="$LIBS -lcap_dns")
226 AC_MSG_CHECKING([whether to sandbox using capsicum])
227 if test "x$ac_lbl_capsicum_function_seen" = "xyes" -a "x$ac_lbl_capsicum_function_not_seen" != "xyes"; then
228 AC_DEFINE(HAVE_CAPSICUM, 1, [capsicum support available])
233 AC_MSG_CHECKING([whether to sandbox using Casper library])
234 if test "x$ac_cv_lib_casper_cap_init" = "xyes" -a "x$ac_cv_lib_cap_dns_cap_gethostbyaddr" = "xyes"; then
235 AC_DEFINE(HAVE_CASPER, 1, [Casper support available])
242 # We must check this before checking whether to check the OS's IPv6,
243 # support because, on some platforms (such as SunOS 5.x), the test
244 # program requires the extra networking libraries.
249 # Check whether AF_INET6 and struct in6_addr are defined.
250 # If they aren't both defined, we don't have sufficient OS
251 # support for IPv6, so we don't look for IPv6 support libraries,
252 # and we define AF_INET6 and struct in6_addr ourselves.
254 AC_MSG_CHECKING([whether the operating system supports IPv6])
259 /* AF_INET6 available check */
260 #include <sys/types.h>
262 #include <ws2tcpip.h>
264 #include <sys/socket.h>
265 #include <netinet/in.h>
269 foo(struct in6_addr *addr)
271 memset(addr, 0, sizeof (struct in6_addr));
274 #error "AF_INET6 not defined"
280 AC_DEFINE(HAVE_OS_IPV6_SUPPORT, 1,
281 [define if the OS provides AF_INET6 and struct in6_addr])
294 if test "$ipv6" = "yes"; then
295 AC_MSG_CHECKING([ipv6 stack type])
296 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
299 dnl http://www.kame.net/
301 [#include <netinet/in.h>
302 #ifdef IPV6_INRIA_VERSION
308 dnl http://www.kame.net/
310 [#include <netinet/in.h>
316 ipv6libdir=/usr/local/v6/lib;
320 dnl http://www.v6.linux.or.jp/
322 [#include <features.h>
323 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
329 dnl http://www.v6.linux.or.jp/
331 dnl This also matches Solaris 8 and Tru64 UNIX 5.1,
332 dnl and possibly other versions of those OSes
334 if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
337 ipv6libdir=/usr/inet6/lib
339 CFLAGS="-I/usr/inet6/include $CFLAGS"
344 [#include <sys/param.h>
345 #ifdef _TOSHIBA_INET6
350 ipv6libdir=/usr/local/v6/lib])
354 [#include </usr/local/v6/include/sys/v6config.h>
360 ipv6libdir=/usr/local/v6/lib;
361 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
365 [#include <sys/param.h>
366 #ifdef _ZETA_MINAMI_INET6
371 ipv6libdir=/usr/local/v6/lib])
374 if test "$ipv6type" != "unknown"; then
378 AC_MSG_RESULT($ipv6type)
381 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
382 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
383 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
384 echo "You have $ipv6lib library, using it"
386 if test "$ipv6trylibc" = "yes"; then
387 echo "You do not have $ipv6lib library, using libc"
389 echo 'Fatal: no $ipv6lib library found. cannot continue.'
390 echo "You need to fetch lib$ipv6lib.a from appropriate"
391 echo 'ipv6 kit and compile beforehand.'
397 AC_SEARCH_LIBS(dnet_htoa, dnet,
399 AC_DEFINE(HAVE_DNET_HTOA, 1,
400 [define if you have the dnet_htoa function])
402 # OK, we have dnet_htoa(). Do we have netdnet/dnetdb.h?
404 AC_CHECK_HEADERS(netdnet/dnetdb.h)
405 if test "$ac_cv_header_netdnet_dnetdb_h" = "yes"; then
407 # Yes. Does it declare dnet_htoa()?
409 AC_CHECK_DECL(dnet_htoa,
412 AC_DEFINE(NETDNET_DNETDB_H_DECLARES_DNET_HTOA,,
413 [Define to 1 if netenet/dnetdb.h declares `dnet_htoa'])
417 #include <netdnet/dnetdb.h>
422 # Do we have netdnet/dn.h?
424 AC_CHECK_HEADERS(netdnet/dn.h)
425 if test "$ac_cv_header_netdnet_dn_h" = "yes"; then
427 # Yes. Does it declare struct dn_naddr?
429 AC_CHECK_TYPES(struct dn_naddr,,,
431 #include <netdnet/dn.h>
436 AC_REPLACE_FUNCS(vfprintf strlcat strlcpy strdup strsep getservent getopt_long)
437 AC_CHECK_FUNCS(fork vfork strftime)
438 AC_CHECK_FUNCS(setlinebuf)
441 AC_CHECK_FUNCS(vsnprintf snprintf,,
443 if test $needsnprintf = yes; then
447 AC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpc
449 dnl Some platforms may need -lnsl for getrpcbynumber.
450 AC_SEARCH_LIBS(getrpcbynumber, nsl,
451 AC_DEFINE(HAVE_GETRPCBYNUMBER, 1, [define if you have getrpcbynumber()]))
453 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
456 # Check for these after AC_LBL_LIBPCAP, so we link with the appropriate
457 # libraries (e.g., "-lsocket -lnsl" on Solaris).
459 # You are in a twisty little maze of UN*Xes, all different.
460 # Some might not have ether_ntohost().
461 # Some might have it, but not declare it in any header file.
462 # Some might have it, but declare it in <netinet/if_ether.h>.
463 # Some might have it, but declare it in <netinet/ether.h>
464 # (And some might have it but document it as something declared in
465 # <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
467 # Before you is a C compiler.
469 AC_CHECK_FUNCS(ether_ntohost, [
470 AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
473 #include <sys/types.h>
474 #include <sys/param.h>
475 #include <sys/socket.h>
478 main(int argc, char **argv)
480 u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
481 char name[MAXHOSTNAMELEN];
483 ether_ntohost(name, (struct ether_addr *)ea);
486 ], [ac_cv_buggy_ether_ntohost=no],
487 [ac_cv_buggy_ether_ntohost=yes],
488 [ac_cv_buggy_ether_ntohost="not while cross-compiling"])])
489 if test "$ac_cv_buggy_ether_ntohost" = "no"; then
490 AC_DEFINE(USE_ETHER_NTOHOST, 1,
491 [define if you have ether_ntohost() and it works])
494 if test "$ac_cv_func_ether_ntohost" = yes -a \
495 "$ac_cv_buggy_ether_ntohost" = "no"; then
497 # OK, we have ether_ntohost(). Do we have <netinet/if_ether.h>?
499 if test "$ac_cv_header_netinet_if_ether_h" = yes; then
501 # Yes. Does it declare ether_ntohost()?
503 AC_CHECK_DECL(ether_ntohost,
505 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST,,
506 [Define to 1 if netinet/if_ether.h declares `ether_ntohost'])
509 #include <sys/types.h>
510 #include <sys/socket.h>
511 #include <netinet/in.h>
512 #include <arpa/inet.h>
516 #include <netinet/if_ether.h>
522 if test "$ac_cv_have_decl_ether_ntohost" != yes; then
524 # No, how about <netinet/ether.h>, as on Linux?
526 AC_CHECK_HEADERS(netinet/ether.h)
527 if test "$ac_cv_header_netinet_ether_h" = yes; then
529 # We have it - does it declare ether_ntohost()?
530 # Unset ac_cv_have_decl_ether_ntohost so we don't
531 # treat the previous failure as a cached value and
532 # suppress the next test.
534 unset ac_cv_have_decl_ether_ntohost
535 AC_CHECK_DECL(ether_ntohost,
537 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,,
538 [Define to 1 if netinet/ether.h declares `ether_ntohost'])
541 #include <netinet/ether.h>
546 # Is ether_ntohost() declared?
548 if test "$ac_cv_have_decl_ether_ntohost" != yes; then
550 # No, we'll have to declare it ourselves.
551 # Do we have "struct ether_addr"?
553 AC_CHECK_TYPES(struct ether_addr,,,
555 #include <sys/types.h>
556 #include <sys/socket.h>
557 #include <netinet/in.h>
558 #include <arpa/inet.h>
562 #include <netinet/if_ether.h>
564 AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 0,
565 [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
568 AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 1,
569 [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
575 dnl Check for "pcap_list_datalinks()", "pcap_set_datalink()",
576 dnl and "pcap_datalink_name_to_val()", and use substitute versions
577 dnl if they're not present.
579 AC_CHECK_FUNC(pcap_list_datalinks,
581 AC_DEFINE(HAVE_PCAP_LIST_DATALINKS, 1,
582 [define if libpcap has pcap_list_datalinks()])
583 AC_CHECK_FUNCS(pcap_free_datalinks)
588 AC_CHECK_FUNCS(pcap_set_datalink)
589 AC_CHECK_FUNC(pcap_datalink_name_to_val,
591 AC_DEFINE(HAVE_PCAP_DATALINK_NAME_TO_VAL, 1,
592 [define if libpcap has pcap_datalink_name_to_val()])
593 AC_CHECK_FUNC(pcap_datalink_val_to_description,
594 AC_DEFINE(HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION, 1,
595 [define if libpcap has pcap_datalink_val_to_description()]),
605 dnl Check for "pcap_breakloop()"; you can't substitute for it if
606 dnl it's absent (it has hooks into the live capture routines),
607 dnl so just define the HAVE_ value if it's there.
609 AC_CHECK_FUNCS(pcap_breakloop)
612 dnl Check for "pcap_dump_ftell()" and use a substitute version
613 dnl if it's not present.
615 AC_CHECK_FUNC(pcap_dump_ftell,
616 AC_DEFINE(HAVE_PCAP_DUMP_FTELL, 1,
617 [define if libpcap has pcap_dump_ftell()]),
619 AC_LIBOBJ(pcap_dump_ftell)
623 # Do we have the new open API? Check for pcap_create, and assume that,
624 # if we do, we also have pcap_activate() and the other new routines
625 # introduced in libpcap 1.0.0.
627 AC_CHECK_FUNCS(pcap_create)
628 if test $ac_cv_func_pcap_create = "yes" ; then
630 # OK, do we have pcap_set_tstamp_type? If so, assume we have
631 # pcap_list_tstamp_types and pcap_free_tstamp_types as well.
633 AC_CHECK_FUNCS(pcap_set_tstamp_type)
635 # And do we have pcap_set_tstamp_precision? If so, we assume
636 # we also have pcap_open_offline_with_tstamp_precision.
638 AC_CHECK_FUNCS(pcap_set_tstamp_precision)
642 # Check for a miscellaneous collection of functions which we use
645 AC_CHECK_FUNCS(pcap_findalldevs)
646 if test $ac_cv_func_pcap_findalldevs = "yes" ; then
647 dnl Check for libpcap having pcap_findalldevs() but the pcap.h header
648 dnl not having pcap_if_t; some versions of Mac OS X shipped with pcap.h
649 dnl from 0.6 and libpcap 0.8, so that libpcap had pcap_findalldevs but
650 dnl pcap.h didn't have pcap_if_t.
651 savedcppflags="$CPPFLAGS"
652 CPPFLAGS="$CPPFLAGS $V_INCLS"
653 AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>])
654 CPPFLAGS="$savedcppflags"
656 AC_CHECK_FUNCS(pcap_dump_flush pcap_lib_version)
657 if test $ac_cv_func_pcap_lib_version = "no" ; then
658 AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
661 extern char pcap_version[];
663 return (int)pcap_version;
665 ac_lbl_cv_pcap_version_defined=yes,
666 ac_lbl_cv_pcap_version_defined=no)
667 if test "$ac_lbl_cv_pcap_version_defined" = yes ; then
669 AC_DEFINE(HAVE_PCAP_VERSION, 1, [define if libpcap has pcap_version])
674 AC_CHECK_FUNCS(pcap_setdirection pcap_set_immediate_mode pcap_dump_ftell64)
675 AC_CHECK_FUNCS(pcap_open pcap_findalldevs_ex)
678 # Check for special debugging functions
680 AC_CHECK_FUNCS(pcap_set_parser_debug)
681 if test "$ac_cv_func_pcap_set_parser_debug" = "no" ; then
683 # OK, we don't have pcap_set_parser_debug() to set the libpcap
684 # filter expression parser debug flag; can we directly set the
686 AC_MSG_CHECKING(whether pcap_debug is defined by libpcap)
689 extern int pcap_debug;
693 ac_lbl_cv_pcap_debug_defined=yes,
694 ac_lbl_cv_pcap_debug_defined=no)
695 if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then
697 AC_DEFINE(HAVE_PCAP_DEBUG, 1, [define if libpcap has pcap_debug])
701 # OK, what about "yydebug"?
703 AC_MSG_CHECKING(whether yydebug is defined by libpcap)
710 ac_lbl_cv_yydebug_defined=yes,
711 ac_lbl_cv_yydebug_defined=no)
712 if test "$ac_lbl_cv_yydebug_defined" = yes ; then
714 AC_DEFINE(HAVE_YYDEBUG, 1, [define if libpcap has yydebug])
720 AC_CHECK_FUNCS(pcap_set_optimizer_debug)
721 AC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6
724 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
728 # Assume V7/BSD convention for man pages (file formats in section 5,
729 # miscellaneous info in section 7).
736 dnl Workaround to enable certain features
737 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
742 # Use System V conventions for man pages.
752 # Use System V conventions for man pages.
762 # Use System V conventions for man pages.
772 # Use System V conventions for man pages.
779 if test -f /dev/bpf0 ; then
784 # Make sure we have a definition for C99's uintptr_t (regardless of
785 # whether the environment is a C99 environment or not).
790 # Check whether we have pcap/pcap-inttypes.h.
791 # If we do, we use that to get the C99 types defined.
793 savedcppflags="$CPPFLAGS"
794 CPPFLAGS="$CPPFLAGS $V_INCLS"
795 AC_CHECK_HEADERS(pcap/pcap-inttypes.h)
796 CPPFLAGS="$savedcppflags"
799 # Define the old BSD specified-width types in terms of the C99 types;
800 # we may need them with libpcap include files.
802 AC_CHECK_TYPE([u_int8_t], ,
803 [AC_DEFINE([u_int8_t], [uint8_t],
804 [Define to `uint8_t' if u_int8_t not defined.])],
806 #include <sys/types.h>
808 AC_CHECK_TYPE([u_int16_t], ,
809 [AC_DEFINE([u_int16_t], [uint16_t],
810 [Define to `uint16_t' if u_int16_t not defined.])],
812 #include <sys/types.h>
814 AC_CHECK_TYPE([u_int32_t], ,
815 [AC_DEFINE([u_int32_t], [uint32_t],
816 [Define to `uint32_t' if u_int32_t not defined.])],
818 #include <sys/types.h>
820 AC_CHECK_TYPE([u_int64_t], ,
821 [AC_DEFINE([u_int64_t], [uint64_t],
822 [Define to `uint64_t' if u_int64_t not defined.])],
824 #include <sys/types.h>
828 # Check for some headers introduced in later versions of libpcap
829 # and used by some printers.
831 # Those headers might use the {u_}intN_t types, so we must do this
832 # after we check for what's needed to get them defined.
834 savedcppflags="$CPPFLAGS"
835 CPPFLAGS="$CPPFLAGS $V_INCLS"
836 AC_CHECK_HEADERS(pcap/bluetooth.h,,,[#include "netdissect-stdinc.h"])
837 AC_CHECK_HEADERS(pcap/nflog.h,,,[#include "netdissect-stdinc.h"])
838 CPPFLAGS="$savedcppflags"
841 AC_CHECK_TOOL([AR], [ar])
843 AC_LBL_DEVEL(V_CCOPT)
845 # Check for OpenSSL/libressl libcrypto
846 AC_MSG_CHECKING(whether to use OpenSSL/libressl libcrypto)
847 # Specify location for both includes and libraries.
848 want_libcrypto=ifavailable
850 AS_HELP_STRING([--with-crypto]@<:@=DIR@:>@,
851 [use OpenSSL/libressl libcrypto (located in directory DIR, if specified) @<:@default=yes, if available@:>@]),
853 if test $withval = no
855 # User doesn't want to link with libcrypto.
858 elif test $withval = yes
860 # User wants to link with libcrypto but hasn't specified
865 # User wants to link with libcrypto and has specified
866 # a directory, so use the provided value.
868 libcrypto_root=$withval
869 AC_MSG_RESULT([yes, using the version installed in $withval])
872 # Put the subdirectories of the libcrypto root directory
873 # at the front of the header and library search path.
875 CFLAGS="-I$withval/include $CFLAGS"
876 LIBS="-L$withval/lib $LIBS"
880 # Use libcrypto if it's present, otherwise don't; no directory
883 want_libcrypto=ifavailable
884 AC_MSG_RESULT([yes, if available])
886 if test "$want_libcrypto" != "no"; then
888 # Don't check for libcrypto unless we have its headers;
889 # Apple, bless their pointy little heads, apparently ship
890 # libcrypto as a library, but not the header files, in
891 # El Capitan, probably because they don't want you writing
892 # nasty portable code that could run on other UN*Xes, they
893 # want you writing code that uses their Shiny New Crypto
894 # Library and that only runs on macOS.
896 AC_CHECK_HEADER(openssl/crypto.h,
898 AC_CHECK_LIB(crypto, DES_cbc_encrypt)
899 if test "$ac_cv_lib_crypto_DES_cbc_encrypt" = "yes"; then
900 AC_CHECK_HEADERS(openssl/evp.h)
904 # 1) do we have EVP_CIPHER_CTX_new?
905 # If so, we use it to allocate an
906 # EVP_CIPHER_CTX, as EVP_CIPHER_CTX may be
907 # opaque; otherwise, we allocate it ourselves.
909 # 2) do we have EVP_CipherInit_ex()?
910 # If so, we use it, because we need to be
911 # able to make two "initialize the cipher"
912 # calls, one with the cipher and key, and
913 # one with the IV, and, as of OpenSSL 1.1,
914 # You Can't Do That with EVP_CipherInit(),
915 # because a call to EVP_CipherInit() will
916 # unconditionally clear the context, and
917 # if you don't supply a cipher, it'll
918 # clear the cipher, rendering the context
919 # unusable and causing a crash.
921 AC_CHECK_FUNCS(EVP_CIPHER_CTX_new EVP_CipherInit_ex)
926 # Check for libcap-ng
927 AC_MSG_CHECKING(whether to use libcap-ng)
928 # Specify location for both includes and libraries.
929 want_libcap_ng=ifavailable
931 AS_HELP_STRING([--with-cap-ng],
932 [use libcap-ng @<:@default=yes, if available@:>@]),
934 if test $withval = no
938 elif test $withval = yes
945 # Use libcap-ng if it's present, otherwise don't.
947 want_libcap_ng=ifavailable
948 AC_MSG_RESULT([yes, if available])
950 if test "$want_libcap_ng" != "no"; then
951 AC_CHECK_LIB(cap-ng, capng_change_id)
952 AC_CHECK_HEADERS(cap-ng.h)
956 dnl set additional include path if necessary
957 if test "$missing_includes" = "yes"; then
958 CPPFLAGS="$CPPFLAGS -I$srcdir/missing"
959 V_INCLS="$V_INCLS -I$srcdir/missing"
968 AC_SUBST(MAN_FILE_FORMATS)
969 AC_SUBST(MAN_MISC_INFO)
973 AC_CONFIG_HEADER(config.h)
975 AC_OUTPUT_COMMANDS([if test -f .devel; then
976 echo timestamp > stamp-h
977 cat Makefile-devel-adds >> Makefile
980 AC_OUTPUT(Makefile tcpdump.1)