diff --git a/Makefile.am b/Makefile.am index 77eaab7e..2374fc28 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,7 @@ -AUTOMAKE_OPTIONS = foreign +# 'foreign' means that we're not enforcing GNU package rules strictly. +# '1.7' means that we need automake 1.7 or later (and we do). +AUTOMAKE_OPTIONS = foreign 1.7 + ACLOCAL_AMFLAGS = -I m4 # This is the version info for the libevent binary API. It has three @@ -32,33 +35,26 @@ ACLOCAL_AMFLAGS = -I m4 # 3:0:0 -- Libevent 2.0.4-alpha VERSION_INFO = 3:0:0 -bin_SCRIPTS = event_rpcgen.py +dist_bin_SCRIPTS = event_rpcgen.py pkgconfigdir=$(libdir)/pkgconfig pkgconfig_DATA=libevent.pc +# These sources are conditionally added by configure.in or conditionally +# included from other files. +PLATFORM_DEPENDENT_SRC = \ + epoll_sub.c \ + arc4random.c + EXTRA_DIST = \ + evdns.3 event.3 \ LICENSE \ - autogen.sh evdns.3 \ - event.3 \ + autogen.sh \ libevent.pc.in \ Doxyfile \ - kqueue.c epoll_sub.c epoll.c select.c poll.c signal.c \ - evport.c devpoll.c win32select.c event_rpcgen.py \ - event_iocp.c buffer_iocp.c iocp-internal.h arc4random.c \ - sample/Makefile.am sample/Makefile.in sample/event-test.c \ - sample/signal-test.c sample/time-test.c \ - test/Makefile.am test/Makefile.in test/bench.c test/regress.c \ - test/test-eof.c test/test-weof.c test/test-time.c \ - test/test-init.c test/test.sh \ - compat/sys/queue.h \ - evthread_win32.c \ - evthread_pthread.c \ whatsnew-2.0.txt \ - bufferevent_async.c \ - WIN32-Code/event-config.h \ - WIN32-Code/tree.h \ - Makefile.nmake test/Makefile.nmake + Makefile.nmake test/Makefile.nmake \ + $(PLATFORM_DEPENDENT_SRC) lib_LTLIBRARIES = libevent.la libevent_core.la libevent_extra.la if PTHREADS @@ -85,6 +81,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 @@ -111,7 +129,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) @@ -131,7 +148,7 @@ libevent_extra_la_LDFLAGS = -version-info $(VERSION_INFO) if OPENSSL libevent_openssl_la_SOURCES = bufferevent_openssl.c libevent_openssl_la_LIBADD = -lcrypto -lssl -libevent_openssl_la_LDFLAGS = -release $(RELEASE) -version-info $(VERSION_INFO) +libevent_openssl_la_LDFLAGS = -version-info $(VERSION_INFO) endif noinst_HEADERS = util-internal.h mm-internal.h ipv6-internal.h \ @@ -139,8 +156,11 @@ noinst_HEADERS = util-internal.h mm-internal.h ipv6-internal.h \ bufferevent-internal.h http-internal.h event-internal.h \ evthread-internal.h ht-internal.h defer-internal.h \ minheap-internal.h log-internal.h evsignal-internal.h evmap-internal.h \ - changelist-internal.h \ - ratelim-internal.h + changelist-internal.h iocp-internal.h \ + ratelim-internal.h \ + WIN32-Code/event-config.h \ + WIN32-Code/tree.h \ + compat/sys/queue.h include_HEADERS = event.h evhttp.h evdns.h evrpc.h evutil.h @@ -150,8 +170,7 @@ INCLUDES = -I$(srcdir)/compat -I$(srcdir)/include $(SYS_INCLUDES) man_MANS = event.3 evdns.3 -verify: libevent.la - cd test && make verify +verify: check doxygen: FORCE doxygen $(srcdir)/Doxyfile 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 diff --git a/test/Makefile.am b/test/Makefile.am index 8fecf000..e139d477 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -2,12 +2,14 @@ AUTOMAKE_OPTIONS = foreign no-dependencies AM_CFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat -I$(top_srcdir)/include -EXTRA_DIST = regress.rpc regress.gen.h regress.gen.c +EXTRA_DIST = regress.rpc regress.gen.h regress.gen.c test.sh noinst_PROGRAMS = test-init test-eof test-weof test-time regress \ bench bench_cascade bench_http bench_httpclient test-ratelim noinst_HEADERS = tinytest.h tinytest_macros.h regress.h +TESTS = $(top_srcdir)/test/test.sh + BUILT_SOURCES = regress.gen.c regress.gen.h test_init_SOURCES = test-init.c test_init_LDADD = ../libevent_core.la @@ -61,9 +63,6 @@ regress.gen.c regress.gen.h: regress.rpc $(top_srcdir)/event_rpcgen.py DISTCLEANFILES = *~ -test: test-init test-eof test-weof test-time regress - -verify: test - @$(srcdir)/test.sh +verify: check bench test-init test-eof test-weof test-time: ../libevent.la