build: fix regression in requiring yajl for new enough qemu

Jonathan Lebon reported an issue to me off-list about his build
failing to use qemu because he failed to install yajl-devel.  But
I recalled specifically tweaking configure.ac to die in that
situation (commits 350583c, ba9c38b).  After a bit more
head-scratching, we found the cause of the regression: commit
654c709 rearranged things so that the qemu version check now
occurs before AC_ARG_WITH has had a chance to set either
$with_qemu or $with_yajl.

Coincidentally, this fix aligns with a documentation patch that
was just posted to the autoconf mailing list :)
http://thread.gmane.org/gmane.comp.sysutils.autoconf.patches/8324

* m4/virt-lib.m4 (LIBVIRT_CHECK_LIB, LIBVIRT_CHECK_LIB_ALT)
(LIBVIRT_CHECK_PKG): Populate defaults earlier.
* configure.ac (AC_ARG_WITH): Likewise for drivers.

Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Eric Blake 2013-09-05 14:32:25 -06:00
parent ff77742104
commit f92c7e31fc
2 changed files with 42 additions and 42 deletions

View File

@ -432,77 +432,77 @@ AM_CONDITIONAL([WITH_FREEBSD], [test "$with_freebsd" = "yes"])
dnl Allow to build without Xen, QEMU/KVM, test or remote driver
AC_ARG_WITH([xen],
[AS_HELP_STRING([--with-xen],
[add XEN support @<:@default=check@:>@])],
[],[with_xen=check])
[add XEN support @<:@default=check@:>@])])
m4_divert_text([DEFAULTS], [with_xen=check])
AC_ARG_WITH([xen-inotify],
[AS_HELP_STRING([--with-xen-inotify],
[add XEN inotify support @<:@default=check@:>@])],
[],[with_xen_inotify=check])
[add XEN inotify support @<:@default=check@:>@])])
m4_divert_text([DEFAULTS], [with_xen_inotify=check])
AC_ARG_WITH([qemu],
[AS_HELP_STRING([--with-qemu],
[add QEMU/KVM support @<:@default=yes@:>@])],
[],[with_qemu=yes])
[add QEMU/KVM support @<:@default=yes@:>@])])
m4_divert_text([DEFAULTS], [with_qemu=yes])
AC_ARG_WITH([uml],
[AS_HELP_STRING([--with-uml],
[add UML support @<:@default=check@:>@])],
[],[with_uml=check])
[add UML support @<:@default=check@:>@])])
m4_divert_text([DEFAULTS], [with_uml=check])
AC_ARG_WITH([openvz],
[AS_HELP_STRING([--with-openvz],
[add OpenVZ support @<:@default=check@:>@])],
[],[with_openvz=check])
[add OpenVZ support @<:@default=check@:>@])])
m4_divert_text([DEFAULTS], [with_openvz=check])
AC_ARG_WITH([vmware],
[AS_HELP_STRING([--with-vmware],
[add VMware support @<:@default=yes@:>@])],
[],[with_vmware=yes])
[add VMware support @<:@default=yes@:>@])])
m4_divert_text([DEFAULTS], [with_vmware=yes])
AC_ARG_WITH([phyp],
[AS_HELP_STRING([--with-phyp],
[add PHYP support @<:@default=check@:>@])],
[],[with_phyp=check])
[add PHYP support @<:@default=check@:>@])])
m4_divert_text([DEFAULTS], [with_phyp=check])
AC_ARG_WITH([xenapi],
[AS_HELP_STRING([--with-xenapi],
[add XenAPI support @<:@default=check@:>@])],
[],[with_xenapi=check])
[add XenAPI support @<:@default=check@:>@])])
m4_divert_text([DEFAULTS], [with_xenapi=check])
AC_ARG_WITH([libxl],
[AS_HELP_STRING([--with-libxl],
[add libxenlight support @<:@default=check@:>@])],
[],[with_libxl=check])
[add libxenlight support @<:@default=check@:>@])])
m4_divert_text([DEFAULTS], [with_libxl=check])
AC_ARG_WITH([vbox],
[AS_HELP_STRING([--with-vbox=@<:@PFX@:>@],
[VirtualBox XPCOMC location @<:@default=yes@:>@])],
[],[with_vbox=yes])
[VirtualBox XPCOMC location @<:@default=yes@:>@])])
m4_divert_text([DEFAULTS], [with_vbox=yes])
AC_ARG_WITH([lxc],
[AS_HELP_STRING([--with-lxc],
[add Linux Container support @<:@default=check@:>@])],
[],[with_lxc=check])
[add Linux Container support @<:@default=check@:>@])])
m4_divert_text([DEFAULTS], [with_lxc=check])
AC_ARG_WITH([esx],
[AS_HELP_STRING([--with-esx],
[add ESX support @<:@default=check@:>@])],
[],[with_esx=check])
[add ESX support @<:@default=check@:>@])])
m4_divert_text([DEFAULTS], [with_esx=check])
AC_ARG_WITH([hyperv],
[AS_HELP_STRING([--with-hyperv],
[add Hyper-V support @<:@default=check@:>@])],
[],[with_hyperv=check])
[add Hyper-V support @<:@default=check@:>@])])
m4_divert_text([DEFAULTS], [with_hyperv=check])
AC_ARG_WITH([parallels],
[AS_HELP_STRING([--with-parallels],
[add Parallels Cloud Server support @<:@default=check@:>@])],
[],[with_parallels=check])
[add Parallels Cloud Server support @<:@default=check@:>@])])
m4_divert_text([DEFAULTS], [with_parallels=check])
AC_ARG_WITH([test],
[AS_HELP_STRING([--with-test],
[add test driver support @<:@default=yes@:>@])],
[],[with_test=yes])
[add test driver support @<:@default=yes@:>@])])
m4_divert_text([DEFAULTS], [with_test=yes])
AC_ARG_WITH([remote],
[AS_HELP_STRING([--with-remote],
[add remote driver support @<:@default=yes@:>@])],
[],[with_remote=yes])
[add remote driver support @<:@default=yes@:>@])])
m4_divert_text([DEFAULTS], [with_remote=yes])
AC_ARG_WITH([libvirtd],
[AS_HELP_STRING([--with-libvirtd],
[add libvirtd support @<:@default=yes@:>@])],
[],[with_libvirtd=yes])
[add libvirtd support @<:@default=yes@:>@])])
m4_divert_text([DEFAULTS], [with_libvirtd=yes])
AC_ARG_WITH([chrdev-lock-files],
[AS_HELP_STRING([--with-chrdev-lock-files],
[location for UUCP style lock files for character devices
(use auto for default paths on some platforms) @<:@default=auto@:>@])],
[],[with_chrdev_lock_files=auto])
(use auto for default paths on some platforms) @<:@default=auto@:>@])])
m4_divert_text([DEFAULTS], [with_chrdev_lock_files=auto])
dnl
dnl in case someone want to build static binaries

