Convert SSH and SPICE to new system. Add options for disabling packages.

This commit is contained in:
Michael Jumper 2013-06-04 23:39:15 -07:00
commit e750d1aabb
7 changed files with 145 additions and 29 deletions

View File

@ -37,5 +37,5 @@
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
# Subprojects # Subprojects
SUBDIRS = libguac guacd protocols/vnc protocols/rdp SUBDIRS = libguac guacd $(PROTOCOL_DIRS)

View File

@ -43,7 +43,63 @@ LT_PREREQ([2.2])
LT_INIT([dlopen]) LT_INIT([dlopen])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SUBDIRS([libguac guacd protocols/vnc protocols/rdp]) AC_CONFIG_SUBDIRS([libguac guacd])
#
# Protocol support options
#
AC_ARG_ENABLE([vnc],
[AS_HELP_STRING([--disable-vnc],
[do not build VNC support])],
[],
[enable_vnc=yes])
AC_ARG_ENABLE([rdp],
[AS_HELP_STRING([--disable-rdp],
[do not build support for Windows Remote Desktop (RDP)])],
[],
[enable_rdp=yes])
AC_ARG_ENABLE([ssh],
[AS_HELP_STRING([--disable-ssh],
[do not build SSH support])],
[],
[enable_ssh=yes])
AC_ARG_ENABLE([spice],
[AS_HELP_STRING([--disable-spice],
[do not build SPICE support])],
[],
[enable_spice=yes])
PROTOCOL_DIRS=
# VNC
if test "x$enable_vnc" = xyes; then
PROTOCOL_DIRS="$PROTOCOL_DIRS protocols/vnc"
AC_CONFIG_SUBDIRS([protocols/vnc])
fi
# RDP
if test "x$enable_rdp" = xyes; then
PROTOCOL_DIRS="$PROTOCOL_DIRS protocols/rdp"
AC_CONFIG_SUBDIRS([protocols/rdp])
fi
# SSH
if test "x$enable_ssh" = xyes; then
PROTOCOL_DIRS="$PROTOCOL_DIRS protocols/ssh"
AC_CONFIG_SUBDIRS([protocols/ssh])
fi
# SPICE
if test "x$enable_spice" = xyes; then
PROTOCOL_DIRS="$PROTOCOL_DIRS protocols/spice"
AC_CONFIG_SUBDIRS([protocols/spice])
fi
AC_SUBST([PROTOCOL_DIRS])
AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([Makefile])
AC_OUTPUT AC_OUTPUT

View File

@ -48,7 +48,8 @@ noinst_HEADERS = \
include/client.h \ include/client.h \
include/guac_handlers.h include/guac_handlers.h
libguac_client_spice_la_CFLAGS = -Werror -Wall -pedantic -Iinclude libguac_client_spice_la_CFLAGS = -Werror -Wall -pedantic -Iinclude @SPICE_CLIENT_GLIB_CFLAGS@ @GLIB_CFLAGS@ $(LIBGUAC_INCLUDE)
libguac_client_spice_la_LIBADD = @SPICE_CLIENT_GLIB_LIBS@ @GLIB_LIBS@ $(LIBGUAC_LTLIB)
libguac_client_spice_la_LDFLAGS = -version-info 0:0:0 libguac_client_spice_la_LDFLAGS = -version-info 0:0:0
EXTRA_DIST = LICENSE EXTRA_DIST = LICENSE

View File

