Repository: incubator-guacamole-server Updated Branches: refs/heads/master ef18f858c -> 6400af605
GUACAMOLE-325: Explicitly check for Winsock. Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/eb735634 Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/eb735634 Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/eb735634 Branch: refs/heads/master Commit: eb73563445b778204e30078a76e23b7e2d2bbc5b Parents: d85f61d Author: Michael Jumper <[email protected]> Authored: Mon Jun 12 14:27:22 2017 -0700 Committer: Michael Jumper <[email protected]> Committed: Wed Jul 5 20:55:02 2017 -0700 ---------------------------------------------------------------------- configure.ac | 28 +++++++++++++++++++++++++--- src/libguac/Makefile.am | 3 ++- src/libguac/socket-fd.c | 10 +++++----- src/libguac/wait-fd.c | 2 +- 4 files changed, 33 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/eb735634/configure.ac ---------------------------------------------------------------------- diff --git a/configure.ac b/configure.ac index 49ac65f..e04d581 100644 --- a/configure.ac +++ b/configure.ac @@ -89,9 +89,6 @@ AC_CHECK_DECL([uuid_make],, # cunit AC_CHECK_LIB([cunit], [CU_run_test], [CUNIT_LIBS=-lcunit]) -# WinSock -AC_CHECK_LIB([wsock32], [main]) - AC_SUBST(DL_LIBS) AC_SUBST(MATH_LIBS) AC_SUBST(PNG_LIBS) @@ -295,6 +292,30 @@ fi AM_CONDITIONAL([ENABLE_SSL], [test "x${have_ssl}" = "xyes"]) AC_SUBST(SSL_LIBS) +# +# Winsock +# + +have_winsock=disabled +WINSOCK_LIBS= +AC_ARG_WITH([winsock], + [AS_HELP_STRING([--with-winsock], + [support Windows Sockets API @<:@default=check@:>@])], + [], + [with_winsock=check]) + +if test "x$with_winsock" != "xno" +then + have_winsock=yes + AC_CHECK_LIB([wsock32], [main], + [WINSOCK_LIBS="-lwsock32"] + [AC_DEFINE([ENABLE_WINSOCK],, + [Whether Windows Socket API support is enabled])], + [have_winsock=no]) +fi + +AM_CONDITIONAL([ENABLE_WINSOCK], [test "x${have_winsock}" = "xyes"]) +AC_SUBST(WINSOCK_LIBS) # # Ogg Vorbis @@ -1234,6 +1255,7 @@ $PACKAGE_NAME version $PACKAGE_VERSION libvorbis ........... ${have_vorbis} libpulse ............ ${have_pulse} libwebp ............. ${have_webp} + wsock32 ............. ${have_winsock} Protocol support: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/eb735634/src/libguac/Makefile.am ---------------------------------------------------------------------- diff --git a/src/libguac/Makefile.am b/src/libguac/Makefile.am index f2b11f3..4a62f97 100644 --- a/src/libguac/Makefile.am +++ b/src/libguac/Makefile.am @@ -122,5 +122,6 @@ libguac_la_LDFLAGS = \ @SSL_LIBS@ \ @UUID_LIBS@ \ @VORBIS_LIBS@ \ - @WEBP_LIBS@ + @WEBP_LIBS@ \ + @WINSOCK_LIBS@ http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/eb735634/src/libguac/socket-fd.c ---------------------------------------------------------------------- diff --git a/src/libguac/socket-fd.c b/src/libguac/socket-fd.c index b12173d..e9cce0f 100644 --- a/src/libguac/socket-fd.c +++ b/src/libguac/socket-fd.c @@ -31,7 +31,7 @@ #include <sys/time.h> #include <unistd.h> -#ifdef __MINGW32__ +#ifdef ENABLE_WINSOCK #include <winsock2.h> #endif @@ -100,8 +100,8 @@ ssize_t guac_socket_fd_write(guac_socket* socket, int retval; -#ifdef __MINGW32__ - /* MINGW32 WINSOCK only works with send() */ +#ifdef ENABLE_WINSOCK + /* WSA only works with send() */ retval = send(data->fd, buf, count, 0); #else /* Use write() for all other platforms */ @@ -148,8 +148,8 @@ static ssize_t guac_socket_fd_read_handler(guac_socket* socket, int retval; -#ifdef __MINGW32__ - /* MINGW32 WINSOCK only works with recv() */ +#ifdef ENABLE_WINSOCK + /* Winsock only works with recv() */ retval = recv(data->fd, buf, count, 0); #else /* Use read() for all other platforms */ http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/eb735634/src/libguac/wait-fd.c ---------------------------------------------------------------------- diff --git a/src/libguac/wait-fd.c b/src/libguac/wait-fd.c index 0523e62..d6079be 100644 --- a/src/libguac/wait-fd.c +++ b/src/libguac/wait-fd.c @@ -19,7 +19,7 @@ #include "config.h" -#ifdef __MINGW32__ +#ifdef ENABLE_WINSOCK # include <winsock2.h> #else # ifdef HAVE_POLL
