1 dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.204 2008-11-18 07:39:20 guy Exp $ (LBL)
3 dnl Copyright (c) 1994, 1995, 1996, 1997
4 dnl The Regents of the University of California. All rights reserved.
6 dnl Process this file with autoconf to produce a configure script.
12 # http://ftp.gnu.org/gnu/config/README
14 # for the URLs to use to fetch new versions of config.guess and
18 AC_REVISION($Revision: 1.204 $)
24 AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
27 dnl Allow the user to specify flags to indicate the target architecture(s)
28 dnl (yes, possibly plural - think, for example, Mac OS X) for which we're
29 dnl building. Those might need to be used not only when compiling, but
30 dnl also when linking and when building a shared library.
32 dnl This is not for general cross-compiling, it's for use on platforms
33 dnl where versions of the native OS support more than one instruction
34 dnl set and where you want to build for the OS on which you're running
35 dnl but not for the default build architecture on the machine on which
38 AC_ARG_WITH(arch-flags,
39 AC_HELP_STRING([--with-arch-flags=FLAGS],[Use FLAGS to specify the target architecture(s)]),
41 if test "$withval" = "yes"
43 AC_MSG_ERROR(No flags specified for --with-arch-flags)
48 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
51 if test "$ac_cv___attribute__" = "yes"; then
52 AC_C___ATTRIBUTE___FORMAT_FUNCTION_POINTER
54 AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netdnet/dnetdb.h)
55 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
56 #include <sys/socket.h>
58 if test "$ac_cv_header_net_pfvar_h" = yes; then
59 LOCALSRC="print-pflog.c $LOCALSRC"
61 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
62 #include <sys/socket.h>])
63 if test "$ac_cv_header_netinet_if_ether_h" != yes; then
65 # The simple test didn't work.
66 # Do we need to include <net/if.h> first?
67 # Unset ac_cv_header_netinet_if_ether_h so we don't
68 # treat the previous failure as a cached value and
69 # suppress the next test.
71 AC_MSG_NOTICE([Rechecking with some additional includes])
72 unset ac_cv_header_netinet_if_ether_h
73 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
74 #include <sys/socket.h>
75 #include <netinet/in.h>
86 AC_MSG_CHECKING(Linux kernel version)
87 if test "$cross_compiling" = yes; then
88 AC_CACHE_VAL(ac_cv_linux_vers,
89 ac_cv_linux_vers=unknown)
91 AC_CACHE_VAL(ac_cv_linux_vers,
92 ac_cv_linux_vers=`uname -r 2>&1 | \
93 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
95 AC_MSG_RESULT($ac_cv_linux_vers)
96 if test $ac_cv_linux_vers = unknown ; then
97 AC_MSG_ERROR(cannot determine linux version when cross-compiling)
99 if test $ac_cv_linux_vers -lt 2 ; then
100 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
110 [ --with-smi link with libsmi (allows to load MIBs on the fly to decode SNMP packets. [default=yes]
111 --without-smi don't link with libsmi],,
114 if test "x$with_smi" != "xno" ; then
115 AC_CHECK_HEADERS(smi.h)
116 AC_CHECK_LIB(smi, smiInit)
117 if test "$ac_cv_header_smi_h" = yes -a "$ac_cv_lib_smi_smiInit" = yes
119 AC_MSG_CHECKING([whether to enable libsmi])
120 AC_TRY_RUN([ /* libsmi available check */
124 int current, revision, age, n;
125 const int required = 2;
128 if (strcmp(SMI_LIBRARY_VERSION, smi_library_version))
130 n = sscanf(smi_library_version, "%d:%d:%d", ¤t, &revision, &age);
133 if (required < current - age || required > current)
141 dnl autoconf documentation says that $? contains the exit value.
142 dnl reality is that it does not. We leave this in just in case
143 dnl autoconf ever comes back to match the documentation.
145 1) AC_MSG_RESULT(no - smiInit failed) ;;
146 2) AC_MSG_RESULT(no - header/library version mismatch) ;;
147 3) AC_MSG_RESULT(no - can't determine library version) ;;
148 4) AC_MSG_RESULT(no - too old) ;;
149 *) AC_MSG_RESULT(no) ;;
152 [ AC_MSG_RESULT(not when cross-compiling)
158 AC_MSG_CHECKING([whether to enable the possibly-buggy SMB printer])
160 [ --enable-smb enable possibly-buggy SMB printer [default=yes]
161 --disable-smb disable possibly-buggy SMB printer],,
164 yes) AC_MSG_RESULT(yes)
165 AC_WARN([The SMB printer may have exploitable buffer overflows!!!])
166 AC_DEFINE(TCPDUMP_DO_SMB)
167 LOCALSRC="print-smb.c smbutil.c $LOCALSRC"
173 AC_ARG_WITH(user, [ --with-user=USERNAME drop privileges by default to USERNAME])
174 AC_MSG_CHECKING([whether to drop root privileges by default])
175 if test ! -z "$with_user" ; then
176 AC_DEFINE_UNQUOTED(WITH_USER, "$withval")
177 AC_MSG_RESULT(to \"$withval\")
182 AC_ARG_WITH(chroot, [ --with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY])
183 AC_MSG_CHECKING([whether to chroot])
184 if test ! -z "$with_chroot" ; then
185 AC_DEFINE_UNQUOTED(WITH_CHROOT, "$withval")
186 AC_MSG_RESULT(to \"$withval\")
191 AC_MSG_CHECKING([whether to enable ipv6])
193 [ --enable-ipv6 enable ipv6 (with ipv4) support
194 --disable-ipv6 disable ipv6 support],
195 [ case "$enableval" in
196 yes) AC_MSG_RESULT(yes)
197 LOCALSRC="print-ip6.c print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
207 AC_TRY_RUN([ /* AF_INET6 available check */
208 #include <sys/types.h>
209 #include <sys/socket.h>
212 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
219 LOCALSRC="print-ip6.c print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
232 if test "$ipv6" = "yes"; then
233 AC_MSG_CHECKING([ipv6 stack type])
234 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
237 dnl http://www.kame.net/
239 [#include <netinet/in.h>
240 #ifdef IPV6_INRIA_VERSION
244 CFLAGS="-DINET6 $CFLAGS"])
247 dnl http://www.kame.net/
249 [#include <netinet/in.h>
255 ipv6libdir=/usr/local/v6/lib;
257 CFLAGS="-DINET6 $CFLAGS"])
260 dnl http://www.v6.linux.or.jp/
262 [#include <features.h>
263 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
267 CFLAGS="-DINET6 $CFLAGS"])
270 dnl http://www.v6.linux.or.jp/
272 dnl This also matches Solaris 8 and Tru64 UNIX 5.1,
273 dnl and possibly other versions of those OSes
275 if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
278 ipv6libdir=/usr/inet6/lib
280 CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
285 [#include <sys/param.h>
286 #ifdef _TOSHIBA_INET6
291 ipv6libdir=/usr/local/v6/lib;
292 CFLAGS="-DINET6 $CFLAGS"])
296 [#include </usr/local/v6/include/sys/v6config.h>
302 ipv6libdir=/usr/local/v6/lib;
303 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
307 [#include <sys/param.h>
308 #ifdef _ZETA_MINAMI_INET6
313 ipv6libdir=/usr/local/v6/lib;
314 CFLAGS="-DINET6 $CFLAGS"])
317 if test "$ipv6type" != "unknown"; then
321 AC_MSG_RESULT($ipv6type)
324 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
325 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
326 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
327 echo "You have $ipv6lib library, using it"
329 if test "$ipv6trylibc" = "yes"; then
330 echo "You do not have $ipv6lib library, using libc"
332 echo 'Fatal: no $ipv6lib library found. cannot continue.'
333 echo "You need to fetch lib$ipv6lib.a from appropriate"
334 echo 'ipv6 kit and compile beforehand.'
341 if test "$ipv6" = "yes"; then
343 # XXX - on Tru64 UNIX 5.1, there is no "getaddrinfo()"
344 # function in libc; there are "ngetaddrinfo()" and
345 # "ogetaddrinfo()" functions, and <netdb.h> #defines
346 # "getaddrinfo" to be either "ngetaddrinfo" or
347 # "ogetaddrinfo", depending on whether _SOCKADDR_LEN
348 # or _XOPEN_SOURCE_EXTENDED are defined or not.
350 # So this test doesn't work on Tru64 5.1, and possibly
351 # on other 5.x releases. This causes the configure
352 # script to become confused, and results in libpcap
355 AC_SEARCH_LIBS(getaddrinfo, socket, [dnl
356 AC_MSG_CHECKING(getaddrinfo bug)
357 AC_CACHE_VAL(td_cv_buggygetaddrinfo, [AC_TRY_RUN([
358 #include <sys/types.h>
361 #include <sys/socket.h>
362 #include <netinet/in.h>
366 int passive, gaierr, inet4 = 0, inet6 = 0;
367 struct addrinfo hints, *ai, *aitop;
368 char straddr[INET6_ADDRSTRLEN], strport[16];
370 for (passive = 0; passive <= 1; passive++) {
371 memset(&hints, 0, sizeof(hints));
372 hints.ai_family = AF_UNSPEC;
373 hints.ai_flags = passive ? AI_PASSIVE : 0;
374 hints.ai_socktype = SOCK_STREAM;
375 hints.ai_protocol = IPPROTO_TCP;
376 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
377 (void)gai_strerror(gaierr);
380 for (ai = aitop; ai; ai = ai->ai_next) {
381 if (ai->ai_addr == NULL ||
382 ai->ai_addrlen == 0 ||
383 getnameinfo(ai->ai_addr, ai->ai_addrlen,
384 straddr, sizeof(straddr), strport, sizeof(strport),
385 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
388 switch (ai->ai_family) {
390 if (strcmp(strport, "54321") != 0) {
394 if (strcmp(straddr, "0.0.0.0") != 0) {
398 if (strcmp(straddr, "127.0.0.1") != 0) {
405 if (strcmp(strport, "54321") != 0) {
409 if (strcmp(straddr, "::") != 0) {
413 if (strcmp(straddr, "::1") != 0) {
430 /* another family support? */
436 /* supported family should be 2, unsupported family should be 0 */
437 if (!(inet4 == 0 || inet4 == 2))
439 if (!(inet6 == 0 || inet6 == 2))
452 td_cv_buggygetaddrinfo=no,
453 td_cv_buggygetaddrinfo=yes,
454 td_cv_buggygetaddrinfo=yes)])
455 if test "$td_cv_buggygetaddrinfo" = no; then
461 if test "$td_cv_buggygetaddrinfo" = "yes"; then
463 # XXX - it doesn't appear that "ipv6type" can ever be
464 # set to "linux". Should this be testing for
465 # "linux-glibc", or for that *or* "linux-libinet6"?
466 # If the latter, note that "linux-libinet6" is also
467 # the type given to some non-Linux OSes.
469 if test "$ipv6type" != "linux"; then
470 echo 'Fatal: You must get working getaddrinfo() function.'
471 echo ' or you can specify "--disable-ipv6"'.
474 echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
475 echo ' Better upgrade your system library to newest version'
476 echo ' of GNU C library (aka glibc).'
480 AC_REPLACE_FUNCS(getnameinfo)
483 AC_CACHE_CHECK([for dnet_htoa declaration in netdnet/dnetdb.h],
484 [td_cv_decl_netdnet_dnetdb_h_dnet_htoa],
485 [AC_EGREP_HEADER(dnet_htoa, netdnet/dnetdb.h,
486 td_cv_decl_netdnet_dnetdb_h_dnet_htoa=yes,
487 td_cv_decl_netdnet_dnetdb_h_dnet_htoa=no)])
488 if test "$td_cv_decl_netdnet_dnetdb_h_dnet_htoa" = yes; then
489 AC_DEFINE(HAVE_NETDNET_DNETDB_H_DNET_HTOA)
493 dnl check sizeof basic types.
494 dnl They're very likely to be wrong for cross-compiling.
495 AC_CHECK_SIZEOF(char, 1)
496 AC_CHECK_SIZEOF(short, 2)
497 AC_CHECK_SIZEOF(int, 4)
498 AC_CHECK_SIZEOF(long, 4)
499 AC_CHECK_SIZEOF(long long, 8)
502 dnl Checks for addrinfo structure
503 AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
504 if test "$ac_cv_addrinfo" = no; then
509 dnl Checks for NI_MAXSERV
510 AC_NI_MAXSERV(ac_cv_maxserv)
511 if test "$ac_cv_maxserv" = no; then
516 dnl Checks for NI_NAMEREQD
517 AC_NI_NAMEREQD(ac_cv_namereqd)
518 if test "$ac_cv_namereqd" = no; then
523 dnl Checks for sockaddr_storage structure
524 AC_STRUCT_SA_STORAGE(ac_cv_sa_storage)
525 if test "$ac_cv_sa_storage" = no; then
530 dnl Checks for IN[6]ADDRSZ
531 AC_CHECK_ADDRSZ(ac_cv_addrsz)
532 if test "$ac_cv_addrsz" = no; then
537 dnl Checks for RES_USE_INET6
538 AC_CHECK_RES_USE_INET6(ac_cv_res_inet6)
539 if test "$ac_cv_res_inet6" = no; then
544 dnl Checks for res_state_ext structure
545 AC_STRUCT_RES_STATE_EXT(ac_cv_res_state_ext)
546 if test "$ac_cv_res_state_ext" = no; then
551 dnl Checks if res_state structure has nsort member.
552 AC_STRUCT_RES_STATE(ac_cv_res_state)
555 AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup strsep)
556 AC_CHECK_FUNCS(strftime)
557 AC_CHECK_FUNCS(setlinebuf alarm)
560 AC_CHECK_FUNCS(vsnprintf snprintf,,
562 if test $needsnprintf = yes; then
568 AC_SEARCH_LIBS(dnet_htoa, dnet, AC_DEFINE(HAVE_DNET_HTOA))
570 AC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpc
572 dnl Some platforms may need -lnsl for getrpcbynumber.
573 AC_SEARCH_LIBS(getrpcbynumber, nsl, AC_DEFINE(HAVE_GETRPCBYNUMBER))
575 dnl AC_CHECK_LIB(z, uncompress)
576 dnl AC_CHECK_HEADERS(zlib.h)
578 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
581 # Check for these after AC_LBL_LIBPCAP, so we link with the appropriate
582 # libraries (e.g., "-lsocket -lnsl" on Solaris).
584 # We don't use AC_REPLACE_FUNCS because that uses AC_CHECK_FUNCS which
585 # use AC_CHECK_FUNC which doesn't let us specify the right #includes
586 # to make this work on BSD/OS 4.x. BSD/OS 4.x ships with the BIND8
587 # resolver, and the way it defines inet_{ntop,pton} is rather strange;
588 # it does not ship with a libc symbol "inet_ntop()", it ships with
589 # "_inet_ntop()", and has a #define macro in one of the system headers
592 dnl AC_TRY_COMPILE(inet_ntop inet_pton inet_aton)
593 AC_MSG_CHECKING(for inet_ntop)
594 AC_TRY_LINK([#include <sys/types.h>
595 #include <sys/socket.h>
596 #include <netinet/in.h>
597 #include <arpa/inet.h>], [char src[4], dst[128];
598 inet_ntop(AF_INET, src, dst, sizeof(dst));],
599 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
600 AC_LIBOBJ(inet_ntop)])
601 AC_MSG_CHECKING(for inet_pton)
602 AC_TRY_LINK([#include <sys/types.h>
603 #include <sys/socket.h>
604 #include <netinet/in.h>
605 #include <arpa/inet.h>], [char src[128], dst[4];
606 inet_pton(AF_INET, src, dst);],
607 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
608 AC_LIBOBJ(inet_pton)])
609 AC_MSG_CHECKING(for inet_aton)
610 AC_TRY_LINK([#include <sys/types.h>
611 #include <netinet/in.h>
612 #include <arpa/inet.h>], [char src[128];
614 inet_aton(src, &dst);],
615 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
616 AC_LIBOBJ(inet_aton)])
619 # Check for these after AC_LBL_LIBPCAP, for the same reason.
621 # You are in a twisty little maze of UN*Xes, all different.
622 # Some might not have ether_ntohost().
623 # Some might have it, but not declare it in any header file.
624 # Some might have it, but declare it in <netinet/if_ether.h>.
625 # Some might have it, but declare it in <netinet/ether.h>
626 # (And some might have it but document it as something declared in
627 # <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
629 # Before you is a C compiler.
631 AC_CHECK_FUNCS(ether_ntohost, [
632 AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
635 #include <sys/types.h>
636 #include <sys/param.h>
637 #include <sys/socket.h>
640 main(int argc, char **argv)
642 u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
643 char name[MAXHOSTNAMELEN];
645 ether_ntohost(name, (struct ether_addr *)ea);
648 ], [ac_cv_buggy_ether_ntohost=no],
649 [ac_cv_buggy_ether_ntohost=yes],
650 [ac_cv_buggy_ether_ntohost="not while cross-compiling"])])
651 if test "$ac_cv_buggy_ether_ntohost" = "no"; then
652 AC_DEFINE(USE_ETHER_NTOHOST)
655 if test "$ac_cv_func_ether_ntohost" = yes -a \
656 "$ac_cv_buggy_ether_ntohost" = "no"; then
658 # OK, we have ether_ntohost(). Do we have <netinet/if_ether.h>?
660 if test "$ac_cv_header_netinet_if_ether_h" = yes; then
662 # Yes. Does it declare ether_ntohost()?
664 AC_CHECK_DECL(ether_ntohost,
666 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST,,
667 [Define to 1 if netinet/if_ether.h declares `ether_ntohost'])
670 #include <sys/types.h>
671 #include <sys/socket.h>
672 #include <netinet/in.h>
673 #include <arpa/inet.h>
677 #include <netinet/if_ether.h>
683 if test "$ac_cv_have_decl_ether_ntohost" != yes; then
685 # No, how about <netinet/ether.h>, as on Linux?
687 AC_CHECK_HEADERS(netinet/ether.h)
688 if test "$ac_cv_header_netinet_ether_h" = yes; then
690 # We have it - does it declare ether_ntohost()?
691 # Unset ac_cv_have_decl_ether_ntohost so we don't
692 # treat the previous failure as a cached value and
693 # suppress the next test.
695 unset ac_cv_have_decl_ether_ntohost
696 AC_CHECK_DECL(ether_ntohost,
698 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,,
699 [Define to 1 if netinet/ether.h declares `ether_ntohost'])
702 #include <netinet/ether.h>
707 # Is ether_ntohost() declared?
709 if test "$ac_cv_have_decl_ether_ntohost" != yes; then
711 # No, we'll have to declare it ourselves.
712 # Do we have "struct ether_addr"?
714 AC_CHECK_TYPES(struct ether_addr,,,
716 #include <sys/types.h>
717 #include <sys/socket.h>
718 #include <netinet/in.h>
719 #include <arpa/inet.h>
723 #include <netinet/if_ether.h>
725 AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 0,
726 [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
729 AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 1,
730 [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
735 # libdlpi is needed for Solaris 11 and later.
736 AC_CHECK_LIB(dlpi, dlpi_walk, LIBS="$LIBS -ldlpi" LDFLAGS="-L/lib $LDFLAGS", ,-L/lib)
738 dnl portability macros for getaddrinfo/getnameinfo
741 AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
742 if test "$ac_cv_sockaddr_has_sa_len" = no; then
747 # Do we have the new open API? Check for pcap_create, and assume that,
748 # if we do, we also have pcap_activate() and the other new routines.
749 AC_CHECK_FUNCS(pcap_create)
751 AC_CHECK_FUNCS(pcap_findalldevs pcap_dump_flush pcap_lib_version)
752 if test $ac_cv_func_pcap_findalldevs = "yes" ; then
753 dnl Check for Mac OS X, which may ship pcap.h from 0.6 but libpcap may
754 dnl be 0.8; this means that lib has pcap_findalldevs but header doesn't
756 savedppflags="$CPPLAGS"
757 CPPFLAGS="$CPPFLAGS $V_INCLS"
758 AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>])
759 CPPFLAGS="$savedcppflags"
762 if test $ac_cv_func_pcap_lib_version = "no" ; then
763 AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
766 extern char pcap_version[];
768 return (int)pcap_version;
770 ac_lbl_cv_pcap_version_defined=yes,
771 ac_lbl_cv_pcap_version_defined=no)
772 if test "$ac_lbl_cv_pcap_version_defined" = yes ; then
774 AC_DEFINE(HAVE_PCAP_VERSION)
779 AC_MSG_CHECKING(whether pcap_debug is defined by libpcap)
782 extern int pcap_debug;
786 ac_lbl_cv_pcap_debug_defined=yes,
787 ac_lbl_cv_pcap_debug_defined=no)
788 if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then
790 AC_DEFINE(HAVE_PCAP_DEBUG)
794 # OK, what about "yydebug"?
796 AC_MSG_CHECKING(whether yydebug is defined by libpcap)
803 ac_lbl_cv_yydebug_defined=yes,
804 ac_lbl_cv_yydebug_defined=no)
805 if test "$ac_lbl_cv_yydebug_defined" = yes ; then
807 AC_DEFINE(HAVE_YYDEBUG)
812 AC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6
815 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
819 # Assume V7/BSD convention for man pages (file formats in section 5,
820 # miscellaneous info in section 7).
827 dnl Workaround to enable certain features
833 # Use System V conventions for man pages.
843 # Use System V conventions for man pages.
853 # Use System V conventions for man pages.
863 # Use System V conventions for man pages.
870 if test -f /dev/bpf0 ; then
875 # Check for some headers introduced in later versions of libpcap
876 # and used by some printers.
878 savedcppflags="$CPPFLAGS"
879 CPPFLAGS="$CPPFLAGS $V_INCLS"
880 AC_CHECK_HEADERS(pcap/bluetooth.h)
881 AC_CHECK_HEADERS(pcap/usb.h)
882 CPPFLAGS="$savedcppflags"
884 AC_CHECK_HEADERS(sys/bitypes.h)
886 AC_CHECK_TYPE([int8_t], ,
887 [AC_DEFINE([int8_t], [signed char],
888 [Define to `signed char' if int8_t not defined.])],
890 #ifdef HAVE_SYS_BITYPES_H
891 #include <sys/bitypes.h>
893 AC_CHECK_TYPE([u_int8_t], ,
894 [AC_DEFINE([u_int8_t], [unsigned char],
895 [Define to `unsigned char' if u_int8_t not defined.])],
897 #ifdef HAVE_SYS_BITYPES_H
898 #include <sys/bitypes.h>
900 AC_CHECK_TYPE([int16_t], ,
901 [AC_DEFINE([int16_t], [short],
902 [Define to `short' if int16_t not defined.])]
904 #ifdef HAVE_SYS_BITYPES_H
905 #include <sys/bitypes.h>
907 AC_CHECK_TYPE([u_int16_t], ,
908 [AC_DEFINE([u_int16_t], [unsigned short],
909 [Define to `unsigned short' if u_int16_t not defined.])],
911 #ifdef HAVE_SYS_BITYPES_H
912 #include <sys/bitypes.h>
914 AC_CHECK_TYPE([int32_t], ,
915 [AC_DEFINE([int32_t], [int],
916 [Define to `int' if int32_t not defined.])],
918 #ifdef HAVE_SYS_BITYPES_H
919 #include <sys/bitypes.h>
921 AC_CHECK_TYPE([u_int32_t], ,
922 [AC_DEFINE([u_int32_t], [unsigned int],
923 [Define to `unsigned int' if u_int32_t not defined.])],
925 #ifdef HAVE_SYS_BITYPES_H
926 #include <sys/bitypes.h>
928 AC_CHECK_TYPE([int64_t], ,
929 [AC_DEFINE([int64_t], [long long],
930 [Define to `long long' if int64_t not defined.])],
932 #ifdef HAVE_SYS_BITYPES_H
933 #include <sys/bitypes.h>
935 AC_CHECK_TYPE([u_int64_t], ,
936 [AC_DEFINE([u_int64_t], [unsigned long long],
937 [Define to `unsigned long long' if u_int64_t not defined.])],
939 #ifdef HAVE_SYS_BITYPES_H
940 #include <sys/bitypes.h>
944 # We can't just check for <inttypes.h> - some systems have one that
945 # doesn't define all the PRI[doxu]64 macros.
947 AC_CHECK_HEADERS(inttypes.h,
950 # OK, we have inttypes.h, but does it define those macros?
952 AC_MSG_CHECKING([[whether inttypes.h defines the PRI[doxu]64 macros]])
957 #include <inttypes.h>
959 #include <sys/types.h>
960 #ifdef HAVE_SYS_BITYPES_H
961 #include <sys/bitypes.h>
966 printf("%" PRId64 "\n", (u_int64_t)1);
967 printf("%" PRIo64 "\n", (u_int64_t)1);
968 printf("%" PRIx64 "\n", (u_int64_t)1);
969 printf("%" PRIu64 "\n", (u_int64_t)1);
975 ac_lbl_inttypes_h_defines_formats=yes
979 ac_lbl_inttypes_h_defines_formats=no
984 # We don't have inttypes.h, so it obviously can't define those
987 ac_lbl_inttypes_h_defines_formats=no
989 if test "$ac_lbl_inttypes_h_defines_formats" = no; then
990 AC_LBL_CHECK_64BIT_FORMAT(l,
992 AC_LBL_CHECK_64BIT_FORMAT(ll,
994 AC_LBL_CHECK_64BIT_FORMAT(L,
996 AC_LBL_CHECK_64BIT_FORMAT(q,
998 AC_MSG_ERROR([neither %llx nor %Lx nor %qx worked on a 64-bit integer])
1007 AC_LBL_DEVEL(V_CCOPT)
1009 AC_LBL_SOCKADDR_SA_LEN
1011 AC_LBL_UNALIGNED_ACCESS
1016 AC_MSG_CHECKING(whether to use SSLeay libcrypto)
1017 # Specify location for both includes and libraries.
1018 want_libcrypto=youmama
1020 AS_HELP_STRING([--with-crypto@<:@=PATH@:>@],
1021 [use SSLeay libcrypto (located in directory PATH, if supplied). @<:@default=yes, if available@:>@]),
1023 if test $withval = no
1027 elif test $withval = yes
1038 # Use libcrypto if it's present, otherwise don't.
1040 want_libcrypto=ifavailable
1041 AC_MSG_RESULT([yes, if available])
1043 if test "$want_libcrypto" != "no"; then
1044 ac_cv_ssleay_path=no
1046 if test "x$crypto_dir" = x; then
1048 # Location not specified; check the default locations.
1050 AC_MSG_CHECKING(where SSLeay is located)
1051 dirs="/usr /usr/local /usr/local/ssl /usr/pkg"
1052 if test "x${host_alias}" != x; then
1053 dirs="/usr/${host_alias} $dirs"
1055 for dir in $dirs; do
1058 if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
1061 ac_cv_ssleay_path=no
1065 if test "$ac_cv_ssleay_path" != no; then
1066 AC_MSG_RESULT($ac_cv_ssleay_path)
1069 AC_MSG_CHECKING(for SSLeay in $crypto_dir)
1070 AC_LBL_SSLEAY($crypto_dir)
1071 if test "$ac_cv_ssleay_path" != no; then
1072 AC_MSG_RESULT(found)
1075 if test "$ac_cv_ssleay_path" != no; then
1076 V_INCLS="$V_INCLS $incdir"
1077 if test "$dir" != "/usr"; then
1078 LDFLAGS="-L$dir/lib $LDFLAGS"
1080 if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
1081 LIBS="$LIBS -lRSAglue"
1083 if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
1084 LIBS="$LIBS -lrsaref"
1086 AC_CHECK_LIB(crypto, DES_cbc_encrypt)
1088 CPPFLAGS="$CPPFLAGS $V_INCLS"
1089 AC_CHECK_HEADERS(openssl/evp.h)
1092 # Not found. Did the user explicitly ask for it?
1094 AC_MSG_RESULT(not found)
1095 if test "$want_libcrypto" = yes; then
1096 AC_MSG_ERROR(SSLeay not found)
1102 dnl set additional include path if necessary
1103 if test "$missing_includes" = "yes"; then
1104 CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
1105 V_INCLS="$V_INCLS -I\$(srcdir)/missing"
1114 AC_SUBST(MAN_FILE_FORMATS)
1115 AC_SUBST(MAN_MISC_INFO)
1119 AC_CONFIG_HEADER(config.h)
1121 AC_OUTPUT_COMMANDS([if test -f .devel; then
1122 echo timestamp > stamp-h
1123 cat Makefile-devel-adds >> Makefile
1126 AC_OUTPUT(Makefile tcpdump.1)