From 426c8fbe9345ee1d3ee0b05c8e35391ef380ad2c Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 12 Mar 2010 13:09:28 -0500 Subject: [PATCH 1/6] Support the standard 'make check' target in place of 'make verify' Based on patch 2816088 from Zack Weinberg --- Makefile.am | 3 +-- test/Makefile.am | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 77eaab7e..1ea04cb8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -150,8 +150,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/test/Makefile.am b/test/Makefile.am index 8fecf000..7243c0c5 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -8,6 +8,8 @@ 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 From b660edf9db50bff0e437a262506a72f125763756 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 12 Mar 2010 13:22:47 -0500 Subject: [PATCH 2/6] Remove redundant stuff from EXTRA_DIST To a first approximation, sources that are mentioned anywhere in an automake file don't need to get mentioned in EXTRA_DIST. --- Makefile.am | 36 +++++++++++++++++------------------- test/Makefile.am | 2 +- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1ea04cb8..6679f0e6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -37,28 +37,23 @@ bin_SCRIPTS = event_rpcgen.py pkgconfigdir=$(libdir)/pkgconfig pkgconfig_DATA=libevent.pc +# These sources are conditionally added to SYS_SRC by configure.in +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 + 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 \ + event_rpcgen.py \ + $(PLATFORM_DEPENDENT_SRC) lib_LTLIBRARIES = libevent.la libevent_core.la libevent_extra.la if PTHREADS @@ -139,8 +134,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 diff --git a/test/Makefile.am b/test/Makefile.am index 7243c0c5..e139d477 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -2,7 +2,7 @@ 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 From 2e898f542bb6dd5dcf13a0612ecd1e5855a014ef Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 12 Mar 2010 14:16:30 -0500 Subject: [PATCH 3/6] Switch to using AM conditionals in place of AC_LIBOBJ AC_LIBOBJ is really only meant for defining missing library functions, not conditional code compilation. Sticking our conditionally compiled modules in SYS_SRC should make stuff easier to maintain. --- Makefile.am | 34 +++++++++++++++++++++++++++------- configure.in | 41 ++++++++++++++++++++--------------------- 2 files changed, 47 insertions(+), 28 deletions(-) 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 From 0794b0d29c7485d10f8e752339b2ed58ffbb5be3 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 12 Mar 2010 14:21:52 -0500 Subject: [PATCH 4/6] Remove an orphaned RELEASE flag in Makefile.am --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index f285d39f..c2732d0a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -146,7 +146,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 \ From 77c917ded058a18480685a026622eef94ebb450e Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 12 Mar 2010 14:37:54 -0500 Subject: [PATCH 5/6] Give a better warning for bad automake versions. If you tried to build with automake-1.6 or earlier, we would previously spit out pages and pages of garbage output. Now, automake should just say "Hey, I'm not new enough for this." --- Makefile.am | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index c2732d0a..b9791304 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 From 9eb2fd75becc336b6b9c38071ad4d4495bc83b9a Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 22 Mar 2010 13:27:47 -0400 Subject: [PATCH 6/6] Use dist_bin_SCRIPTS, not EXTRA_DIST, to distribute scripts --- Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index b9791304..2374fc28 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,7 +35,7 @@ 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 @@ -54,7 +54,6 @@ EXTRA_DIST = \ Doxyfile \ whatsnew-2.0.txt \ Makefile.nmake test/Makefile.nmake \ - event_rpcgen.py \ $(PLATFORM_DEPENDENT_SRC) lib_LTLIBRARIES = libevent.la libevent_core.la libevent_extra.la