1999-10-08 07:47:09 +08:00
|
|
|
dnl Copyright (c) 1994, 1995, 1996, 1997
|
|
|
|
dnl The Regents of the University of California. All rights reserved.
|
|
|
|
dnl
|
|
|
|
dnl Process this file with autoconf to produce a configure script.
|
|
|
|
dnl
|
|
|
|
|
2009-07-03 10:49:53 +08:00
|
|
|
#
|
|
|
|
# See
|
|
|
|
#
|
|
|
|
# http://ftp.gnu.org/gnu/config/README
|
|
|
|
#
|
|
|
|
# for the URLs to use to fetch new versions of config.guess and
|
|
|
|
# config.sub.
|
|
|
|
#
|
|
|
|
|
2013-05-13 03:35:43 +08:00
|
|
|
AC_PREREQ(2.61)
|
1999-10-08 07:47:09 +08:00
|
|
|
AC_INIT(tcpdump.c)
|
|
|
|
|
2001-12-10 16:41:15 +08:00
|
|
|
AC_CANONICAL_HOST
|
1999-10-08 07:47:09 +08:00
|
|
|
|
2013-10-18 07:50:43 +08:00
|
|
|
AC_LBL_C_INIT_BEFORE_CC(V_INCLS)
|
2010-01-03 07:29:06 +08:00
|
|
|
AC_PROG_CC
|
1999-10-08 07:47:09 +08:00
|
|
|
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
|
2005-04-21 10:21:47 +08:00
|
|
|
AC_LBL_C_INLINE
|
2000-04-01 20:09:13 +08:00
|
|
|
AC_C___ATTRIBUTE__
|
2009-07-08 16:22:27 +08:00
|
|
|
if test "$ac_cv___attribute__" = "yes"; then
|
2013-06-23 05:06:33 +08:00
|
|
|
AC_C___ATTRIBUTE___UNUSED
|
|
|
|
AC_C___ATTRIBUTE___NORETURN_FUNCTION_POINTER
|
|
|
|
AC_C___ATTRIBUTE___FORMAT
|
|
|
|
if test "$ac_cv___attribute___format" = "yes"; then
|
|
|
|
AC_C___ATTRIBUTE___FORMAT_FUNCTION_POINTER
|
|
|
|
fi
|
2009-07-08 16:22:27 +08:00
|
|
|
fi
|
2013-09-09 18:45:31 +08:00
|
|
|
AC_CHECK_HEADERS(fcntl.h rpc/rpc.h rpc/rpcent.h netdnet/dnetdb.h)
|
2007-09-13 03:36:18 +08:00
|
|
|
AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <net/if.h>])
|
2008-02-06 02:58:19 +08:00
|
|
|
if test "$ac_cv_header_net_pfvar_h" = yes; then
|
2012-03-01 13:14:50 +08:00
|
|
|
LOCALSRC="print-pflog.c $LOCALSRC"
|
2007-09-13 03:36:18 +08:00
|
|
|
fi
|
2004-03-24 02:57:33 +08:00
|
|
|
AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>])
|
2005-03-28 06:38:09 +08:00
|
|
|
if test "$ac_cv_header_netinet_if_ether_h" != yes; then
|
|
|
|
#
|
|
|
|
# The simple test didn't work.
|
|
|
|
# Do we need to include <net/if.h> first?
|
|
|
|
# Unset ac_cv_header_netinet_if_ether_h so we don't
|
|
|
|
# treat the previous failure as a cached value and
|
|
|
|
# suppress the next test.
|
|
|
|
#
|
|
|
|
AC_MSG_NOTICE([Rechecking with some additional includes])
|
|
|
|
unset ac_cv_header_netinet_if_ether_h
|
|
|
|
AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
struct mbuf;
|
|
|
|
struct rtentry;
|
|
|
|
#include <net/if.h>])
|
|
|
|
fi
|
|
|
|
|
1999-10-08 07:47:09 +08:00
|
|
|
AC_HEADER_TIME
|
|
|
|
|
2001-12-10 16:41:15 +08:00
|
|
|
case "$host_os" in
|
1999-10-08 07:47:09 +08:00
|
|
|
|
2010-04-05 03:08:11 +08:00
|
|
|
darwin*)
|
|
|
|
AC_ARG_ENABLE(universal,
|
|
|
|
AC_HELP_STRING([--disable-universal],[don't build universal on OS X]))
|
|
|
|
if test "$enable_universal" != "no"; then
|
|
|
|
case "$host_os" in
|
|
|
|
|
2010-04-07 06:10:31 +08:00
|
|
|
darwin9.*)
|
|
|
|
#
|
|
|
|
# Leopard. Build for x86 and 32-bit PowerPC, with
|
|
|
|
# x86 first. (That's what Apple does.)
|
|
|
|
#
|
|
|
|
V_CCOPT="$V_CCOPT -arch i386 -arch ppc"
|
|
|
|
LDFLAGS="$LDFLAGS -arch i386 -arch ppc"
|
|
|
|
;;
|
|
|
|
|
2010-04-05 03:42:00 +08:00
|
|
|
darwin10.*)
|
2010-04-05 03:08:11 +08:00
|
|
|
#
|
|
|
|
# Snow Leopard. Build for x86-64 and x86, with
|
|
|
|
# x86-64 first. (That's what Apple does.)
|
|
|
|
#
|
|
|
|
V_CCOPT="$V_CCOPT -arch x86_64 -arch i386"
|
|
|
|
LDFLAGS="$LDFLAGS -arch x86_64 -arch i386"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
1999-10-08 07:47:09 +08:00
|
|
|
linux*)
|
|
|
|
AC_MSG_CHECKING(Linux kernel version)
|
2000-06-10 22:19:02 +08:00
|
|
|
if test "$cross_compiling" = yes; then
|
|
|
|
AC_CACHE_VAL(ac_cv_linux_vers,
|
|
|
|
ac_cv_linux_vers=unknown)
|
|
|
|
else
|
|
|
|
AC_CACHE_VAL(ac_cv_linux_vers,
|
|
|
|
ac_cv_linux_vers=`uname -r 2>&1 | \
|
|
|
|
sed -n -e '$s/.* //' -e '$s/\..*//p'`)
|
|
|
|
fi
|
1999-10-08 07:47:09 +08:00
|
|
|
AC_MSG_RESULT($ac_cv_linux_vers)
|
2000-06-10 22:19:02 +08:00
|
|
|
if test $ac_cv_linux_vers = unknown ; then
|
|
|
|
AC_MSG_ERROR(cannot determine linux version when cross-compiling)
|
|
|
|
fi
|
1999-10-08 07:47:09 +08:00
|
|
|
if test $ac_cv_linux_vers -lt 2 ; then
|
|
|
|
AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
1999-12-14 02:06:13 +08:00
|
|
|
|
2008-11-18 15:39:20 +08:00
|
|
|
AC_ARG_WITH(smi,
|
|
|
|
[ --with-smi link with libsmi (allows to load MIBs on the fly to decode SNMP packets. [default=yes]
|
|
|
|
--without-smi don't link with libsmi],,
|
|
|
|
with_smi=yes)
|
|
|
|
|
|
|
|
if test "x$with_smi" != "xno" ; then
|
1999-12-29 09:12:54 +08:00
|
|
|
AC_CHECK_HEADERS(smi.h)
|
2000-06-27 05:27:17 +08:00
|
|
|
AC_CHECK_LIB(smi, smiInit)
|
2001-04-27 10:33:42 +08:00
|
|
|
if test "$ac_cv_header_smi_h" = yes -a "$ac_cv_lib_smi_smiInit" = yes
|
|
|
|
then
|
1999-12-29 09:12:54 +08:00
|
|
|
AC_MSG_CHECKING([whether to enable libsmi])
|
|
|
|
AC_TRY_RUN([ /* libsmi available check */
|
|
|
|
#include <smi.h>
|
|
|
|
main()
|
|
|
|
{
|
2000-06-27 05:27:17 +08:00
|
|
|
int current, revision, age, n;
|
|
|
|
const int required = 2;
|
1999-12-29 09:12:54 +08:00
|
|
|
if (smiInit(""))
|
|
|
|
exit(1);
|
2000-06-27 05:27:17 +08:00
|
|
|
if (strcmp(SMI_LIBRARY_VERSION, smi_library_version))
|
|
|
|
exit(2);
|
|
|
|
n = sscanf(smi_library_version, "%d:%d:%d", ¤t, &revision, &age);
|
|
|
|
if (n != 3)
|
|
|
|
exit(3);
|
|
|
|
if (required < current - age || required > current)
|
|
|
|
exit(4);
|
|
|
|
exit(0);
|
1999-12-29 09:12:54 +08:00
|
|
|
}
|
|
|
|
],
|
|
|
|
[ AC_MSG_RESULT(yes)
|
2013-05-13 06:28:28 +08:00
|
|
|
AC_DEFINE(LIBSMI, 1, [Define if you enable support for libsmi])
|
1999-12-29 09:12:54 +08:00
|
|
|
libsmi=yes],
|
2001-04-27 10:33:42 +08:00
|
|
|
dnl autoconf documentation says that $? contains the exit value.
|
|
|
|
dnl reality is that it does not. We leave this in just in case
|
|
|
|
dnl autoconf ever comes back to match the documentation.
|
|
|
|
[ case $? in
|
|
|
|
1) AC_MSG_RESULT(no - smiInit failed) ;;
|
|
|
|
2) AC_MSG_RESULT(no - header/library version mismatch) ;;
|
|
|
|
3) AC_MSG_RESULT(no - can't determine library version) ;;
|
|
|
|
4) AC_MSG_RESULT(no - too old) ;;
|
|
|
|
*) AC_MSG_RESULT(no) ;;
|
|
|
|
esac
|
2000-01-10 05:41:00 +08:00
|
|
|
libsmi=no],
|
|
|
|
[ AC_MSG_RESULT(not when cross-compiling)
|
1999-12-29 09:12:54 +08:00
|
|
|
libsmi=no]
|
|
|
|
)
|
2001-04-27 10:33:42 +08:00
|
|
|
fi
|
2008-11-18 15:39:20 +08:00
|
|
|
fi
|
1999-12-14 02:06:13 +08:00
|
|
|
|
2001-10-09 05:25:15 +08:00
|
|
|
AC_MSG_CHECKING([whether to enable the possibly-buggy SMB printer])
|
|
|
|
AC_ARG_ENABLE(smb,
|
2002-01-17 13:00:16 +08:00
|
|
|
[ --enable-smb enable possibly-buggy SMB printer [default=yes]
|
|
|
|
--disable-smb disable possibly-buggy SMB printer],,
|
|
|
|
enableval=yes)
|
|
|
|
case "$enableval" in
|
2001-10-09 05:25:15 +08:00
|
|
|
yes) AC_MSG_RESULT(yes)
|
|
|
|
AC_WARN([The SMB printer may have exploitable buffer overflows!!!])
|
2013-05-13 06:28:28 +08:00
|
|
|
AC_DEFINE(TCPDUMP_DO_SMB, 1,
|
|
|
|
[define if you want to build the possibly-buggy SMB printer])
|
2001-10-09 05:25:15 +08:00
|
|
|
LOCALSRC="print-smb.c smbutil.c $LOCALSRC"
|
|
|
|
;;
|
|
|
|
*) AC_MSG_RESULT(no)
|
|
|
|
;;
|
2002-01-17 13:00:16 +08:00
|
|
|
esac
|
2001-10-09 05:25:15 +08:00
|
|
|
|
2004-01-22 17:51:30 +08:00
|
|
|
AC_ARG_WITH(user, [ --with-user=USERNAME drop privileges by default to USERNAME])
|
|
|
|
AC_MSG_CHECKING([whether to drop root privileges by default])
|
|
|
|
if test ! -z "$with_user" ; then
|
2013-05-13 06:28:28 +08:00
|
|
|
AC_DEFINE_UNQUOTED(WITH_USER, "$withval",
|
|
|
|
[define if should drop privileges by default])
|
2004-01-22 17:51:30 +08:00
|
|
|
AC_MSG_RESULT(to \"$withval\")
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
fi
|
|
|
|
|
2004-02-25 22:23:32 +08:00
|
|
|
AC_ARG_WITH(chroot, [ --with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY])
|
|
|
|
AC_MSG_CHECKING([whether to chroot])
|
2010-04-02 13:33:30 +08:00
|
|
|
if test ! -z "$with_chroot" && test "$with_chroot" != "no" ; then
|
2013-05-13 06:28:28 +08:00
|
|
|
AC_DEFINE_UNQUOTED(WITH_CHROOT, "$withval",
|
|
|
|
[define if should chroot when dropping privileges])
|
2004-02-25 22:23:32 +08:00
|
|
|
AC_MSG_RESULT(to \"$withval\")
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
fi
|
|
|
|
|
2013-04-07 04:03:58 +08:00
|
|
|
#
|
|
|
|
# We must check this before checking whether to enable IPv6, because,
|
|
|
|
# on some platforms (such as SunOS 5.x), the test program requires
|
|
|
|
# the extra networking libraries.
|
|
|
|
#
|
|
|
|
AC_LBL_LIBRARY_NET
|
|
|
|
|
1999-10-30 13:11:06 +08:00
|
|
|
AC_MSG_CHECKING([whether to enable ipv6])
|
|
|
|
AC_ARG_ENABLE(ipv6,
|
1999-12-14 02:06:13 +08:00
|
|
|
[ --enable-ipv6 enable ipv6 (with ipv4) support
|
|
|
|
--disable-ipv6 disable ipv6 support],
|
1999-10-30 13:11:06 +08:00
|
|
|
[ case "$enableval" in
|
1999-10-30 13:26:21 +08:00
|
|
|
yes) AC_MSG_RESULT(yes)
|
2011-08-15 07:26:32 +08:00
|
|
|
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 print-babel.c $LOCALSRC"
|
2013-05-13 06:28:28 +08:00
|
|
|
AC_DEFINE(INET6, 1, [Define if you enable IPv6 support])
|
1999-10-30 13:11:06 +08:00
|
|
|
ipv6=yes
|
|
|
|
;;
|
1999-10-30 13:26:21 +08:00
|
|
|
*)
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
ipv6=no
|
|
|
|
;;
|
1999-10-30 13:11:06 +08:00
|
|
|
esac ],
|
|
|
|
|
2014-01-18 06:08:39 +08:00
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
[
|
|
|
|
AC_LANG_SOURCE(
|
|
|
|
[[/* AF_INET6 available check */
|
1999-10-30 13:11:06 +08:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
2014-01-18 06:08:39 +08:00
|
|
|
#include <netinet/in.h>
|
|
|
|
#ifdef AF_INET6
|
|
|
|
void
|
|
|
|
foo(struct in6_addr *addr)
|
1999-10-30 13:11:06 +08:00
|
|
|
{
|
2014-01-18 06:08:39 +08:00
|
|
|
memset(addr, 0, sizeof (struct in6_addr));
|
1999-10-30 13:11:06 +08:00
|
|
|
}
|
2014-01-18 06:08:39 +08:00
|
|
|
#else
|
|
|
|
#error "AF_INET6 not defined"
|
|
|
|
#endif
|
|
|
|
]])
|
|
|
|
],
|
1999-10-30 13:26:21 +08:00
|
|
|
[ AC_MSG_RESULT(yes)
|
2011-08-15 07:26:32 +08:00
|
|
|
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 print-babel.c $LOCALSRC"
|
2013-05-13 06:28:28 +08:00
|
|
|
AC_DEFINE(INET6, 1, [Define if you enable IPv6 support])
|
1999-10-30 13:26:21 +08:00
|
|
|
ipv6=yes],
|
|
|
|
[ AC_MSG_RESULT(no)
|
|
|
|
ipv6=no],
|
|
|
|
[ AC_MSG_RESULT(no)
|
|
|
|
ipv6=no]
|
1999-10-30 13:11:06 +08:00
|
|
|
))
|
|
|
|
|
|
|
|
ipv6type=unknown
|
|
|
|
ipv6lib=none
|
|
|
|
ipv6trylibc=no
|
|
|
|
|
|
|
|
if test "$ipv6" = "yes"; then
|
|
|
|
AC_MSG_CHECKING([ipv6 stack type])
|
|
|
|
for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
|
|
|
|
case $i in
|
|
|
|
inria)
|
|
|
|
dnl http://www.kame.net/
|
2004-01-14 11:14:29 +08:00
|
|
|
AC_EGREP_CPP(yes,
|
|
|
|
[#include <netinet/in.h>
|
1999-10-30 13:11:06 +08:00
|
|
|
#ifdef IPV6_INRIA_VERSION
|
|
|
|
yes
|
|
|
|
#endif],
|
|
|
|
[ipv6type=$i;
|
|
|
|
CFLAGS="-DINET6 $CFLAGS"])
|
|
|
|
;;
|
|
|
|
kame)
|
|
|
|
dnl http://www.kame.net/
|
2004-01-14 11:14:29 +08:00
|
|
|
AC_EGREP_CPP(yes,
|
|
|
|
[#include <netinet/in.h>
|
1999-10-30 13:11:06 +08:00
|
|
|
#ifdef __KAME__
|
|
|
|
yes
|
|
|
|
#endif],
|
|
|
|
[ipv6type=$i;
|
|
|
|
ipv6lib=inet6;
|
|
|
|
ipv6libdir=/usr/local/v6/lib;
|
|
|
|
ipv6trylibc=yes;
|
|
|
|
CFLAGS="-DINET6 $CFLAGS"])
|
|
|
|
;;
|
|
|
|
linux-glibc)
|
|
|
|
dnl http://www.v6.linux.or.jp/
|
2004-01-14 11:14:29 +08:00
|
|
|
AC_EGREP_CPP(yes,
|
|
|
|
[#include <features.h>
|
1999-10-30 13:11:06 +08:00
|
|
|
#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
|
|
|
|
yes
|
|
|
|
#endif],
|
|
|
|
[ipv6type=$i;
|
|
|
|
CFLAGS="-DINET6 $CFLAGS"])
|
|
|
|
;;
|
|
|
|
linux-libinet6)
|
|
|
|
dnl http://www.v6.linux.or.jp/
|
2002-08-04 04:28:05 +08:00
|
|
|
dnl
|
|
|
|
dnl This also matches Solaris 8 and Tru64 UNIX 5.1,
|
|
|
|
dnl and possibly other versions of those OSes
|
|
|
|
dnl
|
1999-10-30 13:11:06 +08:00
|
|
|
if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
|
|
|
|
ipv6type=$i
|
|
|
|
ipv6lib=inet6
|
|
|
|
ipv6libdir=/usr/inet6/lib
|
|
|
|
ipv6trylibc=yes;
|
|
|
|
CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
toshiba)
|
2004-01-14 11:14:29 +08:00
|
|
|
AC_EGREP_CPP(yes,
|
|
|
|
[#include <sys/param.h>
|
1999-10-30 13:11:06 +08:00
|
|
|
#ifdef _TOSHIBA_INET6
|
|
|
|
yes
|
|
|
|
#endif],
|
|
|
|
[ipv6type=$i;
|
|
|
|
ipv6lib=inet6;
|
|
|
|
ipv6libdir=/usr/local/v6/lib;
|
|
|
|
CFLAGS="-DINET6 $CFLAGS"])
|
|
|
|
;;
|
|
|
|
v6d)
|
2004-01-14 11:14:29 +08:00
|
|
|
AC_EGREP_CPP(yes,
|
|
|
|
[#include </usr/local/v6/include/sys/v6config.h>
|
1999-10-30 13:11:06 +08:00
|
|
|
#ifdef __V6D__
|
|
|
|
yes
|
|
|
|
#endif],
|
|
|
|
[ipv6type=$i;
|
|
|
|
ipv6lib=v6;
|
|
|
|
ipv6libdir=/usr/local/v6/lib;
|
|
|
|
CFLAGS="-I/usr/local/v6/include $CFLAGS"])
|
|
|
|
;;
|
|
|
|
zeta)
|
2004-01-14 11:14:29 +08:00
|
|
|
AC_EGREP_CPP(yes,
|
|
|
|
[#include <sys/param.h>
|
1999-10-30 13:11:06 +08:00
|
|
|
#ifdef _ZETA_MINAMI_INET6
|
|
|
|
yes
|
|
|
|
#endif],
|
|
|
|
[ipv6type=$i;
|
|
|
|
ipv6lib=inet6;
|
|
|
|
ipv6libdir=/usr/local/v6/lib;
|
|
|
|
CFLAGS="-DINET6 $CFLAGS"])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
if test "$ipv6type" != "unknown"; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
AC_MSG_RESULT($ipv6type)
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
|
|
|
|
if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
|
|
|
|
LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
|
|
|
|
echo "You have $ipv6lib library, using it"
|
|
|
|
else
|
|
|
|
if test "$ipv6trylibc" = "yes"; then
|
|
|
|
echo "You do not have $ipv6lib library, using libc"
|
|
|
|
else
|
|
|
|
echo 'Fatal: no $ipv6lib library found. cannot continue.'
|
|
|
|
echo "You need to fetch lib$ipv6lib.a from appropriate"
|
|
|
|
echo 'ipv6 kit and compile beforehand.'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2000-01-25 13:05:21 +08:00
|
|
|
if test "$ipv6" = "yes"; then
|
2002-08-04 04:28:05 +08:00
|
|
|
#
|
|
|
|
# XXX - on Tru64 UNIX 5.1, there is no "getaddrinfo()"
|
|
|
|
# function in libc; there are "ngetaddrinfo()" and
|
|
|
|
# "ogetaddrinfo()" functions, and <netdb.h> #defines
|
|
|
|
# "getaddrinfo" to be either "ngetaddrinfo" or
|
|
|
|
# "ogetaddrinfo", depending on whether _SOCKADDR_LEN
|
|
|
|
# or _XOPEN_SOURCE_EXTENDED are defined or not.
|
|
|
|
#
|
|
|
|
# So this test doesn't work on Tru64 5.1, and possibly
|
|
|
|
# on other 5.x releases. This causes the configure
|
|
|
|
# script to become confused, and results in libpcap
|
|
|
|
# being unbuildable.
|
|
|
|
#
|
2000-04-10 03:13:27 +08:00
|
|
|
AC_SEARCH_LIBS(getaddrinfo, socket, [dnl
|
2000-01-25 13:05:21 +08:00
|
|
|
AC_MSG_CHECKING(getaddrinfo bug)
|
2002-04-07 10:01:36 +08:00
|
|
|
AC_CACHE_VAL(td_cv_buggygetaddrinfo, [AC_TRY_RUN([
|
1999-10-30 13:11:06 +08:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <netdb.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
int passive, gaierr, inet4 = 0, inet6 = 0;
|
|
|
|
struct addrinfo hints, *ai, *aitop;
|
|
|
|
char straddr[INET6_ADDRSTRLEN], strport[16];
|
|
|
|
|
|
|
|
for (passive = 0; passive <= 1; passive++) {
|
|
|
|
memset(&hints, 0, sizeof(hints));
|
|
|
|
hints.ai_family = AF_UNSPEC;
|
|
|
|
hints.ai_flags = passive ? AI_PASSIVE : 0;
|
|
|
|
hints.ai_socktype = SOCK_STREAM;
|
2003-05-02 16:15:18 +08:00
|
|
|
hints.ai_protocol = IPPROTO_TCP;
|
1999-10-30 13:11:06 +08:00
|
|
|
if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
|
|
|
|
(void)gai_strerror(gaierr);
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
for (ai = aitop; ai; ai = ai->ai_next) {
|
|
|
|
if (ai->ai_addr == NULL ||
|
|
|
|
ai->ai_addrlen == 0 ||
|
|
|
|
getnameinfo(ai->ai_addr, ai->ai_addrlen,
|
|
|
|
straddr, sizeof(straddr), strport, sizeof(strport),
|
|
|
|
NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
switch (ai->ai_family) {
|
|
|
|
case AF_INET:
|
|
|
|
if (strcmp(strport, "54321") != 0) {
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
if (passive) {
|
|
|
|
if (strcmp(straddr, "0.0.0.0") != 0) {
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (strcmp(straddr, "127.0.0.1") != 0) {
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
inet4++;
|
|
|
|
break;
|
|
|
|
case AF_INET6:
|
|
|
|
if (strcmp(strport, "54321") != 0) {
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
if (passive) {
|
|
|
|
if (strcmp(straddr, "::") != 0) {
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (strcmp(straddr, "::1") != 0) {
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
inet6++;
|
|
|
|
break;
|
|
|
|
case AF_UNSPEC:
|
|
|
|
goto bad;
|
|
|
|
break;
|
|
|
|
#ifdef AF_UNIX
|
|
|
|
case AF_UNIX:
|
|
|
|
#else
|
|
|
|
#ifdef AF_LOCAL
|
|
|
|
case AF_LOCAL:
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
/* another family support? */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-01-18 13:25:06 +08:00
|
|
|
/* supported family should be 2, unsupported family should be 0 */
|
2000-01-19 12:34:55 +08:00
|
|
|
if (!(inet4 == 0 || inet4 == 2))
|
|
|
|
goto bad;
|
|
|
|
if (!(inet6 == 0 || inet6 == 2))
|
|
|
|
goto bad;
|
1999-10-30 13:11:06 +08:00
|
|
|
|
|
|
|
if (aitop)
|
|
|
|
freeaddrinfo(aitop);
|
|
|
|
exit(0);
|
|
|
|
|
|
|
|
bad:
|
|
|
|
if (aitop)
|
|
|
|
freeaddrinfo(aitop);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
],
|
2002-04-07 10:01:36 +08:00
|
|
|
td_cv_buggygetaddrinfo=no,
|
|
|
|
td_cv_buggygetaddrinfo=yes,
|
|
|
|
td_cv_buggygetaddrinfo=yes)])
|
|
|
|
if test "$td_cv_buggygetaddrinfo" = no; then
|
|
|
|
AC_MSG_RESULT(good)
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(buggy)
|
|
|
|
fi
|
1999-10-30 13:11:06 +08:00
|
|
|
|
2002-04-07 10:01:36 +08:00
|
|
|
if test "$td_cv_buggygetaddrinfo" = "yes"; then
|
2002-08-04 04:28:05 +08:00
|
|
|
#
|
|
|
|
# XXX - it doesn't appear that "ipv6type" can ever be
|
|
|
|
# set to "linux". Should this be testing for
|
|
|
|
# "linux-glibc", or for that *or* "linux-libinet6"?
|
|
|
|
# If the latter, note that "linux-libinet6" is also
|
|
|
|
# the type given to some non-Linux OSes.
|
|
|
|
#
|
2000-01-25 13:05:21 +08:00
|
|
|
if test "$ipv6type" != "linux"; then
|
|
|
|
echo 'Fatal: You must get working getaddrinfo() function.'
|
|
|
|
echo ' or you can specify "--disable-ipv6"'.
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
|
2002-08-02 12:01:33 +08:00
|
|
|
echo ' Better upgrade your system library to newest version'
|
2000-01-25 13:05:21 +08:00
|
|
|
echo ' of GNU C library (aka glibc).'
|
|
|
|
fi
|
1999-10-30 13:11:06 +08:00
|
|
|
fi
|
2002-04-07 10:01:36 +08:00
|
|
|
])
|
2009-07-08 16:22:27 +08:00
|
|
|
AC_REPLACE_FUNCS(getnameinfo)
|
1999-10-30 13:11:06 +08:00
|
|
|
fi
|
|
|
|
|
2002-04-07 10:09:04 +08:00
|
|
|
AC_CACHE_CHECK([for dnet_htoa declaration in netdnet/dnetdb.h],
|
|
|
|
[td_cv_decl_netdnet_dnetdb_h_dnet_htoa],
|
|
|
|
[AC_EGREP_HEADER(dnet_htoa, netdnet/dnetdb.h,
|
|
|
|
td_cv_decl_netdnet_dnetdb_h_dnet_htoa=yes,
|
|
|
|
td_cv_decl_netdnet_dnetdb_h_dnet_htoa=no)])
|
|
|
|
if test "$td_cv_decl_netdnet_dnetdb_h_dnet_htoa" = yes; then
|
2013-05-13 06:28:28 +08:00
|
|
|
AC_DEFINE(HAVE_NETDNET_DNETDB_H_DNET_HTOA, 1,
|
|
|
|
[define if you have a dnet_htoa declaration in <netdnet/dnetdb.h>])
|
2002-04-07 10:09:04 +08:00
|
|
|
fi
|
|
|
|
|
1999-10-30 13:11:06 +08:00
|
|
|
dnl
|
|
|
|
dnl Checks for addrinfo structure
|
|
|
|
AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
|
|
|
|
if test "$ac_cv_addrinfo" = no; then
|
|
|
|
missing_includes=yes
|
|
|
|
fi
|
|
|
|
|
2000-01-21 12:06:17 +08:00
|
|
|
dnl
|
|
|
|
dnl Checks for NI_MAXSERV
|
|
|
|
AC_NI_MAXSERV(ac_cv_maxserv)
|
|
|
|
if test "$ac_cv_maxserv" = no; then
|
|
|
|
missing_includes=yes
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl Checks for NI_NAMEREQD
|
|
|
|
AC_NI_NAMEREQD(ac_cv_namereqd)
|
|
|
|
if test "$ac_cv_namereqd" = no; then
|
|
|
|
missing_includes=yes
|
|
|
|
fi
|
|
|
|
|
2003-03-03 07:19:33 +08:00
|
|
|
AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup strsep)
|
2010-12-01 08:18:32 +08:00
|
|
|
AC_CHECK_FUNCS(fork vfork strftime)
|
2005-03-28 07:16:08 +08:00
|
|
|
AC_CHECK_FUNCS(setlinebuf alarm)
|
|
|
|
|
|
|
|
needsnprintf=no
|
|
|
|
AC_CHECK_FUNCS(vsnprintf snprintf,,
|
|
|
|
[needsnprintf=yes])
|
|
|
|
if test $needsnprintf = yes; then
|
|
|
|
AC_LIBOBJ(snprintf)
|
|
|
|
fi
|
2005-03-28 06:38:09 +08:00
|
|
|
|
2005-03-28 07:16:08 +08:00
|
|
|
AC_LBL_TYPE_SIGNAL
|
|
|
|
|
2013-05-13 06:28:28 +08:00
|
|
|
AC_SEARCH_LIBS(dnet_htoa, dnet,
|
|
|
|
AC_DEFINE(HAVE_DNET_HTOA, 1, [define if you have the dnet_htoa function]))
|
2005-03-28 07:16:08 +08:00
|
|
|
|
|
|
|
AC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpc
|
|
|
|
|
|
|
|
dnl Some platforms may need -lnsl for getrpcbynumber.
|
2013-05-13 06:28:28 +08:00
|
|
|
AC_SEARCH_LIBS(getrpcbynumber, nsl,
|
|
|
|
AC_DEFINE(HAVE_GETRPCBYNUMBER, 1, [define if you have getrpcbynumber()]))
|
2005-03-28 07:16:08 +08:00
|
|
|
|
|
|
|
dnl AC_CHECK_LIB(z, uncompress)
|
|
|
|
dnl AC_CHECK_HEADERS(zlib.h)
|
|
|
|
|
|
|
|
AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check for these after AC_LBL_LIBPCAP, so we link with the appropriate
|
|
|
|
# libraries (e.g., "-lsocket -lnsl" on Solaris).
|
|
|
|
#
|
|
|
|
# We don't use AC_REPLACE_FUNCS because that uses AC_CHECK_FUNCS which
|
|
|
|
# use AC_CHECK_FUNC which doesn't let us specify the right #includes
|
|
|
|
# to make this work on BSD/OS 4.x. BSD/OS 4.x ships with the BIND8
|
|
|
|
# resolver, and the way it defines inet_{ntop,pton} is rather strange;
|
|
|
|
# it does not ship with a libc symbol "inet_ntop()", it ships with
|
|
|
|
# "_inet_ntop()", and has a #define macro in one of the system headers
|
|
|
|
# to rename it.
|
|
|
|
#
|
|
|
|
dnl AC_TRY_COMPILE(inet_ntop inet_pton inet_aton)
|
|
|
|
AC_MSG_CHECKING(for inet_ntop)
|
|
|
|
AC_TRY_LINK([#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <arpa/inet.h>], [char src[4], dst[128];
|
|
|
|
inet_ntop(AF_INET, src, dst, sizeof(dst));],
|
|
|
|
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
|
|
|
|
AC_LIBOBJ(inet_ntop)])
|
|
|
|
AC_MSG_CHECKING(for inet_pton)
|
|
|
|
AC_TRY_LINK([#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <arpa/inet.h>], [char src[128], dst[4];
|
|
|
|
inet_pton(AF_INET, src, dst);],
|
|
|
|
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
|
|
|
|
AC_LIBOBJ(inet_pton)])
|
|
|
|
AC_MSG_CHECKING(for inet_aton)
|
|
|
|
AC_TRY_LINK([#include <sys/types.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <arpa/inet.h>], [char src[128];
|
|
|
|
struct in_addr dst;
|
|
|
|
inet_aton(src, &dst);],
|
|
|
|
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
|
|
|
|
AC_LIBOBJ(inet_aton)])
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check for these after AC_LBL_LIBPCAP, for the same reason.
|
2005-03-28 06:38:09 +08:00
|
|
|
#
|
|
|
|
# You are in a twisty little maze of UN*Xes, all different.
|
|
|
|
# Some might not have ether_ntohost().
|
|
|
|
# Some might have it, but not declare it in any header file.
|
|
|
|
# Some might have it, but declare it in <netinet/if_ether.h>.
|
|
|
|
# Some might have it, but declare it in <netinet/ether.h>
|
|
|
|
# (And some might have it but document it as something declared in
|
|
|
|
# <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
|
|
|
|
#
|
|
|
|
# Before you is a C compiler.
|
|
|
|
#
|
2001-04-27 10:33:42 +08:00
|
|
|
AC_CHECK_FUNCS(ether_ntohost, [
|
|
|
|
AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
|
|
|
|
AC_TRY_RUN([
|
|
|
|
#include <netdb.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
|
|
|
|
char name[MAXHOSTNAMELEN];
|
|
|
|
|
|
|
|
ether_ntohost(name, (struct ether_addr *)ea);
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
], [ac_cv_buggy_ether_ntohost=no],
|
|
|
|
[ac_cv_buggy_ether_ntohost=yes],
|
2002-04-07 10:12:01 +08:00
|
|
|
[ac_cv_buggy_ether_ntohost="not while cross-compiling"])])
|
2001-04-27 10:33:42 +08:00
|
|
|
if test "$ac_cv_buggy_ether_ntohost" = "no"; then
|
2013-05-13 06:28:28 +08:00
|
|
|
AC_DEFINE(USE_ETHER_NTOHOST, 1,
|
|
|
|
[define if you have ether_ntohost() and it works])
|
2001-04-27 10:33:42 +08:00
|
|
|
fi
|
|
|
|
])
|
2005-03-28 06:44:22 +08:00
|
|
|
if test "$ac_cv_func_ether_ntohost" = yes -a \
|
2005-03-28 06:46:21 +08:00
|
|
|
"$ac_cv_buggy_ether_ntohost" = "no"; then
|
2005-03-28 06:38:09 +08:00
|
|
|
#
|
|
|
|
# OK, we have ether_ntohost(). Do we have <netinet/if_ether.h>?
|
|
|
|
#
|
|
|
|
if test "$ac_cv_header_netinet_if_ether_h" = yes; then
|
|
|
|
#
|
|
|
|
# Yes. Does it declare ether_ntohost()?
|
|
|
|
#
|
2005-04-24 09:25:23 +08:00
|
|
|
AC_CHECK_DECL(ether_ntohost,
|
2005-03-28 06:38:09 +08:00
|
|
|
[
|
2005-03-28 06:44:22 +08:00
|
|
|
AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST,,
|
2005-03-28 06:38:09 +08:00
|
|
|
[Define to 1 if netinet/if_ether.h declares `ether_ntohost'])
|
|
|
|
],,
|
|
|
|
[
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
2005-04-20 17:49:52 +08:00
|
|
|
#include <arpa/inet.h>
|
2005-03-28 06:38:09 +08:00
|
|
|
struct mbuf;
|
|
|
|
struct rtentry;
|
|
|
|
#include <net/if.h>
|
|
|
|
#include <netinet/if_ether.h>
|
|
|
|
])
|
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Did that succeed?
|
|
|
|
#
|
|
|
|
if test "$ac_cv_have_decl_ether_ntohost" != yes; then
|
|
|
|
#
|
|
|
|
# No, how about <netinet/ether.h>, as on Linux?
|
|
|
|
#
|
|
|
|
AC_CHECK_HEADERS(netinet/ether.h)
|
|
|
|
if test "$ac_cv_header_netinet_ether_h" = yes; then
|
|
|
|
#
|
|
|
|
# We have it - does it declare ether_ntohost()?
|
|
|
|
# Unset ac_cv_have_decl_ether_ntohost so we don't
|
|
|
|
# treat the previous failure as a cached value and
|
|
|
|
# suppress the next test.
|
|
|
|
#
|
|
|
|
unset ac_cv_have_decl_ether_ntohost
|
2005-04-24 09:25:23 +08:00
|
|
|
AC_CHECK_DECL(ether_ntohost,
|
2005-03-28 06:38:09 +08:00
|
|
|
[
|
2005-03-28 06:44:22 +08:00
|
|
|
AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,,
|
2005-03-28 06:38:09 +08:00
|
|
|
[Define to 1 if netinet/ether.h declares `ether_ntohost'])
|
|
|
|
],,
|
|
|
|
[
|
|
|
|
#include <netinet/ether.h>
|
|
|
|
])
|
|
|
|
fi
|
|
|
|
fi
|
2005-04-20 19:17:18 +08:00
|
|
|
#
|
|
|
|
# Is ether_ntohost() declared?
|
|
|
|
#
|
|
|
|
if test "$ac_cv_have_decl_ether_ntohost" != yes; then
|
|
|
|
#
|
|
|
|
# No, we'll have to declare it ourselves.
|
|
|
|
# Do we have "struct ether_addr"?
|
|
|
|
#
|
|
|
|
AC_CHECK_TYPES(struct ether_addr,,,
|
|
|
|
[
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
struct mbuf;
|
|
|
|
struct rtentry;
|
|
|
|
#include <net/if.h>
|
|
|
|
#include <netinet/if_ether.h>
|
|
|
|
])
|
2005-04-24 09:25:23 +08:00
|
|
|
AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 0,
|
2005-04-24 09:34:59 +08:00
|
|
|
[Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
|
|
|
|
don't.])
|
2005-04-24 09:25:23 +08:00
|
|
|
else
|
|
|
|
AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 1,
|
2005-04-24 09:34:59 +08:00
|
|
|
[Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
|
|
|
|
don't.])
|
2005-04-20 19:17:18 +08:00
|
|
|
fi
|
2005-03-28 06:38:09 +08:00
|
|
|
fi
|
|
|
|
|
2008-03-14 02:32:51 +08:00
|
|
|
# libdlpi is needed for Solaris 11 and later.
|
|
|
|
AC_CHECK_LIB(dlpi, dlpi_walk, LIBS="$LIBS -ldlpi" LDFLAGS="-L/lib $LDFLAGS", ,-L/lib)
|
|
|
|
|
2003-05-02 16:48:25 +08:00
|
|
|
dnl portability macros for getaddrinfo/getnameinfo
|
|
|
|
dnl
|
|
|
|
dnl Check for sa_len
|
|
|
|
AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
|
|
|
|
if test "$ac_cv_sockaddr_has_sa_len" = no; then
|
|
|
|
missing_includes=yes
|
|
|
|
fi
|
|
|
|
|
2008-04-05 03:42:11 +08:00
|
|
|
#
|
|
|
|
# Do we have the new open API? Check for pcap_create, and assume that,
|
2010-08-23 08:32:26 +08:00
|
|
|
# if we do, we also have pcap_activate() and the other new routines
|
|
|
|
# introduced in libpcap 1.0.0.
|
|
|
|
#
|
2008-04-05 03:42:11 +08:00
|
|
|
AC_CHECK_FUNCS(pcap_create)
|
2010-08-23 08:32:26 +08:00
|
|
|
if test $ac_cv_func_pcap_create = "yes" ; then
|
|
|
|
#
|
|
|
|
# OK, do we have pcap_set_tstamp_type? If so, assume we have
|
|
|
|
# pcap_list_tstamp_types and pcap_free_tstamp_types as well.
|
|
|
|
#
|
|
|
|
AC_CHECK_FUNCS(pcap_set_tstamp_type)
|
|
|
|
fi
|
2008-04-05 03:42:11 +08:00
|
|
|
|
2013-09-12 17:54:25 +08:00
|
|
|
AC_CHECK_FUNCS(pcap_findalldevs pcap_dump_flush pcap_lib_version pcap_setdirection)
|
2004-03-24 02:57:33 +08:00
|
|
|
if test $ac_cv_func_pcap_findalldevs = "yes" ; then
|
2004-04-17 16:44:49 +08:00
|
|
|
dnl Check for Mac OS X, which may ship pcap.h from 0.6 but libpcap may
|
2004-03-24 02:57:33 +08:00
|
|
|
dnl be 0.8; this means that lib has pcap_findalldevs but header doesn't
|
|
|
|
dnl have pcap_if_t.
|
2012-03-06 00:12:32 +08:00
|
|
|
savedcppflags="$CPPFLAGS"
|
2008-09-26 05:45:50 +08:00
|
|
|
CPPFLAGS="$CPPFLAGS $V_INCLS"
|
2004-03-24 02:57:33 +08:00
|
|
|
AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>])
|
2008-09-26 05:45:50 +08:00
|
|
|
CPPFLAGS="$savedcppflags"
|
2004-03-24 02:57:33 +08:00
|
|
|
fi
|
2004-07-11 05:53:31 +08:00
|
|
|
|
2003-02-11 15:41:52 +08:00
|
|
|
if test $ac_cv_func_pcap_lib_version = "no" ; then
|
|
|
|
AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
|
|
|
|
AC_TRY_LINK([],
|
|
|
|
[
|
2002-09-05 09:31:41 +08:00
|
|
|
extern char pcap_version[];
|
|
|
|
|
2004-08-27 15:17:03 +08:00
|
|
|
return (int)pcap_version;
|
2003-02-11 15:41:52 +08:00
|
|
|
],
|
|
|
|
ac_lbl_cv_pcap_version_defined=yes,
|
|
|
|
ac_lbl_cv_pcap_version_defined=no)
|
|
|
|
if test "$ac_lbl_cv_pcap_version_defined" = yes ; then
|
|
|
|
AC_MSG_RESULT(yes)
|
2013-05-13 06:28:28 +08:00
|
|
|
AC_DEFINE(HAVE_PCAP_VERSION, 1, [define if libpcap has pcap_version])
|
2003-02-11 15:41:52 +08:00
|
|
|
else
|
2002-09-05 09:31:41 +08:00
|
|
|
AC_MSG_RESULT(no)
|
2003-02-11 15:41:52 +08:00
|
|
|
fi
|
2002-09-05 09:31:41 +08:00
|
|
|
fi
|
|
|
|
AC_MSG_CHECKING(whether pcap_debug is defined by libpcap)
|
|
|
|
AC_TRY_LINK([],
|
|
|
|
[
|
|
|
|
extern int pcap_debug;
|
|
|
|
|
|
|
|
return pcap_debug;
|
|
|
|
],
|
|
|
|
ac_lbl_cv_pcap_debug_defined=yes,
|
|
|
|
ac_lbl_cv_pcap_debug_defined=no)
|
|
|
|
if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then
|
|
|
|
AC_MSG_RESULT(yes)
|
2013-05-13 06:28:28 +08:00
|
|
|
AC_DEFINE(HAVE_PCAP_DEBUG, 1, [define if libpcap has pcap_debug])
|
2002-09-05 09:31:41 +08:00
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
#
|
|
|
|
# OK, what about "yydebug"?
|
|
|
|
#
|
|
|
|
AC_MSG_CHECKING(whether yydebug is defined by libpcap)
|
|
|
|
AC_TRY_LINK([],
|
|
|
|
[
|
|
|
|
extern int yydebug;
|
|
|
|
|
|
|
|
return yydebug;
|
|
|
|
],
|
|
|
|
ac_lbl_cv_yydebug_defined=yes,
|
|
|
|
ac_lbl_cv_yydebug_defined=no)
|
|
|
|
if test "$ac_lbl_cv_yydebug_defined" = yes ; then
|
|
|
|
AC_MSG_RESULT(yes)
|
2013-05-13 06:28:28 +08:00
|
|
|
AC_DEFINE(HAVE_YYDEBUG, 1, [define if libpcap has yydebug])
|
2002-09-05 09:31:41 +08:00
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
fi
|
|
|
|
fi
|
2000-12-09 10:58:45 +08:00
|
|
|
AC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6
|
|
|
|
|
1999-10-08 07:47:09 +08:00
|
|
|
V_GROUP=0
|
|
|
|
if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
|
|
|
|
V_GROUP=wheel
|
|
|
|
fi
|
2008-10-28 05:12:48 +08:00
|
|
|
#
|
|
|
|
# Assume V7/BSD convention for man pages (file formats in section 5,
|
|
|
|
# miscellaneous info in section 7).
|
|
|
|
#
|
|
|
|
MAN_FILE_FORMATS=5
|
|
|
|
MAN_MISC_INFO=7
|
2001-12-10 16:41:15 +08:00
|
|
|
case "$host_os" in
|
1999-10-08 07:47:09 +08:00
|
|
|
|
|
|
|
aix*)
|
|
|
|
dnl Workaround to enable certain features
|
2010-04-16 18:31:04 +08:00
|
|
|
AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
|
1999-10-08 07:47:09 +08:00
|
|
|
;;
|
|
|
|
|
2008-10-28 05:12:48 +08:00
|
|
|
hpux*)
|
|
|
|
#
|
|
|
|
# Use System V conventions for man pages.
|
|
|
|
#
|
|
|
|
MAN_FILE_FORMATS=4
|
|
|
|
MAN_MISC_INFO=5
|
|
|
|
;;
|
|
|
|
|
1999-10-08 07:47:09 +08:00
|
|
|
irix*)
|
|
|
|
V_GROUP=sys
|
2008-10-28 05:12:48 +08:00
|
|
|
|
|
|
|
#
|
|
|
|
# Use System V conventions for man pages.
|
|
|
|
#
|
|
|
|
MAN_FILE_FORMATS=4
|
|
|
|
MAN_MISC_INFO=5
|
1999-10-08 07:47:09 +08:00
|
|
|
;;
|
|
|
|
|
|
|
|
osf*)
|
|
|
|
V_GROUP=system
|
2008-10-28 05:12:48 +08:00
|
|
|
|
|
|
|
#
|
|
|
|
# Use System V conventions for man pages.
|
|
|
|
#
|
|
|
|
MAN_FILE_FORMATS=4
|
|
|
|
MAN_MISC_INFO=5
|
1999-10-08 07:47:09 +08:00
|
|
|
;;
|
|
|
|
|
|
|
|
solaris*)
|
|
|
|
V_GROUP=sys
|
2008-10-28 05:12:48 +08:00
|
|
|
|
|
|
|
#
|
|
|
|
# Use System V conventions for man pages.
|
|
|
|
#
|
|
|
|
MAN_FILE_FORMATS=4
|
|
|
|
MAN_MISC_INFO=5
|
1999-10-08 07:47:09 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if test -f /dev/bpf0 ; then
|
|
|
|
V_GROUP=bpf
|
|
|
|
fi
|
|
|
|
|
2013-06-24 05:03:38 +08:00
|
|
|
#
|
|
|
|
# Make sure we have definitions for all the C99 specified-width types
|
|
|
|
# (regardless of whether the environment is a C99 environment or not).
|
|
|
|
AC_TYPE_INT8_T
|
|
|
|
AC_TYPE_INT16_T
|
|
|
|
AC_TYPE_INT32_T
|
|
|
|
AC_TYPE_INT64_T
|
|
|
|
AC_TYPE_UINT8_T
|
|
|
|
AC_TYPE_UINT16_T
|
|
|
|
AC_TYPE_UINT32_T
|
|
|
|
AC_TYPE_UINT64_T
|
|
|
|
|
|
|
|
#
|
|
|
|
# For now, we're using the old BSD-style u_intXX_t types, so check for
|
|
|
|
# them.
|
|
|
|
#
|
|
|
|
# We should probably migrate to the standard C uintXX_t types.
|
|
|
|
#
|
2005-04-20 17:44:30 +08:00
|
|
|
AC_CHECK_HEADERS(sys/bitypes.h)
|
|
|
|
|
|
|
|
AC_CHECK_TYPE([u_int8_t], ,
|
|
|
|
[AC_DEFINE([u_int8_t], [unsigned char],
|
|
|
|
[Define to `unsigned char' if u_int8_t not defined.])],
|
|
|
|
[AC_INCLUDES_DEFAULT
|
|
|
|
#ifdef HAVE_SYS_BITYPES_H
|
|
|
|
#include <sys/bitypes.h>
|
|
|
|
#endif])
|
|
|
|
AC_CHECK_TYPE([u_int16_t], ,
|
|
|
|
[AC_DEFINE([u_int16_t], [unsigned short],
|
|
|
|
[Define to `unsigned short' if u_int16_t not defined.])],
|
|
|
|
[AC_INCLUDES_DEFAULT
|
|
|
|
#ifdef HAVE_SYS_BITYPES_H
|
|
|
|
#include <sys/bitypes.h>
|
|
|
|
#endif])
|
|
|
|
AC_CHECK_TYPE([u_int32_t], ,
|
|
|
|
[AC_DEFINE([u_int32_t], [unsigned int],
|
|
|
|
[Define to `unsigned int' if u_int32_t not defined.])],
|
|
|
|
[AC_INCLUDES_DEFAULT
|
|
|
|
#ifdef HAVE_SYS_BITYPES_H
|
|
|
|
#include <sys/bitypes.h>
|
|
|
|
#endif])
|
|
|
|
AC_CHECK_TYPE([u_int64_t], ,
|
|
|
|
[AC_DEFINE([u_int64_t], [unsigned long long],
|
|
|
|
[Define to `unsigned long long' if u_int64_t not defined.])],
|
|
|
|
[AC_INCLUDES_DEFAULT
|
|
|
|
#ifdef HAVE_SYS_BITYPES_H
|
|
|
|
#include <sys/bitypes.h>
|
|
|
|
#endif])
|
1999-10-08 07:47:09 +08:00
|
|
|
|
2004-04-17 16:44:49 +08:00
|
|
|
#
|
2013-06-24 05:03:38 +08:00
|
|
|
# Check for <inttypes.h>
|
2004-04-17 16:44:49 +08:00
|
|
|
#
|
|
|
|
AC_CHECK_HEADERS(inttypes.h,
|
|
|
|
[
|
|
|
|
#
|
2013-06-24 05:03:38 +08:00
|
|
|
# OK, we have inttypes.h, but does it define all the PRI[doxu]64 macros?
|
|
|
|
# Some systems have an inttypes.h that doesn't define all of them.
|
2004-04-17 16:44:49 +08:00
|
|
|
#
|
|
|
|
AC_MSG_CHECKING([[whether inttypes.h defines the PRI[doxu]64 macros]])
|
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
[
|
|
|
|
AC_LANG_SOURCE(
|
|
|
|
[[
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/types.h>
|
2005-04-20 17:44:30 +08:00
|
|
|
#ifdef HAVE_SYS_BITYPES_H
|
|
|
|
#include <sys/bitypes.h>
|
|
|
|
#endif
|
2004-04-17 16:44:49 +08:00
|
|
|
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
printf("%" PRId64 "\n", (u_int64_t)1);
|
|
|
|
printf("%" PRIo64 "\n", (u_int64_t)1);
|
|
|
|
printf("%" PRIx64 "\n", (u_int64_t)1);
|
|
|
|
printf("%" PRIu64 "\n", (u_int64_t)1);
|
|
|
|
}
|
|
|
|
]])
|
|
|
|
],
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
ac_lbl_inttypes_h_defines_formats=yes
|
|
|
|
],
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
ac_lbl_inttypes_h_defines_formats=no
|
|
|
|
])
|
|
|
|
],
|
|
|
|
[
|
|
|
|
#
|
|
|
|
# We don't have inttypes.h, so it obviously can't define those
|
|
|
|
# macros.
|
|
|
|
#
|
|
|
|
ac_lbl_inttypes_h_defines_formats=no
|
|
|
|
])
|
2005-04-20 17:44:30 +08:00
|
|
|
if test "$ac_lbl_inttypes_h_defines_formats" = no; then
|
|
|
|
AC_LBL_CHECK_64BIT_FORMAT(l,
|
2004-04-17 16:44:49 +08:00
|
|
|
[
|
2005-04-20 17:44:30 +08:00
|
|
|
AC_LBL_CHECK_64BIT_FORMAT(ll,
|
|
|
|
[
|
|
|
|
AC_LBL_CHECK_64BIT_FORMAT(L,
|
2004-04-17 16:44:49 +08:00
|
|
|
[
|
2005-04-20 17:44:30 +08:00
|
|
|
AC_LBL_CHECK_64BIT_FORMAT(q,
|
|
|
|
[
|
|
|
|
AC_MSG_ERROR([neither %llx nor %Lx nor %qx worked on a 64-bit integer])
|
|
|
|
])
|
2004-04-17 16:44:49 +08:00
|
|
|
])
|
|
|
|
])
|
|
|
|
])
|
|
|
|
fi
|
|
|
|
|
2011-04-05 03:02:02 +08:00
|
|
|
#
|
|
|
|
# Check for some headers introduced in later versions of libpcap
|
|
|
|
# and used by some printers.
|
|
|
|
#
|
|
|
|
# Those headers use the {u_}intN_t types, so we must do this after
|
|
|
|
# we check for what's needed to get them defined.
|
|
|
|
#
|
|
|
|
savedcppflags="$CPPFLAGS"
|
|
|
|
CPPFLAGS="$CPPFLAGS $V_INCLS"
|
2011-04-05 03:07:11 +08:00
|
|
|
AC_CHECK_HEADERS(pcap/bluetooth.h,,,[#include <tcpdump-stdinc.h>])
|
|
|
|
AC_CHECK_HEADERS(pcap/usb.h,,,[#include <tcpdump-stdinc.h>])
|
2011-04-05 03:02:02 +08:00
|
|
|
CPPFLAGS="$savedcppflags"
|
|
|
|
|
2008-02-05 04:33:21 +08:00
|
|
|
AC_PROG_RANLIB
|
2014-01-17 06:40:46 +08:00
|
|
|
AC_CHECK_TOOL([AR], [ar])
|
2008-02-05 04:33:21 +08:00
|
|
|
|
1999-10-08 07:47:09 +08:00
|
|
|
AC_LBL_DEVEL(V_CCOPT)
|
|
|
|
|
|
|
|
AC_LBL_SOCKADDR_SA_LEN
|
|
|
|
|
|
|
|
AC_LBL_UNALIGNED_ACCESS
|
|
|
|
|
1999-10-31 07:45:50 +08:00
|
|
|
AC_VAR_H_ERRNO
|
|
|
|
|
2012-10-14 02:21:45 +08:00
|
|
|
# Check for OpenSSL libcrypto
|
|
|
|
AC_MSG_CHECKING(whether to use OpenSSL libcrypto)
|
2008-02-27 04:47:12 +08:00
|
|
|
# Specify location for both includes and libraries.
|
2012-10-14 02:21:45 +08:00
|
|
|
want_libcrypto=ifavailable
|
2008-02-27 04:47:12 +08:00
|
|
|
AC_ARG_WITH(crypto,
|
2012-10-14 02:21:45 +08:00
|
|
|
AS_HELP_STRING([--with-crypto],
|
|
|
|
[use OpenSSL libcrypto @<:@default=yes, if available@:>@]),
|
2008-02-27 04:47:12 +08:00
|
|
|
[
|
|
|
|
if test $withval = no
|
|
|
|
then
|
|
|
|
want_libcrypto=no
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
elif test $withval = yes
|
|
|
|
then
|
|
|
|
want_libcrypto=yes
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
fi
|
|
|
|
],[
|
2003-07-02 04:44:16 +08:00
|
|
|
#
|
2008-02-27 04:47:12 +08:00
|
|
|
# Use libcrypto if it's present, otherwise don't.
|
2003-07-02 04:44:16 +08:00
|
|
|
#
|
2008-02-27 04:47:12 +08:00
|
|
|
want_libcrypto=ifavailable
|
|
|
|
AC_MSG_RESULT([yes, if available])
|
|
|
|
])
|
|
|
|
if test "$want_libcrypto" != "no"; then
|
2012-10-14 02:21:45 +08:00
|
|
|
AC_CHECK_LIB(crypto, DES_cbc_encrypt)
|
|
|
|
AC_CHECK_HEADERS(openssl/evp.h)
|
1999-10-30 13:11:06 +08:00
|
|
|
fi
|
|
|
|
|
2003-12-15 10:12:40 +08:00
|
|
|
dnl
|
|
|
|
dnl set additional include path if necessary
|
|
|
|
if test "$missing_includes" = "yes"; then
|
2011-04-05 02:49:41 +08:00
|
|
|
CPPFLAGS="$CPPFLAGS -I$srcdir/missing"
|
|
|
|
V_INCLS="$V_INCLS -I$srcdir/missing"
|
2003-12-15 10:12:40 +08:00
|
|
|
fi
|
|
|
|
|
1999-10-08 07:47:09 +08:00
|
|
|
AC_SUBST(V_CCOPT)
|
2003-11-16 17:36:07 +08:00
|
|
|
AC_SUBST(V_DEFS)
|
1999-10-08 07:47:09 +08:00
|
|
|
AC_SUBST(V_GROUP)
|
|
|
|
AC_SUBST(V_INCLS)
|
|
|
|
AC_SUBST(V_PCAPDEP)
|
1999-10-30 13:11:06 +08:00
|
|
|
AC_SUBST(LOCALSRC)
|
2008-10-28 05:12:48 +08:00
|
|
|
AC_SUBST(MAN_FILE_FORMATS)
|
|
|
|
AC_SUBST(MAN_MISC_INFO)
|
1999-10-08 07:47:09 +08:00
|
|
|
|
|
|
|
AC_PROG_INSTALL
|
|
|
|
|
1999-11-21 17:36:43 +08:00
|
|
|
AC_CONFIG_HEADER(config.h)
|
|
|
|
|
2000-01-18 11:46:49 +08:00
|
|
|
AC_OUTPUT_COMMANDS([if test -f .devel; then
|
|
|
|
echo timestamp > stamp-h
|
|
|
|
cat Makefile-devel-adds >> Makefile
|
2000-01-17 14:07:16 +08:00
|
|
|
make depend
|
2000-01-18 11:46:49 +08:00
|
|
|
fi])
|
2008-10-28 05:12:48 +08:00
|
|
|
AC_OUTPUT(Makefile tcpdump.1)
|
2000-01-18 11:46:49 +08:00
|
|
|
exit 0
|