From a92f7f46a675a3533a0a89b6fe2d509e43a2aa8f Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Fri, 2 Oct 2009 14:44:10 +0200 Subject: [PATCH] mingw32 crosscompile fixes. SOCKET is redefined in winsock2.h so #undef it where winsock2.h is included. The changes in rfbproto.c circumvent crosscompiler errors like 'S_IFMT' undeclared ...', the Makefile.am changes avoid building linux specific stuff for a win32 host target. Also added configure option to specify sdl-config. Signed-off-by: Christian Beier Signed-off-by: Johannes Schindelin --- configure.ac | 22 ++++++++++++++++++---- libvncclient/rfbproto.c | 2 ++ libvncclient/sockets.c | 1 + rfb/rfb.h | 1 + vncterm/Makefile.am | 2 ++ 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 65e258c..2eb1961 100644 --- a/configure.ac +++ b/configure.ac @@ -647,11 +647,23 @@ AM_CONDITIONAL(WITH_TIGHTVNC_FILETRANSFER, test "$with_tightvnc_filetransfer" = AM_CONDITIONAL(HAVE_LIBZ, test ! -z "$HAVE_ZLIB_H") AM_CONDITIONAL(HAVE_LIBJPEG, test ! -z "$HAVE_JPEGLIB_H") + +SDLCONFIG="sdl-config" +AC_ARG_WITH(sdl-config, +[[ --with-sdl-config=FILE + Use the given path to sdl-config when determining + SDL configuration; defaults to "sdl-config"]], +[ + if test "$withval" != "yes" -a "$withval" != ""; then + SDLCONFIG=$withval + fi +]) + if test -z "$with_sdl"; then - if sdl-config --version >/dev/null 2>&1; then + if $SDLCONFIG --version >/dev/null 2>&1; then with_sdl=yes - SDL_CFLAGS=`sdl-config --cflags` - SDL_LIBS=`sdl-config --libs` + SDL_CFLAGS=`$SDLCONFIG --cflags` + SDL_LIBS=`$SDLCONFIG --libs` else with_sdl=no fi @@ -660,7 +672,9 @@ AM_CONDITIONAL(HAVE_LIBSDL, test "x$with_sdl" = "xyes") AC_SUBST(SDL_CFLAGS) AC_SUBST(SDL_LIBS) -MINGW=`uname -s | grep MINGW 2>/dev/null` + +AC_CANONICAL_HOST +MINGW=`echo $host_os | grep mingw32 2>/dev/null` AM_CONDITIONAL(MINGW, test ! -z "$MINGW" ) if test ! -z "$MINGW"; then WSOCKLIB="-lws2_32" diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c index fb724f5..9d180ce 100644 --- a/libvncclient/rfbproto.c +++ b/libvncclient/rfbproto.c @@ -344,6 +344,7 @@ DefaultSupportedMessagesTightVNC(rfbClient* client) SetServer2Client(client, rfbTextChat); } +#ifndef WIN32 static rfbBool IsUnixSocket(const char *name) { @@ -352,6 +353,7 @@ IsUnixSocket(const char *name) return TRUE; return FALSE; } +#endif /* * ConnectToRFBServer. diff --git a/libvncclient/sockets.c b/libvncclient/sockets.c index 5cfc743..135861e 100644 --- a/libvncclient/sockets.c +++ b/libvncclient/sockets.c @@ -30,6 +30,7 @@ #include #include #ifdef WIN32 +#undef SOCKET #include #define EWOULDBLOCK WSAEWOULDBLOCK #define close closesocket diff --git a/rfb/rfb.h b/rfb/rfb.h index b28a863..a03ab21 100644 --- a/rfb/rfb.h +++ b/rfb/rfb.h @@ -44,6 +44,7 @@ extern "C" #endif #ifdef __MINGW32__ +#undef SOCKET #include #endif diff --git a/vncterm/Makefile.am b/vncterm/Makefile.am index f5811a4..3ad36a3 100644 --- a/vncterm/Makefile.am +++ b/vncterm/Makefile.am @@ -7,9 +7,11 @@ noinst_HEADERS=VNConsole.h vga.h LDADD=../libvncserver/libvncserver.la @WSOCKLIB@ if LINUX +if ! MINGW bin_PROGRAMS=LinuxVNC LinuxVNC_SOURCES=LinuxVNC.c $(CONSOLE_SRCS) endif +endif if ! MINGW VNCOMMAND=VNCommand