summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2012-02-21 22:44:03 +0000
committerAndrew Stitcher <astitcher@apache.org>2012-02-21 22:44:03 +0000
commit60a803992f70816a69ab31f987645289b2ad95dc (patch)
tree9b2c5a530276a7b59d5b8e130e95764eb1c2dd5d
parentf1a5a7ba9acbca5958a268d5d92eae9987ce6458 (diff)
downloadqpid-python-60a803992f70816a69ab31f987645289b2ad95dc.tar.gz
QPID-3571: A generic Posix poller implementation
Wired manual selection of poll/epoll implementations into autoconf/cmake. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1292066 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/configure.ac13
-rw-r--r--qpid/cpp/src/CMakeLists.txt32
-rw-r--r--qpid/cpp/src/Makefile.am8
3 files changed, 41 insertions, 12 deletions
diff --git a/qpid/cpp/configure.ac b/qpid/cpp/configure.ac
index a3318531bd..6ba5f62f0e 100644
--- a/qpid/cpp/configure.ac
+++ b/qpid/cpp/configure.ac
@@ -448,7 +448,7 @@ AC_ARG_WITH([poller],
[AS_HELP_STRING([--with-poller], [The low level poller implementation: poll/solaris-ecf/epoll])],
[case ${withval} in
poll)
- AC_CHECK_HEADERS([sys/poll.h],[poller=no],[AC_MSG_ERROR([Can't find poll.h header file for poll])])
+ AC_CHECK_HEADERS([sys/poll.h],[poller=poll],[AC_MSG_ERROR([Can't find poll.h header file for poll])])
;;
solaris-ecf)
AC_CHECK_HEADERS([port.h],[poller=solaris-ecf],[AC_MSG_ERROR([Can't find port.h header file for solaris-ecf])])
@@ -458,14 +458,17 @@ AC_ARG_WITH([poller],
;;
esac],
[
- AC_CHECK_HEADERS([sys/poll.h],[poller=no],)
- AC_CHECK_HEADERS([port.h],[poller=solaris-ecf],)
+ # We check for poll first so that it is overridden
+ AC_CHECK_HEADERS([sys/poll.h],[poller=poll],)
+ # Not currently supported - WIP
+ #AC_CHECK_HEADERS([port.h],[poller=solaris-ecf],)
AC_CHECK_HEADERS([sys/epoll.h],[poller=epoll],)
]
)
-AM_CONDITIONAL([HAVE_ECF], [test x$poller = xsolaris-ecf])
-AM_CONDITIONAL([HAVE_EPOLL], [test x$poller = xepoll])
+AM_CONDITIONAL([USE_ECF], [test x$poller = xsolaris-ecf])
+AM_CONDITIONAL([USE_POLL], [test x$poller = xpoll])
+AM_CONDITIONAL([USE_EPOLL], [test x$poller = xepoll])
#Filter not implemented or invalid mechanisms
if test $poller = xno; then
diff --git a/qpid/cpp/src/CMakeLists.txt b/qpid/cpp/src/CMakeLists.txt
index a258605a1e..cfcdead883 100644
--- a/qpid/cpp/src/CMakeLists.txt
+++ b/qpid/cpp/src/CMakeLists.txt
@@ -487,6 +487,19 @@ if (NOT BUILD_PROBES)
set (HAVE_SYS_SDT_H 0)
endif (NOT BUILD_PROBES)
+# Check for poll/epoll header files
+check_include_files(sys/poll.h HAVE_POLL)
+check_include_files(sys/epoll.h HAVE_EPOLL)
+
+# Set default poller implementation (check from general to specific to allow overriding)
+if (HAVE_POLL)
+ set(poller_default poll)
+endif (HAVE_POLL)
+if (HAVE_EPOLL)
+ set(poller_default epoll)
+endif (HAVE_EPOLL)
+set(POLLER ${poller_default} CACHE STRING "Poller implementation (poll/epoll)")
+
# If not windows ensure that we have uuid library
if (NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
CHECK_LIBRARY_EXISTS (uuid uuid_compare "" HAVE_UUID)
@@ -750,9 +763,18 @@ else (CMAKE_SYSTEM_NAME STREQUAL Windows)
# POSIX (Non-Windows) platforms have a lot of overlap in sources; the only
# major difference is the poller module.
- if (CMAKE_SYSTEM_NAME STREQUAL Linux)
+ if (POLLER STREQUAL poll)
+ set (qpid_poller_module
+ qpid/sys/posix/PosixPoller.cpp
+ )
+ elseif (POLLER STREQUAL epoll)
set (qpid_poller_module
qpid/sys/epoll/EpollPoller.cpp
+ )
+ endif (POLLER STREQUAL poll)
+
+ if (CMAKE_SYSTEM_NAME STREQUAL Linux)
+ set (qpid_system_module
qpid/sys/posix/SystemInfo.cpp
)
add_definitions(-pthread)
@@ -764,13 +786,12 @@ else (CMAKE_SYSTEM_NAME STREQUAL Windows)
set (qpidtypes_platform_SOURCES)
set (qpidtypes_platform_LIBS
- uuid
- ${Boost_SYSTEM_LIBRARY}
+ uuid
+ ${Boost_SYSTEM_LIBRARY}
)
if (CMAKE_SYSTEM_NAME STREQUAL SunOS)
- set (qpid_poller_module
- qpid/sys/posix/PosixPoller.cpp
+ set (qpid_system_module
qpid/sys/solaris/SystemInfo.cpp
)
# On Sun we want -lpthread -lthread as the 2nd last and last libs passed to linker
@@ -799,6 +820,7 @@ else (CMAKE_SYSTEM_NAME STREQUAL Windows)
qpid/sys/posix/Time.cpp
qpid/SaslFactory.cpp
+ ${qpid_system_module}
${qpid_poller_module}
)
set (qpidcommon_platform_LIBS
diff --git a/qpid/cpp/src/Makefile.am b/qpid/cpp/src/Makefile.am
index a909ed8185..a954f28577 100644
--- a/qpid/cpp/src/Makefile.am
+++ b/qpid/cpp/src/Makefile.am
@@ -183,11 +183,15 @@ nobase_include_HEADERS += \
../include/qpid/sys/posix/Time.h \
../include/qpid/sys/posix/check.h
-if HAVE_EPOLL
+if USE_EPOLL
poller = qpid/sys/epoll/EpollPoller.cpp
endif
-if HAVE_ECF
+if USE_POLL
+ poller = qpid/sys/posix/PosixPoller.cpp
+endif
+
+if USE_ECF
poller = qpid/sys/solaris/ECFPoller.cpp
endif