[libvirt] [PATCH 08/89] configure: use LIBVIRT_ARG_WITH(_ALT) macros

Pavel Hrdina phrdina at redhat.com
Mon Dec 19 14:10:01 UTC 2016


On Mon, Dec 19, 2016 at 02:16:38PM +0100, Jiri Denemark wrote:
> On Fri, Dec 16, 2016 at 10:10:36 +0100, Pavel Hrdina wrote:
> > Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> > ---
> >  configure.ac             | 381 ++++++++++++++---------------------------------
> >  m4/virt-apparmor.m4      |   6 +-
> >  m4/virt-driver-bhyve.m4  |   5 +-
> >  m4/virt-driver-uml.m4    |   5 +-
> >  m4/virt-driver-vz.m4     |   5 +-
> >  m4/virt-host-validate.m4 |   5 +-
> >  m4/virt-init-script.m4   |   8 +-
> >  m4/virt-lib.m4           |  21 +--
> >  m4/virt-login-shell.m4   |   5 +-
> >  m4/virt-nss.m4           |   7 +-
> >  m4/virt-selinux.m4       |   6 +-
> >  m4/virt-wireshark.m4     |   7 +-
> >  12 files changed, 134 insertions(+), 327 deletions(-)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index 3f8e785078..c4f0623b8c 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> ...
> > @@ -1033,16 +974,16 @@ LIBXML_CFLAGS=""
> >  LIBXML_LIBS=""
> >  LIBXML_FOUND="no"
> >  
> > -AC_ARG_WITH([libxml], [AS_HELP_STRING([--with-libxml=@<:@PFX@:>@],
> > -   [libxml2 location])])
> > +LIBVIRT_ARG_WITH_ALT([LIBXML], [libxml2 (>= 2.6.0) location], [check])
> > +
> >  if test "x$with_libxml" = "xno" ; then
> >      AC_MSG_CHECKING(for libxml2 libraries >= $LIBXML_REQUIRED)
> >      AC_MSG_ERROR([libxml2 >= $LIBXML_REQUIRED is required for libvirt])
> > -elif test "x$with_libxml" = "x" && test "x$PKG_CONFIG" != "x" ; then
> > +elif test "x$with_libxml" != "xno" && test "x$PKG_CONFIG" != "x" ; then
> >      PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_REQUIRED, [LIBXML_FOUND=yes], [LIBXML_FOUND=no])
> >  fi
> >  if test "$LIBXML_FOUND" = "no" ; then
> > -    if test "x$with_libxml" != "x" ; then
> > +    if test "x$with_libxml" != "xyes" ; then
> >  	LIBXML_CONFIG=$with_libxml/bin/$LIBXML_CONFIG
> >      fi
> >      AC_MSG_CHECKING(libxml2 $LIBXML_CONFIG >= $LIBXML_REQUIRED )
> 
> This hunk doesn't seem to be correct. First, "x$with_libxml" != "xno"
> is always true in the else branch of "x$with_libxml" = "xno". But more
> importantly, you would remove the option to override the path to libxml
> using --with-libxml=/path/to/libxml in case another libxml library is
> installed.

That's true, this is just left over after splitting the changes into separate
commits.  I'll update it to this:

@@ -1033,16 +974,16 @@ LIBXML_CFLAGS=""
 LIBXML_LIBS=""
 LIBXML_FOUND="no"
 
-AC_ARG_WITH([libxml], [AS_HELP_STRING([--with-libxml=@<:@PFX@:>@],
-   [libxml2 location])])
+LIBVIRT_ARG_WITH_ALT([LIBXML], [libxml2 (>= 2.6.0) location], [check])
+
 if test "x$with_libxml" = "xno" ; then
     AC_MSG_CHECKING(for libxml2 libraries >= $LIBXML_REQUIRED)
     AC_MSG_ERROR([libxml2 >= $LIBXML_REQUIRED is required for libvirt])
-elif test "x$with_libxml" = "x" && test "x$PKG_CONFIG" != "x" ; then
+elif test "x$with_libxml" = "xcheck" && test "x$PKG_CONFIG" != "x" ; then
     PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_REQUIRED, [LIBXML_FOUND=yes], [L
IBXML_FOUND=no])
 fi
 if test "$LIBXML_FOUND" = "no" ; then
-    if test "x$with_libxml" != "x" ; then
+    if test "x$with_libxml" != "xcheck" ; then
        LIBXML_CONFIG=$with_libxml/bin/$LIBXML_CONFIG
     fi
     AC_MSG_CHECKING(libxml2 $LIBXML_CONFIG >= $LIBXML_REQUIRED )

or I can change the default action to ''.

> ...
> > @@ -2219,18 +2082,20 @@ else
> >    default_qemu_group=root
> >  fi
> >  
> > -AC_ARG_WITH([qemu-user],
> > -  [AS_HELP_STRING([--with-qemu-user],
> > -    [username to run QEMU system instance as
> > -     @<:@default=platform dependent@:>@])],
> > -  [QEMU_USER=${withval}],
> > -  [QEMU_USER=${default_qemu_user}])
> > -AC_ARG_WITH([qemu-group],
> > -  [AS_HELP_STRING([--with-qemu-group],
> > -    [groupname to run QEMU system instance as
> > -     @<:@default=platform dependent@:>@])],
> > -  [QEMU_GROUP=${withval}],
> > -  [QEMU_GROUP=${default_qemu_group}])
> > +LIBVIRT_ARG_WITH_ALT([QEMU_USER], [username to run QEMU system instance as],
> > +                     ['platform dependent'])
> 
> Any reason why $default_qemu_user is not used as the default value
> rather than 'platform dependent'?

I was not able to achieve it after a day of reading documentation and autoconf
code and googling.  It would be better, but I don't know how and if it's even
possible.

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20161219/229e1634/attachment-0001.sig>


More information about the libvir-list mailing list