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

Pavel Hrdina phrdina at redhat.com
Thu Dec 4 20:30:54 UTC 2014


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"
-- 
2.0.4




More information about the libvir-list mailing list