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
33 AC_C___ATTRIBUTE___FALLTHROUGH
36 AC_CHECK_HEADERS(fcntl.h rpc/rpc.h rpc/rpcent.h netdnet/dnetdb.h)
37 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
38 #include <sys/socket.h>
40 if test "$ac_cv_header_net_pfvar_h" = yes; then
41 AC_CHECK_HEADERS(net/if_pflog.h, , , [#include <sys/types.h>
42 #include <sys/socket.h>
44 #include <net/pfvar.h>])
45 if test "$ac_cv_header_net_if_pflog_h" = yes; then
46 LOCALSRC="print-pflog.c $LOCALSRC"
49 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
50 #include <sys/socket.h>])
51 if test "$ac_cv_header_netinet_if_ether_h" != yes; then
53 # The simple test didn't work.
54 # Do we need to include <net/if.h> first?
55 # Unset ac_cv_header_netinet_if_ether_h so we don't
56 # treat the previous failure as a cached value and
57 # suppress the next test.
59 AC_MSG_NOTICE([Rechecking with some additional includes])
60 unset ac_cv_header_netinet_if_ether_h
61 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
62 #include <sys/socket.h>
63 #include <netinet/in.h>
74 AC_ARG_ENABLE(universal,
75 AC_HELP_STRING([--disable-universal],[don't build universal on OS X]))
76 if test "$enable_universal" != "no"; then
81 # Leopard. Build for x86 and 32-bit PowerPC, with
82 # x86 first. (That's what Apple does.)
84 V_CCOPT="$V_CCOPT -arch i386 -arch ppc"
85 LDFLAGS="$LDFLAGS -arch i386 -arch ppc"
90 # Snow Leopard. Build for x86-64 and x86, with
91 # x86-64 first. (That's what Apple does.)
93 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386"
94 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386"
103 [ --with-smi link with libsmi (allows to load MIBs on the fly to decode SNMP packets. [default=yes]
104 --without-smi don't link with libsmi],,
107 if test "x$with_smi" != "xno" ; then
108 AC_CHECK_HEADER(smi.h,
111 # OK, we found smi.h. Do we have libsmi with smiInit?
113 AC_CHECK_LIB(smi, smiInit,
116 # OK, we have libsmi with smiInit. Can we use it?
118 AC_MSG_CHECKING([whether to enable libsmi])
123 /* libsmi available check */
127 int current, revision, age, n;
128 const int required = 2;
131 if (strcmp(SMI_LIBRARY_VERSION, smi_library_version))
133 n = sscanf(smi_library_version, "%d:%d:%d", ¤t, &revision, &age);
136 if (required < current - age || required > current)
143 AC_DEFINE(USE_LIBSMI, 1,
144 [Define if you enable support for libsmi])
147 dnl autoconf documentation says that
148 dnl $? contains the exit value.
149 dnl reality is that it does not.
150 dnl We leave this in just in case
151 dnl autoconf ever comes back to
152 dnl match the documentation.
154 1) AC_MSG_RESULT(no - smiInit failed) ;;
155 2) AC_MSG_RESULT(no - header/library version mismatch) ;;
156 3) AC_MSG_RESULT(no - can't determine library version) ;;
157 4) AC_MSG_RESULT(no - too old) ;;
158 *) AC_MSG_RESULT(no) ;;
163 AC_MSG_RESULT(not when cross-compiling)
171 AC_MSG_CHECKING([whether to enable the possibly-buggy SMB printer])
173 [ --enable-smb enable possibly-buggy SMB printer [default=yes]
174 --disable-smb disable possibly-buggy SMB printer],,
177 yes) AC_MSG_RESULT(yes)
178 AC_WARN([The SMB printer may have exploitable buffer overflows!!!])
179 AC_DEFINE(ENABLE_SMB, 1,
180 [define if you want to build the possibly-buggy SMB printer])
181 LOCALSRC="print-smb.c smbutil.c $LOCALSRC"
187 AC_ARG_WITH(user, [ --with-user=USERNAME drop privileges by default to USERNAME])
188 AC_MSG_CHECKING([whether to drop root privileges by default])
189 if test ! -z "$with_user" ; then
190 AC_DEFINE_UNQUOTED(WITH_USER, "$withval",
191 [define if should drop privileges by default])
192 AC_MSG_RESULT(to \"$withval\")
197 AC_ARG_WITH(chroot, [ --with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY])
198 AC_MSG_CHECKING([whether to chroot])
199 if test ! -z "$with_chroot" && test "$with_chroot" != "no" ; then
200 AC_DEFINE_UNQUOTED(WITH_CHROOT, "$withval",
201 [define if should chroot when dropping privileges])
202 AC_MSG_RESULT(to \"$withval\")
207 AC_ARG_WITH(sandbox-capsicum,
208 AS_HELP_STRING([--with-sandbox-capsicum],
209 [use Capsicum security functions @<:@default=yes, if available@:>@]))
211 # Check whether various functions are available. If any are, set
212 # ac_lbl_capsicum_function_seen to yes; if any are not, set
213 # ac_lbl_capsicum_function_not_seen to yes.
215 # We don't check cap_rights_init(), as it's a macro, wrapping another
216 # function, in at least some versions of FreeBSD, and AC_CHECK_FUNCS()
217 # doesn't handle that.
219 # All of the ones we check for must be available in order to enable
220 # capsicum sandboxing.
222 # XXX - do we need to check for all of them, or are there some that, if
223 # present, imply others are present?
225 if test ! -z "$with_sandbox-capsicum" && test "$with_sandbox-capsicum" != "no" ; then
226 AC_CHECK_FUNCS(cap_enter cap_rights_limit cap_ioctls_limit openat,
227 ac_lbl_capsicum_function_seen=yes,
228 ac_lbl_capsicum_function_not_seen=yes)
229 AC_CHECK_LIB(casper, cap_init, LIBS="$LIBS -lcasper")
230 AC_CHECK_LIB(cap_dns, cap_gethostbyaddr, LIBS="$LIBS -lcap_dns")
232 AC_MSG_CHECKING([whether to sandbox using capsicum])
233 if test "x$ac_lbl_capsicum_function_seen" = "xyes" -a "x$ac_lbl_capsicum_function_not_seen" != "xyes"; then
234 AC_DEFINE(HAVE_CAPSICUM, 1, [capsicum support available])
239 AC_MSG_CHECKING([whether to sandbox using Casper library])
240 if test "x$ac_cv_lib_casper_cap_init" = "xyes" -a "x$ac_cv_lib_cap_dns_cap_gethostbyaddr" = "xyes"; then
241 AC_DEFINE(HAVE_CASPER, 1, [Casper support available])
248 # We must check this before checking whether to check the OS's IPv6,
249 # support because, on some platforms (such as SunOS 5.x), the test
250 # program requires the extra networking libraries.
255 # Check whether AF_INET6 and struct in6_addr are defined.
256 # If they aren't both defined, we don't have sufficient OS
257 # support for IPv6, so we don't look for IPv6 support libraries,
258 # and we define AF_INET6 and struct in6_addr ourselves.
260 AC_MSG_CHECKING([whether the operating system supports IPv6])
265 /* AF_INET6 available check */
266 #include <sys/types.h>
267 #include <sys/socket.h>
268 #include <netinet/in.h>
271 foo(struct in6_addr *addr)
273 memset(addr, 0, sizeof (struct in6_addr));
276 #error "AF_INET6 not defined"
282 AC_DEFINE(HAVE_OS_IPV6_SUPPORT, 1,
283 [define if the OS provides AF_INET6 and struct in6_addr])
296 if test "$ipv6" = "yes"; then
297 AC_MSG_CHECKING([ipv6 stack type])
298 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
301 dnl http://www.kame.net/
303 [#include <netinet/in.h>
304 #ifdef IPV6_INRIA_VERSION
310 dnl http://www.kame.net/
312 [#include <netinet/in.h>
318 ipv6libdir=/usr/local/v6/lib;
322 dnl http://www.v6.linux.or.jp/
324 [#include <features.h>
325 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
331 dnl http://www.v6.linux.or.jp/
333 dnl This also matches Solaris 8 and Tru64 UNIX 5.1,
334 dnl and possibly other versions of those OSes
336 if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
339 ipv6libdir=/usr/inet6/lib
341 CFLAGS="-I/usr/inet6/include $CFLAGS"
346 [#include <sys/param.h>
347 #ifdef _TOSHIBA_INET6
352 ipv6libdir=/usr/local/v6/lib])
356 [#include </usr/local/v6/include/sys/v6config.h>
362 ipv6libdir=/usr/local/v6/lib;
363 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
367 [#include <sys/param.h>
368 #ifdef _ZETA_MINAMI_INET6
373 ipv6libdir=/usr/local/v6/lib])
376 if test "$ipv6type" != "unknown"; then
380 AC_MSG_RESULT($ipv6type)
383 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
384 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
385 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
386 echo "You have $ipv6lib library, using it"
388 if test "$ipv6trylibc" = "yes"; then
389 echo "You do not have $ipv6lib library, using libc"
391 echo 'Fatal: no $ipv6lib library found. cannot continue.'
392 echo "You need to fetch lib$ipv6lib.a from appropriate"
393 echo 'ipv6 kit and compile beforehand.'
399 AC_CACHE_CHECK([for dnet_htoa declaration in netdnet/dnetdb.h],
400 [td_cv_decl_netdnet_dnetdb_h_dnet_htoa],
401 [AC_EGREP_HEADER(dnet_htoa, netdnet/dnetdb.h,
402 td_cv_decl_netdnet_dnetdb_h_dnet_htoa=yes,
403 td_cv_decl_netdnet_dnetdb_h_dnet_htoa=no)])
404 if test "$td_cv_decl_netdnet_dnetdb_h_dnet_htoa" = yes; then
405 AC_DEFINE(HAVE_NETDNET_DNETDB_H_DNET_HTOA, 1,
406 [define if you have a dnet_htoa declaration in <netdnet/dnetdb.h>])
409 AC_REPLACE_FUNCS(vfprintf strlcat strlcpy strdup strsep getopt_long)
410 AC_CHECK_FUNCS(fork vfork strftime)
411 AC_CHECK_FUNCS(setlinebuf alarm)
414 AC_CHECK_FUNCS(vsnprintf snprintf,,
416 if test $needsnprintf = yes; then
422 AC_SEARCH_LIBS(dnet_htoa, dnet,
423 AC_DEFINE(HAVE_DNET_HTOA, 1, [define if you have the dnet_htoa function]))
425 AC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpc
427 dnl Some platforms may need -lnsl for getrpcbynumber.
428 AC_SEARCH_LIBS(getrpcbynumber, nsl,
429 AC_DEFINE(HAVE_GETRPCBYNUMBER, 1, [define if you have getrpcbynumber()]))
431 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
434 # Check for these after AC_LBL_LIBPCAP, so we link with the appropriate
435 # libraries (e.g., "-lsocket -lnsl" on Solaris).
437 # You are in a twisty little maze of UN*Xes, all different.
438 # Some might not have ether_ntohost().
439 # Some might have it, but not declare it in any header file.
440 # Some might have it, but declare it in <netinet/if_ether.h>.
441 # Some might have it, but declare it in <netinet/ether.h>
442 # (And some might have it but document it as something declared in
443 # <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
445 # Before you is a C compiler.
447 AC_CHECK_FUNCS(ether_ntohost, [
448 AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
451 #include <sys/types.h>
452 #include <sys/param.h>
453 #include <sys/socket.h>
456 main(int argc, char **argv)
458 u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
459 char name[MAXHOSTNAMELEN];
461 ether_ntohost(name, (struct ether_addr *)ea);
464 ], [ac_cv_buggy_ether_ntohost=no],
465 [ac_cv_buggy_ether_ntohost=yes],
466 [ac_cv_buggy_ether_ntohost="not while cross-compiling"])])
467 if test "$ac_cv_buggy_ether_ntohost" = "no"; then
468 AC_DEFINE(USE_ETHER_NTOHOST, 1,
469 [define if you have ether_ntohost() and it works])
472 if test "$ac_cv_func_ether_ntohost" = yes -a \
473 "$ac_cv_buggy_ether_ntohost" = "no"; then
475 # OK, we have ether_ntohost(). Do we have <netinet/if_ether.h>?
477 if test "$ac_cv_header_netinet_if_ether_h" = yes; then
479 # Yes. Does it declare ether_ntohost()?
481 AC_CHECK_DECL(ether_ntohost,
483 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST,,
484 [Define to 1 if netinet/if_ether.h declares `ether_ntohost'])
487 #include <sys/types.h>
488 #include <sys/socket.h>
489 #include <netinet/in.h>
490 #include <arpa/inet.h>
494 #include <netinet/if_ether.h>
500 if test "$ac_cv_have_decl_ether_ntohost" != yes; then
502 # No, how about <netinet/ether.h>, as on Linux?
504 AC_CHECK_HEADERS(netinet/ether.h)
505 if test "$ac_cv_header_netinet_ether_h" = yes; then
507 # We have it - does it declare ether_ntohost()?
508 # Unset ac_cv_have_decl_ether_ntohost so we don't
509 # treat the previous failure as a cached value and
510 # suppress the next test.
512 unset ac_cv_have_decl_ether_ntohost
513 AC_CHECK_DECL(ether_ntohost,
515 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,,
516 [Define to 1 if netinet/ether.h declares `ether_ntohost'])
519 #include <netinet/ether.h>
524 # Is ether_ntohost() declared?
526 if test "$ac_cv_have_decl_ether_ntohost" != yes; then
528 # No, we'll have to declare it ourselves.
529 # Do we have "struct ether_addr"?
531 AC_CHECK_TYPES(struct ether_addr,,,
533 #include <sys/types.h>
534 #include <sys/socket.h>
535 #include <netinet/in.h>
536 #include <arpa/inet.h>
540 #include <netinet/if_ether.h>
542 AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 0,
543 [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
546 AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 1,
547 [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
552 # libdlpi is needed for Solaris 11 and later.
553 AC_CHECK_LIB(dlpi, dlpi_walk, LIBS="$LIBS -ldlpi" LDFLAGS="-L/lib $LDFLAGS", ,-L/lib)
556 dnl Check for "pcap_list_datalinks()", "pcap_set_datalink()",
557 dnl and "pcap_datalink_name_to_val()", and use substitute versions
558 dnl if they're not present.
560 AC_CHECK_FUNC(pcap_list_datalinks,
562 AC_DEFINE(HAVE_PCAP_LIST_DATALINKS, 1,
563 [define if libpcap has pcap_list_datalinks()])
564 AC_CHECK_FUNCS(pcap_free_datalinks)
569 AC_CHECK_FUNCS(pcap_set_datalink)
570 AC_CHECK_FUNC(pcap_datalink_name_to_val,
572 AC_DEFINE(HAVE_PCAP_DATALINK_NAME_TO_VAL, 1,
573 [define if libpcap has pcap_datalink_name_to_val()])
574 AC_CHECK_FUNC(pcap_datalink_val_to_description,
575 AC_DEFINE(HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION, 1,
576 [define if libpcap has pcap_datalink_val_to_description()]),
586 dnl Check for "pcap_breakloop()"; you can't substitute for it if
587 dnl it's absent (it has hooks into the live capture routines),
588 dnl so just define the HAVE_ value if it's there.
590 AC_CHECK_FUNCS(pcap_breakloop)
593 dnl Check for "pcap_dump_ftell()" and use a substitute version
594 dnl if it's not present.
596 AC_CHECK_FUNC(pcap_dump_ftell,
597 AC_DEFINE(HAVE_PCAP_DUMP_FTELL, 1,
598 [define if libpcap has pcap_dump_ftell()]),
600 AC_LIBOBJ(pcap_dump_ftell)
604 # Do we have the new open API? Check for pcap_create, and assume that,
605 # if we do, we also have pcap_activate() and the other new routines
606 # introduced in libpcap 1.0.0.
608 AC_CHECK_FUNCS(pcap_create)
609 if test $ac_cv_func_pcap_create = "yes" ; then
611 # OK, do we have pcap_set_tstamp_type? If so, assume we have
612 # pcap_list_tstamp_types and pcap_free_tstamp_types as well.
614 AC_CHECK_FUNCS(pcap_set_tstamp_type)
616 # And do we have pcap_set_tstamp_precision? If so, we assume
617 # we also have pcap_open_offline_with_tstamp_precision.
619 AC_CHECK_FUNCS(pcap_set_tstamp_precision)
623 # Check for a miscellaneous collection of functions which we use
626 AC_CHECK_FUNCS(pcap_findalldevs pcap_dump_flush pcap_lib_version pcap_setdirection pcap_set_immediate_mode)
627 if test $ac_cv_func_pcap_findalldevs = "yes" ; then
628 dnl Check for Mac OS X, which may ship pcap.h from 0.6 but libpcap may
629 dnl be 0.8; this means that lib has pcap_findalldevs but header doesn't
631 savedcppflags="$CPPFLAGS"
632 CPPFLAGS="$CPPFLAGS $V_INCLS"
633 AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>])
634 CPPFLAGS="$savedcppflags"
637 if test $ac_cv_func_pcap_lib_version = "no" ; then
638 AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
641 extern char pcap_version[];
643 return (int)pcap_version;
645 ac_lbl_cv_pcap_version_defined=yes,
646 ac_lbl_cv_pcap_version_defined=no)
647 if test "$ac_lbl_cv_pcap_version_defined" = yes ; then
649 AC_DEFINE(HAVE_PCAP_VERSION, 1, [define if libpcap has pcap_version])
656 # Check for special debugging functions
658 AC_CHECK_FUNCS(pcap_set_parser_debug)
659 if test "$ac_cv_func_pcap_set_parser_debug" = "no" ; then
661 # OK, we don't have pcap_set_parser_debug() to set the libpcap
662 # filter expression parser debug flag; can we directly set the
664 AC_MSG_CHECKING(whether pcap_debug is defined by libpcap)
667 extern int pcap_debug;
671 ac_lbl_cv_pcap_debug_defined=yes,
672 ac_lbl_cv_pcap_debug_defined=no)
673 if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then
675 AC_DEFINE(HAVE_PCAP_DEBUG, 1, [define if libpcap has pcap_debug])
679 # OK, what about "yydebug"?
681 AC_MSG_CHECKING(whether yydebug is defined by libpcap)
688 ac_lbl_cv_yydebug_defined=yes,
689 ac_lbl_cv_yydebug_defined=no)
690 if test "$ac_lbl_cv_yydebug_defined" = yes ; then
692 AC_DEFINE(HAVE_YYDEBUG, 1, [define if libpcap has yydebug])
698 AC_CHECK_FUNCS(pcap_set_optimizer_debug)
699 AC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6
702 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
706 # Assume V7/BSD convention for man pages (file formats in section 5,
707 # miscellaneous info in section 7).
714 dnl Workaround to enable certain features
715 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
720 # Use System V conventions for man pages.
730 # Use System V conventions for man pages.
740 # Use System V conventions for man pages.
750 # Use System V conventions for man pages.
757 if test -f /dev/bpf0 ; then
762 # Make sure we have definitions for all the C99 specified-width types
763 # (regardless of whether the environment is a C99 environment or not).
775 # Make sure we have a definition for C99's uintptr_t (regardless of
776 # whether the environment is a C99 environment or not).
781 # Define the old BSD specified-width types in terms of the C99 types;
782 # we may need them with libpcap include files.
784 AC_CHECK_TYPE([u_int8_t], ,
785 [AC_DEFINE([u_int8_t], [uint8_t],
786 [Define to `uint8_t' if u_int8_t not defined.])],
788 #include <sys/types.h>
790 AC_CHECK_TYPE([u_int16_t], ,
791 [AC_DEFINE([u_int16_t], [uint16_t],
792 [Define to `uint16_t' if u_int16_t not defined.])],
794 #include <sys/types.h>
796 AC_CHECK_TYPE([u_int32_t], ,
797 [AC_DEFINE([u_int32_t], [uint32_t],
798 [Define to `uint32_t' if u_int32_t not defined.])],
800 #include <sys/types.h>
802 AC_CHECK_TYPE([u_int64_t], ,
803 [AC_DEFINE([u_int64_t], [uint64_t],
804 [Define to `uint64_t' if u_int64_t not defined.])],
806 #include <sys/types.h>
810 # Check for <inttypes.h>
812 AC_CHECK_HEADERS(inttypes.h,
815 # OK, we have inttypes.h, but does it define all the PRI[doxu]64 macros?
816 # Some systems have an inttypes.h that doesn't define all of them.
818 AC_MSG_CHECKING([[whether inttypes.h defines the PRI[doxu]64 macros]])
823 #include <inttypes.h>
825 #include <sys/types.h>
829 printf("%" PRId64 "\n", (uint64_t)1);
830 printf("%" PRIo64 "\n", (uint64_t)1);
831 printf("%" PRIx64 "\n", (uint64_t)1);
832 printf("%" PRIu64 "\n", (uint64_t)1);
838 ac_lbl_inttypes_h_defines_formats=yes
842 ac_lbl_inttypes_h_defines_formats=no
847 # We don't have inttypes.h, so it obviously can't define those
850 ac_lbl_inttypes_h_defines_formats=no
852 if test "$ac_lbl_inttypes_h_defines_formats" = no; then
853 AC_LBL_CHECK_64BIT_FORMAT(l,
855 AC_LBL_CHECK_64BIT_FORMAT(ll,
857 AC_LBL_CHECK_64BIT_FORMAT(L,
859 AC_LBL_CHECK_64BIT_FORMAT(q,
861 AC_MSG_ERROR([neither %llx nor %Lx nor %qx worked on a 64-bit integer])
869 # Check for some headers introduced in later versions of libpcap
870 # and used by some printers.
872 # Those headers use the {u_}intN_t types, so we must do this after
873 # we check for what's needed to get them defined.
875 savedcppflags="$CPPFLAGS"
876 CPPFLAGS="$CPPFLAGS $V_INCLS"
877 AC_CHECK_HEADERS(pcap/bluetooth.h,,,[#include "netdissect-stdinc.h"])
878 AC_CHECK_HEADERS(pcap/nflog.h,,,[#include "netdissect-stdinc.h"])
879 AC_CHECK_HEADERS(pcap/usb.h,,,[#include "netdissect-stdinc.h"])
880 CPPFLAGS="$savedcppflags"
883 AC_CHECK_TOOL([AR], [ar])
885 AC_LBL_DEVEL(V_CCOPT)
887 AC_LBL_SOCKADDR_SA_LEN
889 AC_LBL_UNALIGNED_ACCESS
891 # Check for OpenSSL/libressl libcrypto
892 AC_MSG_CHECKING(whether to use OpenSSL/libressl libcrypto)
893 # Specify location for both includes and libraries.
894 want_libcrypto=ifavailable
896 AS_HELP_STRING([--with-crypto]@<:@=DIR@:>@,
897 [use OpenSSL/libressl libcrypto (located in directory DIR, if specified) @<:@default=yes, if available@:>@]),
899 if test $withval = no
901 # User doesn't want to link with libcrypto.
904 elif test $withval = yes
906 # User wants to link with libcrypto but hasn't specified
911 # User wants to link with libcrypto and has specified
912 # a directory, so use the provided value.
914 libcrypto_root=$withval
915 AC_MSG_RESULT([yes, using the version installed in $withval])
918 # Put the subdirectories of the libcrypto root directory
919 # at the front of the header and library search path.
921 CFLAGS="-I$withval/include $CFLAGS"
922 LIBS="-L$withval/lib $LIBS"
926 # Use libcrypto if it's present, otherwise don't; no directory
929 want_libcrypto=ifavailable
930 AC_MSG_RESULT([yes, if available])
932 if test "$want_libcrypto" != "no"; then
934 # Don't check for libcrypto unless we have its headers;
935 # Apple, bless their pointy little heads, apparently ship
936 # libcrypto as a library, but not the header files, in
937 # El Capitan, probably because they don't want you writing
938 # nasty portable code that could run on other UN*Xes, they
939 # want you writing code that uses their Shiny New Crypto
940 # Library and that only runs on OS X.
942 AC_CHECK_HEADER(openssl/crypto.h,
944 AC_CHECK_LIB(crypto, DES_cbc_encrypt)
945 if test "$ac_cv_lib_crypto_DES_cbc_encrypt" = "yes"; then
946 AC_CHECK_HEADERS(openssl/evp.h)
948 # OK, do we have EVP_CIPHER_CTX_new?
949 # If so, we use it to allocate an
950 # EVP_CIPHER_CTX, as EVP_CIPHER_CTX may be
951 # opaque; otherwise, we allocate it ourselves.
953 AC_CHECK_FUNCS(EVP_CIPHER_CTX_new)
958 # Check for libcap-ng
959 AC_MSG_CHECKING(whether to use libcap-ng)
960 # Specify location for both includes and libraries.
961 want_libcap_ng=ifavailable
963 AS_HELP_STRING([--with-cap-ng],
964 [use libcap-ng @<:@default=yes, if available@:>@]),
966 if test $withval = no
970 elif test $withval = yes
977 # Use libcap-ng if it's present, otherwise don't.
979 want_libcap_ng=ifavailable
980 AC_MSG_RESULT([yes, if available])
982 if test "$want_libcap_ng" != "no"; then
983 AC_CHECK_LIB(cap-ng, capng_change_id)
984 AC_CHECK_HEADERS(cap-ng.h)
988 dnl set additional include path if necessary
989 if test "$missing_includes" = "yes"; then
990 CPPFLAGS="$CPPFLAGS -I$srcdir/missing"
991 V_INCLS="$V_INCLS -I$srcdir/missing"
1000 AC_SUBST(MAN_FILE_FORMATS)
1001 AC_SUBST(MAN_MISC_INFO)
1005 AC_CONFIG_HEADER(config.h)
1007 AC_OUTPUT_COMMANDS([if test -f .devel; then
1008 echo timestamp > stamp-h
1009 cat Makefile-devel-adds >> Makefile
1012 AC_OUTPUT(Makefile tcpdump.1)