Richard W.M. Jones
2017-Oct-05 11:30 UTC
[Libguestfs] [PATCH] build: Don't test for qemu virtio-serial at configure time.
qemu has supported virtio-serial since forever, and we depend on much newer features now, so testing for virtio-serial is pointless. In fact allowing a set of possible qemu binaries to be supplied is also pointless, since packagers or even people building from source know what qemu binary they want to use. Now the possible options for --with-qemu are: * --with-qemu=search (or --with-qemu omitted) Search for various qemu binaries on the path. * --with-qemu=/path/to/qemu Use the supplied qemu binary without question. No checks on the binary are done. * --with-qemu=no or --without-qemu Disable the default hypervisor. You have to set $LIBGUESTFS_HV before running programs. --- docs/guestfs-building.pod | 7 +-- m4/guestfs_qemu.m4 | 137 ++++++++++++++++++---------------------------- 2 files changed, 56 insertions(+), 88 deletions(-) diff --git a/docs/guestfs-building.pod b/docs/guestfs-building.pod index 187da37be..9b3f37901 100644 --- a/docs/guestfs-building.pod +++ b/docs/guestfs-building.pod @@ -686,11 +686,10 @@ development libraries are installed. This option forces virt-p2v to be built against Gtk 2, which is currently the most widely tested configuration. -=item B<--with-qemu=">bin1 bin2 ...B<"> +=item B<--with-qemu=>/usr/bin/qemu-system-x86_64 -Provide an alternate qemu binary (or list of binaries). This can be -overridden at runtime by setting the C<LIBGUESTFS_HV> environment -variable. +Provide an alternate qemu binary. This can be overridden at runtime +by setting the C<LIBGUESTFS_HV> environment variable. =item B<--with-supermin-packager-config=>I<yum.conf> diff --git a/m4/guestfs_qemu.m4 b/m4/guestfs_qemu.m4 index e07e9800f..350bb980d 100644 --- a/m4/guestfs_qemu.m4 +++ b/m4/guestfs_qemu.m4 @@ -17,6 +17,7 @@ dnl Check for QEMU for running binaries on this $host_cpu, fall dnl back to basic 'qemu'. Allow the user to override it. + AS_CASE([$host_cpu], [i@<:@456@:>@86],[qemu_cpu=i386], [arm*],[qemu_cpu=arm], @@ -24,110 +25,78 @@ AS_CASE([$host_cpu], [powerpc64 | ppc64le | powerpc64le],[qemu_cpu=ppc64], [qemu_cpu=$host_cpu]) default_qemu="qemu-kvm kvm qemu-system-$qemu_cpu qemu" + AC_ARG_WITH([qemu], - [AS_HELP_STRING([--with-qemu="bin1 bin2 ..."], - [set default QEMU binary @<:@default="[qemu-kvm] qemu-system-<host> qemu"@:>@])], + [AS_HELP_STRING([--with-qemu=/path/to/qemu], + [set default QEMU binary @<:@default=search@:>@])], dnl --with-qemu or --without-qemu: [], dnl neither option was given: - [with_qemu="$default_qemu"] + [with_qemu=search] ) -AS_IF([test "x$with_qemu" = "xno"],[ - AC_MSG_WARN([qemu was disabled, libguestfs may not work at all]) - QEMU=no -],[ - AC_PATH_PROGS([QEMU],[$with_qemu],[no], - [$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/libexec]) - test "x$QEMU" = "xno" && AC_MSG_ERROR([qemu must be installed]) +AS_CASE([$with_qemu], + [no],[ + AC_MSG_WARN([qemu was disabled, libguestfs may not work at all]) + QEMU=no + ], + [search],[ + AC_PATH_PROGS([QEMU],[$default_qemu],[no], + [$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/libexec]) + test "x$QEMU" = "xno" && AC_MSG_ERROR([qemu not found]) AC_DEFINE_UNQUOTED([QEMU],["$QEMU"],[Location of qemu binary.]) - dnl Check that the chosen qemu has virtio-serial support. - dnl For historical reasons this can be disabled by setting - dnl vmchannel_test=no. - if test "x$vmchannel_test" != "xno"; then - AC_MSG_CHECKING([that $QEMU -help works]) - if $QEMU -help >&AS_MESSAGE_LOG_FD 2>&1; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - AC_MSG_FAILURE( + # Only check that -help and -version are available and look + # reasonable. Real checks will be performed at runtime. + + AC_MSG_CHECKING([that $QEMU -help works]) + if $QEMU -help >&AS_MESSAGE_LOG_FD 2>&1; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + AC_MSG_FAILURE( [$QEMU -help: command failed. This could be a very old version of qemu, or qemu might not be working. ]) - fi + fi - AC_MSG_CHECKING([that $QEMU -version works]) - if $QEMU -version >&AS_MESSAGE_LOG_FD 2>&1; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - AC_MSG_FAILURE( + AC_MSG_CHECKING([that $QEMU -version works]) + if $QEMU -version >&AS_MESSAGE_LOG_FD 2>&1; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + AC_MSG_FAILURE( [$QEMU -version: command failed. This could be a very old version of qemu, or qemu might not be working. ]) - fi - - AC_MSG_CHECKING([for $QEMU version >= 1]) - if $QEMU -version | grep -sq 'version @<:@1-9@:>@'; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - AC_MSG_FAILURE([$QEMU version must be >= 1.0.]) - fi - - dnl Unfortunately $QEMU -device \? won't just work. We probably - dnl need to add a cocktail of different arguments which differ - dnl on the various emulators. Thanks, qemu. - AC_MSG_CHECKING([what extra options we need to use for qemu feature tests]) - QEMU_OPTIONS_FOR_CONFIGURE- # Note: the order we test these matters. - for opt in "-machine virt" "-machine accel=kvm:tcg" "-display none"; do - if $QEMU $QEMU_OPTIONS_FOR_CONFIGURE $opt -device \? >&AS_MESSAGE_LOG_FD 2>&1; then - QEMU_OPTIONS_FOR_CONFIGURE="$QEMU_OPTIONS_FOR_CONFIGURE $opt" - fi - done - AC_MSG_RESULT([$QEMU_OPTIONS_FOR_CONFIGURE]) - - AC_MSG_CHECKING([that $QEMU $QEMU_OPTIONS_FOR_CONFIGURE -device ? works]) - if $QEMU $QEMU_OPTIONS_FOR_CONFIGURE -device \? >&AS_MESSAGE_LOG_FD 2>&1; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - AC_MSG_FAILURE([$QEMU $QEMU_OPTIONS_FOR_CONFIGURE -device ? doesn't work.]) - fi - - AC_MSG_CHECKING([for virtio-serial support in $QEMU]) - if $QEMU $QEMU_OPTIONS_FOR_CONFIGURE -device \? 2>&1 | grep -sq virtio-serial; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - AC_MSG_FAILURE( -[I did not find virtio-serial support in -$QEMU. - -virtio-serial support in qemu or KVM is essential for libguestfs -to operate. - -Usually this means that you have to install a newer version of qemu -and/or KVM. Please read the relevant section in the README file for -more information about this. - -You can override this test by setting the environment variable -vmchannel_test=no - -However if you don't have the right support in your qemu, then this -just delays the pain. + fi -If I am using the wrong qemu or you want to compile qemu from source -and install it in another location, then you should configure with -the --with-qemu option. -]) - fi + AC_MSG_CHECKING([for $QEMU version >= 1]) + if $QEMU -version | grep -sq 'version @<:@1-9@:>@'; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + AC_MSG_FAILURE([$QEMU version must be >= 1.0.]) fi + ],[ + # AS_CASE default: + # Use the binary supplied without question, but check + # that a full path was given. + QEMU="$with_qemu" + AC_MSG_CHECKING([that $QEMU is an absolute path]) + case "$QEMU" in + /*) + AC_MSG_RESULT([yes]) + ;; + *) + AC_MSG_RESULT([no]) + AC_MSG_ERROR([--with-qemu=$QEMU must be an absolute path]) + ;; + esac + AC_DEFINE_UNQUOTED([QEMU],["$QEMU"],[Location of qemu binary.]) ]) -- 2.13.2
Reasonably Related Threads
- [PATCH] Allow ./configure --without-qemu.
- [PATCH] configure: simplify the qemu cpu mapping
- [PATCH 00/16] Refactoring of configure.ac and guestfs.pod
- [PATCH] launch: switch from -nographic to -display none
- [PATCH 1/4] febootstrap: Look for insmod.static, mke2fs in /sbin