mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
Convert yajl check to use LIBVIRT_CHECK_LIB_ALT
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
49a1c16027
commit
654c709baa
87
configure.ac
87
configure.ac
@ -155,6 +155,8 @@ AC_MSG_RESULT([$VERSION_SCRIPT_FLAGS])
|
||||
|
||||
LIBVIRT_COMPILE_WARNINGS
|
||||
|
||||
LIBVIRT_CHECK_YAJL
|
||||
|
||||
AC_MSG_CHECKING([for CPUID instruction])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||
[[
|
||||
@ -1140,85 +1142,6 @@ AC_SUBST([SASL_CFLAGS])
|
||||
AC_SUBST([SASL_LIBS])
|
||||
|
||||
|
||||
dnl YAJL JSON library http://lloyd.github.com/yajl/
|
||||
AC_ARG_WITH([yajl],
|
||||
AC_HELP_STRING([--with-yajl], [use YAJL for JSON parsing/formatting @<:@default=check@:>@]),
|
||||
[],
|
||||
[with_yajl=check])
|
||||
|
||||
if test "$with_qemu:$with_yajl" = yes:check; then
|
||||
dnl Some versions of qemu require the use of yajl; try to detect them
|
||||
dnl here, although we do not require qemu to exist in order to compile.
|
||||
dnl This check mirrors src/qemu/qemu_capabilities.c
|
||||
AC_PATH_PROGS([QEMU], [qemu-kvm qemu kvm qemu-system-x86_64],
|
||||
[], [$PATH:/usr/bin:/usr/libexec])
|
||||
if test -x "$QEMU"; then
|
||||
if `$QEMU -help | grep libvirt` >/dev/null; then
|
||||
with_yajl=yes
|
||||
else
|
||||
[qemu_version_sed='s/.*ersion \([0-9.,]*\).*/\1/']
|
||||
qemu_version=`$QEMU -version | sed "$qemu_version_sed"`
|
||||
case $qemu_version in
|
||||
[[1-9]].* | 0.15.* ) with_yajl=yes ;;
|
||||
0.* | '' ) ;;
|
||||
*) AC_MSG_ERROR([Unexpected qemu version string]) ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
YAJL_CFLAGS=
|
||||
YAJL_LIBS=
|
||||
with_yajl2=no
|
||||
if test "x$with_yajl" != "xno"; then
|
||||
if test "x$with_yajl" != "xyes" && test "x$with_yajl" != "xcheck"; then
|
||||
YAJL_CFLAGS="-I$with_yajl/include"
|
||||
YAJL_LIBS="-L$with_yajl/lib"
|
||||
fi
|
||||
fail=0
|
||||
old_cppflags="$CPPFLAGS"
|
||||
old_libs="$LIBS"
|
||||
CPPFLAGS="$CPPFLAGS $YAJL_CFLAGS"
|
||||
LIBS="$LIBS $YAJL_LIBS"
|
||||
AC_CHECK_HEADER([yajl/yajl_common.h],[],[
|
||||
if test "x$with_yajl" = "xcheck" ; then
|
||||
with_yajl=no
|
||||
else
|
||||
fail=1
|
||||
fi])
|
||||
if test "x$with_yajl" != "xno" ; then
|
||||
AC_CHECK_LIB([yajl], [yajl_parse],[
|
||||
YAJL_LIBS="$YAJL_LIBS -lyajl"
|
||||
with_yajl=yes
|
||||
AC_CHECK_LIB([yajl], [yajl_tree_parse],[
|
||||
with_yajl2=yes
|
||||
],[])
|
||||
],[
|
||||
if test "x$with_yajl" = "xcheck" ; then
|
||||
with_yajl=no
|
||||
else
|
||||
fail=1
|
||||
fi
|
||||
])
|
||||
fi
|
||||
test $fail = 1 &&
|
||||
AC_MSG_ERROR([You must install the YAJL development package in order to compile libvirt])
|
||||
CPPFLAGS="$old_cppflags"
|
||||
LIBS="$old_libs"
|
||||
if test "x$with_yajl" = "xyes" ; then
|
||||
AC_DEFINE_UNQUOTED([WITH_YAJL], 1,
|
||||
[whether YAJL is available for JSON parsing/formatting])
|
||||
fi
|
||||
if test "x$with_yajl2" = "xyes" ; then
|
||||
AC_DEFINE_UNQUOTED([WITH_YAJL2], 1,
|
||||
[whether YAJL has API version 2])
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL([WITH_YAJL], [test "x$with_yajl" = "xyes"])
|
||||
AC_SUBST([YAJL_CFLAGS])
|
||||
AC_SUBST([YAJL_LIBS])
|
||||
|
||||
|
||||
dnl SANLOCK https://fedorahosted.org/sanlock/
|
||||
AC_ARG_WITH([sanlock],
|
||||
AC_HELP_STRING([--with-sanlock], [build Sanlock plugin for lock management @<:@default=check@:>@]),
|
||||
@ -3185,6 +3108,7 @@ fi
|
||||
AC_MSG_NOTICE([])
|
||||
AC_MSG_NOTICE([Libraries])
|
||||
AC_MSG_NOTICE([])
|
||||
LIBVIRT_RESULT_YAJL
|
||||
AC_MSG_NOTICE([ libxml: $LIBXML_CFLAGS $LIBXML_LIBS])
|
||||
AC_MSG_NOTICE([ dlopen: $DLOPEN_LIBS])
|
||||
if test "$have_curl" = "yes" ; then
|
||||
@ -3212,11 +3136,6 @@ AC_MSG_NOTICE([ sasl: $SASL_CFLAGS $SASL_LIBS])
|
||||
else
|
||||
AC_MSG_NOTICE([ sasl: no])
|
||||
fi
|
||||
if test "$with_yajl" != "no" ; then
|
||||
AC_MSG_NOTICE([ yajl: $YAJL_CFLAGS $YAJL_LIBS])
|
||||
else
|
||||
AC_MSG_NOTICE([ yajl: no])
|
||||
fi
|
||||
if test "$with_sanlock" != "no" ; then
|
||||
AC_MSG_NOTICE([ sanlock: $SANLOCK_CFLAGS $SANLOCK_LIBS])
|
||||
else
|
||||
|
51
m4/virt-yajl.m4
Normal file
51
m4/virt-yajl.m4
Normal file
@ -0,0 +1,51 @@
|
||||
dnl The libyajl.so library
|
||||
dnl
|
||||
dnl Copyright (C) 2012-2013 Red Hat, Inc.
|
||||
dnl
|
||||
dnl This library is free software; you can redistribute it and/or
|
||||
dnl modify it under the terms of the GNU Lesser General Public
|
||||
dnl License as published by the Free Software Foundation; either
|
||||
dnl version 2.1 of the License, or (at your option) any later version.
|
||||
dnl
|
||||
dnl This library is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
dnl Lesser General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU Lesser General Public
|
||||
dnl License along with this library. If not, see
|
||||
dnl <http://www.gnu.org/licenses/>.
|
||||
dnl
|
||||
|
||||
AC_DEFUN([LIBVIRT_CHECK_YAJL],[
|
||||
dnl YAJL JSON library http://lloyd.github.com/yajl/
|
||||
if test "$with_qemu:$with_yajl" = yes:check; then
|
||||
dnl Some versions of qemu require the use of yajl; try to detect them
|
||||
dnl here, although we do not require qemu to exist in order to compile.
|
||||
dnl This check mirrors src/qemu/qemu_capabilities.c
|
||||
AC_PATH_PROGS([QEMU], [qemu-kvm qemu kvm qemu-system-x86_64],
|
||||
[], [$PATH:/usr/bin:/usr/libexec])
|
||||
if test -x "$QEMU"; then
|
||||
if `$QEMU -help | grep libvirt` >/dev/null; then
|
||||
with_yajl=yes
|
||||
else
|
||||
[qemu_version_sed='s/.*ersion \([0-9.,]*\).*/\1/']
|
||||
qemu_version=`$QEMU -version | sed "$qemu_version_sed"`
|
||||
case $qemu_version in
|
||||
[[1-9]].* | 0.15.* ) with_yajl=yes ;;
|
||||
0.* | '' ) ;;
|
||||
*) AC_MSG_ERROR([Unexpected qemu version string]) ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
LIBVIRT_CHECK_LIB_ALT([YAJL], [yajl],
|
||||
[yajl_parse_complete], [yajl/yajl_common.h],
|
||||
[YAJL2], [yajl],
|
||||
[yajl_tree_parse], [yajl/yajl_common.h])
|
||||
])
|
||||
|
||||
AC_DEFUN([LIBVIRT_RESULT_YAJL],[
|
||||
LIBVIRT_RESULT_LIB([YAJL])
|
||||
])
|
@ -1160,7 +1160,7 @@ qemuCapsComputeCmdFlags(const char *help,
|
||||
* libvirt but is targetting a newer qemu, we are better off
|
||||
* telling them to recompile (the spec file includes the
|
||||
* dependency, so distros won't hit this). This check is
|
||||
* also in configure.ac (see $with_yajl). */
|
||||
* also in m4/virt-yajl.m4 (see $with_yajl). */
|
||||
if (version >= 15000 ||
|
||||
(version >= 12000 && strstr(help, "libvirt"))) {
|
||||
if (check_yajl) {
|
||||
|
Loading…
Reference in New Issue
Block a user