summaryrefslogtreecommitdiff
path: root/configure.cmake
diff options
context:
space:
mode:
authorVladislav Vaintroub <vvaintroub@linux-rbsx>2009-12-19 03:21:49 +0100
committerVladislav Vaintroub <vvaintroub@linux-rbsx>2009-12-19 03:21:49 +0100
commit9c9cc49060f17415763b1d634aa6770ed63824c4 (patch)
tree9ccfada701764a2476975250d029acbe812b12b1 /configure.cmake
parent54c5a4beefefb8047a3fb1f0259d38e5e8bb664e (diff)
parent92630be0ee81604ec47cb8c7e9ab016e5449dc4d (diff)
downloadmariadb-git-9c9cc49060f17415763b1d634aa6770ed63824c4.tar.gz
merge
Diffstat (limited to 'configure.cmake')
-rw-r--r--configure.cmake48
1 files changed, 46 insertions, 2 deletions
diff --git a/configure.cmake b/configure.cmake
index 84a1b5f1dfb..828c277c1dc 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -273,7 +273,7 @@ IF(UNIX)
IF(NOT LIBM)
MY_SEARCH_LIBS(__infinity m LIBM)
ENDIF()
- MY_SEARCH_LIBS(gethostbyname_r "nsl_r;nsl" LIBNLS)
+ MY_SEARCH_LIBS(gethostbyname_r "nsl_r;nsl" LIBNSL)
MY_SEARCH_LIBS(bind "bind;socket" LIBBIND)
MY_SEARCH_LIBS(crypt crypt LIBCRYPT)
MY_SEARCH_LIBS(setsockopt socket LIBSOCKET)
@@ -285,7 +285,7 @@ IF(UNIX)
FIND_PACKAGE(Threads)
SET(CMAKE_REQUIRED_LIBRARIES
- ${LIBM} ${LIBNLS} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT})
+ ${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT})
LIST(REMOVE_DUPLICATES CMAKE_REQUIRED_LIBRARIES)
LINK_LIBRARIES(${CMAKE_THREAD_LIBS_INIT})
@@ -1136,6 +1136,50 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
ENDIF()
ENDIF()
+# Use of ALARMs to wakeup on timeout on sockets
+#
+# This feature makes use of a mutex and is a scalability hog we
+# try to avoid using. However we need support for SO_SNDTIMEO and
+# SO_RCVTIMEO socket options for this to work. So we will check
+# if this feature is supported by a simple TRY_RUN macro. However
+# on some OS's there is support for setting those variables but
+# they are silently ignored. For those OS's we will not attempt
+# to use SO_SNDTIMEO and SO_RCVTIMEO even if it is said to work.
+# See Bug#29093 for the problem with SO_SND/RCVTIMEO on HP/UX.
+# To use alarm is simple, simply avoid setting anything.
+
+IF(WIN32)
+ SET(HAVE_SOCKET_TIMEOUT 1)
+ELSEIF(CMAKE_SYSTEM MATCHES "HP")
+ SET(HAVE_SOCKET_TIMEOUT 0)
+ELSEIF(CMAKE_CROSSCOMPILING)
+ SET(HAVE_SOCKET_TIMEOUT 0)
+ELSE()
+SET(CMAKE_REQUIRED_LIBRARIES ${LIBNSL} ${LIBSOCKET})
+CHECK_C_SOURCE_RUNS(
+"
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <sys/time.h>
+
+ int main()
+ {
+ int fd = socket(AF_INET, SOCK_STREAM, 0);
+ struct timeval tv;
+ int ret= 0;
+ tv.tv_sec= 2;
+ tv.tv_usec= 0;
+ ret|= setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
+ ret|= setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
+ return !!ret;
+ }
+" HAVE_SOCKET_TIMEOUT)
+ENDIF()
+
+SET(NO_ALARM "${HAVE_SOCKET_TIMEOUT}" CACHE BOOL
+ "No need to use alarm to implement socket timeout")
+MARK_AS_ADVANCED(NO_ALARM)
+
IF(CMAKE_SYSTEM_NAME STREQUAL "AIX" OR CMAKE_SYSTEM_NAME STREQUAL "OS400")
# xlC oddity - it complains about same inline function defined multiple times
# in different compilation units