From nobody Sat May 4 19:07:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490600619606798.8411724525457; Mon, 27 Mar 2017 00:43:39 -0700 (PDT) Received: from localhost ([::1]:44881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csPJS-0004wV-B2 for importer@patchew.org; Mon, 27 Mar 2017 03:43:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csPIl-0004eZ-GD for qemu-devel@nongnu.org; Mon, 27 Mar 2017 03:42:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csPIh-0000je-JJ for qemu-devel@nongnu.org; Mon, 27 Mar 2017 03:42:55 -0400 Received: from mx2.suse.de ([195.135.220.15]:32950) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1csPIh-0000jX-9y for qemu-devel@nongnu.org; Mon, 27 Mar 2017 03:42:51 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1BCCDAD82; Mon, 27 Mar 2017 07:42:49 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: qemu-devel@nongnu.org, xen-devel@lists.xenproject.org Date: Mon, 27 Mar 2017 09:42:45 +0200 Message-Id: <20170327074245.3821-1-jgross@suse.com> X-Mailer: git-send-email 2.10.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 195.135.220.15 Subject: [Qemu-devel] [PATCH v2] configure: use pkg-config for obtaining xen version X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: anthony.perard@citrix.com, Juergen Gross , sstabellini@kernel.org, kraxel@redhat.com, paul.durrant@citrix.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Instead of trying to guess the Xen version to use by compiling various test programs first just ask the system via pkg-config. Only if it can't return the version fall back to the test program scheme. If configure is being called with dedicated flags for the Xen libraries use those instead of the pkg-config output. This will avoid breaking an in-tree Xen build of an old Xen version while a new Xen version is installed on the build machine: pkg-config would pick up the installed Xen config files as the Xen tree wouldn't contain any of them. Signed-off-by: Juergen Gross Reviewed-by: Stefano Stabellini Tested-by: Paul Durrant --- V2: - use pkg-config only if no Xen library paths have been specified via --extra-ldflags - keep test program for detecting Xen 4.9 --- configure | 155 ++++++++++++++++++++++++++++++++++------------------------= ---- 1 file changed, 86 insertions(+), 69 deletions(-) diff --git a/configure b/configure index aabf098..c34b025 100755 --- a/configure +++ b/configure @@ -1962,30 +1962,46 @@ fi # xen probe =20 if test "$xen" !=3D "no" ; then - xen_libs=3D"-lxenstore -lxenctrl -lxenguest" - xen_stable_libs=3D"-lxenforeignmemory -lxengnttab -lxenevtchn" + # Check whether Xen library path is specified via --extra-ldflags to avo= id + # overriding this setting with pkg-config output. If not, try pkg-config + # to obtain all needed flags. =20 - # First we test whether Xen headers and libraries are available. - # If no, we are done and there is no Xen support. - # If yes, more tests are run to detect the Xen version. + if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \ + $pkg_config --exists xencontrol ; then + xen_ctrl_version=3D"$(printf '%d%02d%02d' \ + $($pkg_config --modversion xencontrol | sed 's/\./ /g') )" + xen=3Dyes + xen_pc=3D"xencontrol xenstore xenguest xenforeignmemory xengnttab" + xen_pc=3D"$xen_pc xenevtchn xendevicemodel" + QEMU_CFLAGS=3D"$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)" + libs_softmmu=3D"$($pkg_config --libs $xen_pc) $libs_softmmu" + LDFLAGS=3D"$($pkg_config --libs $xen_pc) $LDFLAGS" + else =20 - # Xen (any) - cat > $TMPC < $TMPC < int main(void) { return 0; } EOF - if ! compile_prog "" "$xen_libs" ; then - # Xen not found - if test "$xen" =3D "yes" ; then - feature_not_found "xen" "Install xen devel" - fi - xen=3Dno + if ! compile_prog "" "$xen_libs" ; then + # Xen not found + if test "$xen" =3D "yes" ; then + feature_not_found "xen" "Install xen devel" + fi + xen=3Dno =20 - # Xen unstable - elif - cat > $TMPC < $TMPC < @@ -1998,13 +2014,13 @@ int main(void) { return 0; } EOF - compile_prog "" "$xen_libs $xen_stable_libs -lxendevicemodel" - then - xen_stable_libs=3D"$xen_stable_libs -lxendevicemodel" - xen_ctrl_version=3D40900 - xen=3Dyes - elif - cat > $TMPC < $TMPC < $TMPC < $TMPC < $TMPC < $TMPC < #include int main(void) { @@ -2120,14 +2136,14 @@ int main(void) { return 0; } EOF - compile_prog "" "$xen_libs" - then - xen_ctrl_version=3D40700 - xen=3Dyes + compile_prog "" "$xen_libs" + then + xen_ctrl_version=3D40700 + xen=3Dyes =20 - # Xen 4.6 - elif - cat > $TMPC < $TMPC < #include #include @@ -2148,14 +2164,14 @@ int main(void) { return 0; } EOF - compile_prog "" "$xen_libs" - then - xen_ctrl_version=3D40600 - xen=3Dyes + compile_prog "" "$xen_libs" + then + xen_ctrl_version=3D40600 + xen=3Dyes =20 - # Xen 4.5 - elif - cat > $TMPC < $TMPC < #include #include @@ -2175,13 +2191,13 @@ int main(void) { return 0; } EOF - compile_prog "" "$xen_libs" - then - xen_ctrl_version=3D40500 - xen=3Dyes + compile_prog "" "$xen_libs" + then + xen_ctrl_version=3D40500 + xen=3Dyes =20 - elif - cat > $TMPC < $TMPC < #include #include @@ -2200,24 +2216,25 @@ int main(void) { return 0; } EOF - compile_prog "" "$xen_libs" - then - xen_ctrl_version=3D40200 - xen=3Dyes + compile_prog "" "$xen_libs" + then + xen_ctrl_version=3D40200 + xen=3Dyes =20 - else - if test "$xen" =3D "yes" ; then - feature_not_found "xen (unsupported version)" \ - "Install a supported xen (xen 4.2 or newer)" + else + if test "$xen" =3D "yes" ; then + feature_not_found "xen (unsupported version)" \ + "Install a supported xen (xen 4.2 or newer)" + fi + xen=3Dno fi - xen=3Dno - fi =20 - if test "$xen" =3D yes; then - if test $xen_ctrl_version -ge 40701 ; then - libs_softmmu=3D"$xen_stable_libs $libs_softmmu" + if test "$xen" =3D yes; then + if test $xen_ctrl_version -ge 40701 ; then + libs_softmmu=3D"$xen_stable_libs $libs_softmmu" + fi + libs_softmmu=3D"$xen_libs $libs_softmmu" fi - libs_softmmu=3D"$xen_libs $libs_softmmu" fi fi =20 --=20 2.10.2