diff mbox

[2/2] configure: use pkg-config for obtaining xen version

Message ID 1bd386167cff4ef9a281139afb9308dc@AMSPEX02CL03.citrite.net (mailing list archive)
State New, archived
Headers show

Commit Message

Paul Durrant March 24, 2017, 4:42 p.m. UTC
> -----Original Message-----
[snip]
> >> That's a change in behaviour that I, and probably others, have long been
> used to. What we really want, presumably, is to have pkg-config just look
> under tools/pkgconfig when querying for the version of xencontrol. Could
> that not be done by simply setting PKG_CONFIG_LIBDIR in QEMU's configure
> script, or would it still mean picking up installed libraries before ones just
> built?
> >
> > I guess this would break qemu's configure badly as it wouldn't find all
> > the other library informations it is looking for via pkg-config.
> 
> Aah, wait, you mean just for the Xen query?
> 
> This might complicate things for my qemu stubdom plans...
> 

How about this patch to QEMU configure?


This appears to DTRT for me when switching between versions of Xen.

  Paul

Comments

Juergen Gross March 24, 2017, 6:43 p.m. UTC | #1
On 24/03/17 17:42, Paul Durrant wrote:
>> -----Original Message-----
> [snip]
>>>> That's a change in behaviour that I, and probably others, have long been
>> used to. What we really want, presumably, is to have pkg-config just look
>> under tools/pkgconfig when querying for the version of xencontrol. Could
>> that not be done by simply setting PKG_CONFIG_LIBDIR in QEMU's configure
>> script, or would it still mean picking up installed libraries before ones just
>> built?
>>>
>>> I guess this would break qemu's configure badly as it wouldn't find all
>>> the other library informations it is looking for via pkg-config.
>>
>> Aah, wait, you mean just for the Xen query?
>>
>> This might complicate things for my qemu stubdom plans...
>>
> 
> How about this patch to QEMU configure?
> 
> diff --git a/configure b/configure
> index fdf47e4..6ef5980 100755
> --- a/configure
> +++ b/configure
> @@ -1974,6 +1974,10 @@ fi
>  ##########################################
>  # xen probe
> 
> +xen_query_pkg_config() {
> +    PKG_CONFIG_LIBDIR= ${pkg_config_exe} "$@"
> +}
> +
>  if test "$xen" != "no" ; then
>    xen_libs="-lxenstore -lxenctrl -lxenguest"
>    xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
> @@ -1997,9 +2001,9 @@ EOF
>      xen=no
> 
>    # Xen version via pkg-config (Xen 4.9.0 and newer)
> -  elif $pkg_config --exists xencontrol ; then
> +  elif xen_query_pkg_config --exists xencontrol; then
>      xen_ctrl_version="$(printf '%d%02d%02d' \
> -      $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
> +      $(xen_query_pkg_config --modversion xencontrol | sed 's/\./ /g') )"
>      xen=yes
> 
>    elif
> @@ -2216,8 +2220,8 @@ EOF
>      if test $xen_ctrl_version -ge 40900 ; then
>        xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab xenevtchn"
>        xen_pc="$xen_pc xendevicemodel"
> -      xen_libs="$($pkg_config --libs $xen_pc)"
> -      QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
> +      xen_libs="$(xen_query_pkg_config --libs $xen_pc)"
> +      QEMU_CFLAGS="$QEMU_CFLAGS $(xen_query_pkg_config --cflags $xen_pc)"
>      elif test $xen_ctrl_version -ge 40701 ; then
>        libs_softmmu="$xen_stable_libs $libs_softmmu"
>      fi
> 
> This appears to DTRT for me when switching between versions of Xen.

But not for someone trying to build qemu outside of Xen trying to use
the properly installed pkg-config files of Xen. They wouldn't be
found any more.

You are breaking a feature for the majority of users just to make
live easier for a handful of developers unwilling to change their
workflow.


Juergen
diff mbox

Patch

diff --git a/configure b/configure
index fdf47e4..6ef5980 100755
--- a/configure
+++ b/configure
@@ -1974,6 +1974,10 @@  fi
 ##########################################
 # xen probe

+xen_query_pkg_config() {
+    PKG_CONFIG_LIBDIR= ${pkg_config_exe} "$@"
+}
+
 if test "$xen" != "no" ; then
   xen_libs="-lxenstore -lxenctrl -lxenguest"
   xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
@@ -1997,9 +2001,9 @@  EOF
     xen=no

   # Xen version via pkg-config (Xen 4.9.0 and newer)
-  elif $pkg_config --exists xencontrol ; then
+  elif xen_query_pkg_config --exists xencontrol; then
     xen_ctrl_version="$(printf '%d%02d%02d' \
-      $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
+      $(xen_query_pkg_config --modversion xencontrol | sed 's/\./ /g') )"
     xen=yes

   elif
@@ -2216,8 +2220,8 @@  EOF
     if test $xen_ctrl_version -ge 40900 ; then
       xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab xenevtchn"
       xen_pc="$xen_pc xendevicemodel"
-      xen_libs="$($pkg_config --libs $xen_pc)"
-      QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
+      xen_libs="$(xen_query_pkg_config --libs $xen_pc)"
+      QEMU_CFLAGS="$QEMU_CFLAGS $(xen_query_pkg_config --cflags $xen_pc)"
     elif test $xen_ctrl_version -ge 40701 ; then
       libs_softmmu="$xen_stable_libs $libs_softmmu"
     fi