diff --git a/Makefile.am b/Makefile.am index 6679f0e6..f285d39f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -37,17 +37,16 @@ bin_SCRIPTS = event_rpcgen.py pkgconfigdir=$(libdir)/pkgconfig pkgconfig_DATA=libevent.pc -# These sources are conditionally added to SYS_SRC by configure.in +# These sources are conditionally added by configure.in or conditionally +# included from other files. PLATFORM_DEPENDENT_SRC = \ - kqueue.c epoll_sub.c epoll.c select.c poll.c signal.c \ - evport.c devpoll.c - arc4random.c \ - evthread_pthread.c + epoll_sub.c \ + arc4random.c EXTRA_DIST = \ evdns.3 event.3 \ LICENSE \ - autogen.sh + autogen.sh \ libevent.pc.in \ Doxyfile \ whatsnew-2.0.txt \ @@ -80,6 +79,28 @@ SYS_INCLUDES = endif +if SELECT_BACKEND +SYS_SRC += select.c +endif +if POLL_BACKEND +SYS_SRC += poll.c +endif +if DEVPOLL_BACKEND +SYS_SRC += devpoll.c +endif +if KQUEUE_BACKEND +SYS_SRC += kqueue.c +endif +if EPOLL_BACKEND +SYS_SRC += epoll.c +endif +if EVPORT_BACKEND +SYS_SRC += evport.c +endif +if SIGNAL_SUPPORT +SYS_SRC += signal.c +endif + BUILT_SOURCES = event-config.h event-config.h: config.h @@ -106,7 +127,6 @@ CORE_SRC = event.c evthread.c buffer.c \ evmap.c log.c evutil.c evutil_rand.c strlcpy.c $(SYS_SRC) EXTRA_SRC = event_tagging.c http.c evdns.c evrpc.c - libevent_la_SOURCES = $(CORE_SRC) $(EXTRA_SRC) libevent_la_LIBADD = @LTLIBOBJS@ $(SYS_LIBS) libevent_la_LDFLAGS = -version-info $(VERSION_INFO) diff --git a/configure.in b/configure.in index 2aeab1ec..269f6cdc 100644 --- a/configure.in +++ b/configure.in @@ -260,32 +260,23 @@ needsignal=no haveselect=no AC_CHECK_FUNCS(select, [haveselect=yes], ) if test "x$haveselect" = "xyes" ; then - AC_LIBOBJ(select) needsignal=yes fi +AM_CONDITIONAL(SELECT_BACKEND, [test "x$haveselect" = "xyes"]) havepoll=no AC_CHECK_FUNCS(poll, [havepoll=yes], ) if test "x$havepoll" = "xyes" ; then - AC_LIBOBJ(poll) - needsignal=yes -fi - -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 +AM_CONDITIONAL(POLL_BACKEND, [test "x$havepoll" = "xyes"]) havedevpoll=no if test "x$ac_cv_header_sys_devpoll_h" = "xyes"; then AC_DEFINE(HAVE_DEVPOLL, 1, [Define if /dev/poll is available]) - AC_LIBOBJ(devpoll) fi +AM_CONDITIONAL(DEVPOLL_BACKEND, [test "ac_cv_header_sys_devpoll_h" = "xyes"]) havekqueue=no if test "x$ac_cv_header_sys_event_h" = "xyes"; then @@ -340,11 +331,20 @@ main(int argc, char **argv) }, [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_WORKING_KQUEUE, 1, [Define if kqueue works correctly with pipes]) - AC_LIBOBJ(kqueue)], AC_MSG_RESULT(no), AC_MSG_RESULT(no)) + havekqueue=yes + ], AC_MSG_RESULT(no), AC_MSG_RESULT(no)) fi fi +AM_CONDITIONAL(KQUEUE_BACKEND, [test "x$havekqueue" = "xyes"]) haveepollsyscall=no +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]) + needsignal=yes +fi if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then if test "x$haveepoll" = "xno" ; then AC_MSG_CHECKING(for epoll system call) @@ -373,28 +373,27 @@ main(int argc, char **argv) AC_DEFINE(HAVE_EPOLL, 1, [Define if your system supports the epoll system calls]) needsignal=yes + have_epoll=yes AC_LIBOBJ(epoll_sub) - AC_LIBOBJ(epoll)], AC_MSG_RESULT(no), AC_MSG_RESULT(no)) + ], AC_MSG_RESULT(no), AC_MSG_RESULT(no)) fi fi +AM_CONDITIONAL(EPOLL_BACKEND, [test "x$haveepoll" = "xyes"]) haveeventports=no AC_CHECK_FUNCS(port_create, [haveeventports=yes], ) if test "x$haveeventports" = "xyes" ; then AC_DEFINE(HAVE_EVENT_PORTS, 1, [Define if your system supports event ports]) - AC_LIBOBJ(evport) needsignal=yes fi +AM_CONDITIONAL(EVPORT_BACKEND, [test "x$haveeventports" = "xyes"]) + if test "x$bwin32" = "xtrue"; then needsignal=yes fi -if test "x$bwin32" = "xtrue"; then - needsignal=yes -fi -if test "x$needsignal" = "xyes" ; then - AC_LIBOBJ(signal) -fi + +AM_CONDITIONAL(SIGNAL_SUPPORT, [test "x$needsignal" = "xyes"]) AC_TYPE_PID_T AC_TYPE_SIZE_T