[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/12] meson: simplify logic for -Dfdt
From: |
Paolo Bonzini |
Subject: |
[PULL 09/12] meson: simplify logic for -Dfdt |
Date: |
Fri, 26 May 2023 18:08:21 +0200 |
fdt_opt == 'disabled' is going to give an error if libfdt is required
by any target, so catch that immediately. For fdt_opt == 'enabled',
instead, do not check immediately whether the internal libfdt is present.
Instead do the check after ascertaining that libfdt is absent or too old.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
meson.build | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/meson.build b/meson.build
index ee1b7dac730b..218428841d36 100644
--- a/meson.build
+++ b/meson.build
@@ -3059,13 +3059,14 @@ if have_system and vfio_user_server_allowed
endif
fdt = not_found
-if have_system
- fdt_opt = get_option('fdt')
+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']
- have_internal = fs.exists(meson.current_source_dir() /
'dtc/libfdt/Makefile.libfdt')
- fdt = cc.find_library('fdt',
- required: fdt_opt == 'system' or
- fdt_opt == 'enabled' and not have_internal)
+ fdt = cc.find_library('fdt', required: fdt_opt == 'system')
if fdt.found() and cc.links('''
#include <libfdt.h>
#include <libfdt_env.h>
@@ -3074,14 +3075,19 @@ if have_system
fdt_opt = 'system'
elif fdt_opt == 'system'
error('system libfdt requested, but it is too old (1.5.1 or newer
required)')
- elif have_internal
- fdt_opt = 'internal'
else
- fdt_opt = 'disabled'
+ fdt_opt = 'internal'
fdt = not_found
endif
endif
- if fdt_opt == 'internal'
+ if not fdt.found()
+ assert(fdt_opt == 'internal')
+ have_internal = fs.exists(meson.current_source_dir() /
'subprojects/dtc/meson.build')
+
+ if not have_internal
+ error('libfdt source not found - please pull git submodule')
+ endif
+
fdt_files = files(
'dtc/libfdt/fdt.c',
'dtc/libfdt/fdt_ro.c',
@@ -3106,9 +3112,6 @@ if have_system
else
fdt_opt = 'disabled'
endif
-if not fdt.found() and fdt_required.length() > 0
- error('fdt not available but required by targets ' + ', '.join(fdt_required))
-endif
config_host_data.set('CONFIG_CAPSTONE', capstone.found())
config_host_data.set('CONFIG_FDT', fdt.found())
--
2.40.1
- [PULL 01/12] tests/docker: simplify HOST_ARCH definition, (continued)
- [PULL 01/12] tests/docker: simplify HOST_ARCH definition, Paolo Bonzini, 2023/05/26
- [PULL 02/12] tests/vm: fix and simplify HOST_ARCH definition, Paolo Bonzini, 2023/05/26
- [PULL 03/12] Makefile: remove $(TESTS_PYTHON), Paolo Bonzini, 2023/05/26
- [PULL 04/12] configure: unset harmful environment variables, Paolo Bonzini, 2023/05/26
- [PULL 08/12] virtio: qmp: fix memory leak, Paolo Bonzini, 2023/05/26
- [PULL 05/12] meson: Remove leftover comment, Paolo Bonzini, 2023/05/26
- [PULL 07/12] slirp: update wrap to latest master, Paolo Bonzini, 2023/05/26
- [PULL 09/12] meson: simplify logic for -Dfdt,
Paolo Bonzini <=
- [PULL 10/12] meson: use subproject for internal libfdt, Paolo Bonzini, 2023/05/26
- [PULL 11/12] meson: use subproject for keycodemapdb, Paolo Bonzini, 2023/05/26
- [PULL 12/12] configure: ignore --make, Paolo Bonzini, 2023/05/26
- [PULL 06/12] meson: Add static glib dependency for initrd-stress.img, Paolo Bonzini, 2023/05/26
- Re: [PULL 00/12] (Mostly) build system patches for 2023-05-26, Richard Henderson, 2023/05/26