diff --git a/configure.in b/configure.in
index 1a92983..9f994b7 100644
--- a/configure.in
+++ b/configure.in
@@ -531,14 +531,46 @@ dnl Now figure out how we get a list of interfaces and addresses,
 dnl if we support capturing.  Don't bother if we don't support
 dnl capturing.
 dnl
-if test "$V_PCAP" = null
-then
+case "$V_PCAP" in
+null)
 	#
 	# We can't capture, so we can't open any capture
 	# devices, so we won't return any interfaces.
 	#
 	V_FINDALLDEVS=null
-else
+	;;
+
+dlpi|libdlpi)
+	AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
+	#
+	# This might be Solaris 8 or later, with
+	# SIOCGLIFCONF, or it might be some other OS
+	# or some older version of Solaris, with
+	# just SIOCGIFCONF.
+	#
+	AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
+	AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
+	    AC_TRY_COMPILE(
+		[#include <sys/param.h>
+		#include <sys/file.h>
+		#include <sys/ioctl.h>
+		#include <sys/socket.h>
+		#include <sys/sockio.h>],
+		[ioctl(0, SIOCGLIFCONF, (char *)0);],
+		ac_cv_lbl_have_siocglifconf=yes,
+		ac_cv_lbl_have_siocglifconf=no))
+	AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
+	if test $ac_cv_lbl_have_siocglifconf = yes ; then
+		V_FINDALLDEVS=glifc
+	else
+		V_FINDALLDEVS=gifc
+	fi
+	#
+	# Needed for common functions used by pcap-[dlpi,libdlpi].c
+	#
+ 	SSRC="dlpisubs.c"
+	;;		
+*)
 	AC_CHECK_FUNC(getifaddrs,[
 		#
 		# We have "getifaddrs()"; make sure we have <ifaddrs.h>
@@ -564,56 +596,14 @@ else
 		])
 	],[
 		#
-		# Well, we don't have "getifaddrs()", so we have to use
-		# some other mechanism; determine what that mechanism is.
+		# Assume we just have SIOCGIFCONF.
+		# (XXX - on at least later Linux kernels, there's
+		# another mechanism, and we should be using that
+		# instead.)
 		#
-		# The first thing we use is the type of capture mechanism,
-		# which is somewhat of a proxy for the OS we're using.
-		#
-		case "$V_PCAP" in
-
-		dlpi|libdlpi)
-			AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
-			#
-			# This might be Solaris 8 or later, with
-			# SIOCGLIFCONF, or it might be some other OS
-			# or some older version of Solaris, with
-			# just SIOCGIFCONF.
-			#
-			AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
-			AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
-			    AC_TRY_COMPILE(
-				[#include <sys/param.h>
-				#include <sys/file.h>
-				#include <sys/ioctl.h>
-				#include <sys/socket.h>
-				#include <sys/sockio.h>],
-				[ioctl(0, SIOCGLIFCONF, (char *)0);],
-				ac_cv_lbl_have_siocglifconf=yes,
-				ac_cv_lbl_have_siocglifconf=no))
-			AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
-			if test $ac_cv_lbl_have_siocglifconf = yes ; then
-				V_FINDALLDEVS=glifc
-			else
-				V_FINDALLDEVS=gifc
-			fi
-			#
-			# Needed for common functions used by pcap-[dlpi,libdlpi].c
-			#
-		 	SSRC="dlpisubs.c"
-			;;
-
-		*)
-			#
-			# Assume we just have SIOCGIFCONF.
-			# (XXX - on at least later Linux kernels, there's
-			# another mechanism, and we should be using that
-			# instead.)
-			#
-			V_FINDALLDEVS=gifc
-			;;
-		esac])
-fi
+		V_FINDALLDEVS=gifc
+		])
+esac
 ])
 
 AC_MSG_CHECKING(for socklen_t)
diff --git a/gencode.c b/gencode.c
index 0010df5..8510f1f 100644
--- a/gencode.c
+++ b/gencode.c
@@ -84,7 +84,7 @@ static const char rcsid[] _U_ =
 #include "pcap/sll.h"
 #include "pcap/ipnet.h"
 #include "arcnet.h"
-#if defined(PF_PACKET) && defined(SO_ATTACH_FILTER)
+#if defined(PF_PACKET) && defined(SO_ATTACH_FILTER) && !defined(__sun__)
 #include <linux/types.h>
 #include <linux/if_packet.h>
 #include <linux/filter.h>
@@ -7592,7 +7592,7 @@ gen_inbound(dir)
 		 * check it, otherwise give up as this link-layer type
 		 * has nothing in the packet data.
 		 */
-#if defined(PF_PACKET) && defined(SO_ATTACH_FILTER)
+#if defined(PF_PACKET) && defined(SO_ATTACH_FILTER) && !defined(__sun__)
 		/*
 		 * We infer that this is Linux with PF_PACKET support.
 		 * If this is a *live* capture, we can look at
diff --git a/pcap-libdlpi.c b/pcap-libdlpi.c
index 9252de4..b982e58 100644
--- a/pcap-libdlpi.c
+++ b/pcap-libdlpi.c
@@ -236,6 +236,7 @@ static int
 dlpromiscon(pcap_t *p, bpf_u_int32 level)
 {
 	int err;
+	int retv;
 
 	retv = dlpi_promiscon(p->dlpi_hd, level);
 	if (retv != DLPI_SUCCESS) {