@ -34,25 +34,40 @@
# #
# ***** END LICENSE BLOCK ***** # ***** END LICENSE BLOCK *****
AC_INIT(src/client.c) AC_PREREQ([2.61])
AM_INIT_AUTOMAKE([libguac-client-spice], 0.8.0) AC_INIT([libguac-client-spice], [0.8.0])
AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([-Wall -Werror foreign])
# Checks for programs. LT_PREREQ([2.2])
LT_INIT([dlopen])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/client.c])
# Programs
AC_PROG_CC AC_PROG_CC
AC_PROG_CC_C99 AC_PROG_CC_C99
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
# Checks for libraries. # Libraries
AC_CHECK_LIB([guac], [guac_client_plugin_open],, AC_MSG_ERROR("libguac must be installed first"))
AC_CHECK_LIB([cairo], [cairo_create],, AC_MSG_ERROR("cairo is required for drawing instructions"))
AC_CHECK_LIB([pthread], [pthread_create]) AC_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_LIB([cairo], [cairo_create],, AC_MSG_ERROR("cairo is required for drawing instructions"))
PKG_CHECK_MODULES([SPICE_CLIENT_GLIB], [spice-client-glib-2.0])
PKG_CHECK_MODULES([GLIB], [glib-2.0])
# Checks for header files. # If bundled copy of libguac found, use that
AC_CHECK_HEADERS([guacamole/client.h guacamole/guacio.h guacamole/protocol.h]) if test -d "$srcdir/../../libguac"
then
AC_SUBST([LIBGUAC_LTLIB], '$(top_builddir)/../../libguac/src/libguac.la')
AC_SUBST([LIBGUAC_INCLUDE], '-I$(top_srcdir)/../../libguac/include')
else
AC_CHECK_LIB([guac], [guac_client_plugin_open])
fi
# Checks for library functions. # Functions
AC_FUNC_MALLOC AC_FUNC_MALLOC
# Done
AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([Makefile])
AC_OUTPUT AC_OUTPUT

View File

@ -36,17 +36,23 @@
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h>
#include <guacamole/client.h> #include <guacamole/client.h>
#include <spice-session.h>
#include "guac_handlers.h" #include "guac_handlers.h"
/* Client plugin arguments */ /* Client plugin arguments */
const char* GUAC_CLIENT_ARGS[] = { const char* GUAC_CLIENT_ARGS[] = {
"hostname",
"port",
NULL NULL
}; };
enum __SPICE_ARGS_IDX { enum __SPICE_ARGS_IDX {
SPICE_ARGS_HOSTNAME,
SPICE_ARGS_PORT,
SPICE_ARGS_COUNT SPICE_ARGS_COUNT
}; };
@ -54,11 +60,36 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
/* STUB */ /* STUB */
GMainLoop* mainloop;
SpiceSession* session;
if (argc != SPICE_ARGS_COUNT) { if (argc != SPICE_ARGS_COUNT) {
guac_client_log_error(client, "Wrong number of arguments"); guac_client_log_error(client, "Wrong number of arguments");
return -1; return -1;
} }
/* Init GLIB */
guac_client_log_info(client, "Init GLIB-2.0...");
g_type_init();
mainloop = g_main_loop_new(NULL, false);
/* Create session */
guac_client_log_info(client, "Creating SPICE session...");
session = spice_session_new();
/* Init session parameters */
guac_client_log_info(client, "Setting parameters...");
g_object_set(session, "host", argv[SPICE_ARGS_HOSTNAME], NULL);
g_object_set(session, "port", argv[SPICE_ARGS_PORT], NULL);
/* Connect */
guac_client_log_info(client, "Connecting...");
if (!spice_session_connect(session)) {
guac_client_log_error(client, "SPICE connection failed");
return 1;
}
/* Set handlers */ /* Set handlers */
client->handle_messages = spice_guac_client_handle_messages; client->handle_messages = spice_guac_client_handle_messages;
client->clipboard_handler = spice_guac_client_clipboard_handler; client->clipboard_handler = spice_guac_client_clipboard_handler;
@ -67,6 +98,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
client->size_handler = spice_guac_client_size_handler; client->size_handler = spice_guac_client_size_handler;
client->free_handler = spice_guac_client_free_handler; client->free_handler = spice_guac_client_free_handler;
g_main_loop_run(mainloop);
return 0; return 0;
} }

View File

