File kexec-tools-xen-static.patch of Package kexec-tools

From: Bernhard Walle <bwalle@suse.de>
Subject: [PATCH] Link xenctrl statically
Upstream: no
Signed-off-by: Tony Jones <tonyj@suse.de>

This patch just links the xenctrl library statically. That allows
to use Xen support without a runtime dependency to the Xen package.

31Oct2017: Updated to handle Xen 4.10 with new xentoolcore library

Signed-off-by: Bernhard Walle <bwalle@suse.de>
Signed-off-by: Charles Arnold <carnold@suse.com>

================================================================================
---
 configure.ac |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Index: kexec-tools-2.0.14/configure.ac
===================================================================
--- kexec-tools-2.0.14.orig/configure.ac
+++ kexec-tools-2.0.14/configure.ac
@@ -164,8 +164,10 @@ fi
 
 dnl find Xen control stack libraries
 if test "$with_xen" = yes ; then
+	if pkg-config --exists 'xenlight > 4.9.0' ; then
 	AC_CHECK_HEADER(xenctrl.h,
-		[AC_CHECK_LIB(xenctrl, xc_kexec_load, ,
+		[AC_CHECK_LIB(xenctrl, xc_kexec_load,
+		[AC_DEFINE([HAVE_LIBXENCTRL], [1], [libxenctrl]) [LIBS="-Wl,-Bstatic -lxenctrl -lxencall -lxentoolcore -lxentoollog -lxendevicemodel -lxenforeignmemory -Wl,-Bdynamic -lpthread -ldl $LIBS"]],
 		AC_MSG_NOTICE([Xen support disabled]))])
 		if test "$ac_cv_lib_xenctrl_xc_kexec_load" = yes ; then
 			AC_CHECK_LIB(xenctrl, xc_kexec_status,
@@ -173,6 +175,32 @@ if test "$with_xen" = yes ; then
 					[The kexec_status call is available]),
 				AC_MSG_NOTICE([The kexec_status call is not available]))
 		fi
+	else
+		if pkg-config --exists 'xenlight > 4.8.0' ; then
+		AC_CHECK_HEADER(xenctrl.h,
+			[AC_CHECK_LIB(xenctrl, xc_kexec_load,
+			[AC_DEFINE([HAVE_LIBXENCTRL], [1], [libxenctrl]) [LIBS="-Wl,-Bstatic -lxenctrl -lxencall -lxentoollog -lxendevicemodel -lxenforeignmemory -Wl,-Bdynamic -lpthread -ldl $LIBS"]],
+			AC_MSG_NOTICE([Xen support disabled]))])
+			if test "$ac_cv_lib_xenctrl_xc_kexec_load" = yes ; then
+				AC_CHECK_LIB(xenctrl, xc_kexec_status,
+					AC_DEFINE(HAVE_KEXEC_CMD_STATUS, 1,
+						[The kexec_status call is available]),
+					AC_MSG_NOTICE([The kexec_status call is not available]))
+			fi
+		else
+			if pkg-config --exists 'xenlight > 4.6.0' ; then
+			AC_CHECK_HEADER(xenctrl.h,
+				[AC_CHECK_LIB(xenctrl, xc_kexec_load,
+				[AC_DEFINE([HAVE_LIBXENCTRL], [1], [libxenctrl]) [LIBS="-Wl,-Bstatic -lxenctrl -lxencall -lxentoollog -lxenforeignmemory -Wl,-Bdynamic -lpthread -ldl $LIBS"]],
+				AC_MSG_NOTICE([Xen support disabled]))])
+			else
+			AC_CHECK_HEADER(xenctrl.h,
+				[AC_CHECK_LIB(xenctrl, xc_kexec_load,
+				[AC_DEFINE([HAVE_LIBXENCTRL], [1], [libxenctrl]) [LIBS="-Wl,-Bstatic -lxenctrl -Wl,-Bdynamic -lpthread -ldl $LIBS"]],
+				AC_MSG_NOTICE([Xen support disabled]))])
+			fi
+		fi
+	fi
 fi
 
 dnl ---Sanity checks
openSUSE Build Service is sponsored by