--- ../squid-3.1.8/configure.in	Sat Sep  4 04:26:52 2010
+++ ./configure.in	Mon Oct 11 11:38:39 2010
@@ -1339,6 +1339,59 @@
   fi
 fi
 
+dnl Enable solaris /dev/poll
+disable_devpoll=
+force_devpoll="no"
+AC_ARG_ENABLE(devpoll,
+  AS_HELP_STRING([--disable-devpoll],[Disable Solaris /dev/poll support.]),
+[
+  case "$enableval" in
+  yes)
+    AC_MSG_WARN([Forcing devpoll() to be enabled])
+    SELECT_TYPE="devpoll"
+    force_devpoll="yes"
+    ;;
+  no)
+    AC_MSG_WARN([Forcing devpoll() to be disabled])
+    disable_devpoll=true
+  ;;
+esac
+])
+dnl auto-detect and verify devpoll header and library present and working
+if test -z "$disable_devpoll"; then
+
+  # Check for /dev/poll
+  AC_CHECK_FUNCS(ioctl)
+  AC_CHECK_FUNCS(write)
+
+  dnl devpoll requires sys/devpoll.h
+  AC_CHECK_HEADERS([sys/devpoll.h])
+
+  dnl Verify that /dev/poll really works
+  if test "$ac_cv_func_ioctl" = "yes" && test "$ac_cv_func_write" = "yes"; then
+    AC_CACHE_CHECK(if /dev/poll works, ac_cv_devpoll_works,
+      AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <sys/devpoll.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
+int main(int argc, char **argv)
+{
+    int fd = open("/dev/poll", O_RDWR);
+    if (fd < 0) {
+	perror("devpoll_create:");
+	return 1;
+    }
+    return 0;
+}
+      ]])],[ac_cv_devpoll_works=yes],[ac_cv_devpoll_works=no],[]))
+  fi
+
+  if test "$force_devpoll" = "yes" && test "$ac_cv_devpoll_works" = "no" ; then
+    AC_MSG_ERROR([/dev/poll does not work. Force-enabling it is not going to help.])
+  fi
+fi
+
 dnl Disable HTTP violations
 http_violations=1
 AC_ARG_ENABLE(http-violations,
@@ -3013,6 +3066,8 @@
 	: # Already decided above. Nothing to do here
 elif test -z "$disable_epoll" && test "$ac_cv_epoll_works" = "yes" ; then
 	SELECT_TYPE="epoll"
+elif test -z "$disable_devpoll" && test "$ac_cv_devpoll_works" = "yes" ; then
+	SELECT_TYPE="devpoll"
 elif test -z "$disable_kqueue" && test "$ac_cv_func_kqueue" = "yes" ; then
 	SELECT_TYPE="kqueue"
 elif test -z "$disable_poll" && test "$ac_cv_func_poll" = "yes" ; then
@@ -3027,7 +3082,7 @@
 		;;
 	esac
 else
-        AC_MSG_WARN([Eep!  Can't find poll, kqueue, epoll, or select!])
+        AC_MSG_WARN([Eep!  Can't find poll, devpoll, kqueue, epoll, or select!])
         AC_MSG_WARN([I'll try select and hope for the best.])
         SELECT_TYPE="select"
         AC_DEFINE(USE_SELECT,1)
@@ -3037,6 +3092,7 @@
 
 AM_CONDITIONAL([USE_POLL], [test $SELECT_TYPE = poll])
 AM_CONDITIONAL([USE_EPOLL], [test $SELECT_TYPE = epoll])
+AM_CONDITIONAL([USE_DEVPOLL], [test $SELECT_TYPE = devpoll])
 AM_CONDITIONAL([USE_SELECT], [test $SELECT_TYPE = select])
 AM_CONDITIONAL([USE_SELECT_SIMPLE], [test $SELECT_TYPE = select_simple])
 AM_CONDITIONAL([USE_SELECT_WIN32], [test $SELECT_TYPE = select_win32])
@@ -3047,6 +3103,9 @@
 epoll)
 	AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop])
 	;;
+devpoll)
+	AC_DEFINE(USE_DEVPOLL,1,[Use /dev/poll for the IO loop])
+	;;
 poll)
         AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop])
 	;;

