[Libguestfs] [PATCH] configure: simplify the qemu cpu mapping
Richard W.M. Jones
rjones at redhat.com
Thu Nov 13 13:28:56 UTC 2014
On Wed, Nov 12, 2014 at 10:02:32AM +0100, Pino Toscano wrote:
> Use AS_CASE to properly map from the host cpu to the qemu cpu suffix;
> this avoids doing multiple string replacements using sed, and it is
> possible to use case-like syntax.
> ---
> configure.ac | 16 +++++++---------
> 1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index a571de5..75dfb37 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -755,15 +755,13 @@ AC_DEFINE_UNQUOTED([UNZIP],["$UNZIP"],[Name of unzip program.])
>
> dnl Check for QEMU for running binaries on this $host_cpu, fall
> dnl back to basic 'qemu'. Allow the user to override it.
> -qemu_system="$(
> - echo qemu-system-$host_cpu |
> - $SED -e 's/-i@<:@456@:>@86/-i386/g' \
> - -e 's/-arm.*/-arm/g' \
> - -e 's/-amd64/-x86_64/g' \
> - -e 's/-powerpc64/-ppc64/g' \
> - -e 's/-ppc64le/-ppc64/g'
> - )"
> -default_qemu="qemu-kvm kvm $qemu_system qemu"
> +AS_CASE([$host_cpu],
> + [i@<:@456@:>@86],[qemu_cpu=i386],
> + [arm*],[qemu_cpu=arm],
> + [amd64],[qemu_cpu=x86_64],
> + [powerpc64 | ppc64le],[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"@:>@])],
> --
> 1.9.3
Seems good to me, ACK.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
More information about the Libguestfs
mailing list