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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/05/2014 11:09 AM, Daniel P. Berrange wrote:
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@xxxxxxxxxx>
---
  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


I know that those macros are the non-pkg-config codepath and it seems
to be wrong using the PKG_CHECK_MODULE there but it will work even if
pkg-config isn't installed in the system or if library in question
doesn't support pkg-config.

If you still disagree with this solution, then the users of systems where some libraries are not in the default LIBS path will have to set the correct path manually for those libraries. However I think that it would be nice to autodetect as much as possible.

I'll try to come up with more suitable patch for this issue.

Pavel




--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]