diff mbox

configure: Support --target-list=? to list available targets

Message ID 1303391455-5289-1-git-send-email-peter.maydell@linaro.org
State New
Headers show

Commit Message

Peter Maydell April 21, 2011, 1:10 p.m. UTC
Add support for getting configure to print the list of all targets
that can be built, via the option '--target-list=?'.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Yes, you can get the list of targets by running configure without
any arguments and then scrolling up to find the target list in
the screenful of output, but I think this is a bit more user-friendly.

 configure |   36 ++++++++++++++++++++++--------------
 1 files changed, 22 insertions(+), 14 deletions(-)

Comments

Stefan Weil April 21, 2011, 5:45 p.m. UTC | #1
Am 21.04.2011 15:10, schrieb Peter Maydell:
> Add support for getting configure to print the list of all targets
> that can be built, via the option '--target-list=?'.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Yes, you can get the list of targets by running configure without
> any arguments and then scrolling up to find the target list in
> the screenful of output, but I think this is a bit more user-friendly.
>
> configure | 36 ++++++++++++++++++++++--------------
> 1 files changed, 22 insertions(+), 14 deletions(-)

The qemu executable supports this use pattern (-cpu ?),
but it's unusual for configure.

Other options (--audio-drv-list=LIST, --audio-card-list=LIST)
show the available values in the help message (configure --help).

What about a similar help text for --target-list? Like this:

   --target-list=LIST       set target list []
                            Available targets: i386-softmmu ...
                            i386-linux-user ...

Users would not have to call configure twice to get the list of
available targets (the first call is configure --help because
they don't know whether it is --target, --targets, --targetlist
or --target-list).
Peter Maydell April 22, 2011, 12:50 a.m. UTC | #2
On 21 April 2011 18:45, Stefan Weil <weil@mail.berlios.de> wrote:
> Am 21.04.2011 15:10, schrieb Peter Maydell:
>> Add support for getting configure to print the list of all targets
>> that can be built, via the option '--target-list=?'.

> The qemu executable supports this use pattern (-cpu ?),
> but it's unusual for configure.
>
> Other options (--audio-drv-list=LIST, --audio-card-list=LIST)
> show the available values in the help message (configure --help).
>
> What about a similar help text for --target-list? Like this:
>
>  --target-list=LIST       set target list []
>                           Available targets: i386-softmmu ...
>                           i386-linux-user ...

The "[]" here is wrong, incidentally, because the bit in [] is
supposed to be the default value, which for the target list is
not "build no targets" but "build all targets". So we could
either say:

  --target-list=LIST       set target list (default: build everything)
                           Available targets: i386-softmmu ...
                           i386-linux-user ...

or

  --target-list=LIST       set target list [i386-softmmu ...
i386-linux-user ...]

I vaguely prefer the first but have no strong feelings.

The other issue is that the target list is vastly longer than
any of the existing lists in the help, so it probably needs
something to automatically format it so it doesn't mess up
the formatting of the --help message.

(We could perhaps support --option=? for all the options that
take a list, in addition to giving the supported values in
--help, but maybe that's overkill.)

-- PMM
diff mbox

Patch

diff --git a/configure b/configure
index da2da04..15330ea 100755
--- a/configure
+++ b/configure
@@ -834,7 +834,8 @@  echo "  --help                   print this message"
 echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
 echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."
 echo "                           use %M for cpu name [$interp_prefix]"
-echo "  --target-list=LIST       set target list [$target_list]"
+echo "  --target-list=LIST       set target list (default: build everything)"
+echo "                           use --target-list=? to list available targets"
 echo ""
 echo "Advanced options (experts only):"
 echo "  --source-path=PATH       path of source code [$source_path]"
@@ -1004,11 +1005,11 @@  if test "$solaris" = "yes" ; then
   fi
 fi
 
+default_target_list=""
 
-if test -z "$target_list" ; then
 # these targets are portable
-    if [ "$softmmu" = "yes" ] ; then
-        target_list="\
+if [ "$softmmu" = "yes" ] ; then
+    default_target_list="\
 i386-softmmu \
 x86_64-softmmu \
 arm-softmmu \
@@ -1029,10 +1030,10 @@  sh4eb-softmmu \
 sparc-softmmu \
 sparc64-softmmu \
 "
-    fi
+fi
 # the following are Linux specific
-    if [ "$linux_user" = "yes" ] ; then
-        target_list="${target_list}\
+if [ "$linux_user" = "yes" ] ; then
+    default_target_list="${default_target_list}\
 i386-linux-user \
 x86_64-linux-user \
 alpha-linux-user \
@@ -1054,20 +1055,27 @@  sparc64-linux-user \
 sparc32plus-linux-user \
 unicore32-linux-user \
 "
-    fi
+fi
 # the following are Darwin specific
-    if [ "$darwin_user" = "yes" ] ; then
-        target_list="$target_list i386-darwin-user ppc-darwin-user "
-    fi
+if [ "$darwin_user" = "yes" ] ; then
+    default_target_list="$default_target_list i386-darwin-user ppc-darwin-user "
+fi
 # the following are BSD specific
-    if [ "$bsd_user" = "yes" ] ; then
-        target_list="${target_list}\
+if [ "$bsd_user" = "yes" ] ; then
+    default_target_list="${default_target_list}\
 i386-bsd-user \
 x86_64-bsd-user \
 sparc-bsd-user \
 sparc64-bsd-user \
 "
-    fi
+fi
+
+if test -z "$target_list" ; then
+    target_list="$default_target_list"
+elif [ "$target_list" = "?" ]; then
+    echo "Supported targets: "
+    echo "$default_target_list"
+    exit 0
 else
     target_list=`echo "$target_list" | sed -e 's/,/ /g'`
 fi