From 9e9ecca022a54992c2f33845bc89410222f26f7a Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 22 Nov 2012 18:42:27 -0800 Subject: [PATCH] Make vorbis support conditional. --- protocols/rdp/Makefile.am | 11 +++++++++-- protocols/rdp/configure.in | 18 +++++++++++++++++- protocols/rdp/src/client.c | 7 ++++++- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/protocols/rdp/Makefile.am b/protocols/rdp/Makefile.am index f41f66ac..c0d7df0f 100644 --- a/protocols/rdp/Makefile.am +++ b/protocols/rdp/Makefile.am @@ -43,11 +43,11 @@ lib_LTLIBRARIES = libguac-client-rdp.la freerdp_LTLIBRARIES = guac_rdpsnd.la libguac_client_rdp_la_SOURCES = \ + $(OGG_SOURCES) \ src/audio.c \ src/client.c \ src/default_pointer.c \ src/guac_handlers.c \ - src/ogg_encoder.c \ src/rdp_bitmap.c \ src/rdp_cliprdr.c \ src/rdp_gdi.c \ @@ -64,13 +64,13 @@ guac_rdpsnd_la_SOURCES = \ src/audio.c noinst_HEADERS = \ + $(OGG_HEADERS) \ guac_rdpsnd/messages.h \ guac_rdpsnd/service.h \ include/audio.h \ include/client.h \ include/default_pointer.h \ include/guac_handlers.h \ - include/ogg_encoder.h \ include/rdp_bitmap.h \ include/rdp_cliprdr.h \ include/rdp_gdi.h \ @@ -79,6 +79,13 @@ noinst_HEADERS = \ include/rdp_pointer.h \ include/wav_encoder.h +# Compile OGG support if available +if ENABLE_OGG + libguac_client_rdp_la_SOURCES += src/ogg_encoder.c + noinst_HEADERS += include/ogg_encoder.h +endif + + libguac_client_rdp_la_LDFLAGS = -version-info 0:0:0 guac_rdpsnd_la_LDFLAGS = -module -avoid-version -shared diff --git a/protocols/rdp/configure.in b/protocols/rdp/configure.in index 1a96eb59..266a64eb 100644 --- a/protocols/rdp/configure.in +++ b/protocols/rdp/configure.in @@ -53,7 +53,23 @@ AC_CHECK_LIB([freerdp-utils], [xzalloc],, AC_MSG_ERROR("libfreerdp-utils is requ AC_CHECK_LIB([freerdp-codec], [freerdp_image_convert],, AC_MSG_ERROR("libfreerdp-codec is required (part of FreeRDP)")) AC_CHECK_LIB([pthread], [pthread_mutex_init],, AC_MSG_ERROR("libpthread is required")) -AC_CHECK_LIB([vorbisenc], [vorbis_encode_init],, AC_MSG_ERROR("libvorbisenc is required for sound")) +# Check for libvorbisenc + +have_vorbisenc=no +AC_CHECK_HEADER(vorbis/vorbisenc.h, + AC_CHECK_LIB([vorbisenc], [vorbis_encode_init], [have_vorbisenc=yes])) +AM_CONDITIONAL([ENABLE_OGG], [test "x${have_vorbisenc}" = "xyes"]) + +if test "x${have_vorbisenc}" = "xno" +then + AC_MSG_WARN([ + -------------------------------------------- + Unable to find libvorbisenc. + Sound will not be encoded with Ogg Vorbis. + --------------------------------------------]) +else + AC_DEFINE([ENABLE_OGG]) +fi # Checks for header files. AC_CHECK_HEADERS([guacamole/client.h guacamole/guacio.h guacamole/protocol.h freerdp/locale/keyboard.h freerdp/kbd/layouts.h]) diff --git a/protocols/rdp/src/client.c b/protocols/rdp/src/client.c index cf29355e..3b2ecd78 100644 --- a/protocols/rdp/src/client.c +++ b/protocols/rdp/src/client.c @@ -65,9 +65,12 @@ #include #include "audio.h" -#include "ogg_encoder.h" #include "wav_encoder.h" +#ifdef ENABLE_OGG +#include "ogg_encoder.h" +#endif + #include "client.h" #include "guac_handlers.h" #include "rdp_keymap.h" @@ -132,12 +135,14 @@ boolean rdp_freerdp_pre_connect(freerdp* instance) { const char* mimetype = client->info.audio_mimetypes[i]; +#ifdef ENABLE_OGG /* If Ogg is supported, done. */ if (strcmp(mimetype, ogg_encoder->mimetype) == 0) { guac_client_log_info(client, "Loading Ogg Vorbis encoder."); guac_client_data->audio = audio_stream_alloc(client, ogg_encoder); break; } +#endif /* If wav is supported, done. */ if (strcmp(mimetype, wav_encoder->mimetype) == 0) {