Solaris/autoconf patch from Jonathan Abbey <jonabbey@ganymeta.org>

This commit is contained in:
pdw
2003-06-06 22:42:35 +00:00
parent c7429ed887
commit 4089483e6a
15 changed files with 2089 additions and 126 deletions

View File

@@ -15,9 +15,13 @@ dnl Boilerplate configuration
dnl
AC_INIT(iftop.c)
AC_CONFIG_AUX_DIR(config)
AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(iftop, "0.12")
AM_INIT_AUTOMAKE(iftop, "0.13pre1")
AC_DEFINE_UNQUOTED(IFTOP_VERSION, "$VERSION", [The iftop version number])
@@ -60,6 +64,12 @@ AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
dnl
dnl Are we on a system that uses the STREAMS low-level DLPI interface?
dnl
AC_CHECK_HEADER([sys/dlpi.h],[AC_DEFINE([HAVE_DLPI],1,[Are we running on a STREAMS system with DLPI?])])
dnl Checks for library functions.
AC_CHECK_FUNCS(regcomp select strdup strerror strspn)
@@ -68,8 +78,8 @@ AC_SEARCH_LIBS(log, m)
AC_CHECK_FUNC(gethostbyname, ,
[AC_CHECK_LIB(nsl, gethostbyname)] )
AC_SEARCH_LIBS(inet_aton, [-lsocket -lnsl])
AC_SEARCH_LIBS(inet_pton, [-lsocket -lnsl])
AC_SEARCH_LIBS(inet_aton, [socket nsl])
AC_SEARCH_LIBS(inet_pton, [socket nsl])
AC_CHECK_FUNCS(inet_aton inet_pton)
dnl
@@ -143,7 +153,7 @@ dnl but that's probably not available on typical machines.
if test x$resolver = xnetdb ; then
dnl Best possibility is getnameinfo.
use_getnameinfo=0
AC_SEARCH_LIBS(getnameinfo, [-lnsl], [use_getnameinfo=1])
AC_SEARCH_LIBS(getnameinfo, [nsl], [use_getnameinfo=1])
dnl XXX For the moment, don't use getnameinfo, since it isn't actually
dnl thread safe on, e.g., NetBSD.
@@ -154,7 +164,7 @@ if test x$resolver = xnetdb ; then
AC_DEFINE(USE_GETNAMEINFO, 1, [use getnameinfo for name resolution])
else
dnl Now see if we can use gethostbyaddr_r.
AC_SEARCH_LIBS(gethostbyaddr_r, [-lnsl], , [resolver=netdb_1thread])
AC_SEARCH_LIBS(gethostbyaddr_r, [nsl], , [resolver=netdb_1thread])
dnl Still want gethostbyaddr_r....
if test x$resolver = xnetdb ; then
@@ -195,7 +205,7 @@ dnl machine had a working gethostbyaddr_r, the user wouldn't be pissing about
dnl with ARES.
if test x$resolver = xares ; then
dnl See if ares is to hand....
AC_SEARCH_LIBS(ares_init, [-lares], [
AC_SEARCH_LIBS(ares_init, [ares], [
AC_DEFINE(USE_ARES, 1, [use ARES for name resolution])
], [
dnl no ares
@@ -206,7 +216,7 @@ fi
dnl Ugh. gethostbyaddr.
if test x$resolver = xnetdb_1thread ; then
AC_SEARCH_LIBS(gethostbyaddr, [-lnsl], , [
AC_SEARCH_LIBS(gethostbyaddr, [nsl], , [
AC_MSG_ERROR([not even gethostbyaddr is available
What sort of UNIX system is this, anyway?])
]
@@ -232,15 +242,15 @@ fi
AC_MSG_CHECKING([where to find pcap.h])
foundpcaph=0
oldCPPFLAGS=$CPPFLAGS
for prefix in "" $libpcap_prefix ; do
for test_prefix in "" $libpcap_prefix ; do
for x in "" /pcap ; do
if test x$prefix != x ; then
CPPFLAGS="$oldCPPFLAGS -I$prefix/include$x"
if test x$test_prefix != x ; then
CPPFLAGS="$oldCPPFLAGS -I$test_prefix/include$x"
fi
AC_TRY_CPP([
#include <pcap.h>
], [
AC_MSG_RESULT([$prefix/include$x])
AC_MSG_RESULT([$test_prefix/include$x])
foundpcaph=1
break
])
@@ -255,9 +265,9 @@ if test $foundpcaph = 0 ; then
AC_MSG_ERROR([can't find pcap.h
You're not going to get very far without libpcap.])
else
dnl assume that -lpcap is under $prefix/lib
if test x$prefix != x ; then
LDFLAGS="$LDFLAGS -L$prefix"
dnl assume that -lpcap is under $test_prefix/lib
if test x$test_prefix != x ; then
LDFLAGS="$LDFLAGS -L$test_prefix"
fi
AC_CHECK_LIB(pcap, pcap_open_live, , [
AC_MSG_ERROR([can't find libpcap
@@ -341,9 +351,30 @@ else
fi
dnl
dnl Wahey! This might even work.
dnl Are we on a system (like Solaris) that requires promiscuous mode in order to
dnl see any outgoing packets?
dnl
AC_MSG_CHECKING([if we need to enable promiscuous mode by default])
enable_default_promiscuous="no"
case "$host_os" in
solaris*) enable_default_promiscuous="yes" ;;
esac
AC_ARG_ENABLE(default-promiscuous,
[--enable-default-promiscuous If enabled, iftop will operate in promiscuous mode to capture outgoing packets])
AC_MSG_RESULT([$enable_default_promiscuous])
if test x"$enable_default_promiscuous" = x"yes"; then
AC_DEFINE([NEED_PROMISCUOUS_FOR_OUTGOING],1,[Enable default promiscuous mode to capture outgoing packets])
fi
dnl
dnl Wahey! This might even work.
dnl
AC_SUBST(ac_aux_dir)