diff mbox series

[RFC] configure: shorthand for only enabling native softmmu target

Message ID 20180314120906.30872-1-berrange@redhat.com
State New
Headers show
Series [RFC] configure: shorthand for only enabling native softmmu target | expand

Commit Message

Daniel P. Berrangé March 14, 2018, 12:09 p.m. UTC
With the huge number of QEMU targets, a default configuration will take
a very long time to rebuild. When developing most code changes, it is
sufficient to test compilation with a single target - rebuilding all
targets just extends compile times while not detecting any new problems.

Developers will often thus specify a single target for configure,
commonly matching the host architecture. eg

  ./configure --target-list=x86_64-softmmu

This works fine, but is a bit of a verbose thing to type out everytime
configure is invoked. There are already short-hand args to disable all
user targets, all softmmu targets, or all tcg targets. This adds one
further shorthand to disable all non-native architecture targets.

  ./configure --native

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---

Suggestions welcomed for better names than --native, but bear in mind
the goal is to minimise amount of typing so nothing too verbose, hence
why I didn't do something like --disable-non-native ...

 configure | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

Alex Bennée March 14, 2018, 6:04 p.m. UTC | #1
Daniel P. Berrangé <berrange@redhat.com> writes:

> With the huge number of QEMU targets, a default configuration will take
> a very long time to rebuild. When developing most code changes, it is
> sufficient to test compilation with a single target - rebuilding all
> targets just extends compile times while not detecting any new problems.
>
> Developers will often thus specify a single target for configure,
> commonly matching the host architecture. eg
>
>   ./configure --target-list=x86_64-softmmu

A while back I messed with a patch that allowed stems in --target-list
so you could quickly select targets with stems:

  Subject: [PATCH 0/4] Current Travis queue
  Date: Fri, 15 Apr 2016 16:56:57 +0100
  Message-Id: <1460735821-12775-1-git-send-email-alex.bennee@linaro.org>

but if I recall Peter was worried about it breaking existing configure
lines.

>
> This works fine, but is a bit of a verbose thing to type out everytime
> configure is invoked. There are already short-hand args to disable all
> user targets, all softmmu targets, or all tcg targets. This adds one
> further shorthand to disable all non-native architecture targets.
>
>   ./configure --native

I'm not sure this is really the case. My history tends to be littered
with things like:

  ./configure --enable-debug --enable-debug-tcg --extra-cflags="-O0 -g3" --target-list=aarch64-linux-user

when compile time is an issue although my development box is an x86.
Normally I do compile all targets and rely on ccache to keep the compile
time reasonable.

>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>
> Suggestions welcomed for better names than --native, but bear in mind
> the goal is to minimise amount of typing so nothing too verbose, hence
> why I didn't do something like --disable-non-native ...

I would argue it's "almost" equivalent to --disable-tcg as most native
users in my experience aren't looking to run X on X via TCG. I could be
wrong of course.

>
>  configure | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>
> diff --git a/configure b/configure
> index af72fc852e..807af93116 100755
> --- a/configure
> +++ b/configure
> @@ -233,6 +233,22 @@ supported_whpx_target() {
>      return 1
>  }
>
> +supported_native_target() {
> +    glob "$1" "*-softmmu" || return 1
> +    case "${1%-softmmu}:$cpu" in
> +        arm:arm | aarch64:aarch64 | \
> +        i386:i386 | i386:x32 | \
> +        x86_64:x86_64 | \
> +        mips:mips | mipsel:mips | \
> +        ppc:ppc | ppcemb:ppc | \
> +        ppc64:ppc64 | \
> +        s390x:s390x)
> +            return 0
> +        ;;
> +    esac
> +    return 1
> +}
> +

This strikes me as another place to mess about with when doing target
specific changes to configure.

>  supported_target() {
>      case "$1" in
>          *-softmmu)
> @@ -254,6 +270,10 @@ supported_target() {
>              return 1
>              ;;
>      esac
> +    if test "$native" = "yes"
> +    then
> +	supported_native_target "$1" || return 1
> +    fi
>      test "$tcg" = "yes" && return 0
>      supported_kvm_target "$1" && return 0
>      supported_xen_target "$1" && return 0
> @@ -390,6 +410,7 @@ cocoa="no"
>  softmmu="yes"
>  linux_user="no"
>  bsd_user="no"
> +native="no"
>  blobs="yes"
>  pkgversion=""
>  pie=""
> @@ -1112,6 +1133,8 @@ for opt do
>        cocoa="yes" ;
>        audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)"
>    ;;
> +  --native) native="yes"
> +  ;;
>    --disable-system) softmmu="no"
>    ;;
>    --enable-system) softmmu="yes"
> @@ -1540,6 +1563,7 @@ Advanced options (experts only):
>                             xen pv domain builder
>    --enable-debug-stack-usage
>                             track the maximum stack usage of stacks created by qemu_alloc_stack
> +  --native                 only enable the softmmu target matching host architecture
>
>  Optional features, enabled with --enable-FEATURE and
>  disabled with --disable-FEATURE, default is enabled if available:


