[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH] configure: simplify the qemu cpu mapping



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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]