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)
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"
40 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
41 #include <sys/socket.h>])
42 if test "$ac_cv_header_netinet_if_ether_h" != yes; then
44 # The simple test didn't work.
45 # Do we need to include <net/if.h> first?
46 # Unset ac_cv_header_netinet_if_ether_h so we don't
47 # treat the previous failure as a cached value and
48 # suppress the next test.
50 AC_MSG_NOTICE([Rechecking with some additional includes])
51 unset ac_cv_header_netinet_if_ether_h
52 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
53 #include <sys/socket.h>
54 #include <netinet/in.h>
63 AC_ARG_ENABLE(universal,
64 AC_HELP_STRING([--disable-universal],[don't build universal on macOS]))
65 if test "$enable_universal" != "no"; then
70 # Leopard. Build for x86 and 32-bit PowerPC, with
71 # x86 first. (That's what Apple does.)
73 V_CCOPT="$V_CCOPT -arch i386 -arch ppc"
74 LDFLAGS="$LDFLAGS -arch i386 -arch ppc"
79 # Snow Leopard. Build for x86-64 and x86, with
80 # x86-64 first. (That's what Apple does.)
82 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386"
83 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386"
92 [ --with-smi link with libsmi (allows to load MIBs on the fly to decode SNMP packets. [default=yes]
93 --without-smi don't link with libsmi],,
96 if test "x$with_smi" != "xno" ; then
97 AC_CHECK_HEADER(smi.h,
100 # OK, we found smi.h. Do we have libsmi with smiInit?
102 AC_CHECK_LIB(smi, smiInit,
105 # OK, we have libsmi with smiInit. Can we use it?
107 AC_MSG_CHECKING([whether to enable libsmi])
112 /* libsmi available check */
116 int current, revision, age, n;
117 const int required = 2;
120 if (strcmp(SMI_LIBRARY_VERSION, smi_library_version))
122 n = sscanf(smi_library_version, "%d:%d:%d", ¤t, &revision, &age);
125 if (required < current - age || required > current)
132 AC_DEFINE(USE_LIBSMI, 1,
133 [Define if you enable support for libsmi])
136 dnl autoconf documentation says that
137 dnl $? contains the exit value.
138 dnl reality is that it does not.
139 dnl We leave this in just in case
140 dnl autoconf ever comes back to
141 dnl match the documentation.
143 1) AC_MSG_RESULT(no - smiInit failed) ;;
144 2) AC_MSG_RESULT(no - header/library version mismatch) ;;
145 3) AC_MSG_RESULT(no - can't determine library version) ;;
146 4) AC_MSG_RESULT(no - too old) ;;
147 *) AC_MSG_RESULT(no) ;;
152 AC_MSG_RESULT(not when cross-compiling)
160 AC_MSG_CHECKING([whether to enable the possibly-buggy SMB printer])
162 [ --enable-smb enable possibly-buggy SMB printer [default=yes]
163 --disable-smb disable possibly-buggy SMB printer],,
166 yes) AC_MSG_RESULT(yes)
167 AC_WARN([The SMB printer may have exploitable buffer overflows!!!])
168 AC_DEFINE(ENABLE_SMB, 1,
169 [define if you want to build the possibly-buggy SMB printer])
170 LOCALSRC="print-smb.c smbutil.c $LOCALSRC"
176 AC_ARG_WITH(user, [ --with-user=USERNAME drop privileges by default to USERNAME])
177 AC_MSG_CHECKING([whether to drop root privileges by default])
178 if test ! -z "$with_user" ; then
179 AC_DEFINE_UNQUOTED(WITH_USER, "$withval",
180 [define if should drop privileges by default])
181 AC_MSG_RESULT(to \"$withval\")
186 AC_ARG_WITH(chroot, [ --with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY])
187 AC_MSG_CHECKING([whether to chroot])
188 if test ! -z "$with_chroot" && test "$with_chroot" != "no" ; then
189 AC_DEFINE_UNQUOTED(WITH_CHROOT, "$withval",
190 [define if should chroot when dropping privileges])
191 AC_MSG_RESULT(to \"$withval\")
196 AC_ARG_WITH(sandbox-capsicum,
197 AS_HELP_STRING([--with-sandbox-capsicum],
198 [use Capsicum security functions @<:@default=yes, if available@:>@]))
200 # Check whether various functions are available. If any are, set
201 # ac_lbl_capsicum_function_seen to yes; if any are not, set
202 # ac_lbl_capsicum_function_not_seen to yes.
204 # We don't check cap_rights_init(), as it's a macro, wrapping another
205 # function, in at least some versions of FreeBSD, and AC_CHECK_FUNCS()
206 # doesn't handle that.
208 # All of the ones we check for must be available in order to enable
209 # capsicum sandboxing.
211 # XXX - do we need to check for all of them, or are there some that, if
212 # present, imply others are present?
214 if test ! -z "$with_sandbox-capsicum" && test "$with_sandbox-capsicum" != "no" ; then
215 AC_CHECK_FUNCS(cap_enter cap_rights_limit cap_ioctls_limit openat,
216 ac_lbl_capsicum_function_seen=yes,
217 ac_lbl_capsicum_function_not_seen=yes)
218 AC_CHECK_LIB(casper, cap_init, LIBS="$LIBS -lcasper")
219 AC_CHECK_LIB(cap_dns, cap_gethostbyaddr, LIBS="$LIBS -lcap_dns")
221 AC_MSG_CHECKING([whether to sandbox using capsicum])
222 if test "x$ac_lbl_capsicum_function_seen" = "xyes" -a "x$ac_lbl_capsicum_function_not_seen" != "xyes"; then
223 AC_DEFINE(HAVE_CAPSICUM, 1, [capsicum support available])
228 AC_MSG_CHECKING([whether to sandbox using Casper library])
229 if test "x$ac_cv_lib_casper_cap_init" = "xyes" -a "x$ac_cv_lib_cap_dns_cap_gethostbyaddr" = "xyes"; then
230 AC_DEFINE(HAVE_CASPER, 1, [Casper support available])
237 # We must check this before checking whether to check the OS's IPv6,
238 # support because, on some platforms (such as SunOS 5.x), the test
239 # program requires the extra networking libraries.
244 # Check whether AF_INET6 and struct in6_addr are defined.
245 # If they aren't both defined, we don't have sufficient OS
246 # support for IPv6, so we don't look for IPv6 support libraries,
247 # and we define AF_INET6 and struct in6_addr ourselves.
249 AC_MSG_CHECKING([whether the operating system supports IPv6])
254 /* AF_INET6 available check */
255 #include <sys/types.h>
257 #include <ws2tcpip.h>
259 #include <sys/socket.h>
260 #include <netinet/in.h>
264 foo(struct in6_addr *addr)
266 memset(addr, 0, sizeof (struct in6_addr));
269 #error "AF_INET6 not defined"
275 AC_DEFINE(HAVE_OS_IPV6_SUPPORT, 1,
276 [define if the OS provides AF_INET6 and struct in6_addr])
289 if test "$ipv6" = "yes"; then
290 AC_MSG_CHECKING([ipv6 stack type])
291 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
294 dnl http://www.kame.net/
296 [#include <netinet/in.h>
297 #ifdef IPV6_INRIA_VERSION
303 dnl http://www.kame.net/
305 [#include <netinet/in.h>
311 ipv6libdir=/usr/local/v6/lib;
315 dnl http://www.v6.linux.or.jp/
317 [#include <features.h>
318 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
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="-I/usr/inet6/include $CFLAGS"
339 [#include <sys/param.h>
340 #ifdef _TOSHIBA_INET6
345 ipv6libdir=/usr/local/v6/lib])
349 [#include </usr/local/v6/include/sys/v6config.h>
355 ipv6libdir=/usr/local/v6/lib;
356 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
360 [#include <sys/param.h>
361 #ifdef _ZETA_MINAMI_INET6
366 ipv6libdir=/usr/local/v6/lib])
369 if test "$ipv6type" != "unknown"; then
373 AC_MSG_RESULT($ipv6type)
376 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
377 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
378 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
379 echo "You have $ipv6lib library, using it"
381 if test "$ipv6trylibc" = "yes"; then
382 echo "You do not have $ipv6lib library, using libc"
384 echo 'Fatal: no $ipv6lib library found. cannot continue.'
385 echo "You need to fetch lib$ipv6lib.a from appropriate"
386 echo 'ipv6 kit and compile beforehand.'
392 AC_SEARCH_LIBS(dnet_htoa, dnet,
394 AC_DEFINE(HAVE_DNET_HTOA, 1,
395 [define if you have the dnet_htoa function])
397 # OK, we have dnet_htoa(). Do we have netdnet/dnetdb.h?
399 AC_CHECK_HEADERS(netdnet/dnetdb.h)
400 if test "$ac_cv_header_netdnet_dnetdb_h" = "yes"; then
402 # Yes. Does it declare dnet_htoa()?
404 AC_CHECK_DECL(dnet_htoa,
407 AC_DEFINE(NETDNET_DNETDB_H_DECLARES_DNET_HTOA,,
408 [Define to 1 if netenet/dnetdb.h declares `dnet_htoa'])
412 #include <netdnet/dnetdb.h>
417 # Do we have netdnet/dn.h?
419 AC_CHECK_HEADERS(netdnet/dn.h)
420 if test "$ac_cv_header_netdnet_dn_h" = "yes"; then
422 # Yes. Does it declare struct dn_naddr?
424 AC_CHECK_TYPES(struct dn_naddr,,,
426 #include <netdnet/dn.h>
431 AC_REPLACE_FUNCS(strlcat strlcpy strdup strsep getservent getopt_long)
432 AC_CHECK_FUNCS(fork vfork strftime)
433 AC_CHECK_FUNCS(setlinebuf)
436 AC_CHECK_FUNCS(vsnprintf snprintf,,
438 if test $needsnprintf = yes; then
442 AC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpc
444 dnl Some platforms may need -lnsl for getrpcbynumber.
445 AC_SEARCH_LIBS(getrpcbynumber, nsl,
446 AC_DEFINE(HAVE_GETRPCBYNUMBER, 1, [define if you have getrpcbynumber()]))
448 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
451 # Check for these after AC_LBL_LIBPCAP, so we link with the appropriate
452 # libraries (e.g., "-lsocket -lnsl" on Solaris).
454 # You are in a twisty little maze of UN*Xes, all different.
455 # Some might not have ether_ntohost().
456 # Some might have it, but not declare it in any header file.
457 # Some might have it, but declare it in <netinet/if_ether.h>.
458 # Some might have it, but declare it in <netinet/ether.h>
459 # (And some might have it but document it as something declared in
460 # <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
462 # Before you is a C compiler.
464 AC_CHECK_FUNCS(ether_ntohost, [
465 AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
468 #include <sys/types.h>
469 #include <sys/param.h>
470 #include <sys/socket.h>
473 main(int argc, char **argv)
475 u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
476 char name[MAXHOSTNAMELEN];
478 ether_ntohost(name, (struct ether_addr *)ea);
481 ], [ac_cv_buggy_ether_ntohost=no],
482 [ac_cv_buggy_ether_ntohost=yes],
483 [ac_cv_buggy_ether_ntohost="not while cross-compiling"])])
484 if test "$ac_cv_buggy_ether_ntohost" = "no"; then
485 AC_DEFINE(USE_ETHER_NTOHOST, 1,
486 [define if you have ether_ntohost() and it works])
489 if test "$ac_cv_func_ether_ntohost" = yes -a \
490 "$ac_cv_buggy_ether_ntohost" = "no"; then
492 # OK, we have ether_ntohost(). Do we have <netinet/if_ether.h>?
494 if test "$ac_cv_header_netinet_if_ether_h" = yes; then
496 # Yes. Does it declare ether_ntohost()?
498 AC_CHECK_DECL(ether_ntohost,
500 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST,,
501 [Define to 1 if netinet/if_ether.h declares `ether_ntohost'])
504 #include <sys/types.h>
505 #include <sys/socket.h>
506 #include <netinet/in.h>
507 #include <arpa/inet.h>
511 #include <netinet/if_ether.h>
517 if test "$ac_cv_have_decl_ether_ntohost" != yes; then
519 # No, how about <netinet/ether.h>, as on Linux?
521 AC_CHECK_HEADERS(netinet/ether.h)
522 if test "$ac_cv_header_netinet_ether_h" = yes; then
524 # We have it - does it declare ether_ntohost()?
525 # Unset ac_cv_have_decl_ether_ntohost so we don't
526 # treat the previous failure as a cached value and
527 # suppress the next test.
529 unset ac_cv_have_decl_ether_ntohost
530 AC_CHECK_DECL(ether_ntohost,
532 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,,
533 [Define to 1 if netinet/ether.h declares `ether_ntohost'])
536 #include <netinet/ether.h>
541 # Is ether_ntohost() declared?
543 if test "$ac_cv_have_decl_ether_ntohost" != yes; then
545 # No, we'll have to declare it ourselves.
546 # Do we have "struct ether_addr"?
548 AC_CHECK_TYPES(struct ether_addr,,,
550 #include <sys/types.h>
551 #include <sys/socket.h>
552 #include <netinet/in.h>
553 #include <arpa/inet.h>
557 #include <netinet/if_ether.h>
559 AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 0,
560 [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
563 AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 1,
564 [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
570 dnl Check for "pcap_list_datalinks()" and use a substitute version if
571 dnl it's not present. If it is present, check for "pcap_free_datalinks()";
572 dnl if it's not present, we don't replace it for now. (We could do so
573 dnl on UN*X, but not on Windows, where hilarity ensues if a program
574 dnl built with one version of the MSVC support library tries to free
575 dnl something allocated by a library built with another version of
576 dnl the MSVC support library.)
578 AC_CHECK_FUNC(pcap_list_datalinks,
580 AC_DEFINE(HAVE_PCAP_LIST_DATALINKS, 1,
581 [define if libpcap has pcap_list_datalinks()])
582 AC_CHECK_FUNCS(pcap_free_datalinks)
589 dnl Check for "pcap_datalink_name_to_val()", and use a substitute
590 dnl version if it's not present. If it is present, check for
591 dnl "pcap_datalink_val_to_description()", and if we don't have it,
592 dnl use a substitute version.
594 AC_CHECK_FUNC(pcap_datalink_name_to_val,
596 AC_DEFINE(HAVE_PCAP_DATALINK_NAME_TO_VAL, 1,
597 [define if libpcap has pcap_datalink_name_to_val()])
598 AC_CHECK_FUNC(pcap_datalink_val_to_description,
599 AC_DEFINE(HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION, 1,
600 [define if libpcap has pcap_datalink_val_to_description()]),
610 dnl Check for "pcap_set_datalink()"; you can't substitute for it if
611 dnl it's absent (it has hooks into libpcap), so just define the
612 dnl HAVE_ value if it's there.
614 AC_CHECK_FUNCS(pcap_set_datalink)
617 dnl Check for "pcap_breakloop()"; you can't substitute for it if
618 dnl it's absent (it has hooks into the live capture routines),
619 dnl so just define the HAVE_ value if it's there.
621 AC_CHECK_FUNCS(pcap_breakloop)
624 dnl Check for "pcap_dump_ftell()" and use a substitute version
625 dnl if it's not present.
627 AC_CHECK_FUNC(pcap_dump_ftell,
628 AC_DEFINE(HAVE_PCAP_DUMP_FTELL, 1,
629 [define if libpcap has pcap_dump_ftell()]),
631 AC_LIBOBJ(pcap_dump_ftell)
635 # Do we have the new open API? Check for pcap_create, and assume that,
636 # if we do, we also have pcap_activate() and the other new routines
637 # introduced in libpcap 1.0.0.
639 AC_CHECK_FUNCS(pcap_create)
640 if test $ac_cv_func_pcap_create = "yes" ; then
642 # OK, do we have pcap_set_tstamp_type? If so, assume we have
643 # pcap_list_tstamp_types and pcap_free_tstamp_types as well.
645 AC_CHECK_FUNCS(pcap_set_tstamp_type)
647 # And do we have pcap_set_tstamp_precision? If so, we assume
648 # we also have pcap_open_offline_with_tstamp_precision.
650 AC_CHECK_FUNCS(pcap_set_tstamp_precision)
654 # Check for a miscellaneous collection of functions which we use
657 AC_CHECK_FUNCS(pcap_findalldevs)
658 if test $ac_cv_func_pcap_findalldevs = "yes" ; then
659 dnl Check for libpcap having pcap_findalldevs() but the pcap.h header
660 dnl not having pcap_if_t; some versions of Mac OS X shipped with pcap.h
661 dnl from 0.6 and libpcap 0.8, so that libpcap had pcap_findalldevs but
662 dnl pcap.h didn't have pcap_if_t.
663 savedcppflags="$CPPFLAGS"
664 CPPFLAGS="$CPPFLAGS $V_INCLS"
665 AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>])
666 CPPFLAGS="$savedcppflags"
668 AC_CHECK_FUNCS(pcap_dump_flush pcap_lib_version)
669 if test $ac_cv_func_pcap_lib_version = "no" ; then
670 AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
673 extern char pcap_version[];
675 return (int)pcap_version;
677 ac_lbl_cv_pcap_version_defined=yes,
678 ac_lbl_cv_pcap_version_defined=no)
679 if test "$ac_lbl_cv_pcap_version_defined" = yes ; then
681 AC_DEFINE(HAVE_PCAP_VERSION, 1, [define if libpcap has pcap_version])
686 AC_CHECK_FUNCS(pcap_setdirection pcap_set_immediate_mode pcap_dump_ftell64)
687 AC_CHECK_FUNCS(pcap_open pcap_findalldevs_ex)
690 # Check for special debugging functions
692 AC_CHECK_FUNCS(pcap_set_parser_debug)
693 if test "$ac_cv_func_pcap_set_parser_debug" = "no" ; then
695 # OK, we don't have pcap_set_parser_debug() to set the libpcap
696 # filter expression parser debug flag; can we directly set the
698 AC_MSG_CHECKING(whether pcap_debug is defined by libpcap)
701 extern int pcap_debug;
705 ac_lbl_cv_pcap_debug_defined=yes,
706 ac_lbl_cv_pcap_debug_defined=no)
707 if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then
709 AC_DEFINE(HAVE_PCAP_DEBUG, 1, [define if libpcap has pcap_debug])
713 # OK, what about "yydebug"?
715 AC_MSG_CHECKING(whether yydebug is defined by libpcap)
722 ac_lbl_cv_yydebug_defined=yes,
723 ac_lbl_cv_yydebug_defined=no)
724 if test "$ac_lbl_cv_yydebug_defined" = yes ; then
726 AC_DEFINE(HAVE_YYDEBUG, 1, [define if libpcap has yydebug])
732 AC_CHECK_FUNCS(pcap_set_optimizer_debug)
733 AC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6
736 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
740 # Assume V7/BSD convention for man pages (file formats in section 5,
741 # miscellaneous info in section 7).
748 dnl Workaround to enable certain features
749 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
754 # Use System V conventions for man pages.
764 # Use System V conventions for man pages.
774 # Use System V conventions for man pages.
784 # Use System V conventions for man pages.
791 if test -f /dev/bpf0 ; then
796 # Make sure we have a definition for C99's uintptr_t (regardless of
797 # whether the environment is a C99 environment or not).
802 # Check whether we have pcap/pcap-inttypes.h.
803 # If we do, we use that to get the C99 types defined.
805 savedcppflags="$CPPFLAGS"
806 CPPFLAGS="$CPPFLAGS $V_INCLS"
807 AC_CHECK_HEADERS(pcap/pcap-inttypes.h)
808 CPPFLAGS="$savedcppflags"
811 # Define the old BSD specified-width types in terms of the C99 types;
812 # we may need them with libpcap include files.
814 AC_CHECK_TYPE([u_int8_t], ,
815 [AC_DEFINE([u_int8_t], [uint8_t],
816 [Define to `uint8_t' if u_int8_t not defined.])],
818 #include <sys/types.h>
820 AC_CHECK_TYPE([u_int16_t], ,
821 [AC_DEFINE([u_int16_t], [uint16_t],
822 [Define to `uint16_t' if u_int16_t not defined.])],
824 #include <sys/types.h>
826 AC_CHECK_TYPE([u_int32_t], ,
827 [AC_DEFINE([u_int32_t], [uint32_t],
828 [Define to `uint32_t' if u_int32_t not defined.])],
830 #include <sys/types.h>
832 AC_CHECK_TYPE([u_int64_t], ,
833 [AC_DEFINE([u_int64_t], [uint64_t],
834 [Define to `uint64_t' if u_int64_t not defined.])],
836 #include <sys/types.h>
840 # Check for some headers introduced in later versions of libpcap
841 # and used by some printers.
843 # Those headers might use the {u_}intN_t types, so we must do this
844 # after we check for what's needed to get them defined.
846 savedcppflags="$CPPFLAGS"
847 CPPFLAGS="$CPPFLAGS $V_INCLS"
848 AC_CHECK_HEADERS(pcap/bluetooth.h,,,[#include "netdissect-stdinc.h"])
849 AC_CHECK_HEADERS(pcap/nflog.h,,,[#include "netdissect-stdinc.h"])
850 CPPFLAGS="$savedcppflags"
853 AC_CHECK_TOOL([AR], [ar])
855 AC_LBL_DEVEL(V_CCOPT)
857 # Check for OpenSSL/libressl libcrypto
858 AC_MSG_CHECKING(whether to use OpenSSL/libressl libcrypto)
859 # Specify location for both includes and libraries.
860 want_libcrypto=ifavailable
862 AS_HELP_STRING([--with-crypto]@<:@=DIR@:>@,
863 [use OpenSSL/libressl libcrypto (located in directory DIR, if specified) @<:@default=yes, if available@:>@]),
865 if test $withval = no
867 # User doesn't want to link with libcrypto.
870 elif test $withval = yes
872 # User wants to link with libcrypto but hasn't specified
877 # User wants to link with libcrypto and has specified
878 # a directory, so use the provided value.
880 libcrypto_root=$withval
881 AC_MSG_RESULT([yes, using the version installed in $withval])
884 # Put the subdirectories of the libcrypto root directory
885 # at the front of the header and library search path.
887 CFLAGS="-I$withval/include $CFLAGS"
888 LIBS="-L$withval/lib $LIBS"
892 # Use libcrypto if it's present, otherwise don't; no directory
895 want_libcrypto=ifavailable
896 AC_MSG_RESULT([yes, if available])
898 if test "$want_libcrypto" != "no"; then
900 # Don't check for libcrypto unless we have its headers;
901 # Apple, bless their pointy little heads, apparently ship
902 # libcrypto as a library, but not the header files, in
903 # El Capitan, probably because they don't want you writing
904 # nasty portable code that could run on other UN*Xes, they
905 # want you writing code that uses their Shiny New Crypto
906 # Library and that only runs on macOS.
908 AC_CHECK_HEADER(openssl/crypto.h,
910 AC_CHECK_LIB(crypto, DES_cbc_encrypt)
911 if test "$ac_cv_lib_crypto_DES_cbc_encrypt" = "yes"; then
912 AC_CHECK_HEADERS(openssl/evp.h)
916 # 1) do we have EVP_CIPHER_CTX_new?
917 # If so, we use it to allocate an
918 # EVP_CIPHER_CTX, as EVP_CIPHER_CTX may be
919 # opaque; otherwise, we allocate it ourselves.
921 # 2) do we have EVP_CipherInit_ex()?
922 # If so, we use it, because we need to be
923 # able to make two "initialize the cipher"
924 # calls, one with the cipher and key, and
925 # one with the IV, and, as of OpenSSL 1.1,
926 # You Can't Do That with EVP_CipherInit(),
927 # because a call to EVP_CipherInit() will
928 # unconditionally clear the context, and
929 # if you don't supply a cipher, it'll
930 # clear the cipher, rendering the context
931 # unusable and causing a crash.
933 AC_CHECK_FUNCS(EVP_CIPHER_CTX_new EVP_CipherInit_ex)
938 # Check for libcap-ng
939 AC_MSG_CHECKING(whether to use libcap-ng)
940 # Specify location for both includes and libraries.
941 want_libcap_ng=ifavailable
943 AS_HELP_STRING([--with-cap-ng],
944 [use libcap-ng @<:@default=yes, if available@:>@]),
946 if test $withval = no
950 elif test $withval = yes
957 # Use libcap-ng if it's present, otherwise don't.
959 want_libcap_ng=ifavailable
960 AC_MSG_RESULT([yes, if available])
962 if test "$want_libcap_ng" != "no"; then
963 AC_CHECK_LIB(cap-ng, capng_change_id)
964 AC_CHECK_HEADERS(cap-ng.h)
968 dnl set additional include path if necessary
969 if test "$missing_includes" = "yes"; then
970 CPPFLAGS="$CPPFLAGS -I$srcdir/missing"
971 V_INCLS="$V_INCLS -I$srcdir/missing"
980 AC_SUBST(MAN_FILE_FORMATS)
981 AC_SUBST(MAN_MISC_INFO)
985 AC_CONFIG_HEADER(config.h)
987 AC_OUTPUT_COMMANDS([if test -f .devel; then
988 echo timestamp > stamp-h
989 cat Makefile-devel-adds >> Makefile
992 AC_OUTPUT(Makefile tcpdump.1)