[libvirt] [PATCH] Update LIBVIRT_CHECK_LIB and LIBVIRT_CHECK_LIB_ALT to use pkg-config

Daniel P. Berrange berrange at redhat.com
Fri Dec 5 10:09:01 UTC 2014


On Thu, Dec 04, 2014 at 09:30:54PM +0100, Pavel Hrdina wrote:
> For example on FreeBSD the "yajl" library is located at "/usr/local/lib"
> and it's not in default LIBS and therefore the configure fails that
> "yajl" not installed.
> 
> We can use the "PKG_CHECK_MODULES" to get the correct library path in
> case the library provides pkg-config file definition, otherwise the old
> approach is used.
> 
> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> ---
>  m4/virt-lib.m4 | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/m4/virt-lib.m4 b/m4/virt-lib.m4
> index 75b9b1d..2401034 100644
> --- a/m4/virt-lib.m4
> +++ b/m4/virt-lib.m4
> @@ -78,6 +78,8 @@ AC_DEFUN([LIBVIRT_CHECK_LIB],[
>      if test "x$with_var" != "xyes" && test "x$with_var" != "xcheck" ; then
>        cflags_var="-I$with_var/include"
>        libs_var="-L$with_var/lib"
> +    else
> +      PKG_CHECK_MODULES(check_name, library_name, [], [true])
>      fi
>      CFLAGS="$CFLAGS $cflags_var"
>      LIBS="$LIBS $libs_var"
> @@ -211,6 +213,8 @@ AC_DEFUN([LIBVIRT_CHECK_LIB_ALT],[
>      if test "x$with_var" != "xyes" && test "x$with_var" != "xcheck" ; then
>        cflags_var="-I$with_var/include"
>        libs_var="-L$with_var/lib"
> +    else
> +      PKG_CHECK_MODULES(check_name, library_name, [], [true])
>      fi
>      CFLAGS="$CFLAGS $cflags_var"
>      LIBS="$LIBS $libs_var"

These CHECK_LIB* functions are the non-pkg-config codepath, so it is really
wrong to put PKG_CHECK_MODULE calls in here IMHO.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list