On 12/04/2014 09:41 PM, Eric Blake wrote:
On 12/04/2014 01:30 PM, 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.
This feels a bit awkward. Shouldn't we instead be fixing
m4/virt-yajl.m4 to use LIBVIRT_CHECK_PKG? That is, shouldn't yajl be
using pkg-config everywhere, and not just on FreeBSD?
Hi, it will use the pkg-config everywhere. I don't know the exact
reason why yajl and sasl don't use the LIBVIRT_CHECK_PKG but it seems
that it's because we support two different major versions of yajl and
the have some changes in API and ABI so we have to check which version
is installed in the system and define appropriate macros.
See the 'src/util/virjson.c' that we have "WITH_YAJL" and
"WITH_YAJL2".
The LIBVIRT_CHECK_PKG doesn't count with the possibility of alternative
versions of libraries.
In this case the "PKG_CHECK_MODULES" will just set for yajl
"YAJL_CFLAGS" and "YAJL_LIBS" with correct path only if pkg-config is
able to find that information otherwise it will leave them empty and
ends without exiting with error message. It's used there only as helper
to get the correct paths for libraries where we for some reason what to
use "AC_CHECK_LIB" and "AC_CHECK_HEADER" instead of
"PKG_CHECK_MODULES".
Pavel