diff --git a/Makefile.am b/Makefile.am index 88880608..df44d3c2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -37,5 +37,5 @@ ACLOCAL_AMFLAGS = -I m4 # Subprojects -SUBDIRS = libguac guacd protocols/vnc protocols/rdp +SUBDIRS = libguac guacd $(PROTOCOL_DIRS) diff --git a/configure.ac b/configure.ac index 10c81e95..481e7a2d 100644 --- a/configure.ac +++ b/configure.ac @@ -43,7 +43,63 @@ LT_PREREQ([2.2]) LT_INIT([dlopen]) 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_OUTPUT diff --git a/protocols/spice/Makefile.am b/protocols/spice/Makefile.am index ee1ec68b..b897f4d4 100644 --- a/protocols/spice/Makefile.am +++ b/protocols/spice/Makefile.am @@ -48,7 +48,8 @@ noinst_HEADERS = \ include/client.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 EXTRA_DIST = LICENSE diff --git a/protocols/spice/configure.ac b/protocols/spice/configure.ac index 65185e93..59b77287 100644 --- a/protocols/spice/configure.ac +++ b/protocols/spice/configure.ac @@ -34,25 +34,40 @@ # # ***** END LICENSE BLOCK ***** -AC_INIT(src/client.c) -AM_INIT_AUTOMAKE([libguac-client-spice], 0.8.0) -AC_CONFIG_MACRO_DIR([m4]) +AC_PREREQ([2.61]) +AC_INIT([libguac-client-spice], [0.8.0]) +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_C99 AC_PROG_LIBTOOL -# Checks for 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")) +# Libraries 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. -AC_CHECK_HEADERS([guacamole/client.h guacamole/guacio.h guacamole/protocol.h]) +# 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 -# Checks for library functions. +# Functions AC_FUNC_MALLOC +# Done AC_CONFIG_FILES([Makefile]) AC_OUTPUT + diff --git a/protocols/spice/src/client.c b/protocols/spice/src/client.c index 0e869080..57fbb030 100644 --- a/protocols/spice/src/client.c +++ b/protocols/spice/src/client.c @@ -36,17 +36,23 @@ * ***** END LICENSE BLOCK ***** */ #include +#include #include +#include #include "guac_handlers.h" /* Client plugin arguments */ const char* GUAC_CLIENT_ARGS[] = { + "hostname", + "port", NULL }; enum __SPICE_ARGS_IDX { + SPICE_ARGS_HOSTNAME, + SPICE_ARGS_PORT, SPICE_ARGS_COUNT }; @@ -54,11 +60,36 @@ int guac_client_init(guac_client* client, int argc, char** argv) { /* STUB */ + GMainLoop* mainloop; + SpiceSession* session; + if (argc != SPICE_ARGS_COUNT) { guac_client_log_error(client, "Wrong number of arguments"); 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 */ client->handle_messages = spice_guac_client_handle_messages; 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->free_handler = spice_guac_client_free_handler; + g_main_loop_run(mainloop); return 0; } diff --git a/protocols/ssh/Makefile.am b/protocols/ssh/Makefile.am index 850b3a25..3c7f4b2e 100644 --- a/protocols/ssh/Makefile.am +++ b/protocols/ssh/Makefile.am @@ -70,8 +70,8 @@ noinst_HEADERS = \ include/terminal_handlers.h \ include/types.h -libguac_client_ssh_la_CFLAGS = -Werror -Wall -pedantic -Iinclude @PANGO_CFLAGS@ @PANGOCAIRO_CFLAGS@ -libguac_client_ssh_la_LIBADD = @PANGO_LIBS@ @PANGOCAIRO_LIBS@ +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_LTLIB) libguac_client_ssh_la_LDFLAGS = -version-info 0:0:0 EXTRA_DIST = LICENSE diff --git a/protocols/ssh/configure.ac b/protocols/ssh/configure.ac index 65a164af..4364ba01 100644 --- a/protocols/ssh/configure.ac +++ b/protocols/ssh/configure.ac @@ -34,33 +34,45 @@ # # ***** END LICENSE BLOCK ***** -AC_INIT(src/client.c) -AM_INIT_AUTOMAKE([libguac-client-ssh], 0.8.0) -AC_CONFIG_MACRO_DIR([m4]) +AC_PREREQ([2.61]) +AC_INIT([libguac-client-ssh], [0.8.0]) +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_C99 AC_PROG_LIBTOOL -# Checks for libraries. -AC_CHECK_LIB([guac], [guac_client_plugin_open],, AC_MSG_ERROR("libguac must be installed first")) +# Libraries +AC_CHECK_LIB([pthread], [pthread_create]) 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([pthread], [pthread_create]) PKG_CHECK_MODULES([PANGO], pango); 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_send_eof, AC_DEFINE(HAVE_SSH_CHANNEL_SEND_EOF)) AC_CHECK_FUNC(ssh_channel_free, AC_DEFINE(HAVE_SSH_CHANNEL_FREE)) -# Checks for header files. -AC_CHECK_HEADERS([guacamole/client.h guacamole/guacio.h guacamole/protocol.h]) - -# Checks for library functions. -AC_FUNC_MALLOC - +# Done AC_CONFIG_FILES([Makefile]) AC_OUTPUT +