Since Xen 4.9 a pkgconfig file exists to gather info about building
against libxenstore.so. Use it if available.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
As a general rule any time we switch() on something that is an enum, we
want to have a case for every enum constant. The -Wswitch warning will
report any switch where we've violated this rule, except if that switch
has a default case.
Unfortunately it is reasonable to want to list all enum constants *and*
also have a default case. To get a warning in that scenario requires
that we turn on -Wswitch-enum.
In a few cases where we explicitly don't want to list all enum cases, we
can discard the enum type checking by casting the value to a plain int.
Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
The -Wextra flag bundle gained a new warning -Wcast-function-type.
This complains if you cast between two function prototypes where
the number of parameters or their data types are not compatible.
Unfortunately we need such "bad" function casts for our event
callbacks. It is possible to silence the warning by first casting
to the generic "void (*)(void)" function prototype, but that is
rather ugly to add throughout libvirt code.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Undefined symbols are a bad thing in general because they can get
resolved in unexpected ways at runtime if multiple sources provide the
same symbol name. For example both glibc and libtirpc may provide XDR
symbols and we want to ensure that we resolve to libtirpc if that's what
we originally built against.
The toolchain maintainers thus strongly recommend that all applications
use the '-z defs' linker flag to prevent undefined symbols. This is
shortly becoming part of the default linker flags for RPMs. As an added
benefit this aligns Linux builds with Windows builds, where the linker
has never permitted undefined symbols.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Since
commit eee7bd4ecb
Author: Joao Martins <joao.m.martins@oracle.com>
Date: Tue Jul 26 00:45:14 2016 +0100
libxl: implement virDomainBlockStats
Introduce initial support for domainBlockStats API
the libxl driver calls a couple of xenstore APIs, so it must explicitly
link to this library rather than rely on indirect linkage via libxl or
other xen libraries.
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
After the latest CPU additions, the build fails with clang:
cputest.c:905:1: error: stack frame size of 26136 bytes
in function 'mymain' [-Werror,-Wframe-larger-than=]
Raise the relaxed limit which is used for tests.
Apparently we can't assume that people run readline recent enough
to have rl_completion_quote_character (added in readline-5.0
released in 2011). However, we can't compile without it. So if
not present, disable readline.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Due to the way that check logic was written we basically enabled
bash completion whenever readline was enabled. This is not right
because it made bash-completion pkg-config module required.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
The only purpose of this file is to be sourced. After that one
can use completion even for their bash:
# virsh list --<TAB><TAB>
--all --inactive ...
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
After b4f7793ce2, qemuxml2xmltest has apparently become big enough
to trigger a compilation error when using --enable-test-coverage on
aarch64:
CC qemuxml2xmltest.o
qemuxml2xmltest.c: In function 'mymain':
qemuxml2xmltest.c:1216:1: error: const/copy propagation disabled: 4361 basic blocks and 99285 registers [-Werror=disabled-optimization]
}
^
qemuxml2xmltest.c:1216:1: error: PRE disabled: 4361 basic blocks and 99285 registers [-Werror=disabled-optimization]
qemuxml2xmltest.c:1216:1: error: const/copy propagation disabled: 4361 basic blocks and 99285 registers [-Werror=disabled-optimization]
qemuxml2xmltest.c:1216:1: error: const/copy propagation disabled: 4361 basic blocks and 99285 registers [-Werror=disabled-optimization]
However, as the GCC documentation states, this warning is not really
caused by issues in our code, so it makes sense to disable it.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
3 out of 4 uses of gl_WARN_ADD() were incorrectly adding "" around
the argument, which in turn resulted in the argument being used
unquoted (configure had gl_positive=""-fstack-protector-all"",
rather than the intended gl_positive="-fstack-protector-all").
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
When building libvirt with clang we get bogus warnings about
'double' being promoted to 'long double' when calling isnan().
https://bugzilla.redhat.com/show_bug.cgi?id=1472437
Detect this broken isnan() / compiler combination and disable
the -Wdouble-promotion flag.
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
The libxl library allows a libxl_domain_config object to be serialized
from/to a JSON string. Use this to allow testing of the XML to
libxl_domain_config conversion process. Test XML is converted to
libxl_domain_config, which is then serialized to json. A json template
corresponding to the test XML is converted to a libxl_domain_config
object using libxl_domain_config_from_json(), and then serialized
back to json using libxl_domain_config_to_json(). The two json
docs are then compared.
Using libxl to convert the json template to a libxl_domain_config
object and then back to json provides a simple way to account for
any changes or additions to the json representation across Xen
releases.
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
[update to v3.5.0-rc1, improve error reporting, use /bin/true emulator]
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
We already require libxml to be installed, so it is not unreasonable
to require xmllint and xsltproc to be installed too - any platform
with the former will have the latter too.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
The HTML pages are currently validated against an XHTML 1.0 DTD.
This makes it impossible to take advantage of features that are
introduced in HTML 5, because they'll fail validation.
There is intentionally no DTD defined for HTML 5, so there's no
alternative to XHTML 1.0 DTD that we could switch to. The only
options are to stick with XHTML 1.0 forever, or drop the DTD
validation, and we pick the latter.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Driver modules proved to be reliable for a long time. Since support for
not building modules complicates the code and makefiles drop it.
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
GCC 7.1 introduces a new -Wformat-truncation warning
flag that reports if it thinks the maximum possible
size of the formatted output will exceed the provided
fixed buffer. This is enabled automatically by the
-Wformat warning flag. There are quite a few places
hit by this in libvirt which need rewriting. This is
non-trivial work in some places, so temporarily
disable the new warning until those fixes can be
implemented.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Depending on the platform/architecture, a number of conditionals
in libvirt code expand the same on both branches. This is expected
behaviour and harmless, so disable the warning to avoid creating
unexpected build failures
Two examples, mingw32:
../../src/util/vircommand.c: In function 'virCommandWait':
../../src/util/vircommand.c:2562:51: error: this condition has identical branches [-Werror=duplicated-branches]
*exitstatus = cmd->rawStatus ? status : WEXITSTATUS(status);
^
and gcc7.1
In file included from util/virobject.c:28:0:
util/virobject.c: In function 'virClassNew':
util/viratomic.h:176:46: error: this condition has identical branches [-Werror=duplicated-branches]
(void)(0 ? *(atomic) ^ *(atomic) : 0); \
^
util/virobject.c:144:20: note: in expansion of macro 'virAtomicIntInc'
klass->magic = virAtomicIntInc(&magicCounter);
^~~~~~~~~~~~~~~
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
When building with clang 4.0.0, virsh build fails like this:
gmake[3]: Entering directory '/usr/home/novel/code/libvirt/tools'
CC virsh-virsh.o
In file included from virsh.c:45:
In file included from /usr/local/include/readline/readline.h:31:
/usr/local/include/readline/rltypedefs.h:35:22: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
typedef int Function () __attribute__ ((deprecated));
^
void
/usr/local/include/readline/rltypedefs.h:36:24: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
typedef void VFunction () __attribute__ ((deprecated));
^
void
/usr/local/include/readline/rltypedefs.h:37:26: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
typedef char *CPFunction () __attribute__ ((deprecated));
^
void
/usr/local/include/readline/rltypedefs.h:38:28: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
typedef char **CPPFunction () __attribute__ ((deprecated));
^
void
In file included from virsh.c:45:
/usr/local/include/readline/readline.h:385:23: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
extern int rl_message ();
^
void
5 errors generated.
gmake[3]: *** [Makefile:2823: virsh-virsh.o] Error 1
Fix that by adding -D_FUNCTION_DEF to READLINE_CFLAGS to fix *Function
related warnings and add a check for stdarg.h so we have HAVE_STDARG_H
defined that's needed by the readline headers to use proper rl_message
declaration.
Bug report on the readline mailing list:
http://lists.gnu.org/archive/html/bug-readline/2017-05/msg00004.html
This commit fixes an acl missing variable. The virt-acl.m4 inside the
macro directory does not contain the variable 'with_acl'. So, it is
being set as an empty string "with_acl=''". This is causing a missing
option during the configuration, even if you have acl libs installed.
Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
The recently added sanlock_strerror function can be used to translate
sanlock's numeric errors into human readable strings.
https://bugzilla.redhat.com/show_bug.cgi?id=1409511
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
If building libvirt against Ubuntu precise, the librbd.h is lacking
many functions that libvirt expects. We have no version check, so
we were enabling RBD even though it cannot compile. This configure
check uses existance of 'rbd_get_features' as an identifier for the
min required version.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Introduce STRICT_FRAME_LIMIT_CFLAGS that will be used for
production code and RELAXED_FRAME_LIMIT_CFLAGS for tests.
Raising the limit for tests allows building them with clang
with optimizations disabled.
The 'fs' backend m4 code was copied, but one of the condition were not
changed which resulted into:
configure: Gluster: yes
configure: ZFS: yes
configure: Virtuozzo storage: check
Make the code turn on the virtuozzo driver automatically if the tools
are found.
Added general definitions for vstorage pool backend including
the build options to add --with-storage-vstorage checking.
In order to use vstorage as a backend for a storage pool
vstorage tools (vstorage and vstorage-mount) need to be installed.
Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
The plugin depends on more modules than we currently check for,
i.e. network driver and yajl library.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
LIBVIRT_ARG_WITH_ALT is more generic than LIBVIRT_ARG_WITH, which
is tailored at switching features on and off.
Rename the macros according to their intended purpose, and add
some documentation to help developers pick between the two.
Commit 943ddcb712 partially fixed this bug in gnutls configure code.
However we also need to backup and modify CFLAGS and do if for
AC_CHECK_HEADERS as well.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Sigh, autoconf has AC_CHECK_FUNC and AC_CHECK_FUNCS and both check
whether some function exists or not. However in addition to the obvious
difference that the later is able to check multiple functions it also
defines HAVE_FUNCTION_NAME for each function.
Commit 680d2f49da moved the code to separate file, but also blindly
changed the macro to AC_CHECK_FUNC without confronting the
documentation.
Reported-by: John Ferlan <jferlan@redhat.com>
<https://www.redhat.com/archives/libvir-list/2016-December/msg01086.html>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Introduced by commit 25034b3c40 and reused by commit 4519e94b74.
This patch silences warning printed by configure:
configure: WARNING: unrecognized options: --with-qemu-user
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
The bug was introduced by commit 08c2d1480b. The string must be quoted
because it is used as function argument.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pkg-config file libxml-2.0.pc was introduced in libxml2-2.2.4 and we
require at least 2.6.0 so the crazy xml2-config check can be dropped.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This allows to use two or more LIBVIRT_CHECK_(LIB|LIB_ALT|PKG) macros
for one library. For example, when we check for existence of
pgk-config file of some library and we know that not all versions of
that library that libvirt requires provides this file, we can fallback
to use library check.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Usage of AC_REQUIRE will mess with order how LIBVIRT_CHECK_* macros
are composed into configure.ac. This ensures that the output of
configure --help is properly ordered and grouped into sections.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Following patch will update LIBVIRT_CHECK_(LIB|LIB_ALT|PKG) macros in
a way that you will be able to call a another macro as a fallback if
the first one fails. To allow that, we need to move the
LIBVIRT_ARG_WITH out of those macro to not have two or more same lines
in output of "configure --help".
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
All checks that prints result at the end of configure uses
LIBVIRT_RESULT_${CHECK_NAME}. Create those macros for remaining check.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
The *header_name* cannot be quoted, otherwise it is not translated to
the passed argument. Without this fix the generated configure contains
*ac_cv_header_header_name*, but there should be for example
*ac_cv_header_sals_sasl_h* for "sasl/sasl.h".
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Implement a new libssh transport, which uses libssh to communicate with
remote hosts, and add all the build system stuff (search of libssh,
private symbols, etc) to built it.
This new transport supports all the common ssh authentication methods,
making use of libvirt's auth callbacks for interaction with the user.
${exec_prefix} and ${prefix} point to the same directory in
most setups, but when that's not the case the former should
be used for architecture-dependent data such as shared objects,
which makes it the best fit for our Wireshark dissector.
While at it, change all uses of $(var) to ${var}: they are
absolutely identicaly as far as make's concerned, but autoconf
itself seems to prefer the latter form so we might as well
follow suit.
We only need to strip $ws_prefix from $ws_plugindir if we've
retrieved it from pkg-config: if we're building it ourselves
from $libdir, we can just use it without further processing.
This fixes a build issue with old gnutls.
Broken by commit 680d2f49da.
Reported-by: Olga Krishtal <okrishtal@virtuozzo.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Commit d8a8af3492 changed the minimal required version of gnutls
so it's safe to remove the code for older versions.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Since we're using autoconf to substitute the right value in
Makefile.am now, we can use a less generic name without running
into circular dependencies.
Adding $(prefix) in Makefile.am, as we were doing, means that
it would be prepended even when using --with-ws-plugindir,
which is something we don't want to happen.
Instead, we add it beforehand but take care that it doesn't
get expanded until make is called.
Even when we're building $plugindir ourselves because we can't
retrieve it using pkg-config, we still want to strip the prefix,
except in that case it would be the same prefix we're using for
building libvirt.
The fact that $plugindir is missing also doesn't tell us
anything about $ws_prefix, so we have to handle the two variables
separately.
Running the output of qemu -help doesn't make any sense. We should be
looking for libvirt being mentioned in the output. This worked by
accident, let's make it work as expected it to.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Currently, we are checking for sanlock_add_lockspace_timeout
which is good for now. But in a subsequent patch we are going to
use sanlock_write_lockspace (which sets an initial value for io
timeout for sanlock). Now, there is no reason to check for both
functions in sanlock library as the sanlock_write_lockspace was
introduced in 2.7 release and the one we are currently checking
for in the 2.5 release. Therefore it is safe to assume presence
of sanlock_add_lockspace_timeout when sanlock_write_lockspace
is detected.
Moreover, the macro for conditional compilation is renamed to
HAVE_SANLOCK_IO_TIMEOUT (as it now encapsulates two functions).
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
So, when building wireshark plugin, we get the plugindir variable
from the wireshark.pc as well as prefix. Then we replace the
prefix in the plugindir with our own prefix where libvirt is
building to:
plugindir="${prefix}${plugindir#ws_prefix}"
However, as you can see, there's '$' missing in front of the
ws_prefix variable. This results in the mangled plugindir, for
instance like this:
plugindir='/usr/usr/lib64/wireshark/plugins'
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Unconditionally use gnulib's getopt module. This is needed by the bhyve driver
to provide a reentrant interface for getopt.
Several gnulib headers rely on features.h being included by ctype.h to provide
__GNUC_PREREQ, but on systems without glibc, this is not provided. In these
cases __GNUC_PREREQ gets redefined to 0, which causes build errors from checks
in src/internal.h.
Therefore, define __GNUC_PREREQ as early as possible. config-post.h is probably
the first header that is included, before any other headers.
Currently, virt-login-shell is not allowed to build on Windows.
However, as it's designed around LXC, it does not make sense to
build it on anything but Linux, so make the check stricter and allow to
enable it on Linux only.
The sd_notify method is used to tell systemd when libvirtd
has finished starting up. All it does is send a datagram
containing the string parameter to systemd on a UNIX socket
named in the NOTIFY_SOCKET environment variable. Rather than
pulling in the systemd libraries for this, just code the
notification directly in libvirt as this is a stable ABI
from systemd's POV which explicitly allows independant
implementations:
See "Reimplementable Independently" column in the
"$NOTIFY_SOCKET Daemon Notifications" row:
https://www.freedesktop.org/wiki/Software/systemd/InterfacePortabilityAndStabilityChart/
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1314881
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
We don't need them any longer; moreover, the previous structure
made it very easy for bugs to slip in, by having the result of one
check influence the following one.
By placing the check for "$with_init_script" = check front and
center, hopefully this won't happen (as easily) again.
Our distcheck is broken. Well, it works but only by pure chance.
When wireshark plugin is enabled, we try to query which path
should the plugin be installed into. Firstly, we try to ask
pkg-config as some releases of wireshark already sets
corresponding variable in their pkg-config files. However, if we
obtained no value from there we try to construct the path on our
own. Based on our observations it usually is:
$libdir/wireshark/plugins/$version/.
Now, the problem is in the way we are deciding whether we have
obtained the plugin directory from pkg-config or not. Simply
said, we are checking wrong variable. The variable we are
checking has never been set, thus in our test is empty and
therefore we will always construct the plugin dir path on our
own, regardless of its presence in the pkg-config file.
To make things worse, after fixing this problem, VPATH build was
broken as it now tried to install plugin into correct directory.
Yes, this is problem, because --prefix was not honoured and
everything but the plugin was installed into given prefix. I've
managed to resolve this issue by replacing plugin dir prefix with
our own. So when doing regular installation (our prefix ==
wireshark prefix), nothing changes. When doing VPATH build &
installation plugin is installed into correctly prefixed dir.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
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.
fdstream.c: In function 'virFDStreamWrite':
fdstream.c:390:29: error: logical 'or' of equal expressions [-Werror=logical-op]
if (errno == EAGAIN || errno == EWOULDBLOCK) {
^~
Fedora rawhide now uses gcc 6.0 and there is a bug with -Wlogical-op
producing false warnings.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602
Use GCC pragma push/pop and ignore -Wlogical-op for GCC that supports
push/pop pragma and also has this bug.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>