virt-viewer
changeset 39:2cce513346ae
* configure.ac, src/Makefile.am, src/main.c, src/usleep.c: Support
for building on Windows using MinGW compiler toolchain (or
for cross-compiling using the same).
* .hgignore: Ignore some generated files.
for building on Windows using MinGW compiler toolchain (or
for cross-compiling using the same).
* .hgignore: Ignore some generated files.
| author | "Richard W.M. Jones <rjones@redhat.com>" |
|---|---|
| date | Fri Oct 10 12:37:23 2008 +0100 (13 months ago) |
| parents | 57d1fb020d57 |
| children | e70af57502f9 |
| files | .hgignore ChangeLog configure.ac src/Makefile.am src/main.c src/usleep.c |
line diff
1.1 --- a/.hgignore Tue Jun 17 04:02:50 2008 -0400 1.2 +++ b/.hgignore Fri Oct 10 12:37:23 2008 +0100 1.3 @@ -5,17 +5,22 @@ 1.4 Makefile\.in$ 1.5 ^config\.guess$ 1.6 ^config\.sub$ 1.7 +^config\.h 1.8 +^config\.log 1.9 +^config\.status 1.10 ^configure$ 1.11 ^compile$ 1.12 ^depcomp$ 1.13 ^install-sh$ 1.14 ^ltmain.sh$ 1.15 +^Makefile$ 1.16 ^missing$ 1.17 ^libtool$ 1.18 ^src/\.deps 1.19 -^src/virt-viewer$ 1.20 +^src/virt-viewer(.exe)?$ 1.21 ^src/.*\.o 1.22 ^src/Makefile$ 1.23 +^stamp-h1$ 1.24 ^virt-viewer\.spec$ 1.25 ^config.h.in$ 1.26 ^man/Makefile$
2.1 --- a/ChangeLog Tue Jun 17 04:02:50 2008 -0400 2.2 +++ b/ChangeLog Fri Oct 10 12:37:23 2008 +0100 2.3 @@ -1,3 +1,11 @@ 2.4 +2008-03-10 "Richard W.M. Jones" <rjones@redhat.com> 2.5 + 2.6 + * configure.ac, src/Makefile.am, src/main.c, src/usleep.c: Support 2.7 + for building on Windows using MinGW compiler toolchain (or 2.8 + for cross-compiling using the same). 2.9 + 2.10 + * .hgignore: Ignore some generated files. 2.11 + 2.12 2008-03-09 "Daniel P. Berrange <berrange@redhat.com> 2.13 2.14 * autobuild.sh, configure.ac, virt-viewer.spec.in:
3.1 --- a/configure.ac Tue Jun 17 04:02:50 2008 -0400 3.2 +++ b/configure.ac Fri Oct 10 12:37:23 2008 +0100 3.3 @@ -10,6 +10,8 @@ 3.4 AM_PROG_CC_C_O 3.5 AC_PROG_LIBTOOL 3.6 3.7 +AC_CONFIG_LIBOBJ_DIR([src]) 3.8 + 3.9 AC_DEFINE([_GNU_SOURCE], [], [Enable GNU extensions]) 3.10 3.11 VIRT_VIEWER_COMPILE_WARNINGS(maximum) 3.12 @@ -19,6 +21,13 @@ 3.13 PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.10.0) 3.14 PKG_CHECK_MODULES(GTKVNC, gtk-vnc-1.0 >= 0.3.5) 3.15 3.16 +dnl Decide if this platform can support the SSH tunnel feature. 3.17 +AC_CHECK_HEADERS([sys/socket.h sys/un.h windows.h]) 3.18 +AC_CHECK_FUNCS([fork socketpair]) 3.19 + 3.20 +dnl Do we need to replace the usleep function (Windows). 3.21 +AC_REPLACE_FUNCS([usleep]) 3.22 + 3.23 dnl --enable-plugin to enable the browser plugin. 3.24 NSPR_REQUIRED=4.0.0 3.25 FIREFOX_PLUGIN_REQUIRED=1.5.0
4.1 --- a/src/Makefile.am Tue Jun 17 04:02:50 2008 -0400 4.2 +++ b/src/Makefile.am Fri Oct 10 12:37:23 2008 +0100 4.3 @@ -2,5 +2,5 @@ 4.4 bin_PROGRAMS = virt-viewer 4.5 4.6 virt_viewer_SOURCES = main.c viewer.h 4.7 -virt_viewer_LDADD = @GTKVNC_LIBS@ @GTK2_LIBS@ @LIBXML2_LIBS@ @LIBVIRT_LIBS@ 4.8 +virt_viewer_LDADD = @GTKVNC_LIBS@ @GTK2_LIBS@ @LIBXML2_LIBS@ @LIBVIRT_LIBS@ @LIBOBJS@ 4.9 virt_viewer_CFLAGS = @GTKVNC_CFLAGS@ @GTK2_CFLAGS@ @LIBXML2_CFLAGS@ @LIBVIRT_CFLAGS@ @WARN_CFLAGS@
5.1 --- a/src/main.c Tue Jun 17 04:02:50 2008 -0400 5.2 +++ b/src/main.c Fri Oct 10 12:37:23 2008 +0100 5.3 @@ -32,11 +32,25 @@ 5.4 #include <libvirt/libvirt.h> 5.5 #include <libxml/xpath.h> 5.6 #include <libxml/uri.h> 5.7 + 5.8 +#ifdef HAVE_SYS_SOCKET_H 5.9 #include <sys/socket.h> 5.10 +#endif 5.11 + 5.12 +#ifdef HAVE_SYS_UN_H 5.13 #include <sys/un.h> 5.14 +#endif 5.15 + 5.16 +#ifdef HAVE_WINDOWS_H 5.17 +#include <windows.h> 5.18 +#endif 5.19 5.20 #include "viewer.h" 5.21 5.22 +#ifndef HAVE_USLEEP 5.23 +int usleep (unsigned int usecs); 5.24 +#endif 5.25 + 5.26 // #define DEBUG 1 5.27 #ifdef DEBUG 5.28 #define DEBUG_LOG(s, ...) fprintf(stderr, (s), ## __VA_ARGS__) 5.29 @@ -716,6 +730,8 @@ 5.30 return 0; 5.31 } 5.32 5.33 +#if defined(HAVE_SOCKETPAIR) && defined(HAVE_FORK) 5.34 + 5.35 static int viewer_open_tunnel(const char **cmd) 5.36 { 5.37 int fd[2]; 5.38 @@ -775,6 +791,8 @@ 5.39 return viewer_open_tunnel(cmd); 5.40 } 5.41 5.42 +#endif /* defined(HAVE_SOCKETPAIR) && defined(HAVE_FORK) */ 5.43 + 5.44 int 5.45 viewer_start (const char *uri, const char *name, 5.46 int direct, int waitvnc, int set_verbose, 5.47 @@ -850,8 +868,10 @@ 5.48 } 5.49 DEBUG_LOG("Remote host is %s and transport %s user %s\n", host, transport ? transport : "", user ? user : ""); 5.50 5.51 +#if defined(HAVE_SOCKETPAIR) && defined(HAVE_FORK) 5.52 if (transport && strcasecmp(transport, "ssh") == 0 && !direct) 5.53 fd = viewer_open_tunnel_ssh(host, port, user, vncport); 5.54 +#endif 5.55 5.56 vnc = vnc_display_new(); 5.57 window = viewer_build_window (VNC_DISPLAY(vnc),
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/src/usleep.c Fri Oct 10 12:37:23 2008 +0100 6.3 @@ -0,0 +1,61 @@ 6.4 +/* 6.5 + * Virt Viewer: A virtual machine console viewer 6.6 + * 6.7 + * Copyright (C) 2008 Red Hat. 6.8 + * 6.9 + * This program is free software; you can redistribute it and/or modify 6.10 + * it under the terms of the GNU General Public License as published by 6.11 + * the Free Software Foundation; either version 2 of the License, or 6.12 + * (at your option) any later version. 6.13 + * 6.14 + * This program is distributed in the hope that it will be useful, 6.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 6.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 6.17 + * GNU General Public License for more details. 6.18 + * 6.19 + * You should have received a copy of the GNU General Public License 6.20 + * along with this program; if not, write to the Free Software 6.21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6.22 + * 6.23 + * Author: Richard W.M. Jones <rjones@redhat.com> 6.24 + */ 6.25 + 6.26 +/* Replacement usleep function, only used on platforms which lack 6.27 + * this system or library function. 6.28 + */ 6.29 + 6.30 +#include <config.h> 6.31 + 6.32 +#ifdef HAVE_WINDOWS_H 6.33 +#include <windows.h> 6.34 +#endif 6.35 + 6.36 +#ifdef WIN32 6.37 + 6.38 +int 6.39 +usleep (unsigned int usecs) 6.40 +{ 6.41 + unsigned int msecs = usecs / 1000; 6.42 + if (msecs < 1) 6.43 + Sleep (1); 6.44 + else 6.45 + Sleep (msecs); 6.46 +} 6.47 + 6.48 +#else 6.49 + 6.50 +int 6.51 +usleep (unsigned int usecs) 6.52 +{ 6.53 + /* This sucks, but everything has sleep and it's not 6.54 + * really that critical how long we sleep for in the 6.55 + * main code. 6.56 + */ 6.57 + unsigned int secs = usecs / 1000000; 6.58 + if (secs < 1) 6.59 + sleep (1); 6.60 + else 6.61 + sleep (secs); 6.62 +} 6.63 + 6.64 +#endif
