diff mbox series

[v1,3/6] configure: add --without-default-features

Message ID 20201209170059.20742-4-alex.bennee@linaro.org
State Superseded
Headers show
Series testing/next (without-features, gitlab, python) | expand

Commit Message

Alex Bennée Dec. 9, 2020, 5 p.m. UTC
By default QEMU enables a lot of features if it can probe and find the
support libraries. It also enables a bunch of features by default.
This patch adds the ability to build --without-default-features which
can be paired with a --without-default-devices for a barely functional
build.

The main use case for this is testing our build assumptions and for
minimising the amount of stuff you build if you just want to test a
particular feature on your relatively slow emulated test system.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 configure | 159 ++++++++++++++++++++++++++++++------------------------
 1 file changed, 88 insertions(+), 71 deletions(-)

-- 
2.20.1

Comments

Paolo Bonzini Dec. 10, 2020, 12:08 a.m. UTC | #1
On 09/12/20 18:00, Alex Bennée wrote:
> By default QEMU enables a lot of features if it can probe and find the

> support libraries. It also enables a bunch of features by default.

> This patch adds the ability to build --without-default-features which

> can be paired with a --without-default-devices for a barely functional

> build.

> 

> The main use case for this is testing our build assumptions and for

> minimising the amount of stuff you build if you just want to test a

> particular feature on your relatively slow emulated test system.

> 

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>   configure | 159 ++++++++++++++++++++++++++++++------------------------

>   1 file changed, 88 insertions(+), 71 deletions(-)

> 

> diff --git a/configure b/configure

> index 8f2095a2db..a08e6c96e0 100755

> --- a/configure

> +++ b/configure

> @@ -291,10 +291,24 @@ unset target_list_exclude

>   #

>   # Always add --enable-foo and --disable-foo command line args.

>   # Distributions want to ensure that several features are compiled in, and it

> -# is impossible without a --enable-foo that exits if a feature is not found.

> +# is impossible without a --enable-foo that exits if a feature is not

> +# found.

>   

> -brlapi=""

> -curl=""

> +default_feature=""

> +default_yes_feature="yes"

> +# parse CC options second

> +for opt do

> +  optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')

> +  case "$opt" in

> +      --without-default-features)

> +          default_feature="no"

> +          default_yes_feature="no"


default_yes_features can be replaced with ${default_feature:-yes} if you 
wish.

> +  ;;

> +  esac

> +done


Since Meson has equivalent functionality to --without-default-features, 
you also want to add -Dauto_features=disabled to the meson command line.

Also, the gettext feature is true/false/empty rather than yes/no, so 
it's not being adjusted.  I suggest you change it (in meson_options.txt) 
from "boolean" to "feature" (auto/enabled/disabled) and move the 
detection code from configure to po/meson.build.  It should be as simple as

-if get_option('gettext')
+if find_program('xgettext', required: get_option('gettext')).found()

and then it will also get the functionality from -Dauto_features.

Paolo

> @@ -453,7 +467,7 @@ gettext=""

>   bogus_os="no"

>   malloc_trim="auto"

>   

> -# parse CC options first

> +# parse CC options second

>   for opt do

>     optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')

>     case "$opt" in

> @@ -796,7 +810,7 @@ Linux)

>     audio_possible_drivers="oss alsa sdl pa"

>     linux="yes"

>     linux_user="yes"

> -  vhost_user="yes"

> +  vhost_user="$default_yes_feature"

>   ;;

>   esac

>   

> @@ -940,6 +954,8 @@ for opt do

>     ;;

>     --without-default-devices) default_devices="no"

>     ;;

> +  --without-default-features) # processed above

> +  ;;

>     --enable-gprof) gprof="yes"

>     ;;

>     --enable-gcov) gcov="yes"

> @@ -1737,7 +1753,8 @@ Advanced options (experts only):

>     --gdb=GDB-path           gdb to use for gdbstub tests [$gdb_bin]

>   

>   Optional features, enabled with --enable-FEATURE and

