Skip to contentSkip to conversation

configure: improve handling of target lists

PATCH Applied Peter Maydell 4 participants 10 messages May 20, 2013 – Jun 10, 2013

lore
Share & tools
lore
#7 lore raw

PATCH 2/2 configure: Report unknown target names more helpfully

In reply to Peter Maydell

If the user specifies a target list themselves, check each entry to make sure it's a target we recognise. This allows us to print a helpful error message, rather than falling through (where we would probably eventually end up hitting the uninformative "ERROR: Unsupported target CPU").

---
 configure |   13 +++++++++++++
 1 file changed, 13 insertions(+)
configure +13 -0
index e0fa143..4b74a94 100755
@@ -1338,6 +1338,19 @@ if test -z "${target_list+xxx}" ; then
 else
     target_list=`echo "$target_list" | sed -e 's/,/ /g'`
 fi
+
+# Check that we recognised the target name; this allows a more
+# friendly error message than if we let it fall through.
+for target in $target_list; do
+    case " $default_target_list " in
+        *" $target "*)
+            ;;
+        *)
+            error_exit "Unknown target name '$target'"
+            ;;
+    esac
+done
+
 # see if system emulation was really requested
 case " $target_list " in
   *"-softmmu "*) softmmu=yes
Signature · 1 line
1.7.9.5
#0 lore raw

cover configure: improve handling of target lists

These patches clean up configure's handling of the list of known targets. Firstly we autogenerate the default list based on the set of default-config files; this reduces by 1 the number of places that need editing when a new target is added to QEMU. Secondly we improve the quality of our error message if you ask configure to build for something we don't recognise.

NB that autogenerating the default list changes configure's --help output very slightly, in that the alpha sort means that i386 and x86_64 are no longer together at the top of the list. (It is entirely coincidental that aarch64 will now be at the top of the list when it is added :-) )

Peter Maydell (2):
configure: Autogenerate default target list
configure: Report unknown target names more helpfully

 configure |   97 +++++++++++++++++--------------------------------------------
 1 file changed, 27 insertions(+), 70 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/2 configure: Autogenerate default target list

Autogenerate the default target list based on what files exist in default-configs; this allows us to remove one of the places that has to be kept up to date with a complete list of every target we support.

---
 configure |   84 +++++++++++--------------------------------------------------
 1 file changed, 14 insertions(+), 70 deletions(-)
configure +14 -70
index 9439f1c..e0fa143 100755
@@ -970,78 +970,22 @@ EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
 
 default_target_list=""
 
-# these targets are portable
-if [ "$softmmu" = "yes" ] ; then
-    default_target_list="\
-i386-softmmu \
-x86_64-softmmu \
-alpha-softmmu \
-arm-softmmu \
-cris-softmmu \
-lm32-softmmu \
-m68k-softmmu \
-microblaze-softmmu \
-microblazeel-softmmu \
-mips-softmmu \
-mipsel-softmmu \
-mips64-softmmu \
-mips64el-softmmu \
-moxie-softmmu \
-or32-softmmu \
-ppc-softmmu \
-ppcemb-softmmu \
-ppc64-softmmu \
-sh4-softmmu \
-sh4eb-softmmu \
-sparc-softmmu \
-sparc64-softmmu \
-s390x-softmmu \
-xtensa-softmmu \
-xtensaeb-softmmu \
-unicore32-softmmu \
-"
-fi
-# the following are Linux specific
-if [ "$linux_user" = "yes" ] ; then
-    default_target_list="${default_target_list}\
-i386-linux-user \
-x86_64-linux-user \
-alpha-linux-user \
-arm-linux-user \
-armeb-linux-user \
-cris-linux-user \
-m68k-linux-user \
-microblaze-linux-user \
-microblazeel-linux-user \
-mips-linux-user \
-mipsel-linux-user \
-mips64-linux-user \
-mips64el-linux-user \
-mipsn32-linux-user \
-mipsn32el-linux-user \
-or32-linux-user \
-ppc-linux-user \
-ppc64-linux-user \
-ppc64abi32-linux-user \
-sh4-linux-user \
-sh4eb-linux-user \
-sparc-linux-user \
-sparc64-linux-user \
-sparc32plus-linux-user \
-unicore32-linux-user \
-s390x-linux-user \
-"
-fi
-# the following are BSD specific
-if [ "$bsd_user" = "yes" ] ; then
-    default_target_list="${default_target_list}\
-i386-bsd-user \
-x86_64-bsd-user \
-sparc-bsd-user \
-sparc64-bsd-user \
-"
+mak_wilds=""
+
+if [ "$softmmu" = "yes" ]; then
+    mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
+fi
+if [ "$linux_user" = "yes" ]; then
+    mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
+fi
+if [ "$bsd_user" = "yes" ]; then
+    mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
 fi
 
+for config in $mak_wilds; do
+    default_target_list="${default_target_list} $(basename "$config" .mak)"
+done
+
 if test x"$show_help" = x"yes" ; then
 cat << EOF
 
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] configure: Autogenerate default target list

Am 20.05.2013 17:16, schrieb Peter Maydell:

Quoted 6 lines

Autogenerate the default target list based on what files exist in default-configs; this allows us to remove one of the places that has to be kept up to date with a complete list of every target we support.

In the past we have had differences between targets compilable and targets fully implemented and thus not in the default list (mipsn32 and mips64 linux-user). They could then be tested by the brave using --target-list and --disable-werror.

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#3 lore raw

Re: [Qemu-devel] [PATCH 1/2] configure: Autogenerate default target list

Quoted 6 lines · Andreas Färber

Am 20.05.2013 17:16, schrieb Peter Maydell:

Quoted 5 lines

Autogenerate the default target list based on what files exist in default-configs; this allows us to remove one of the places that has to be kept up to date with a complete list of every target we support.

Quoted 6 lines
Quoted 1 line

In the past we have had differences between targets compilable and targets fully implemented and thus not in the default list (mipsn32 and mips64 linux-user). They could then be tested by the brave using --target-list and --disable-werror.

I suspect that any target we have in tree but not in the default list is liable to bitrot because nobody will compile test it (and indeed nobody knows about it since it's undocumented).

That said, we could have an experimental-configs/ to go with default-configs/, such that we allow --target-list=foo if there's an experimental-configs/ file but don't default to it (and we could even print a "warning, this is an experimental target!" message if we were feeling friendly, and have an --enable-experimental-targets options so buildbots could at least compiletest them).

I'm not sure that's worth the effort at this point when we don't actually have any targets in tree which aren't enabled by default, though. (I did cross-check the old and new lists so this patch isn't accidentally enabling a previously disabled config.)

thanks
-- PMM

#8 lore raw
In reply to Peter Maydell
Quoted 7 lines · Peter Maydell

These patches clean up configure's handling of the list of known targets. Firstly we autogenerate the default list based on the set of default-config files; this reduces by 1 the number of places that need editing when a new target is added to QEMU. Secondly we improve the quality of our error message if you ask configure to build for something we don't recognise.

Quoted 5 lines

NB that autogenerating the default list changes configure's --help output very slightly, in that the alpha sort means that i386 and x86_64 are no longer together at the top of the list. (It is entirely coincidental that aarch64 will now be at the top of the list when it is added :-) )

Ping!

thanks
-- PMM

#4 lore raw

Re: [Qemu-devel] [PATCH 1/2] configure: Autogenerate default target list

In reply to Peter Maydell
Quoted 4 lines · Peter Maydell

I'm not sure that's worth the effort at this point when we don't actually have any targets in tree which aren't enabled by default, though. (I did cross-check the old and new lists so this patch isn't accidentally enabling a previously disabled config.)

We do have some targets in the tree not enabled by default: arm and mips bsd-user. There's work in progress on both of these, and both are working with the patch set currently in the FreeBSD ports tree, but they don't currently build in git head.

I'll send a patch to temporarily revert the bsd-user list to an explicit set until the WIP is ready to submit, if that's acceptable.

#5 lore raw

Re: [Qemu-devel] [PATCH 1/2] configure: Autogenerate default target list

Quoted 6 lines · Ed Maste
Quoted 4 lines · Peter Maydell

I'm not sure that's worth the effort at this point when we don't actually have any targets in tree which aren't enabled by default, though. (I did cross-check the old and new lists so this patch isn't accidentally enabling a previously disabled config.)

Quoted 7 lines

We do have some targets in the tree not enabled by default: arm and mips bsd-user. There's work in progress on both of these, and both are working with the patch set currently in the FreeBSD ports tree, but they don't currently build in git head.

I'll send a patch to temporarily revert the bsd-user list to an explicit set until the WIP is ready to submit, if that's acceptable.

You don't need to do this, because there are no config files in default-configs/ for these, so this patch set will not change the behaviour for them.

(I checked that the set of defaults doesn't change from the previous specific list to the generated list.)

Do you need the "have a config in experimental-configs" functionality?

thanks
-- PMM

#6 lore raw

Re: [Qemu-devel] [PATCH 1/2] configure: Autogenerate default target list

Quoted 3 lines · Peter Maydell

You don't need to do this, because there are no config files in default-configs/ for these, so this patch set will not change the behaviour for them.

Oh, my apologies; I tested the bsd-user WIP at some point in the past, and it seems I have arm- and mips-bsd-user untracked files left over in default-configs/, so they started getting picked up after this change.

Quoted 2 lines

Do you need the "have a config in experimental-configs" functionality?

No, I don't think it's necessary. We'll just submit the target config along with the patch to get it working.

-Ed