diff mbox

[RFC,v3,04/11] qemu-ga: Add an configure option to specify path to Windows VSS SDK

Message ID 20130521153349.4880.13431.stgit@hds.com
State New
Headers show

Commit Message

Tomoki Sekiyama May 21, 2013, 3:33 p.m. UTC
To enable VSS support in qemu-ga for Windows, header files included in
VSS SDK is required.
The VSS support is enabled when the option like below:
  ./configure --with-vss-sdk="/pass/to/VSS SDK"

VSS SDK is available from:
  http://www.microsoft.com/en-us/download/details.aspx?id=23490

To cross-compilie using mingw32 for Linux, you need to setup the SDK on
Windows environments to extract headers. You can also extract the SDK
headers using scripts/extract-vss-headers, written by Paolo Bonzini.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
---
 .gitignore |    1 +
 Makefile   |    1 +
 configure  |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+)

Comments

Eric Blake May 21, 2013, 4:53 p.m. UTC | #1
On 05/21/2013 09:33 AM, Tomoki Sekiyama wrote:
> To enable VSS support in qemu-ga for Windows, header files included in
> VSS SDK is required.
> The VSS support is enabled when the option like below:
>   ./configure --with-vss-sdk="/pass/to/VSS SDK"
> 
> VSS SDK is available from:
>   http://www.microsoft.com/en-us/download/details.aspx?id=23490
> 
> To cross-compilie using mingw32 for Linux, you need to setup the SDK on

s/compilie/compile/

There are two mingw projects: mingw (older, 32-bit only) and mingw64
(newer, both 32- and 64-bit support).  The name 'mingw32' is misleading,
as neither project uses it.  Fedora uses mingw64.

> Windows environments to extract headers. You can also extract the SDK
> headers using scripts/extract-vss-headers, written by Paolo Bonzini.

I haven't downloaded the sdk to check for myself; are we breaking any
licensing restrictions by compiling against those files?
Tomoki Sekiyama May 21, 2013, 9:02 p.m. UTC | #2
On 5/21/13 12:53 , "Eric Blake" <eblake@redhat.com> wrote:

>On 05/21/2013 09:33 AM, Tomoki Sekiyama wrote:
>> To enable VSS support in qemu-ga for Windows, header files included in
>> VSS SDK is required.
>> The VSS support is enabled when the option like below:
>>   ./configure --with-vss-sdk="/pass/to/VSS SDK"
>> 
>> VSS SDK is available from:
>>   http://www.microsoft.com/en-us/download/details.aspx?id=23490
>> 
>> To cross-compilie using mingw32 for Linux, you need to setup the SDK on
>
>s/compilie/compile/
>
>There are two mingw projects: mingw (older, 32-bit only) and mingw64
>(newer, both 32- and 64-bit support).  The name 'mingw32' is misleading,
>as neither project uses it.  Fedora uses mingw64.

Ah, I should say just mingw here.

>> Windows environments to extract headers. You can also extract the SDK
>> headers using scripts/extract-vss-headers, written by Paolo Bonzini.
>
>I haven't downloaded the sdk to check for myself; are we breaking any
>licensing restrictions by compiling against those files?

I believe it is ok while the SDK is used for development of software
running on Windows, and while the SDK is not redistributed.
Laszlo Ersek May 24, 2013, 1:48 p.m. UTC | #3
On 05/21/13 18:53, Eric Blake wrote:
> On 05/21/2013 09:33 AM, Tomoki Sekiyama wrote:
>> To enable VSS support in qemu-ga for Windows, header files included in
>> VSS SDK is required.
>> The VSS support is enabled when the option like below:
>>   ./configure --with-vss-sdk="/pass/to/VSS SDK"
>>
>> VSS SDK is available from:
>>   http://www.microsoft.com/en-us/download/details.aspx?id=23490
>>
>> To cross-compilie using mingw32 for Linux, you need to setup the SDK on
> 
> s/compilie/compile/
> 
> There are two mingw projects: mingw (older, 32-bit only) and mingw64
> (newer, both 32- and 64-bit support).  The name 'mingw32' is misleading,
> as neither project uses it.  Fedora uses mingw64.

RHEL-6 has packages named mingw32-* (from
"rhel-6-workstation-optional-rpms" -- on my laptop anyway).

I believe saying just "mingw" should be fine, as proposed.

Laszlo
Laszlo Ersek May 24, 2013, 2:03 p.m. UTC | #4
On 05/21/13 17:33, Tomoki Sekiyama wrote:

> +    if test "$vss_win32_sdk" != "" ; then
> +      echo "ERROR: Please download and install Microsoft VSS SDK:"
> +      echo "ERROR:   http://www.microsoft.com/en-us/download/details.aspx?id=23490"
> +      echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
> +      echo "ERROR:   scripts/extract-vsssdk-headers setup.exe"
> +      echo "ERROR: The headers are extracted in the directory \`inc'."
> +      feature_not_found "VSS support"
> +    fi

