configure: improve handling of target lists
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
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
@@ -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
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.
Signed-off-by Peter Maydell <[email protected]>
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
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
Signed-off-by Peter Maydell <[email protected]>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
Re: [Qemu-devel] [PATCH 1/2] configure: Autogenerate default target list
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.
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
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
PATCH 2/2 configure: Report unknown target names more helpfully
In reply to Peter MaydellIf 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
@@ -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
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_64are 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
Anthony Liguori
AppliedApplied. Thanks.
Regards,
Anthony Liguori