summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-12-16 19:57:09 +0100
committerStefan Metzmacher <metze@samba.org>2008-12-17 13:31:29 +0100
commit46eda790905e0ca70d9ecd2822578dbfde456e63 (patch)
tree142d4b85c91416c02b107ed41ec3232697b4c06e
parent504f8816e3058b9358a18ef42e442753fe2657ba (diff)
downloadsamba-46eda790905e0ca70d9ecd2822578dbfde456e63.tar.gz
samba-46eda790905e0ca70d9ecd2822578dbfde456e63.tar.bz2
samba-46eda790905e0ca70d9ecd2822578dbfde456e63.zip
s4:lib/tevent: add lib/events/ compat and let things compile
metze
-rw-r--r--lib/tevent/Makefile.in36
-rw-r--r--lib/tevent/config.mk45
-rw-r--r--lib/tevent/configure.ac6
-rw-r--r--lib/tevent/events.i4
-rw-r--r--lib/tevent/events_wrap.c2
-rw-r--r--lib/tevent/libtevent.m448
-rw-r--r--lib/tevent/tevent.c6
-rw-r--r--lib/tevent/tevent.h6
-rw-r--r--lib/tevent/tevent.pc.in2
-rw-r--r--lib/tevent/tevent_aio.c6
-rw-r--r--lib/tevent/tevent_debug.c4
-rw-r--r--lib/tevent/tevent_epoll.c6
-rw-r--r--lib/tevent/tevent_s4.c4
-rw-r--r--lib/tevent/tevent_select.c6
-rw-r--r--lib/tevent/tevent_signal.c6
-rw-r--r--lib/tevent/tevent_standard.c6
-rw-r--r--lib/tevent/tevent_timed.c6
-rw-r--r--lib/tevent/tevent_util.c6
-rw-r--r--source3/samba4.m44
-rw-r--r--source3/samba4.mk1
-rw-r--r--source4/Makefile1
-rw-r--r--source4/configure.ac4
-rw-r--r--source4/lib/events/config.mk7
-rw-r--r--source4/lib/events/events.h1
-rw-r--r--source4/lib/events/events_dummy.c4
-rw-r--r--source4/lib/events/events_internal.h1
-rw-r--r--source4/main.mk1
-rw-r--r--source4/torture/local/config.mk2
28 files changed, 125 insertions, 106 deletions
diff --git a/lib/tevent/Makefile.in b/lib/tevent/Makefile.in
index 4257119849..9765d35720 100644
--- a/lib/tevent/Makefile.in
+++ b/lib/tevent/Makefile.in
@@ -29,41 +29,41 @@ PYTHON_BUILD_TARGET = @PYTHON_BUILD_TARGET@
PYTHON_INSTALL_TARGET = @PYTHON_INSTALL_TARGET@
PYTHON_CHECK_TARGET = @PYTHON_CHECK_TARGET@
LIB_PATH_VAR = @LIB_PATH_VAR@
-eventsdir = @eventsdir@
+teventdir = @teventdir@
TALLOC_CFLAGS = @TALLOC_CFLAGS@
TALLOC_LDFLAGS = @TALLOC_CFLAGS@
TALLOC_LIBS = @TALLOC_LIBS@
-EVENTS_CFLAGS = @EVENTS_CFLAGS@
-EVENTS_LDFLAGS = @EVENTS_CFLAGS@
-EVENTS_LIBS = @EVENTS_LIBS@
+TEVENT_CFLAGS = @TEVENT_CFLAGS@
+TEVENT_LDFLAGS = @TEVENT_CFLAGS@
+TEVENT_LIBS = @TEVENT_LIBS@
-CFLAGS = $(CPPFLAGS) $(TALLOC_CFLAGS) $(EVENTS_CFLAGS) @CFLAGS@
-LDFLAGS = $(TALLOC_LDFLAGS) $(EVENTS_LDFLAGS) @LDFLAGS@
-LIBS = $(TALLOC_LIBS) $(EVENTS_LIBS) @LIBS@
+CFLAGS = $(CPPFLAGS) $(TALLOC_CFLAGS) $(TEVENT_CFLAGS) @CFLAGS@
+LDFLAGS = $(TALLOC_LDFLAGS) $(TEVENT_LDFLAGS) @LDFLAGS@
+LIBS = $(TALLOC_LIBS) $(TEVENT_LIBS) @LIBS@
-EVENTS_OBJ = @EVENTS_OBJ@ @LIBREPLACEOBJ@
+TEVENT_OBJ = @TEVENT_OBJ@ @LIBREPLACEOBJ@
default: all
-include $(eventsdir)/events.mk
-include $(eventsdir)/rules.mk
+include $(teventdir)/tevent.mk
+include $(teventdir)/rules.mk
-all:: showflags dirs $(PROGS) $(EVENTS_SOLIB) libevents.a $(PYTHON_BUILD_TARGET)
+all:: showflags dirs $(PROGS) $(TEVENT_SOLIB) libtevent.a $(PYTHON_BUILD_TARGET)
install:: all
-$(EVENTS_SOLIB): $(EVENTS_OBJ)
- $(SHLD) $(SHLD_FLAGS) $(LDFLAGS) $(LIBS) -o $@ $(EVENTS_OBJ) @SONAMEFLAG@$(EVENTS_SONAME)
+$(TEVENT_SOLIB): $(TEVENT_OBJ)
+ $(SHLD) $(SHLD_FLAGS) $(LDFLAGS) $(LIBS) -o $@ $(TEVENT_OBJ) @SONAMEFLAG@$(TEVENT_SONAME)
shared-build: all
${INSTALLCMD} -d $(sharedbuilddir)/lib
- ${INSTALLCMD} -m 644 libevents.a $(sharedbuilddir)/lib
- ${INSTALLCMD} -m 755 $(EVENTS_SOLIB) $(sharedbuilddir)/lib
- ln -sf $(EVENTS_SOLIB) $(sharedbuilddir)/lib/$(EVENTS_SONAME)
- ln -sf $(EVENTS_SOLIB) $(sharedbuilddir)/lib/libevents.so
+ ${INSTALLCMD} -m 644 libtevent.a $(sharedbuilddir)/lib
+ ${INSTALLCMD} -m 755 $(TEVENT_SOLIB) $(sharedbuilddir)/lib
+ ln -sf $(TEVENT_SOLIB) $(sharedbuilddir)/lib/$(TEVENT_SONAME)
+ ln -sf $(TEVENT_SOLIB) $(sharedbuilddir)/lib/libtevent.so
${INSTALLCMD} -d $(sharedbuilddir)/include
- ${INSTALLCMD} -m 644 $(srcdir)/events.h $(sharedbuilddir)/include
+ ${INSTALLCMD} -m 644 $(srcdir)/tevent.h $(sharedbuilddir)/include
check: test
diff --git a/lib/tevent/config.mk b/lib/tevent/config.mk
index 127d964775..5f9508a44f 100644
--- a/lib/tevent/config.mk
+++ b/lib/tevent/config.mk
@@ -1,58 +1,59 @@
##############################
-[MODULE::EVENTS_AIO]
+[MODULE::TEVENT_AIO]
PRIVATE_DEPENDENCIES = LIBAIO_LINUX
-SUBSYSTEM = LIBEVENTS
+SUBSYSTEM = LIBTEVENT
INIT_FUNCTION = s4_events_aio_init
##############################
-EVENTS_AIO_OBJ_FILES = $(libeventssrcdir)/events_aio.o
+TEVENT_AIO_OBJ_FILES = $(libteventsrcdir)/tevent_aio.o
##############################
-[MODULE::EVENTS_EPOLL]
-SUBSYSTEM = LIBEVENTS
+[MODULE::TEVENT_EPOLL]
+SUBSYSTEM = LIBTEVENT
INIT_FUNCTION = s4_events_epoll_init
##############################
-EVENTS_EPOLL_OBJ_FILES = $(libeventssrcdir)/events_epoll.o
+TEVENT_EPOLL_OBJ_FILES = $(libteventsrcdir)/tevent_epoll.o
##############################
-[MODULE::EVENTS_SELECT]
-SUBSYSTEM = LIBEVENTS
+[MODULE::TEVENT_SELECT]
+SUBSYSTEM = LIBTEVENT
INIT_FUNCTION = s4_events_select_init
##############################
-EVENTS_SELECT_OBJ_FILES = $(libeventssrcdir)/events_select.o
+TEVENT_SELECT_OBJ_FILES = $(libteventsrcdir)/tevent_select.o
##############################
-[MODULE::EVENTS_STANDARD]
-SUBSYSTEM = LIBEVENTS
+[MODULE::TEVENT_STANDARD]
+SUBSYSTEM = LIBTEVENT
INIT_FUNCTION = s4_events_standard_init
##############################
-EVENTS_STANDARD_OBJ_FILES = $(libeventssrcdir)/events_standard.o
+TEVENT_STANDARD_OBJ_FILES = $(libteventsrcdir)/tevent_standard.o
################################################
-# Start SUBSYSTEM LIBEVENTS
-[LIBRARY::LIBEVENTS]
+# Start SUBSYSTEM LIBTEVENT
+[LIBRARY::LIBTEVENT]
PUBLIC_DEPENDENCIES = LIBTALLOC
OUTPUT_TYPE = MERGED_OBJ
-CFLAGS = -Ilib/events
+CFLAGS = -I../lib/tevent
#
-# End SUBSYSTEM LIBEVENTS
+# End SUBSYSTEM LIBTEVENT
################################################
-LIBEVENTS_OBJ_FILES = $(addprefix $(libeventssrcdir)/, events.o events_timed.o events_signal.o events_debug.o events_util.o events_s4.o)
+LIBTEVENT_OBJ_FILES = $(addprefix $(libteventsrcdir)/, tevent.o tevent_timed.o tevent_signal.o tevent_debug.o tevent_util.o tevent_s4.o)
-PUBLIC_HEADERS += $(addprefix $(libeventssrcdir)/, events.h events_internal.h)
+PUBLIC_HEADERS += $(addprefix $(libteventsrcdir)/, tevent.h tevent_internal.h)
+# TODO: Change python stuff to tevent
[PYTHON::swig_events]
LIBRARY_REALNAME = samba/_events.$(SHLIBEXT)
-PRIVATE_DEPENDENCIES = LIBEVENTS LIBSAMBA-HOSTCONFIG LIBSAMBA-UTIL
+PRIVATE_DEPENDENCIES = LIBTEVENT LIBSAMBA-HOSTCONFIG LIBSAMBA-UTIL
-swig_events_OBJ_FILES = $(libeventssrcdir)/events_wrap.o
+swig_events_OBJ_FILES = $(libteventsrcdir)/events_wrap.o
-$(eval $(call python_py_module_template,samba/events.py,$(libeventssrcdir)/events.py))
+$(eval $(call python_py_module_template,samba/events.py,$(libteventsrcdir)/events.py))
$(swig_events_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
-PC_FILES += $(libeventssrcdir)/events.pc
+PC_FILES += $(libteventsrcdir)/tevent.pc
diff --git a/lib/tevent/configure.ac b/lib/tevent/configure.ac
index 895f2a1daa..75719d13b4 100644
--- a/lib/tevent/configure.ac
+++ b/lib/tevent/configure.ac
@@ -3,8 +3,8 @@ AC_DEFUN([SMB_MODULE_DEFAULT], [echo -n ""])
AC_DEFUN([SMB_LIBRARY_ENABLE], [echo -n ""])
AC_DEFUN([SMB_ENABLE], [echo -n ""])
AC_DEFUN([SMB_EXT_LIB], [echo -n ""])
-AC_INIT(events, 1.0.0)
-AC_CONFIG_SRCDIR([events.c])
+AC_INIT(tevent, 1.0.0)
+AC_CONFIG_SRCDIR([tevent.c])
AC_CONFIG_HEADER(config.h)
AC_LIBREPLACE_ALL_CHECKS
@@ -22,7 +22,7 @@ BUILD_WITH_SHARED_BUILD_DIR
m4_include(pkg.m4)
m4_include(libtalloc.m4)
-m4_include(libevents.m4)
+m4_include(libtevent.m4)
AC_PATH_PROGS([PYTHON_CONFIG], [python2.6-config python2.5-config python2.4-config python-config])
AC_PATH_PROGS([PYTHON], [python2.6 python2.5 python2.4 python])
diff --git a/lib/tevent/events.i b/lib/tevent/events.i
index 8a0d9c4b6f..7a604a9f23 100644
--- a/lib/tevent/events.i
+++ b/lib/tevent/events.i
@@ -18,10 +18,10 @@
%module(docstring="Event management.",package="samba.events") events;
-%import "../../../lib/talloc/talloc.i";
+%import "../../lib/talloc/talloc.i";
%{
-#include "events.h"
+#include "tevent.h"
typedef struct event_context event;
%}
diff --git a/lib/tevent/events_wrap.c b/lib/tevent/events_wrap.c
index 335652101b..b8b3a962bc 100644
--- a/lib/tevent/events_wrap.c
+++ b/lib/tevent/events_wrap.c
@@ -2525,7 +2525,7 @@ static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0};
#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
-#include "events.h"
+#include "tevent.h"
typedef struct event_context event;
SWIGINTERN event *new_event(TALLOC_CTX *mem_ctx){ return event_context_init(mem_ctx); }
diff --git a/lib/tevent/libtevent.m4 b/lib/tevent/libtevent.m4
index ed76b03d4f..30105d9bef 100644
--- a/lib/tevent/libtevent.m4
+++ b/lib/tevent/libtevent.m4
@@ -1,49 +1,51 @@
-dnl find the events sources. This is meant to work both for
-dnl standalone builds, and builds of packages using libevents
-if test x"$eventsdir" = "x"; then
- eventsdir=""
- eventspaths="$srcdir $srcdir/../samba4/source/lib/events $srcdir/lib/events $srcdir/events $srcdir/../events"
- for d in $eventspaths; do
- if test -f "$d/events.c"; then
- eventsdir="$d"
- AC_SUBST(eventsdir)
+dnl find the tevent sources. This is meant to work both for
+dnl standalone builds, and builds of packages using libtevent
+if test x"$teventdir" = "x"; then
+ teventdir=""
+ teventpaths="$srcdir $srcdir/../lib/tevent $srcdir/tevent $srcdir/../tevent"
+ for d in $teventpaths; do
+ if test -f "$d/tevent.c"; then
+ teventdir="$d"
+ AC_SUBST(teventdir)
break;
fi
done
- if test x"$eventsdir" = "x"; then
- AC_MSG_ERROR([cannot find libevents source in $eventspaths])
+ if test x"$teventdir" = "x"; then
+ AC_MSG_ERROR([cannot find libtevent source in $teventpaths])
fi
fi
-EVENTS_OBJ="events.o events_select.o events_signal.o events_timed.o events_standard.o events_debug.o events_util.o"
+TEVENT_OBJ="tevent.o tevent_select.o tevent_signal.o tevent_timed.o tevent_standard.o tevent_debug.o tevent_util.o"
AC_LIBREPLACE_NETWORK_CHECKS
-SMB_ENABLE(EVENTS_EPOLL, NO)
-SMB_ENABLE(EVENTS_AIO, NO)
+SMB_ENABLE(TEVENT_EPOLL, NO)
+SMB_ENABLE(TEVENT_AIO, NO)
AC_CHECK_HEADERS(sys/epoll.h)
AC_CHECK_FUNCS(epoll_create)
if test x"$ac_cv_header_sys_epoll_h" = x"yes" -a x"$ac_cv_func_epoll_create" = x"yes"; then
- EVENTS_OBJ="$EVENTS_OBJ events_epoll.o"
- SMB_ENABLE(EVENTS_EPOLL,YES)
+ TEVENT_OBJ="$TEVENT_OBJ tevent_epoll.o"
+ SMB_ENABLE(TEVENT_EPOLL,YES)
+ AC_DEFINE(HAVE_EPOLL, 1, [Whether epoll available])
+ #TODO: remove HAVE_EVENTS_EPOLL and use HAVE_EPOLL
AC_DEFINE(HAVE_EVENTS_EPOLL, 1, [Whether epoll available])
# check for native Linux AIO interface
AC_CHECK_HEADERS(libaio.h)
AC_CHECK_LIB_EXT(aio, AIO_LIBS, io_getevents)
if test x"$ac_cv_header_libaio_h" = x"yes" -a x"$ac_cv_lib_ext_aio_io_getevents" = x"yes";then
- EVENTS_OBJ="$EVENTS_OBJ events_aio.o"
- SMB_ENABLE(EVENTS_AIO,YES)
+ TEVENT_OBJ="$TEVENT_OBJ tevent_aio.o"
+ SMB_ENABLE(TEVENT_AIO,YES)
AC_DEFINE(HAVE_LINUX_AIO, 1, [Whether Linux AIO is available])
fi
fi
-AC_SUBST(EVENTS_OBJ)
+AC_SUBST(TEVENT_OBJ)
SMB_EXT_LIB(LIBAIO_LINUX, $AIO_LIBS)
-EVENTS_CFLAGS="-I$eventsdir"
-AC_SUBST(EVENTS_CFLAGS)
+TEVENT_CFLAGS="-I$teventdir"
+AC_SUBST(TEVENT_CFLAGS)
-EVENTS_LIBS="$AIO_LIBS"
-AC_SUBST(EVENTS_LIBS)
+TEVENT_LIBS="$AIO_LIBS"
+AC_SUBST(TEVENT_LIBS)
diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c
index 52699d968e..cd470c93ae 100644
--- a/lib/tevent/tevent.c
+++ b/lib/tevent/tevent.c
@@ -53,9 +53,9 @@
*/
#include "replace.h"
-#include "events.h"
-#include "events_internal.h"
-#include "events_util.h"
+#include "tevent.h"
+#include "tevent_internal.h"
+#include "tevent_util.h"
struct event_ops_list {
struct event_ops_list *next, *prev;
diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h
index 1ece49697f..1857f9bb10 100644
--- a/lib/tevent/tevent.h
+++ b/lib/tevent/tevent.h
@@ -19,8 +19,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __EVENTS_H__
-#define __EVENTS_H__
+#ifndef __TEVENT_H__
+#define __TEVENT_H__
#include <stdint.h>
#include <talloc.h>
@@ -95,4 +95,4 @@ struct event_context *event_context_find(TALLOC_CTX *mem_ctx);
#define EVENT_FD_NOT_READABLE(fde) \
event_set_fd_flags(fde, event_get_fd_flags(fde) & ~EVENT_FD_READ)
-#endif /* __EVENTS_H__ */
+#endif /* __TEVENT_H__ */
diff --git a/lib/tevent/tevent.pc.in b/lib/tevent/tevent.pc.in
index 4a4c012d73..afd9fcc279 100644
--- a/lib/tevent/tevent.pc.in
+++ b/lib/tevent/tevent.pc.in
@@ -6,6 +6,6 @@ includedir=@includedir@
Name: events
Description: An event system library
Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -levents
+Libs: -L${libdir} -ltevent
Cflags: -I${includedir}
URL: http://samba.org/
diff --git a/lib/tevent/tevent_aio.c b/lib/tevent/tevent_aio.c
index e30213acbc..7c3473b9a7 100644
--- a/lib/tevent/tevent_aio.c
+++ b/lib/tevent/tevent_aio.c
@@ -32,9 +32,9 @@
#include "system/filesys.h"
#include "replace.h"
-#include "events.h"
-#include "events_internal.h"
-#include "events_util.h"
+#include "tevent.h"
+#include "tevent_internal.h"
+#include "tevent_util.h"
#include <sys/epoll.h>
#include <libaio.h>
diff --git a/lib/tevent/tevent_debug.c b/lib/tevent/tevent_debug.c
index 233844f024..a23ff09755 100644
--- a/lib/tevent/tevent_debug.c
+++ b/lib/tevent/tevent_debug.c
@@ -19,8 +19,8 @@
*/
#include "replace.h"
-#include "events.h"
-#include "events_internal.h"
+#include "tevent.h"
+#include "tevent_internal.h"
/********************************************************************
* Debug wrapper functions, modeled (with lot's of code copied as is)
diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c
index d46d5c2bbc..1d03b7dbf0 100644
--- a/lib/tevent/tevent_epoll.c
+++ b/lib/tevent/tevent_epoll.c
@@ -23,9 +23,9 @@
#include "replace.h"
#include "system/filesys.h"
#include "system/network.h"
-#include "events.h"
-#include "events_internal.h"
-#include "events_util.h"
+#include "tevent.h"
+#include "tevent_internal.h"
+#include "tevent_util.h"
#include <sys/epoll.h>
struct epoll_event_context {
diff --git a/lib/tevent/tevent_s4.c b/lib/tevent/tevent_s4.c
index 134f899cf8..4be92599a7 100644
--- a/lib/tevent/tevent_s4.c
+++ b/lib/tevent/tevent_s4.c
@@ -17,8 +17,8 @@
*/
#include "includes.h"
-#include "events.h"
-#include "events_internal.h"
+#include "tevent.h"
+#include "tevent_internal.h"
NTSTATUS s4_events_standard_init(void)
{
diff --git a/lib/tevent/tevent_select.c b/lib/tevent/tevent_select.c
index 54d32204f5..35c6f78599 100644
--- a/lib/tevent/tevent_select.c
+++ b/lib/tevent/tevent_select.c
@@ -26,9 +26,9 @@
#include "replace.h"
#include "system/filesys.h"
#include "system/select.h"
-#include "events.h"
-#include "events_util.h"
-#include "events_internal.h"
+#include "tevent.h"
+#include "tevent_util.h"
+#include "tevent_internal.h"
struct select_event_context {
/* a pointer back to the generic event_context */
diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c
index 652df53d4b..36907af6be 100644
--- a/lib/tevent/tevent_signal.c
+++ b/lib/tevent/tevent_signal.c
@@ -23,9 +23,9 @@
#include "replace.h"
#include "system/filesys.h"
#include "system/select.h"
-#include "events.h"
-#include "events_internal.h"
-#include "events_util.h"
+#include "tevent.h"
+#include "tevent_internal.h"
+#include "tevent_util.h"
#define NUM_SIGNALS 64
diff --git a/lib/tevent/tevent_standard.c b/lib/tevent/tevent_standard.c
index 11128d7623..c63d092173 100644
--- a/lib/tevent/tevent_standard.c
+++ b/lib/tevent/tevent_standard.c
@@ -31,9 +31,9 @@
#include "system/filesys.h"
#include "system/network.h"
#include "system/select.h" /* needed for HAVE_EVENTS_EPOLL */
-#include "events.h"
-#include "events_util.h"
-#include "events_internal.h"
+#include "tevent.h"
+#include "tevent_util.h"
+#include "tevent_internal.h"
struct std_event_context {
/* a pointer back to the generic event_context */
diff --git a/lib/tevent/tevent_timed.c b/lib/tevent/tevent_timed.c
index c58c898c6d..ba8213710e 100644
--- a/lib/tevent/tevent_timed.c
+++ b/lib/tevent/tevent_timed.c
@@ -25,9 +25,9 @@
#include "replace.h"
#include "system/filesys.h"
#include "system/select.h"
-#include "events.h"
-#include "events_internal.h"
-#include "events_util.h"
+#include "tevent.h"
+#include "tevent_internal.h"
+#include "tevent_util.h"
/**
compare two timeval structures.
diff --git a/lib/tevent/tevent_util.c b/lib/tevent/tevent_util.c
index 9e7d758405..cfcca9185d 100644
--- a/lib/tevent/tevent_util.c
+++ b/lib/tevent/tevent_util.c
@@ -20,9 +20,9 @@
#include "replace.h"
#include "talloc.h"
-#include "events.h"
-#include "events_internal.h"
-#include "events_util.h"
+#include "tevent.h"
+#include "tevent_internal.h"
+#include "tevent_util.h"
#include <fcntl.h>
/**
diff --git a/source3/samba4.m4 b/source3/samba4.m4
index 34d03de158..5b35d541f2 100644
--- a/source3/samba4.m4
+++ b/source3/samba4.m4
@@ -108,8 +108,8 @@ SMB_INCLUDE_MK(lib/ldb/python.mk)
SMB_ENABLE(swig_ldb,YES)
m4_include(lib/tls/config.m4)
-eventsdir="../source4/lib/events"
-m4_include(lib/events/libevents.m4)
+teventdir="../lib/tevent"
+m4_include(../lib/tevent/libtevent.m4)
dnl m4_include(auth/kerberos/config.m4)
m4_include(auth/gensec/config.m4)
diff --git a/source3/samba4.mk b/source3/samba4.mk
index 8962d6b5de..e15d60255d 100644
--- a/source3/samba4.mk
+++ b/source3/samba4.mk
@@ -82,6 +82,7 @@ ldb_sambasrcdir := $(samba4srcdir)/lib/ldb-samba
libtlssrcdir := $(samba4srcdir)/lib/tls
libregistrysrcdir := $(samba4srcdir)/lib/registry
libmessagingsrcdir := $(samba4srcdir)/lib/messaging
+libteventsrcdir := $(samba4srcdir)/../lib/tevent
libeventssrcdir := $(samba4srcdir)/lib/events
libcmdlinesrcdir := $(samba4srcdir)/lib/cmdline
poptsrcdir := $(samba4srcdir)/../lib/popt
diff --git a/source4/Makefile b/source4/Makefile
index 8899cde2d2..2d49efb93b 100644
--- a/source4/Makefile
+++ b/source4/Makefile
@@ -67,6 +67,7 @@ libtlssrcdir := lib/tls
libregistrysrcdir := lib/registry
smbreadlinesrcdir := lib/smbreadline
libmessagingsrcdir := lib/messaging
+libteventsrcdir := ../lib/tevent
libeventssrcdir := lib/events
libcmdlinesrcdir := lib/cmdline
poptsrcdir := ../lib/popt
diff --git a/source4/configure.ac b/source4/configure.ac
index 53e093e813..7162081bbb 100644
--- a/source4/configure.ac
+++ b/source4/configure.ac
@@ -34,7 +34,7 @@ m4_include(../nsswitch/nsstest.m4)
m4_include(../pidl/config.m4)
AC_CONFIG_FILES(lib/registry/registry.pc)
-AC_CONFIG_FILES(lib/events/events.pc)
+AC_CONFIG_FILES(../lib/tevent/tevent.pc)
AC_CONFIG_FILES(librpc/dcerpc.pc)
AC_CONFIG_FILES(../librpc/ndr.pc)
AC_CONFIG_FILES(../lib/torture/torture.pc)
@@ -96,7 +96,7 @@ SMB_EXT_LIB_FROM_PKGCONFIG(LIBLDB, ldb >= 0.9.1,
SMB_INCLUDE_MK(lib/ldb/python.mk)
m4_include(lib/tls/config.m4)
-m4_include(lib/events/libevents.m4)
+m4_include(../lib/tevent/libtevent.m4)
dnl m4_include(auth/kerberos/config.m4)
m4_include(auth/gensec/config.m4)
diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk
new file mode 100644
index 0000000000..b9d6879b3c
--- /dev/null
+++ b/source4/lib/events/config.mk
@@ -0,0 +1,7 @@
+[SUBSYSTEM::LIBEVENTS]
+PUBLIC_DEPENDENCIES = LIBTEVENT
+CFLAGS = -Ilib/events
+
+LIBEVENTS_OBJ_FILES = $(addprefix $(libeventssrcdir)/, events_dummy.o)
+
+PUBLIC_HEADERS += $(addprefix $(libeventssrcdir)/, events.h events_internal.h)
diff --git a/source4/lib/events/events.h b/source4/lib/events/events.h
new file mode 100644
index 0000000000..d2e81f5279
--- /dev/null
+++ b/source4/lib/events/events.h
@@ -0,0 +1 @@
+#include <tevent.h>
diff --git a/source4/lib/events/events_dummy.c b/source4/lib/events/events_dummy.c
new file mode 100644
index 0000000000..15bb25e953
--- /dev/null
+++ b/source4/lib/events/events_dummy.c
@@ -0,0 +1,4 @@
+void __events_dummy(void)
+{
+}
+
diff --git a/source4/lib/events/events_internal.h b/source4/lib/events/events_internal.h
new file mode 100644
index 0000000000..308587ce2f
--- /dev/null
+++ b/source4/lib/events/events_internal.h
@@ -0,0 +1 @@
+#include <tevent_internal.h>
diff --git a/source4/main.mk b/source4/main.mk
index 1d4ffc5d44..e54196a2f9 100644
--- a/source4/main.mk
+++ b/source4/main.mk
@@ -14,6 +14,7 @@ mkinclude lib/ldb-samba/config.mk
mkinclude lib/tls/config.mk
mkinclude lib/registry/config.mk
mkinclude lib/messaging/config.mk
+mkinclude ../lib/tevent/config.mk
mkinclude lib/events/config.mk
mkinclude lib/cmdline/config.mk
mkinclude ../lib/socket_wrapper/config.mk
diff --git a/source4/torture/local/config.mk b/source4/torture/local/config.mk
index 46d5e38e67..60cbf25eda 100644
--- a/source4/torture/local/config.mk
+++ b/source4/torture/local/config.mk
@@ -43,7 +43,7 @@ TORTURE_LOCAL_OBJ_FILES = \
$(torturesrcdir)/../../lib/util/charset/tests/charset.o \
$(torturesrcdir)/../libcli/security/tests/sddl.o \
$(torturesrcdir)/../lib/tdr/testsuite.o \
- $(torturesrcdir)/../lib/events/testsuite.o \
+ $(torturesrcdir)/../../lib/tevent/testsuite.o \
$(torturesrcdir)/../param/tests/share.o \
$(torturesrcdir)/../param/tests/loadparm.o \
$(torturesrcdir)/../auth/credentials/tests/simple.o \