958e1b
From 018133d4217c5aebaa09a43b341b0765075f4254 Mon Sep 17 00:00:00 2001
958e1b
From: Laszlo Ersek <lersek@redhat.com>
958e1b
Date: Fri, 7 Nov 2014 17:17:55 +0100
958e1b
Subject: [PATCH 08/41] dump: add support for lzo/snappy
958e1b
958e1b
Message-id: <1415380693-16593-9-git-send-email-lersek@redhat.com>
958e1b
Patchwork-id: 62194
958e1b
O-Subject: [RHEL-7.1 qemu-kvm PATCH 08/26] dump: add support for lzo/snappy
958e1b
Bugzilla: 1157798
958e1b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
958e1b
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
958e1b
RH-Acked-by: dgibson <dgibson@redhat.com>
958e1b
958e1b
From: qiaonuohan <qiaonuohan@cn.fujitsu.com>
958e1b
958e1b
kdump-compressed format supports three compression format, zlib/lzo/snappy.
958e1b
Currently, only zlib is available. This patch is used to support lzo/snappy.
958e1b
'--enable-lzo/--enable-snappy' is needed to be specified with configure to make
958e1b
lzo/snappy available for qemu
958e1b
958e1b
Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
958e1b
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
958e1b
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
958e1b
(cherry picked from commit 607dacd0a082a4ea73a7a16a1c70406f37ebacdb)
958e1b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
958e1b
Conflicts:
958e1b
	configure
958e1b
958e1b
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
958e1b
---
958e1b
 configure | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
958e1b
 1 file changed, 54 insertions(+)
958e1b
958e1b
diff --git a/configure b/configure
958e1b
index fb0c839..5373237 100755
958e1b
--- a/configure
958e1b
+++ b/configure
958e1b
@@ -232,6 +232,8 @@ libusb=""
958e1b
 usb_redir=""
958e1b
 glx=""
958e1b
 zlib="yes"
958e1b
+lzo="no"
958e1b
+snappy="no"
958e1b
 guest_agent="yes"
958e1b
 want_tools="yes"
958e1b
 libiscsi=""
958e1b
@@ -909,6 +911,10 @@ for opt do
958e1b
   ;;
958e1b
   --disable-zlib-test) zlib="no"
958e1b
   ;;
958e1b
+  --enable-lzo) lzo="yes"
958e1b
+  ;;
958e1b
+  --enable-snappy) snappy="yes"
958e1b
+  ;;
958e1b
   --enable-guest-agent) guest_agent="yes"
958e1b
   ;;
958e1b
   --disable-guest-agent) guest_agent="no"
958e1b
@@ -1220,6 +1226,8 @@ echo "  --disable-libusb         disable libusb (for usb passthrough)"
958e1b
 echo "  --enable-libusb          enable libusb (for usb passthrough)"
958e1b
 echo "  --disable-usb-redir      disable usb network redirection support"
958e1b
 echo "  --enable-usb-redir       enable usb network redirection support"
958e1b
+echo "  --enable-lzo             enable the support of lzo compression library"
958e1b
+echo "  --enable-snappy          enable the support of snappy compression library"
958e1b
 echo "  --disable-guest-agent    disable building of the QEMU Guest Agent"
958e1b
 echo "  --enable-guest-agent     enable building of the QEMU Guest Agent"
958e1b
 echo "  --disable-seccomp        disable seccomp support"
958e1b
@@ -1554,6 +1562,42 @@ fi
958e1b
 libs_softmmu="$libs_softmmu -lz"
958e1b
 
958e1b
 ##########################################
958e1b
+# lzo check
958e1b
+
958e1b
+if test "$lzo" != "no" ; then
958e1b
+    cat > $TMPC << EOF
958e1b
+#include <lzo/lzo1x.h>
958e1b
+int main(void) { lzo_version(); return 0; }
958e1b
+EOF
958e1b
+    if compile_prog "" "-llzo2" ; then
958e1b
+        :
958e1b
+    else
958e1b
+        error_exit "lzo check failed" \
958e1b
+            "Make sure to have the lzo libs and headers installed."
958e1b
+    fi
958e1b
+
958e1b
+    libs_softmmu="$libs_softmmu -llzo2"
958e1b
+fi
958e1b
+
958e1b
+##########################################
958e1b
+# snappy check
958e1b
+
958e1b
+if test "$snappy" != "no" ; then
958e1b
+    cat > $TMPC << EOF
958e1b
+#include <snappy-c.h>
958e1b
+int main(void) { snappy_max_compressed_length(4096); return 0; }
958e1b
+EOF
958e1b
+    if compile_prog "" "-lsnappy" ; then
958e1b
+        :
958e1b
+    else
958e1b
+        error_exit "snappy check failed" \
958e1b
+            "Make sure to have the snappy libs and headers installed."
958e1b
+    fi
958e1b
+
958e1b
+    libs_softmmu="$libs_softmmu -lsnappy"
958e1b
+fi
958e1b
+
958e1b
+##########################################
958e1b
 # libseccomp check
958e1b
 
958e1b
 if test "$seccomp" != "no" ; then
958e1b
@@ -3648,6 +3692,8 @@ echo "QOM debugging     $qom_cast_debug"
958e1b
 echo "Live block operations $live_block_ops"
958e1b
 echo "Live block migration $live_block_migration"
958e1b
 echo "vhdx              $vhdx"
958e1b
+echo "lzo support       $lzo"
958e1b
+echo "snappy support    $snappy"
958e1b
 
958e1b
 if test "$sdl_too_old" = "yes"; then
958e1b
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
958e1b
@@ -3965,6 +4011,14 @@ if test "$glx" = "yes" ; then
958e1b
   echo "GLX_LIBS=$glx_libs" >> $config_host_mak
958e1b
 fi
958e1b
 
958e1b
+if test "$lzo" = "yes" ; then
958e1b
+  echo "CONFIG_LZO=y" >> $config_host_mak
958e1b
+fi
958e1b
+
958e1b
+if test "$snappy" = "yes" ; then
958e1b
+  echo "CONFIG_SNAPPY=y" >> $config_host_mak
958e1b
+fi
958e1b
+
958e1b
 if test "$libiscsi" = "yes" ; then
958e1b
   echo "CONFIG_LIBISCSI=y" >> $config_host_mak
958e1b
   echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
958e1b
-- 
958e1b
1.8.3.1
958e1b