summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2011-09-06 23:23:39 +0000
committerGreg Hudson <ghudson@mit.edu>2011-09-06 23:23:39 +0000
commitd6e6d23d5fdc21a1ce613c3fc7f378de7b05d47c (patch)
tree4642dbe56bf913d0c4b730cb2b4562ccc1ed0174 /src
parente68eef8d34b9527c3a24c9f0d6c0ae9b0be0e76f (diff)
downloadkrb5-d6e6d23d5fdc21a1ce613c3fc7f378de7b05d47c.tar.gz
krb5-d6e6d23d5fdc21a1ce613c3fc7f378de7b05d47c.tar.xz
krb5-d6e6d23d5fdc21a1ce613c3fc7f378de7b05d47c.zip
Change how bundled libverto is linked
Give libverto-k5ev a header file. When using the internal verto library, link against -lverto-k5ev and use verto_default_k5ev() instead of verto_default(), bypassing the module loading logic and making static builds possible. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25166 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/config/pre.in2
-rw-r--r--src/configure.in3
-rw-r--r--src/lib/apputils/net-server.c7
-rw-r--r--src/util/k5ev/Makefile.in11
-rw-r--r--src/util/k5ev/README4
-rw-r--r--src/util/k5ev/libverto-k5ev.exports2
-rw-r--r--src/util/k5ev/verto-k5ev.c36
-rw-r--r--src/util/k5ev/verto-k5ev.h33
8 files changed, 77 insertions, 21 deletions
diff --git a/src/config/pre.in b/src/config/pre.in
index 74204facf7..d434b73d2a 100644
--- a/src/config/pre.in
+++ b/src/config/pre.in
@@ -380,7 +380,7 @@ KDB5_LIB = -lkdb5 $(KDB5_PLUGIN_LIBS)
VERTO_DEPLIB = $(VERTO_DEPLIB-@VERTO_VERSION@)
VERTO_DEPLIB-sys = # empty
-VERTO_DEPLIB-k5 = $(TOPLIBD)/libverto$(DEPLIBEXT)
+VERTO_DEPLIB-k5 = $(TOPLIBD)/libverto-k5ev$(DEPLIBEXT) $(TOPLIBD)/libverto$(DEPLIBEXT)
VERTO_CFLAGS = @VERTO_CFLAGS@
VERTO_LIBS = @VERTO_LIBS@
diff --git a/src/configure.in b/src/configure.in
index 38889cf529..51262d8c98 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -1162,7 +1162,7 @@ AC_ARG_WITH([system-verto],
[AC_HELP_STRING([--with-system-verto], [always use system verto library])],
[], [with_system_verto=default])
VERTO_CFLAGS=
-VERTO_LIBS=-lverto
+VERTO_LIBS="-lverto-k5ev -lverto"
VERTO_VERSION=k5
if test "x$with_system_verto" != xno; then
if verto_cflags=`pkg-config --cflags libverto 2>&1`; then
@@ -1180,6 +1180,7 @@ if test "x$VERTO_VERSION" = xsys; then
AC_MSG_NOTICE([Using system libverto])
else
AC_MSG_RESULT([Using built-in libverto])
+ AC_DEFINE([INTERNAL_VERTO],[1],[Define if using bundled libverto])
fi
AC_SUBST([VERTO_CFLAGS])
AC_SUBST([VERTO_LIBS])
diff --git a/src/lib/apputils/net-server.c b/src/lib/apputils/net-server.c
index 9c0d5849d7..fc6d6e7c48 100644
--- a/src/lib/apputils/net-server.c
+++ b/src/lib/apputils/net-server.c
@@ -58,6 +58,9 @@
#include "fake-addrinfo.h"
#include "net-server.h"
+#ifdef INTERNAL_VERTO
+#include "verto-k5ev.h"
+#endif
#include <signal.h>
@@ -306,7 +309,11 @@ loop_init(verto_ev_type types, void *handle, void (*reset)())
types |= VERTO_EV_TYPE_IO;
types |= VERTO_EV_TYPE_SIGNAL;
types |= VERTO_EV_TYPE_TIMEOUT;
+#ifdef INTERNAL_VERTO
+ ctx = verto_default_k5ev();
+#else
ctx = verto_default(NULL, types);
+#endif
if (!verto_add_signal(ctx, VERTO_EV_FLAG_PERSIST, do_break, SIGINT) ||
!verto_add_signal(ctx, VERTO_EV_FLAG_PERSIST, do_break, SIGTERM) ||
!verto_add_signal(ctx, VERTO_EV_FLAG_PERSIST, do_break, SIGQUIT) ||
diff --git a/src/util/k5ev/Makefile.in b/src/util/k5ev/Makefile.in
index 857a85b082..27e77f4fbe 100644
--- a/src/util/k5ev/Makefile.in
+++ b/src/util/k5ev/Makefile.in
@@ -23,11 +23,20 @@ SHLIB_EXPLIBS= $(LIBS) -lverto -lm # libm needed for ceil() currently.
SHLIB_DIRS=-L$(TOPLIBD)
SHLIB_RDIRS=$(KRB5_LIBDIR)
-all-unix:: all-liblinks
+VERTO_K5EV_HDR=$(BUILDTOP)$(S)include$(S)verto-k5ev.h
+
+all-unix:: all-liblinks includes
install-unix:: install-libs
clean-unix:: clean-liblinks clean-libs clean-libobjs
+ $(RM) $(VERTO_K5EV_HDR)
+
+includes:: $(VERTO_K5EV_HDR)
+
+$(VERTO_K5EV_HDR): $(srcdir)/verto-k5ev.h
+ $(RM) $@
+ $(CP) $(srcdir)/verto-k5ev.h $@
rename.h: $(srcdir)/Symbols.ev
$(RM) $@
diff --git a/src/util/k5ev/README b/src/util/k5ev/README
index 1165f37f70..10b49976bd 100644
--- a/src/util/k5ev/README
+++ b/src/util/k5ev/README
@@ -1,8 +1,6 @@
This directory builds a private libverto module using an embedded
libev with renamed symbols (so we don't leak libev symbols into the
-namespace on platforms where we can't control the export list). The
-module is not intended to be used directly by applications, so it has
-no header file.
+namespace on platforms where we can't control the export list).
libev has built-in support for this kind of embedding, so we don't
have to modify the libev sources. Following libev's documentation,
diff --git a/src/util/k5ev/libverto-k5ev.exports b/src/util/k5ev/libverto-k5ev.exports
index ee1b8d00eb..fe128fd470 100644
--- a/src/util/k5ev/libverto-k5ev.exports
+++ b/src/util/k5ev/libverto-k5ev.exports
@@ -1 +1,3 @@
+verto_default_k5ev
verto_module_table
+verto_new_k5ev
diff --git a/src/util/k5ev/verto-k5ev.c b/src/util/k5ev/verto-k5ev.c
index e4f669a75f..d244484c58 100644
--- a/src/util/k5ev/verto-k5ev.c
+++ b/src/util/k5ev/verto-k5ev.c
@@ -29,7 +29,7 @@
#include <string.h>
#include <errno.h>
-#include <verto.h>
+#include "verto-k5ev.h"
#include <verto-module.h>
#include "rename.h"
#include "autoconf.h"
@@ -45,26 +45,26 @@
#include "ev.c"
static void
-libev_ctx_free(void *ctx)
+k5ev_ctx_free(void *ctx)
{
if (ctx != EV_DEFAULT)
ev_loop_destroy(ctx);
}
static void
-libev_ctx_run(void *ctx)
+k5ev_ctx_run(void *ctx)
{
ev_run(ctx, 0);
}
static void
-libev_ctx_run_once(void *ctx)
+k5ev_ctx_run_once(void *ctx)
{
ev_run(ctx, EVRUN_ONCE);
}
static void
-libev_ctx_break(void *ctx)
+k5ev_ctx_break(void *ctx)
{
ev_break(ctx, EVBREAK_ONE);
}
@@ -88,7 +88,7 @@ libev_callback(EV_P_ ev_watcher *w, int revents)
return type ## w
static void *
-libev_ctx_add(void *ctx, const verto_ev *ev, verto_ev_flag *flags)
+k5ev_ctx_add(void *ctx, const verto_ev *ev, verto_ev_flag *flags)
{
ev_io *iow = NULL;
ev_timer *timerw = NULL;
@@ -122,7 +122,7 @@ libev_ctx_add(void *ctx, const verto_ev *ev, verto_ev_flag *flags)
}
static void
-libev_ctx_del(void *ctx, const verto_ev *ev, void *evpriv)
+k5ev_ctx_del(void *ctx, const verto_ev *ev, void *evpriv)
{
switch (verto_get_type(ev)) {
case VERTO_EV_TYPE_IO:
@@ -142,24 +142,30 @@ libev_ctx_del(void *ctx, const verto_ev *ev, void *evpriv)
free(evpriv);
}
-static verto_ctx *verto_new_libev(void);
-static verto_ctx *verto_default_libev(void);
+static verto_ctx *verto_convert_k5ev(struct ev_loop* loop);
-VERTO_MODULE(libev, ev_loop_new,
+VERTO_MODULE(k5ev, NULL,
VERTO_EV_TYPE_IO |
VERTO_EV_TYPE_TIMEOUT |
VERTO_EV_TYPE_IDLE |
VERTO_EV_TYPE_SIGNAL |
VERTO_EV_TYPE_CHILD);
-static verto_ctx *
-verto_new_libev()
+verto_ctx *
+verto_new_k5ev()
+{
+ return verto_convert_k5ev(ev_loop_new(EVFLAG_AUTO));
+}
+
+verto_ctx *
+verto_default_k5ev()
{
- return verto_convert(libev, ev_loop_new(EVFLAG_AUTO));
+ return verto_convert_k5ev(ev_default_loop(EVFLAG_AUTO));
}
+/* Don't export this since our underlying libev is hidden. */
static verto_ctx *
-verto_default_libev()
+verto_convert_k5ev(struct ev_loop* loop)
{
- return verto_convert(libev, ev_default_loop(EVFLAG_AUTO));
+ return verto_convert(k5ev, loop);
}
diff --git a/src/util/k5ev/verto-k5ev.h b/src/util/k5ev/verto-k5ev.h
new file mode 100644
index 0000000000..0b1ad192c3
--- /dev/null
+++ b/src/util/k5ev/verto-k5ev.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2011 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef VERTO_K5EV_H_
+#define VERTO_K5EV_H_
+
+#include <verto.h>
+
+verto_ctx *verto_new_k5ev(void);
+verto_ctx *verto_default_k5ev(void);
+
+#endif /* VERTO_K5EV_H_ */