build: make gtk-vnc optional

This commit is contained in:
Marc-André Lureau 2011-07-16 16:04:46 +02:00 committed by Daniel P. Berrange
parent 9c5f7bfcf2
commit 15cc78d91c
6 changed files with 44 additions and 10 deletions

10
README
View File

@ -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

View File

@ -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]))

View File

@ -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 += \

View File

@ -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",

View File

@ -22,10 +22,13 @@
#include <config.h>
#include <vncdisplay.h>
#include <gtk/gtk.h>
#include <string.h>
#ifdef HAVE_GTK_VNC
#include <vncdisplay.h>
#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

View File

@ -22,11 +22,14 @@
#include <config.h>
#include <locale.h>
#include <vncdisplay.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <stdlib.h>
#ifdef HAVE_GTK_VNC
#include <vncdisplay.h>
#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",