[Spice-commits] configure.ac server/Makefile.am server/reds.c

Alexander Larsson alexl at kemper.freedesktop.org
Tue Apr 6 08:46:20 PDT 2010


 configure.ac       |   20 ++++++++++++++++----
 server/Makefile.am |   12 ++++++++++--
 server/reds.c      |    8 +++++++-
 3 files changed, 33 insertions(+), 7 deletions(-)

New commits:
commit 4acf155fb2ced327495fe95e64bf62117f5d307a
Author: Yonit Halperin <yhalperi at redhat.com>
Date:   Tue Apr 6 18:07:49 2010 +0300

    server configuration: make network redirection support optional
    
    By default it is disabled. To enable: configure --enable-tunnel.
    When active, requires libslirp.

diff --git a/configure.ac b/configure.ac
index aa9db5a..c68d849 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,6 +88,13 @@ AM_CONDITIONAL(OS_UNIX, test "$os_win32" != "yes")
 AM_CONDITIONAL(OS_LINUX, test "$os_linux" = "yes")
 
 dnl =========================================================================
+dnl Chek optional features
+have_tunnel=no
+AC_ARG_ENABLE(tunnel,
+[  --enable-tunnel         Enable network redirection],
+[  have_tunnel=yes])
+AM_CONDITIONAL(SUPPORT_TUNNEL, test "x$have_tunnel" = "xyes")
+dnl =========================================================================
 dnl Check deps
 
 PKG_CHECK_MODULES(PROTOCOL, spice-protocol)
@@ -118,10 +125,13 @@ AC_SUBST(CEGUI_CFLAGS)
 AC_SUBST(CEGUI_LIBS)
 SPICE_REQUIRES+=" CEGUI"
 
-PKG_CHECK_MODULES(SLIRP, slirp)
-AC_SUBST(SLIRP_CFLAGS)
-AC_SUBST(SLIRP_LIBS)
-SPICE_REQUIRES+=" slirp"
+if test "x$have_tunnel" = "xyes"; then
+	PKG_CHECK_MODULES(SLIRP, slirp)
+	AC_SUBST(SLIRP_CFLAGS)
+	AC_SUBST(SLIRP_LIBS)
+	SPICE_REQUIRES+=" slirp"
+	AC_DEFINE([HAVE_SLIRP], [], [Define if we have slirp])
+fi
 
 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.17.7)
 AC_SUBST(PIXMAN_CFLAGS)
@@ -345,6 +355,8 @@ echo "
 
         Have XRANDR 1.2:          ${have_xrandr12}
 
+        Support tunneling:        ${have_tunnel}
+
         Red target:               ${red_target}
 
         Now type 'make' to build $PACKAGE
diff --git a/server/Makefile.am b/server/Makefile.am
index 0fe1c0e..d09e2d2 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -50,6 +50,15 @@ libspice_server_la_LIBADD = 			\
 	$(LIBRT)				\
 	$(NULL)
 
+if SUPPORT_TUNNEL
+	TUNNEL_SRCS =			\
+		red_tunnel_worker.c	\
+		red_tunnel_worker.h	\
+		$(NULL)
+else
+	TUNNEL_SRCS =
+endif
+
 libspice_server_la_SOURCES =			\
 	glz_encoder.c				\
 	glz_encoder_config.h			\
@@ -73,10 +82,9 @@ libspice_server_la_SOURCES =			\
 	snd_worker.h				\
 	red_channel.h				\
 	red_channel.c				\
-	red_tunnel_worker.c			\
-	red_tunnel_worker.h			\
 	spice.h					\
 	vd_interface.h				\
+	$(TUNNEL_SRCS)				\
 	$(COMMON_SRCS)				\
 	$(NULL)
 
diff --git a/server/reds.c b/server/reds.c
index ef088f0..675db61 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -46,11 +46,13 @@
 #include "red_common.h"
 #include "red_dispatcher.h"
 #include "snd_worker.h"
-#include "red_tunnel_worker.h"
 #include <spice/stats.h>
 #include "stat.h"
 #include "ring.h"
 #include "config.h"
+#ifdef HAVE_SLIRP
+#include "red_tunnel_worker.h"
+#endif
 
 CoreInterface *core = NULL;
 static MigrationInterface *mig = NULL;
@@ -5162,6 +5164,7 @@ static void interface_change_notifier(void *opaque, VDInterface *interface,
             }
             attach_to_red_agent((VDIPortInterface *)interface);
         } else if (strcmp(interface->type, VD_INTERFACE_NET_WIRE) == 0) {
+#ifdef HAVE_SLIRP
             NetWireInterface * net_wire = (NetWireInterface *)interface;
             red_printf("VD_INTERFACE_NET_WIRE");
             if (red_tunnel) {
@@ -5174,6 +5177,9 @@ static void interface_change_notifier(void *opaque, VDInterface *interface,
                 return;
             }
             red_tunnel = red_tunnel_attach(core, net_wire);
+#else
+            red_printf("unsupported net wire interface");
+#endif
         }
         break;
     case VD_INTERFACE_REMOVING:


More information about the Spice-commits mailing list