@ -70,8 +70,8 @@ noinst_HEADERS = \
include/terminal_handlers.h \ include/terminal_handlers.h \
include/types.h include/types.h
libguac_client_ssh_la_CFLAGS = -Werror -Wall -pedantic -Iinclude @PANGO_CFLAGS@ @PANGOCAIRO_CFLAGS@ libguac_client_ssh_la_CFLAGS = -Werror -Wall -pedantic -Iinclude @PANGO_CFLAGS@ @PANGOCAIRO_CFLAGS@ $(LIBGUAC_INCLUDE)
libguac_client_ssh_la_LIBADD = @PANGO_LIBS@ @PANGOCAIRO_LIBS@ libguac_client_ssh_la_LIBADD = @PANGO_LIBS@ @PANGOCAIRO_LIBS@ $(LIBGUAC_LTLIB)
libguac_client_ssh_la_LDFLAGS = -version-info 0:0:0 libguac_client_ssh_la_LDFLAGS = -version-info 0:0:0
EXTRA_DIST = LICENSE EXTRA_DIST = LICENSE

View File

@ -34,33 +34,45 @@
# #
# ***** END LICENSE BLOCK ***** # ***** END LICENSE BLOCK *****
AC_INIT(src/client.c) AC_PREREQ([2.61])
AM_INIT_AUTOMAKE([libguac-client-ssh], 0.8.0) AC_INIT([libguac-client-ssh], [0.8.0])
AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([-Wall -Werror foreign])
# Checks for programs. LT_PREREQ([2.2])
LT_INIT([dlopen])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/client.c])
# Programs
AC_PROG_CC AC_PROG_CC
AC_PROG_CC_C99 AC_PROG_CC_C99
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
# Checks for libraries. # Libraries
AC_CHECK_LIB([guac], [guac_client_plugin_open],, AC_MSG_ERROR("libguac must be installed first")) AC_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_LIB([cairo], [cairo_create],, AC_MSG_ERROR("cairo is required for drawing instructions")) AC_CHECK_LIB([cairo], [cairo_create],, AC_MSG_ERROR("cairo is required for drawing instructions"))
AC_CHECK_LIB([ssh], [ssh_new],, AC_MSG_ERROR("libssh is required")) AC_CHECK_LIB([ssh], [ssh_new],, AC_MSG_ERROR("libssh is required"))
AC_CHECK_LIB([pthread], [pthread_create])
PKG_CHECK_MODULES([PANGO], pango); PKG_CHECK_MODULES([PANGO], pango);
PKG_CHECK_MODULES([PANGOCAIRO], pangocairo); PKG_CHECK_MODULES([PANGOCAIRO], pangocairo);
# Check for SSH functions # If bundled copy of libguac found, use that
if test -d "$srcdir/../../libguac"
then
AC_SUBST([LIBGUAC_LTLIB], '$(top_builddir)/../../libguac/src/libguac.la')
AC_SUBST([LIBGUAC_INCLUDE], '-I$(top_srcdir)/../../libguac/include')
else
AC_CHECK_LIB([guac], [guac_client_plugin_open])
fi
# Functions
AC_FUNC_MALLOC
AC_CHECK_FUNCS([memset socket strerror fork])
AC_CHECK_FUNC(ssh_channel_close, AC_DEFINE(HAVE_SSH_CHANNEL_CLOSE)) AC_CHECK_FUNC(ssh_channel_close, AC_DEFINE(HAVE_SSH_CHANNEL_CLOSE))
AC_CHECK_FUNC(ssh_channel_send_eof, AC_DEFINE(HAVE_SSH_CHANNEL_SEND_EOF)) AC_CHECK_FUNC(ssh_channel_send_eof, AC_DEFINE(HAVE_SSH_CHANNEL_SEND_EOF))
AC_CHECK_FUNC(ssh_channel_free, AC_DEFINE(HAVE_SSH_CHANNEL_FREE)) AC_CHECK_FUNC(ssh_channel_free, AC_DEFINE(HAVE_SSH_CHANNEL_FREE))
# Checks for header files. # Done
AC_CHECK_HEADERS([guacamole/client.h guacamole/guacio.h guacamole/protocol.h])
# Checks for library functions.
AC_FUNC_MALLOC
AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([Makefile])
AC_OUTPUT AC_OUTPUT