View File

@ -62,10 +62,10 @@ AC_DEFUN([LIBVIRT_CHECK_LIB],[
m4_pushdef([arg_var], [with-]check_name_lc)
m4_pushdef([with_var], [with_]check_name_lc)
m4_divert_text([DEFAULTS], [with_var][=check])
AC_ARG_WITH(check_name_lc,
[AS_HELP_STRING([--arg_var],
[with lib]]m4_dquote(library_name)[[ support @<:@default=check@:>@])],
[],[with_var][=check])
[with lib]]m4_dquote(library_name)[[ support @<:@default=check@:>@])])
old_LIBS=$LIBS
old_CFLAGS=$CFLAGS
@ -192,10 +192,10 @@ AC_DEFUN([LIBVIRT_CHECK_LIB_ALT],[
m4_pushdef([config_var_alt], [WITH_]check_name_alt)
m4_pushdef([make_var_alt], [WITH_]check_name_alt)
m4_divert_text([DEFAULTS], [with_var][=check])
AC_ARG_WITH(check_name_lc,
[AS_HELP_STRING([--arg_var],
[with lib]]m4_dquote(library_name)[[ support @<:@default=check@:>@])],
[],[with_var][=check])
[with lib]]m4_dquote(library_name)[[ support @<:@default=check@:>@])])
old_LIBS=$LIBS
old_CFLAGS=$CFLAGS
@ -318,10 +318,10 @@ AC_DEFUN([LIBVIRT_CHECK_PKG],[
m4_pushdef([arg_var], [with-]check_name_lc)
m4_pushdef([with_var], [with_]check_name_lc)
m4_divert_text([DEFAULTS], [with_var][=check])
AC_ARG_WITH(check_name_lc,
[AS_HELP_STRING([--arg_var],
[with ]]m4_dquote(pc_name)[[ (>= ]]m4_dquote(pc_version)[[) support @<:@default=check@:>@])],
[],[with_var][=check])
[with ]]m4_dquote(pc_name)[[ (>= ]]m4_dquote(pc_version)[[) support @<:@default=check@:>@])])
fail=0
if test "x$with_var" != "xno" ; then