> -disabled with --disable-FEATURE, default is enabled if available:

> +disabled with --disable-FEATURE, default is enabled if available

> +(unless built with --without-default-features):

>   

>     system          all system emulation targets

>     user            supported user emulation targets

>
diff mbox series

Patch

diff --git a/configure b/configure
index 8f2095a2db..a08e6c96e0 100755
--- a/configure
+++ b/configure
@@ -291,10 +291,24 @@  unset target_list_exclude
 #
 # Always add --enable-foo and --disable-foo command line args.
 # Distributions want to ensure that several features are compiled in, and it
-# is impossible without a --enable-foo that exits if a feature is not found.
+# is impossible without a --enable-foo that exits if a feature is not
+# found.
 
-brlapi=""
-curl=""
+default_feature=""
+default_yes_feature="yes"
+# parse CC options second
+for opt do
+  optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
+  case "$opt" in
+      --without-default-features)
+          default_feature="no"
+          default_yes_feature="no"
+  ;;
+  esac
+done
+
+brlapi="$default_feature"
+curl="$default_feature"
 iconv="auto"
 curses="auto"
 docs="auto"
@@ -303,52 +317,52 @@  netmap="no"
 sdl="auto"
 sdl_image="auto"
 virtiofsd="auto"
-virtfs=""
+virtfs="$default_feature"
 libudev="auto"
 mpath="auto"
 vnc="enabled"
 sparse="auto"
-vde=""
+vde="$default_feature"
 vnc_sasl="auto"
 vnc_jpeg="auto"
 vnc_png="auto"
 xkbcommon="auto"
-xen=""
-xen_ctrl_version=""
+xen="$default_feature"
+xen_ctrl_version="$default_feature"
 xen_pci_passthrough="auto"
-linux_aio=""
-linux_io_uring=""
-cap_ng=""
-attr=""
-libattr=""
-xfs=""
+linux_aio="$default_feature"
+linux_io_uring="$default_feature"
+cap_ng="$default_feature"
+attr="$default_feature"
+libattr="$default_feature"
+xfs="$default_feature"
 tcg="enabled"
-membarrier=""
-vhost_net=""
-vhost_crypto=""
-vhost_scsi=""
-vhost_vsock=""
+membarrier="$default_feature"
+vhost_net="$default_feature"
+vhost_crypto="$default_feature"
+vhost_scsi="$default_feature"
+vhost_vsock="$default_feature"
 vhost_user="no"
 vhost_user_blk_server="auto"
-vhost_user_fs=""
+vhost_user_fs="$default_feature"
 kvm="auto"
 hax="auto"
 hvf="auto"
 whpx="auto"
-rdma=""
-pvrdma=""
+rdma="$default_feature"
+pvrdma="$default_feature"
 gprof="no"
 debug_tcg="no"
 debug="no"
 sanitizers="no"
 tsan="no"
-fortify_source=""
+fortify_source="$default_feature"
 strip_opt="yes"
 tcg_interpreter="no"
 bigendian="no"
 mingw32="no"
 gcov="no"
-EXESUF=""
+EXESUF="$default_feature"
 HOST_DSOSUF=".so"
 modules="no"
 module_upgrades="no"
@@ -370,81 +384,81 @@  pie=""
 qom_cast_debug="yes"
 trace_backends="log"
 trace_file="trace"
-spice=""
-rbd=""
-smartcard=""
+spice="$default_feature"
+rbd="$default_feature"
+smartcard="$default_feature"
 u2f="auto"
-libusb=""
-usb_redir=""
-opengl=""
+libusb="$default_feature"
+usb_redir="$default_feature"
+opengl="$default_feature"
 opengl_dmabuf="no"
 cpuid_h="no"
-avx2_opt=""
+avx2_opt="$default_feature"
 capstone="auto"
-lzo=""
-snappy=""
-bzip2=""
-lzfse=""
-zstd=""
-guest_agent=""
+lzo="$default_feature"
+snappy="$default_feature"
+bzip2="$default_feature"
+lzfse="$default_feature"
+zstd="$default_feature"
+guest_agent="$default_feature"
 guest_agent_with_vss="no"
 guest_agent_ntddscsi="no"
