Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
configure.ac | 39 -------------
m4/virt-external-programs.m4 | 106 -----------------------------------
meson.build | 82 +++++++++++++++++++++++++++
3 files changed, 82 insertions(+), 145 deletions(-)
delete mode 100644 m4/virt-external-programs.m4
diff --git a/configure.ac b/configure.ac
index b85fa9a9a6f..d8ff2ba3900 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,9 +40,6 @@ m4_ifndef([AM_SILENT_RULES],
AC_CANONICAL_HOST
-dnl Where we look for daemons and admin binaries during configure
-LIBVIRT_SBIN_PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin"
-
dnl Checks for C compiler.
AC_PROG_CC
AC_PROG_INSTALL
@@ -62,10 +59,6 @@ m4_ifndef([LT_INIT], [
AM_PROG_CC_C_O
AM_PROG_LD
-dnl Specify if we rely on ifconfig instead of iproute2 (e.g. in case
-dnl we're working on BSD)
-want_ifconfig=no
-
dnl Make some notes about which OS we're compiling for, as the lxc and qemu
dnl drivers require linux headers, and storage_mpath, dtrace, and nwfilter
dnl are also linux specific. The "network" and storage_fs drivers are known
@@ -90,7 +83,6 @@ if test $with_linux = no; then
fi
if test $with_freebsd = yes; then
- want_ifconfig=yes
with_firewalld=no
fi
@@ -208,12 +200,6 @@ AC_CHECK_LIB([intl],[gettext],[])
AC_CHECK_LIB([util],[openpty],[])
-dnl
-dnl Check for external programs
-dnl
-
-LIBVIRT_CHECK_EXTERNAL_PROGRAMS
-
dnl
dnl Virtualization drivers check
dnl
@@ -377,17 +363,6 @@ if test $with_storage = yes; then
fi
AM_CONDITIONAL([WITH_STORAGE], [test "$with_storage" = "yes"])
-dnl Allow perl/python overrides
-AC_PATH_PROGS([PYTHON], [python3])
-if test -z "$PYTHON"; then
- AC_MSG_ERROR(['python3' binary is required to build libvirt])
-fi
-AC_DEFINE_UNQUOTED([PYTHON], "$PYTHON", [path to python binary])
-AC_PATH_PROG([FLAKE8], [flake8])
-if test -z "$FLAKE8"; then
- AC_MSG_WARN(['flake8' binary is required to check python code style])
-fi
-
dnl Python3 < 3.7 treats the C locale as 7-bit only.
dnl We must force env vars so it treats it as UTF-8
dnl regardless of the user's locale.
@@ -395,11 +370,6 @@ RUNUTF8="LC_ALL= LANG=C LC_CTYPE=en_US.UTF-8"
AC_SUBST(RUNUTF8)
-AC_PATH_PROG([PERL], [perl])
-if test -z "$PERL"; then
- AC_MSG_ERROR(['perl' binary is required to build libvirt])
-fi
-
dnl MinGW checks
LIBVIRT_WIN_CHECK_COMMON
LIBVIRT_WIN_CHECK_MINGW
@@ -435,15 +405,6 @@ if test $with_freebsd = yes; then
)
fi
-# Check if we need to look for ifconfig
-if test "$want_ifconfig" = "yes"; then
- AC_PATH_PROG([IFCONFIG_PATH], [ifconfig])
- if test -z "$IFCONFIG_PATH"; then
- AC_MSG_ERROR([Failed to find ifconfig.])
- fi
- AC_DEFINE_UNQUOTED([IFCONFIG_PATH], "$IFCONFIG_PATH", [path to ifconfig
binary])
-fi
-
GNUmakefile=GNUmakefile
m4_if(m4_version_compare([2.61a.100],
m4_defn([m4_PACKAGE_VERSION])), [1], [],
diff --git a/m4/virt-external-programs.m4 b/m4/virt-external-programs.m4
deleted file mode 100644
index d905beed71d..00000000000
--- a/m4/virt-external-programs.m4
+++ /dev/null
@@ -1,106 +0,0 @@
-dnl The External programs check
-dnl
-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/>.
-dnl
-
-AC_DEFUN([LIBVIRT_CHECK_EXTERNAL_PROGRAMS], [
- dnl Do we have rpcgen?
- AC_PATH_PROGS([RPCGEN], [rpcgen portable-rpcgen], [no])
- AM_CONDITIONAL([HAVE_RPCGEN], [test "x$ac_cv_path_RPCGEN" !=
"xno"])
-
- dnl Miscellaneous external programs.
- AC_PATH_PROG([XMLLINT], [xmllint], [])
- if test -z "$XMLLINT"
- then
- AC_MSG_ERROR("xmllint is required to build libvirt")
- fi
- AC_PATH_PROG([XSLTPROC], [xsltproc], [])
- if test -z "$XSLTPROC"
- then
- AC_MSG_ERROR("xsltproc is required to build libvirt")
- fi
-
- dnl Drop the rst2html (aka HTML4) variants once we
- dnl stop supporting Ubuntu 16.04 (Xenial)
- AC_PATH_PROGS([RST2HTML], [rst2html5 rst2html5.py rst2html5-3 rst2html rst2html.py
rst2html-3], [])
- if test -z "$RST2HTML"
- then
- AC_MSG_ERROR("rst2html5/rst2html is required to build libvirt")
- fi
- AC_PATH_PROGS([RST2MAN], [rst2man rst2man.py rst2man-3], [])
- if test -z "$RST2MAN"
- then
- AC_MSG_ERROR("rst2man is required to build libvirt")
- fi
- AC_PATH_PROG([AUGPARSE], [augparse], [/usr/bin/augparse])
- AC_PROG_MKDIR_P
- AC_PROG_LN_S
-
- dnl External programs that we can use if they are available.
- dnl We will hard-code paths to these programs unless we cannot
- dnl detect them, in which case we'll search for the program
- dnl along the $PATH at runtime and fail if it's not there.
- AC_PATH_PROG([DMIDECODE], [dmidecode], [dmidecode], [$LIBVIRT_SBIN_PATH])
- AC_PATH_PROG([DNSMASQ], [dnsmasq], [dnsmasq], [$LIBVIRT_SBIN_PATH])
- AC_PATH_PROG([RADVD], [radvd], [radvd], [$LIBVIRT_SBIN_PATH])
- AC_PATH_PROG([TC], [tc], [tc], [$LIBVIRT_SBIN_PATH])
- AC_PATH_PROG([UDEVADM], [udevadm], [udevadm], [$LIBVIRT_SBIN_PATH])
- AC_PATH_PROG([MODPROBE], [modprobe], [modprobe], [$LIBVIRT_SBIN_PATH])
- AC_PATH_PROG([RMMOD], [rmmod], [rmmod], [$LIBVIRT_SBIN_PATH])
- AC_PATH_PROG([MM_CTL], [mm-ctl], [mm-ctl], [$LIBVIRT_SBIN_PATH])
- AC_PATH_PROG([OVS_VSCTL], [ovs-vsctl], [ovs-vsctl], [$LIBVIRT_SBIN_PATH])
- AC_PATH_PROG([SCRUB], [scrub], [scrub], [$LIBVIRT_SBIN_PATH])
- AC_PATH_PROG([ADDR2LINE], [addr2line], [addr2line], [$LIBVIRT_SBIN_PATH])
- AC_PATH_PROG([MDEVCTL], [mdevctl], [mdevctl], [$LIBVIRT_SBIN_PATH])
-
- AC_DEFINE_UNQUOTED([DMIDECODE], ["$DMIDECODE"],
- [Location or name of the dmidecode program])
- AC_DEFINE_UNQUOTED([DNSMASQ], ["$DNSMASQ"],
- [Location or name of the dnsmasq program])
- AC_DEFINE_UNQUOTED([RADVD], ["$RADVD"],
- [Location or name of the radvd program])
- AC_DEFINE_UNQUOTED([TC], ["$TC"],
- [Location or name of the tc program (see iproute2)])
- AC_DEFINE_UNQUOTED([MM_CTL], ["$MM_CTL"],
- [Location or name of the mm-ctl program])
- AC_DEFINE_UNQUOTED([OVS_VSCTL], ["$OVS_VSCTL"],
- [Location or name of the ovs-vsctl program])
- AC_DEFINE_UNQUOTED([UDEVADM], ["$UDEVADM"],
- [Location or name of the udevadm program])
- AC_DEFINE_UNQUOTED([MODPROBE], ["$MODPROBE"],
- [Location or name of the modprobe program])
- AC_DEFINE_UNQUOTED([RMMOD], ["$RMMOD"],
- [Location or name of the rmmod program])
- AC_DEFINE_UNQUOTED([SCRUB], ["$SCRUB"],
- [Location or name of the scrub program (for wiping algorithms)])
- AC_DEFINE_UNQUOTED([ADDR2LINE], ["$ADDR2LINE"],
- [Location of addr2line program])
- AC_DEFINE_UNQUOTED([MDEVCTL], ["$MDEVCTL"],
- [Location or name of the mdevctl program])
-
- AC_PATH_PROG([IP_PATH], [ip], [/sbin/ip], [$LIBVIRT_SBIN_PATH])
- AC_DEFINE_UNQUOTED([IP_PATH], ["$IP_PATH"], [path to ip binary])
-
- AC_PATH_PROG([IPTABLES_PATH], [iptables], /sbin/iptables, [$LIBVIRT_SBIN_PATH])
- AC_DEFINE_UNQUOTED([IPTABLES_PATH], ["$IPTABLES_PATH"], [path to iptables
binary])
-
- AC_PATH_PROG([IP6TABLES_PATH], [ip6tables], [/sbin/ip6tables], [$LIBVIRT_SBIN_PATH])
- AC_DEFINE_UNQUOTED([IP6TABLES_PATH], ["$IP6TABLES_PATH"], [path to ip6tables
binary])
-
- AC_PATH_PROG([EBTABLES_PATH], [ebtables], [/sbin/ebtables], [$LIBVIRT_SBIN_PATH])
- AC_DEFINE_UNQUOTED([EBTABLES_PATH], ["$EBTABLES_PATH"], [path to ebtables
binary])
-])
diff --git a/meson.build b/meson.build
index 121022e5f78..3f86f931de0 100644
--- a/meson.build
+++ b/meson.build
@@ -859,6 +859,88 @@ endforeach
conf.set('SIZEOF_LONG', cc.sizeof('long'))
+# Where we look for daemons and admin binaries during configure
+
+libvirt_sbin_path = [
+ '/sbin',
+ '/usr/sbin',
+ '/usr/local/sbin',
+]
+
+
+# required programs check
+
+required_programs = [
+ 'perl',
+ 'python3',
+ 'xmllint',
+ 'xsltproc',
+]
+
+required_programs_groups = [
+ {'name':'rpcgen', 'prog':['rpcgen',
'portable-rpcgen']},
+ # Drop the rst2html (aka HTML4) variants once we stop supporting Ubuntu 16.04 (Xenial)
+ {'name':'rst2html', 'prog':['rst2html5',
'rst2html5.py', 'rst2html5-3', 'rst2html', 'rst2html.py',
'rst2html-3']},
+ {'name':'rst2man', 'prog':['rst2man',
'rst2man.py', 'rst2man-3']},
+]
+
+if host_machine.system() == 'freebsd'
+ required_programs += 'ifconfig'
+endif
+
+foreach name : required_programs
+ prog = find_program(name, required: true, dirs: libvirt_sbin_path)
+ varname = name.underscorify()
+ conf.set_quoted(varname.to_upper(), prog.path())
+ set_variable('@0(a)_prog'.format(varname), prog)
+endforeach
+
+foreach item : required_programs_groups
+ prog = find_program(item.get('prog'), required: true, dirs: libvirt_sbin_path)
+ varname = item.get('name').underscorify()
+ conf.set_quoted(varname.to_upper(), prog.path())
+ set_variable('@0(a)_prog'.format(varname), prog)
+endforeach
+
+
+# optional programs
+
+optional_programs = [
+ 'addr2line',
+ 'augparse',
+ 'dmidecode',
+ 'dnsmasq',
+ 'ebtables',
+ 'flake8',
+ 'ip',
+ 'ip6tables',
+ 'iptables',
+ 'mdevctl',
+ 'mm-ctl',
+ 'modprobe',
+ 'ovs-vsctl',
+ 'radvd',
+ 'rmmod',
+ 'scrub',
+ 'tc',
+ 'udevadm',
+]
+
+foreach name : optional_programs
+ prog = find_program(name, required: false, dirs: libvirt_sbin_path)
+ varname = name.underscorify()
+ if prog.found()
+ prog_path = prog.path()
+ else
+ prog_path = name
+ endif
+
+ conf.set_quoted(varname.to_upper(), prog_path)
+ conf.set_quoted('@0(a)_PATH'.format(varname.to_upper()), prog_path)
+ set_variable('@0(a)_prog'.format(varname), prog)
+endforeach
+
+
# define top include directory
top_inc_dir = include_directories('.')
--
2.26.2