[Groonga-commit] groonga/groonga [master] cmake: detect event loop backend

Back to archive index

null+****@clear***** null+****@clear*****
2012年 5月 17日 (木) 10:05:36 JST


Kouhei Sutou	2012-05-17 10:05:36 +0900 (Thu, 17 May 2012)

  New Revision: 7a5bc0bce12cc2c7248361125aa32ab6cc24befa

  Log:
    cmake: detect event loop backend

  Modified files:
    CMakeLists.txt

  Modified: CMakeLists.txt (+48 -0)
===================================================================
--- CMakeLists.txt    2012-05-17 09:47:33 +0900 (3c2da5f)
+++ CMakeLists.txt    2012-05-17 10:05:36 +0900 (760c3b4)
@@ -115,6 +115,54 @@ endif()
 
 option(WITH_NFKC "use NFKC based UTF8 normalization." ON)
 
+if(WIN32)
+  ac_check_headers(winsock2.h)
+  if(NOT ${HAVE_WINSOCK2_H} EQUAL 1)
+    message(FATAL_ERROR "No winsock2.h found")
+  endif()
+  set(USE_SELECT TRUE)
+else()
+  ac_check_headers(sys/epoll.h)
+  if(${HAVE_SYS_EPOLL_H} EQUAL 1)
+    ac_check_funcs(epoll_create)
+    if(${HAVE_EPOLL_CREATE} EQUAL 1)
+      set(USE_EPOLL TRUE)
+    endif()
+  endif()
+
+  if(NOT USE_EPOLL)
+    ac_check_headers(sys/event.h)
+    if(${HAVE_SYS_EVENT_H} EQUAL 1)
+      ac_check_funcs(kevent)
+      if(${HAVE_KEVENT} EQUAL 1)
+        set(USE_KQUEUE TRUE)
+      endif()
+    endif()
+
+    if(NOT USE_KQUEUE)
+      ac_check_headers(sys/poll.h)
+      if(${HAVE_SYS_POLL_H} EQUAL 1)
+        ac_check_funcs(poll)
+        if(${HAVE_POLL} EQUAL 1)
+          set(USE_POLL TRUE)
+        endif()
+      endif()
+
+      if(NOT USE_POLL)
+        ac_check_funcs(select)
+        if(${HAVE_SELECT} EQUAL 1)
+          set(USE_SELECT TRUE)
+          ac_check_headers(sys/select.h)
+        endif()
+
+        if(NOT USE_SELECT)
+          message(FATAL_ERROR "All epoll/kqueue/poll/select are missing")
+        endif()
+      endif()
+    endif()
+  endif()
+endif()
+
 option(WITH_ZLIB "use zlib for data compression." OFF)
 if(WITH_ZLIB)
   ac_check_lib(z compress)




Groonga-commit メーリングリストの案内
Back to archive index