]> granicus.if.org Git - libevent/commitdiff
check for linux eventpoll
authorNiels Provos <provos@gmail.com>
Fri, 7 Mar 2003 23:21:01 +0000 (23:21 +0000)
committerNiels Provos <provos@gmail.com>
Fri, 7 Mar 2003 23:21:01 +0000 (23:21 +0000)
svn:r43

configure.in

index 025ae34aed1e950c0ff4fb31e49e5ade36092c7a..9b8793b1aee6b855e14773d5f390ca1b731373ac 100644 (file)
@@ -20,7 +20,7 @@ dnl Checks for libraries.
 
 dnl Checks for header files.
 AC_HEADER_STDC
-AC_CHECK_HEADERS(poll.h signal.h unistd.h sys/time.h sys/queue.h sys/event.h)
+AC_CHECK_HEADERS(poll.h signal.h unistd.h sys/epoll.h sys/time.h sys/queue.h sys/event.h)
 if test "x$ac_cv_header_sys_queue_h" = "xyes"; then
        AC_MSG_CHECKING(for TAILQ_FOREACH in sys/queue.h)
        AC_EGREP_CPP(yes,
@@ -71,12 +71,15 @@ if test "x$havepoll" = "xyes" ; then
        needsignal=yes
 fi
 
-if test "x$needsignal" = "xyes" ; then
-       AC_LIBOBJ([signal])
+haveepoll=no
+AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
+if test "x$haveepoll" = "xyes" ; then
+       AC_DEFINE(HAVE_EPOLL, 1,
+               [Define if your system supports the epoll system calls])
+       AC_LIBOBJ([epoll])
+       needsignal=yes
 fi
 
-AC_REPLACE_FUNCS(err)
-
 havekqueue=no
 if test "x$ac_cv_header_sys_event_h" = "xyes"; then
        AC_CHECK_FUNCS(kqueue, [havekqueue=yes], )
@@ -134,6 +137,46 @@ main(int argc, char **argv)
        fi
 fi
 
+haveepollsyscall=no
+if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
+       if test "x$haveepoll" = "xno" ; then
+               AC_MSG_CHECKING(for epoll system call)
+               AC_TRY_RUN(
+#include <stdint.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <sys/epoll.h>
+#include <unistd.h>
+
+int
+epoll_create(int size)
+{
+       return (syscall(__NR_epoll_create, size));
+}
+
+int
+main(int argc, char **argv)
+{
+       int epfd;
+
+       epfd = epoll_create(256);
+       exit (epfd == -1 ? 1 : 0);
+}, [AC_MSG_RESULT(yes)
+    AC_DEFINE(HAVE_EPOLL, 1,
+       [Define if your system supports the epoll system calls])
+    needsignal=yes
+    AC_LIBOBJ([epoll_sub])
+    AC_LIBOBJ([epoll])], AC_MSG_RESULT(no), AC_MSG_RESULT(no))
+       fi
+fi
+
+if test "x$needsignal" = "xyes" ; then
+       AC_LIBOBJ([signal])
+fi
+
+AC_REPLACE_FUNCS(err)
+
 AC_TYPE_PID_T
 AC_TYPE_SIZE_T
 AC_CHECK_TYPE(u_int64_t, unsigned long long)