Please consider adding >&2 after the "fi".

(... although even feature_not_found() --> error_exit() misses that
redirection (and the behavior would change with my suggestion), so maybe
it's more consistent the way you submitted it.)

Laszlo
diff mbox

Patch

diff --git a/.gitignore b/.gitignore
index 64e9466..67facd3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -79,6 +79,7 @@  fsdev/virtfs-proxy-helper.pod
 *.la
 *.pc
 .libs
+.sdk
 *.swp
 *.orig
 .pc
diff --git a/Makefile b/Makefile
index 7dc0204..b87cc5a 100644
--- a/Makefile
+++ b/Makefile
@@ -272,6 +272,7 @@  distclean: clean
 	for d in $(TARGET_DIRS); do \
 	rm -rf $$d || exit 1 ; \
         done
+	rm -Rf .sdk
 	if test -f pixman/config.log; then make -C pixman distclean; fi
 	if test -f dtc/version_gen.h; then make $(DTC_MAKE_ARGS) clean; fi
 
diff --git a/configure b/configure
index 1af2f37..981561f 100755
--- a/configure
+++ b/configure
@@ -231,6 +231,8 @@  usb_redir=""
 glx=""
 zlib="yes"
 guest_agent="yes"
+guest_agent_with_vss="no"
+vss_win32_sdk=""
 want_tools="yes"
 libiscsi=""
 coroutine=""
@@ -910,6 +912,12 @@  for opt do
   ;;
   --disable-guest-agent) guest_agent="no"
   ;;
+  --with-vss-sdk) vss_win32_sdk=""
+  ;;
+  --with-vss-sdk=*) vss_win32_sdk="$optarg"
+  ;;
+  --without-vss-sdk) vss_win32_sdk="no"
+  ;;
   --enable-tools) want_tools="yes"
   ;;
   --disable-tools) want_tools="no"
@@ -1193,6 +1201,7 @@  echo "  --disable-usb-redir      disable usb network redirection support"
 echo "  --enable-usb-redir       enable usb network redirection support"
 echo "  --disable-guest-agent    disable building of the QEMU Guest Agent"
 echo "  --enable-guest-agent     enable building of the QEMU Guest Agent"
+echo "  --with-vss-sdk=SDK-path  enable Windows VSS support in QEMU Guest Agent"
 echo "  --disable-seccomp        disable seccomp support"
 echo "  --enable-seccomp         enables seccomp support"
 echo "  --with-coroutine=BACKEND coroutine backend. Supported options:"
@@ -3098,6 +3107,41 @@  if test "$usb_redir" != "no" ; then
 fi
 
 ##########################################
+# check if we have VSS SDK headers for win
+
+if test "$mingw32" = "yes" -a "$guest_agent" = "yes" -a "$vss_win32_sdk" != "no" ; then
+  case "$vss_win32_sdk" in
+    "")   vss_win32_include="-I$source_path" ;;
+    *\ *) # The SDK is installed in "Program Files" by default, but we cannot
+          # handle path with spaces. So we symlink the headers into ".sdk/vss".
+          vss_win32_include="-I$source_path/.sdk/vss"
+	  symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
+	  ;;
+    *)    vss_win32_include="-I$vss_win32_sdk"
+  esac
+  cat > $TMPC << EOF
+#define __MIDL_user_allocate_free_DEFINED__
+#include <inc/win2003/vss.h>
+int main(void) { return VSS_CTX_BACKUP; }
+EOF
+  if compile_prog "$vss_win32_include" "" ; then
+    guest_agent_with_vss="yes"
+    QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
+    libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
+  else
+    if test "$vss_win32_sdk" != "" ; then
+      echo "ERROR: Please download and install Microsoft VSS SDK:"
+      echo "ERROR:   http://www.microsoft.com/en-us/download/details.aspx?id=23490"
+      echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
+      echo "ERROR:   scripts/extract-vsssdk-headers setup.exe"
+      echo "ERROR: The headers are extracted in the directory \`inc'."
+      feature_not_found "VSS support"
+    fi
+    guest_agent_with_vss="no"
+  fi
+fi
+
+##########################################
 
 ##########################################
 # check if we have fdatasync
@@ -3581,6 +3625,7 @@  echo "usb net redir     $usb_redir"
 echo "GLX support       $glx"
 echo "libiscsi support  $libiscsi"
 echo "build guest agent $guest_agent"
+echo "QGA VSS support   $guest_agent_with_vss"
 echo "seccomp support   $seccomp"
 echo "coroutine backend $coroutine"
 echo "GlusterFS support $glusterfs"
@@ -3654,6 +3699,9 @@  if test "$mingw32" = "yes" ; then
   version_micro=0
   echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
   echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
+  if test "$guest_agent_with_vss" = "yes" ; then
+    echo "CONFIG_QGA_VSS=y" >> $config_host_mak
+  fi
 else
   echo "CONFIG_POSIX=y" >> $config_host_mak
 fi