From edebc16607dc2315d05587854249d3d5423a450e Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Fri, 8 Apr 2016 17:14:13 +0200 Subject: [PATCH] configure: Make virt-host-validate optional virt-host-validate, just like virt-login-shell, doesn't make sense on Windows, so we should avoid building it. Make the tool optional and build it by default on all platforms except Windows, erroring out if the user attempts to build it anyway. --- configure.ac | 29 ++++++++++++++++++----------- m4/virt-host-validate.m4 | 40 ++++++++++++++++++++++++++++++++++++++++ tools/Makefile.am | 10 ++++++++-- 3 files changed, 66 insertions(+), 13 deletions(-) create mode 100644 m4/virt-host-validate.m4 diff --git a/configure.ac b/configure.ac index 1eb19eef53..b1500f60bc 100644 --- a/configure.ac +++ b/configure.ac @@ -1098,6 +1098,12 @@ dnl LIBVIRT_CHECK_LOGIN_SHELL +dnl +dnl Check for virt-host-validate +dnl + +LIBVIRT_CHECK_HOST_VALIDATE + AM_CONDITIONAL([WITH_SETUID_RPC_CLIENT], [test "$with_lxc$with_login_shell" != "nono"]) dnl @@ -2925,17 +2931,18 @@ AC_MSG_NOTICE([ Alloc OOM: $enable_oom]) AC_MSG_NOTICE([]) AC_MSG_NOTICE([Miscellaneous]) AC_MSG_NOTICE([]) -AC_MSG_NOTICE([ Debug: $enable_debug]) -AC_MSG_NOTICE([ Use -Werror: $set_werror]) -AC_MSG_NOTICE([ Warning Flags: $WARN_CFLAGS]) -AC_MSG_NOTICE([ DTrace: $with_dtrace]) -AC_MSG_NOTICE([ numad: $with_numad]) -AC_MSG_NOTICE([ XML Catalog: $XML_CATALOG_FILE]) -AC_MSG_NOTICE([ Init script: $with_init_script]) -AC_MSG_NOTICE([Char device locks: $with_chrdev_lock_files]) -AC_MSG_NOTICE([ Default Editor: $DEFAULT_EDITOR]) -AC_MSG_NOTICE([ Loader/NVRAM: $with_loader_nvram]) -AC_MSG_NOTICE([ virt-login-shell: $with_login_shell]) +AC_MSG_NOTICE([ Debug: $enable_debug]) +AC_MSG_NOTICE([ Use -Werror: $set_werror]) +AC_MSG_NOTICE([ Warning Flags: $WARN_CFLAGS]) +AC_MSG_NOTICE([ DTrace: $with_dtrace]) +AC_MSG_NOTICE([ numad: $with_numad]) +AC_MSG_NOTICE([ XML Catalog: $XML_CATALOG_FILE]) +AC_MSG_NOTICE([ Init script: $with_init_script]) +AC_MSG_NOTICE([ Char device locks: $with_chrdev_lock_files]) +AC_MSG_NOTICE([ Default Editor: $DEFAULT_EDITOR]) +AC_MSG_NOTICE([ Loader/NVRAM: $with_loader_nvram]) +AC_MSG_NOTICE([ virt-login-shell: $with_login_shell]) +AC_MSG_NOTICE([virt-host-validate: $with_host_validate]) AC_MSG_NOTICE([]) AC_MSG_NOTICE([Developer Tools]) AC_MSG_NOTICE([]) diff --git a/m4/virt-host-validate.m4 b/m4/virt-host-validate.m4 new file mode 100644 index 0000000000..a56fe4154e --- /dev/null +++ b/m4/virt-host-validate.m4 @@ -0,0 +1,40 @@ +dnl Copyright (C) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. +dnl Copyright (C) 2016 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 . + +AC_DEFUN([LIBVIRT_CHECK_HOST_VALIDATE], [ + AC_ARG_WITH([host_validate], + [AS_HELP_STRING([--with-host-validate], + [build virt-host-validate @<:@default=check@:>@])]) + m4_divert_text([DEFAULTS], [with_host_validate=check]) + + if test "x$with_host_validate" != "xno"; then + if test "x$with_win" = "xyes"; then + if test "x$with_host_validate" = "xyes"; then + AC_MSG_ERROR([virt-host-validate is not supported on Windows]) + else + with_host_validate=no; + fi + else + with_host_validate=yes; + fi + fi + + if test "x$with_host_validate" = "xyes" ; then + AC_DEFINE_UNQUOTED([WITH_HOST_VALIDATE], 1, [whether virt-host-validate is built]) + fi + AM_CONDITIONAL([WITH_HOST_VALIDATE], [test "x$with_host_validate" = "xyes"]) +]) diff --git a/tools/Makefile.am b/tools/Makefile.am index 890cdd98b6..560a9a5bc7 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -64,10 +64,9 @@ confdir = $(sysconfdir)/libvirt conf_DATA = bin_SCRIPTS = virt-xml-validate virt-pki-validate -bin_PROGRAMS = virsh virt-host-validate virt-admin +bin_PROGRAMS = virsh virt-admin libexec_SCRIPTS = libvirt-guests.sh dist_man1_MANS = \ - virt-host-validate.1 \ virt-pki-validate.1 \ virt-xml-validate.1 \ virsh.1 \ @@ -89,6 +88,13 @@ EXTRA_DIST += \ virt-login-shell.1 endif ! WITH_LOGIN_SHELL +if WITH_HOST_VALIDATE +bin_PROGRAMS += virt-host-validate +dist_man1_MANS += virt-host-validate.1 +else ! WITH_HOST_VALIDATE +EXTRA_DIST += virt-host-validate.1 +endif ! WITH_HOST_VALIDATE + virt-xml-validate: virt-xml-validate.in Makefile $(AM_V_GEN)sed -e 's|[@]schemadir@|$(pkgdatadir)/schemas|g' \ -e 's|[@]VERSION@|$(VERSION)|g' \