]> xenbits.xensource.com Git - libvirt.git/commitdiff
configure: Make virt-host-validate optional
authorAndrea Bolognani <abologna@redhat.com>
Fri, 8 Apr 2016 15:14:13 +0000 (17:14 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Wed, 13 Apr 2016 08:06:29 +0000 (10:06 +0200)
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
m4/virt-host-validate.m4 [new file with mode: 0644]
tools/Makefile.am

index 1eb19eef53b16f81e44c2f8f7a8d5c4bdb2dec0d..b1500f60bc5da3a99c48cc30651ecc1129f4847d 100644 (file)
@@ -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 (file)
index 0000000..a56fe41
--- /dev/null
@@ -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"])
+])
index 890cdd98b64df61ddfe958afd633e7e84703312d..560a9a5bc7f6ce7568da22e3d39b49f0585f352b 100644 (file)
@@ -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' \