--
Alex Bennée
Peter Maydell March 14, 2018, 6:20 p.m. UTC | #2
On 14 March 2018 at 12:09, Daniel P. Berrangé <berrange@redhat.com> wrote:
> With the huge number of QEMU targets, a default configuration will take
> a very long time to rebuild. When developing most code changes, it is
> sufficient to test compilation with a single target - rebuilding all
> targets just extends compile times while not detecting any new problems.
>
> Developers will often thus specify a single target for configure,
> commonly matching the host architecture. eg
>
>   ./configure --target-list=x86_64-softmmu
>
> This works fine, but is a bit of a verbose thing to type out everytime
> configure is invoked. There are already short-hand args to disable all
> user targets, all softmmu targets, or all tcg targets. This adds one
> further shorthand to disable all non-native architecture targets.
>
>   ./configure --native

How common actually is that, though? Almost all the time when
I'm picking targets I want something that's *not* the native
target...

More to the point, I actually only fairly rarely run configure
by hand at all. I have a source tree, with a subdir build/
which I have lots of subdirectories of for each config I
care about or have cared about. So if I want to do something
with sparc I'll just use 'make -C build/sparc' which will
automatically rerun configure with the right arguments, because
they're in the config.status in that build tree.

And as Alex points out you already usually want to feed
configure a pile of options, like --enable-debug. I also
like --with-pkgversion=foo, because without that the
version depends on the git commit hash, which means
every time the git hash changes multiple files and
executables get pointlessly rebuilt because the version
string changed. Keeping build dirs around means that
all this sort of customisation of options stays around.

So I'm not hugely keen on this patch, because it saves
20 characters on a command line that really ought not to
need typing more than once a month at most, but it
adds another messy case statement in configure that
knows about multiple architecture and subarchitecture
names.

thanks
-- PMM
diff mbox series

Patch

diff --git a/configure b/configure
index af72fc852e..807af93116 100755
--- a/configure
+++ b/configure
@@ -233,6 +233,22 @@  supported_whpx_target() {
     return 1
 }
 
+supported_native_target() {
+    glob "$1" "*-softmmu" || return 1
+    case "${1%-softmmu}:$cpu" in
+        arm:arm | aarch64:aarch64 | \
+        i386:i386 | i386:x32 | \
+        x86_64:x86_64 | \
+        mips:mips | mipsel:mips | \
+        ppc:ppc | ppcemb:ppc | \
+        ppc64:ppc64 | \
+        s390x:s390x)
+            return 0
+        ;;
+    esac
+    return 1
+}
+
 supported_target() {
     case "$1" in
         *-softmmu)
@@ -254,6 +270,10 @@  supported_target() {
             return 1
             ;;
     esac
+    if test "$native" = "yes"
+    then
+	supported_native_target "$1" || return 1
+    fi
     test "$tcg" = "yes" && return 0
     supported_kvm_target "$1" && return 0
     supported_xen_target "$1" && return 0
@@ -390,6 +410,7 @@  cocoa="no"
 softmmu="yes"
 linux_user="no"
 bsd_user="no"
+native="no"
 blobs="yes"
 pkgversion=""
 pie=""
@@ -1112,6 +1133,8 @@  for opt do
       cocoa="yes" ;
       audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)"
   ;;
+  --native) native="yes"
+  ;;
   --disable-system) softmmu="no"
   ;;
   --enable-system) softmmu="yes"
@@ -1540,6 +1563,7 @@  Advanced options (experts only):
                            xen pv domain builder
   --enable-debug-stack-usage
                            track the maximum stack usage of stacks created by qemu_alloc_stack
+  --native                 only enable the softmmu target matching host architecture
 
 Optional features, enabled with --enable-FEATURE and
 disabled with --disable-FEATURE, default is enabled if available: