diff --git a/README b/README index d1f551f..caecb69 100644 --- a/README +++ b/README @@ -15,15 +15,19 @@ with: ./configure --with-gtk=3.0 (or =2.0) Virt Viewer uses the GTK-VNC (>= 0.4.3) widget to provide a -display of the VNC protocol. This is available from +display of the VNC protocol, which is available from http://gtk-vnc.sourceforge.net/ -Optionally Virt Viewer can also provide a SPICE client -using the SPICE-GTK widget (>= 0.6) available from +Virt Viewer uses the SPICE-GTK (>= 0.6) widget to provide a +display of the SPICE protocol, which is available from: http://spice-space.org/page/Spice-Gtk +Use of either SPICE-GTK or GTK-VNC can be disabled at time +of configure, with --without-gtk-vnc or --without-spice-gtk +respectively. + Virt Viewer uses libvirt to lookup information about the guest OS display. This is available from diff --git a/configure.ac b/configure.ac index 4fee775..fbbacb5 100644 --- a/configure.ac +++ b/configure.ac @@ -70,7 +70,22 @@ AM_CONDITIONAL([HAVE_GTK_3],[test "$with_gtk" = "3.0"]) PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED) -PKG_CHECK_MODULES(GTK_VNC, gtk-vnc-$GTK_VNC_API_VERSION >= $GTK_VNC_REQUIRED) +AC_ARG_WITH([gtk-vnc], + AS_HELP_STRING([--without-gtk-vnc], [Ignore presence of gtk-vnc and disable it])) + +AS_IF([test "x$with_gtk_vnc" != "xno"], + [PKG_CHECK_MODULES(GTK_VNC, + gtk-vnc-$GTK_VNC_API_VERSION >= $GTK_VNC_REQUIRED, + [have_gtk_vnc=yes], [have_gtk_vnc=no])], + [have_gtk_vnc=no]) + +AS_IF([test "x$have_gtk_vnc" = "xyes"], + [AC_DEFINE([HAVE_GTK_VNC], 1, [Have gtk-vnc?])], + [AS_IF([test "x$with_gtk_vnc" = "xyes"], + [AC_MSG_ERROR([gtk-vnc requested but not found]) + ]) +]) +AM_CONDITIONAL([HAVE_GTK_VNC], [test "x$have_gtk_vnc" = "xyes"]) AC_ARG_WITH([spice-gtk], AS_HELP_STRING([--without-spice-gtk], [Ignore presence of spice-gtk and disable it])) diff --git a/src/Makefile.am b/src/Makefile.am index d0aa73a..4643de9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,3 @@ - bin_PROGRAMS = virt-viewer builderxmldir = $(pkgdatadir)/ui @@ -17,9 +16,7 @@ virt_viewer_SOURCES = \ virt-viewer-events.h virt-viewer-events.c \ virt-viewer-app.h virt-viewer-app.c \ virt-viewer-session.h virt-viewer-session.c \ - virt-viewer-session-vnc.h virt-viewer-session-vnc.c \ virt-viewer-display.h virt-viewer-display.c \ - virt-viewer-display-vnc.h virt-viewer-display-vnc.c \ virt-viewer-notebook.h virt-viewer-notebook.c \ virt-viewer-window.h virt-viewer-window.c \ view/autoDrawer.c \ @@ -29,6 +26,11 @@ virt_viewer_SOURCES = \ view/ovBox.c \ view/ovBox.h +if HAVE_GTK_VNC +virt_viewer_SOURCES += \ + virt-viewer-session-vnc.h virt-viewer-session-vnc.c \ + virt-viewer-display-vnc.h virt-viewer-display-vnc.c +endif if HAVE_SPICE_GTK virt_viewer_SOURCES += \ diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c index 94c95e0..3b468b3 100644 --- a/src/virt-viewer-app.c +++ b/src/virt-viewer-app.c @@ -54,7 +54,9 @@ #include "virt-viewer-auth.h" #include "virt-viewer-window.h" #include "virt-viewer-session.h" +#ifdef HAVE_GTK_VNC #include "virt-viewer-session-vnc.h" +#endif #ifdef HAVE_SPICE_GTK #include "virt-viewer-session-spice.h" #endif @@ -574,11 +576,13 @@ virt_viewer_app_create_session(VirtViewerApp *self, const gchar *type) VirtViewerAppPrivate *priv = self->priv; g_return_val_if_fail(priv->session == NULL, -1); +#ifdef HAVE_GTK_VNC if (g_strcasecmp(type, "vnc") == 0) { virt_viewer_app_trace(self, "Guest %s has a %s display\n", priv->guest_name, type); priv->session = virt_viewer_session_vnc_new(); } else +#endif #ifdef HAVE_SPICE_GTK if (g_strcasecmp(type, "spice") == 0) { virt_viewer_app_trace(self, "Guest %s has a %s display\n", diff --git a/src/virt-viewer-auth.c b/src/virt-viewer-auth.c index 811051f..d6c0300 100644 --- a/src/virt-viewer-auth.c +++ b/src/virt-viewer-auth.c @@ -22,10 +22,13 @@ #include -#include #include #include +#ifdef HAVE_GTK_VNC +#include +#endif + #include "virt-viewer-auth.h" @@ -88,6 +91,7 @@ virt_viewer_auth_collect_credentials(const char *type, return response == GTK_RESPONSE_OK ? 0 : -1; } +#ifdef HAVE_GTK_VNC void virt_viewer_auth_vnc_credentials(GtkWidget *vnc, GValueArray *credList, @@ -167,7 +171,7 @@ virt_viewer_auth_vnc_credentials(GtkWidget *vnc, g_free(username); g_free(password); } - +#endif int diff --git a/src/virt-viewer-main.c b/src/virt-viewer-main.c index 5b8b3b3..7e2886b 100644 --- a/src/virt-viewer-main.c +++ b/src/virt-viewer-main.c @@ -22,11 +22,14 @@ #include #include -#include #include #include #include +#ifdef HAVE_GTK_VNC +#include +#endif + #include "virt-viewer.h" static void virt_viewer_version(void) @@ -88,7 +91,9 @@ int main(int argc, char **argv) context = g_option_context_new (_("- Virtual machine graphical console")); g_option_context_add_main_entries (context, options, NULL); g_option_context_add_group (context, gtk_get_option_group (TRUE)); +#ifdef HAVE_GTK_VNC g_option_context_add_group (context, vnc_display_get_option_group ()); +#endif g_option_context_parse (context, &argc, &argv, &error); if (error) { g_printerr("%s\n%s\n",