Treat libfdt like slirp and the other dependencies that use --enable-download; remove the ability to force usage of the subproject.
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> --- meson.build | 69 +++++++++++++++-------------------- meson_options.txt | 6 +-- scripts/meson-buildoptions.sh | 4 +- 3 files changed, 34 insertions(+), 45 deletions(-) diff --git a/meson.build b/meson.build index 43da4923721..530f92c0a9c 100644 --- a/meson.build +++ b/meson.build @@ -1858,6 +1858,30 @@ if numa.found() and not cc.links(''' endif endif +fdt = not_found +if get_option('fdt').disable_auto_if(not have_system).allowed() + fdt = cc.find_library('fdt', required: false) + if fdt.found() + if not cc.links(''' + #include <libfdt.h> + #include <libfdt_env.h> + int main(void) { fdt_find_max_phandle(NULL, NULL); return 0; }''', + dependencies: fdt) + libfdt_proj = subproject('dtc', required: get_option('fdt'), + default_options: ['tools=false', 'yaml=disabled', + 'python=disabled', 'default_library=static']) + fdt = libfdt_proj.get_variable('libfdt_dep') + endif + if not fdt.found() + if get_option('fdt').enabled() + error('libfdt found but too old (1.5.1 or newer required)') + else + warning('libfdt found but too old (1.5.1 or newer required)') + endif + endif + endif +endif + rdma = not_found if not get_option('rdma').auto() or have_system libumad = cc.find_library('ibumad', required: get_option('rdma')) @@ -2199,6 +2223,7 @@ config_host_data.set('CONFIG_BSD', host_os in bsd_oses) config_host_data.set('CONFIG_CAPSTONE', capstone.found()) config_host_data.set('CONFIG_COCOA', cocoa.found()) config_host_data.set('CONFIG_DARWIN', host_os == 'darwin') +config_host_data.set('CONFIG_FDT', fdt.found()) config_host_data.set('CONFIG_FUZZ', get_option('fuzzing')) config_host_data.set('CONFIG_GCOV', get_option('b_coverage')) config_host_data.set('CONFIG_LIBUDEV', libudev.found()) @@ -3120,6 +3145,10 @@ genh += custom_target('config-poison.h', command: [find_program('scripts/make-config-poison.sh'), target_configs_h]) +if fdt_required.length() > 0 and not fdt.found() + error('fdt disabled but required by targets ' + ', '.join(fdt_required)) +endif + ############### # Subprojects # ############### @@ -3130,44 +3159,6 @@ if have_system and vfio_user_server_allowed libvfio_user_dep = libvfio_user_proj.get_variable('libvfio_user_dep') endif -fdt = not_found -fdt_opt = get_option('fdt') -if fdt_required.length() > 0 or fdt_opt == 'enabled' - if fdt_opt == 'disabled' - error('fdt disabled but required by targets ' + ', '.join(fdt_required)) - endif - - if fdt_opt in ['enabled', 'auto', 'system'] - if get_option('wrap_mode') == 'nodownload' - fdt_opt = 'system' - endif - fdt = cc.find_library('fdt', required: fdt_opt == 'system') - if fdt.found() and cc.links(''' - #include <libfdt.h> - #include <libfdt_env.h> - int main(void) { fdt_find_max_phandle(NULL, NULL); return 0; }''', - dependencies: fdt) - fdt_opt = 'system' - elif fdt_opt == 'system' - error('system libfdt requested, but it is too old (1.5.1 or newer required)') - else - fdt_opt = 'internal' - fdt = not_found - endif - endif - if not fdt.found() - assert(fdt_opt == 'internal') - libfdt_proj = subproject('dtc', required: true, - default_options: ['tools=false', 'yaml=disabled', - 'python=disabled', 'default_library=static']) - fdt = libfdt_proj.get_variable('libfdt_dep') - endif -else - fdt_opt = 'disabled' -endif - -config_host_data.set('CONFIG_FDT', fdt.found()) - vhost_user = not_found if host_os == 'linux' and have_vhost_user libvhost_user = subproject('libvhost-user') @@ -4411,7 +4402,7 @@ summary_info += {'Linux AIO support': libaio} summary_info += {'Linux io_uring support': linux_io_uring} summary_info += {'ATTR/XATTR support': libattr} summary_info += {'RDMA support': rdma} -summary_info += {'fdt support': fdt_opt == 'disabled' ? false : fdt_opt} +summary_info += {'fdt support': fdt} summary_info += {'libcap-ng support': libcap_ng} summary_info += {'bpf support': libbpf} summary_info += {'rbd support': rbd} diff --git a/meson_options.txt b/meson_options.txt index adc77bae0cd..90902c19d1c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -308,9 +308,9 @@ option('vduse_blk_export', type: 'feature', value: 'auto', option('capstone', type: 'feature', value: 'auto', description: 'Whether and how to find the capstone library') -option('fdt', type: 'combo', value: 'auto', - choices: ['disabled', 'enabled', 'auto', 'system', 'internal'], - description: 'Whether and how to find the libfdt library') +option('fdt', type: 'feature', value: 'auto', + deprecated: { 'system': 'enabled' }, + description: 'device tree support') option('selinux', type: 'feature', value: 'auto', description: 'SELinux support in qemu-nbd') diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 0a29d35fdb6..d816b35a2f4 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -33,8 +33,6 @@ meson_options_help() { printf "%s\n" ' --enable-debug-stack-usage' printf "%s\n" ' measure coroutine stack usage' printf "%s\n" ' --enable-debug-tcg TCG debugging' - printf "%s\n" ' --enable-fdt[=CHOICE] Whether and how to find the libfdt library' - printf "%s\n" ' (choices: auto/disabled/enabled/internal/system)' printf "%s\n" ' --enable-fuzzing build fuzzing targets' printf "%s\n" ' --enable-gcov Enable coverage tracking.' printf "%s\n" ' --enable-lto Use link time optimization' @@ -113,6 +111,7 @@ meson_options_help() { printf "%s\n" ' dmg dmg image format support' printf "%s\n" ' docs Documentations build support' printf "%s\n" ' dsound DirectSound sound support' + printf "%s\n" ' fdt device tree support' printf "%s\n" ' fuse FUSE block device export' printf "%s\n" ' fuse-lseek SEEK_HOLE/SEEK_DATA support for FUSE exports' printf "%s\n" ' gcrypt libgcrypt cryptography support' @@ -310,7 +309,6 @@ _meson_option_parse() { --disable-dsound) printf "%s" -Ddsound=disabled ;; --enable-fdt) printf "%s" -Dfdt=enabled ;; --disable-fdt) printf "%s" -Dfdt=disabled ;; - --enable-fdt=*) quote_sh "-Dfdt=$2" ;; --enable-fuse) printf "%s" -Dfuse=enabled ;; --disable-fuse) printf "%s" -Dfuse=disabled ;; --enable-fuse-lseek) printf "%s" -Dfuse_lseek=enabled ;; -- 2.45.0