[PATCH 2/2] configure: Make virt-host-validate optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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        |  9 ++++++++-
 3 files changed, 66 insertions(+), 12 deletions(-)
 create mode 100644 m4/virt-host-validate.m4

diff --git a/configure.ac b/configure.ac
index 1eb19ee..b1500f6 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 0000000..a56fe41
--- /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 <http://www.gnu.org/licenses/>.
+
+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 930e6c3..16a1aed 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -64,7 +64,7 @@ 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 \
@@ -89,6 +89,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' \
-- 
2.5.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]