# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../xen-tools/compile-fix.patch
# Copyright (C) 2010 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---

diff -Nur xen-4.0.1-orig/tools/ioemu-qemu-xen/configure xen-4.0.1/tools/ioemu-qemu-xen/configure
--- xen-4.0.1-orig/tools/ioemu-qemu-xen/configure	2010-09-23 17:45:26.648000253 +0200
+++ xen-4.0.1/tools/ioemu-qemu-xen/configure	2010-09-23 17:46:35.044000252 +0200
@@ -1436,7 +1436,7 @@
   if test "$target_softmmu" = "no" -o "$static" = "yes"; then
     echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
   elif test "$sdl_x11" = "yes" ; then
-    echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
+    echo "SDL_LIBS=`$sdl_config --libs` `pkg-config --cflags x11 --libs`" >> $config_mak
   else
     echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
   fi
diff -Nur xen-4.0.1-orig/tools/libxc/Makefile xen-4.0.1/tools/libxc/Makefile
--- xen-4.0.1-orig/tools/libxc/Makefile	2010-09-23 17:45:26.892000253 +0200
+++ xen-4.0.1/tools/libxc/Makefile	2010-09-23 17:47:17.984000252 +0200
@@ -174,7 +174,7 @@
 
 libxenguest.so.$(MAJOR).$(MINOR): LDFLAGS += $(call zlib-options,l)
 libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so
-	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $(GUEST_PIC_OBJS) -lz -lxenctrl $(PTHREAD_LIBS)
+	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $(GUEST_PIC_OBJS) -lz -lbz2 -lxenctrl $(PTHREAD_LIBS)
 
 -include $(DEPS)
 
diff -Nur xen-4.0.1-orig/tools/xcutils/Makefile xen-4.0.1/tools/xcutils/Makefile
--- xen-4.0.1-orig/tools/xcutils/Makefile	2010-09-23 17:45:26.932000253 +0200
+++ xen-4.0.1/tools/xcutils/Makefile	2010-09-23 17:47:49.136000252 +0200
@@ -16,7 +16,7 @@
 
 PROGRAMS = xc_restore xc_save readnotes lsevtchn
 
-LDLIBS   = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore)
+LDLIBS   = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore) -lbz2
 
 .PHONY: all
 all: build