-guest_agent_msi=""
-vss_win32_sdk=""
+guest_agent_msi="$default_feature"
+vss_win32_sdk="$default_feature"
 win_sdk="no"
-want_tools=""
-libiscsi=""
-libnfs=""
+want_tools="$default_feature"
+libiscsi="$default_feature"
+libnfs="$default_feature"
 coroutine=""
-coroutine_pool=""
+coroutine_pool="$default_feature"
 debug_stack_usage="no"
 crypto_afalg="no"
-seccomp=""
-glusterfs=""
+seccomp="$default_feature"
+glusterfs="$default_feature"
 glusterfs_xlator_opt="no"
 glusterfs_discard="no"
 glusterfs_fallocate="no"
 glusterfs_zerofill="no"
 glusterfs_ftruncate_has_stat="no"
 glusterfs_iocb_has_stat="no"
-gtk=""
+gtk="$default_feature"
 gtk_gl="no"
 tls_priority="NORMAL"
-gnutls=""
-nettle=""
+gnutls="$default_feature"
+nettle="$default_feature"
 nettle_xts="no"
-gcrypt=""
+gcrypt="$default_feature"
 gcrypt_hmac="no"
 gcrypt_xts="no"
 qemu_private_xts="yes"
-auth_pam=""
-vte=""
-virglrenderer=""
-tpm=""
-libssh=""
-live_block_migration="yes"
-numa=""
+auth_pam="$default_feature"
+vte="$default_feature"
+virglrenderer="$default_feature"
+tpm="$default_feature"
+libssh="$default_feature"
+live_block_migration="$default_yes_feature"
+numa="$default_feature"
 tcmalloc="no"
 jemalloc="no"
-replication="yes"
-bochs="yes"
-cloop="yes"
-dmg="yes"
-qcow1="yes"
-vdi="yes"
-vvfat="yes"
-qed="yes"
-parallels="yes"
+replication="$default_yes_feature"
+bochs="$default_yes_feature"
+cloop="$default_yes_feature"
+dmg="$default_yes_feature"
+qcow1="$default_yes_feature"
+vdi="$default_yes_feature"
+vvfat="$default_yes_feature"
+qed="$default_yes_feature"
+parallels="$default_yes_feature"
 sheepdog="no"
-libxml2=""
+libxml2="$default_feature"
 debug_mutex="no"
-libpmem=""
+libpmem="$default_feature"
 default_devices="yes"
 plugins="no"
 fuzzing="no"
 rng_none="no"
-secret_keyring=""
-libdaxctl=""
+secret_keyring="$default_feature"
+libdaxctl="$default_feature"
 meson=""
 ninja=""
 skip_meson=no
@@ -453,7 +467,7 @@  gettext=""
 bogus_os="no"
 malloc_trim="auto"
 
-# parse CC options first
+# parse CC options second
 for opt do
   optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
   case "$opt" in
@@ -796,7 +810,7 @@  Linux)
   audio_possible_drivers="oss alsa sdl pa"
   linux="yes"
   linux_user="yes"
-  vhost_user="yes"
+  vhost_user="$default_yes_feature"
 ;;
 esac
 
@@ -940,6 +954,8 @@  for opt do
   ;;
   --without-default-devices) default_devices="no"
   ;;
+  --without-default-features) # processed above
+  ;;
   --enable-gprof) gprof="yes"
   ;;
   --enable-gcov) gcov="yes"
@@ -1737,7 +1753,8 @@  Advanced options (experts only):
   --gdb=GDB-path           gdb to use for gdbstub tests [$gdb_bin]
 
 Optional features, enabled with --enable-FEATURE and
-disabled with --disable-FEATURE, default is enabled if available:
+disabled with --disable-FEATURE, default is enabled if available
+(unless built with --without-default-features):
 
   system          all system emulation targets
   user            supported user emulation targets