On 11/05/21 17:53, Philippe Mathieu-Daudé wrote:
diff --git a/meson.build b/meson.build
index 0b41ff41188..1ffb4bccdb2 100644
--- a/meson.build
+++ b/meson.build
@@ -1612,7 +1612,7 @@
         int main(void) { fdt_check_full(NULL, 0); return 0; }''',
           dependencies: fdt)
        fdt_opt = 'system'
-    elif have_internal
+    elif have_internal and fdt_opt in ['enabled', 'auto']
        fdt_opt = 'internal'
      else

This will disable FDT silently for --enable-fdt=system instead of failing
the build.  What about:

diff --git a/meson.build b/meson.build
index 60040cd7cf..efb38ca780 100644
--- a/meson.build
+++ b/meson.build
@@ -1610,11 +1610,18 @@ if have_system
     fdt = cc.find_library('fdt', kwargs: static_kwargs,
                           required: fdt_opt == 'system' or
                                     fdt_opt == 'enabled' and not have_internal)
-    if fdt.found() and cc.links('''
+    if fdt.found() and not cc.links('''
        #include <libfdt.h>
        #include <libfdt_env.h>
        int main(void) { fdt_check_full(NULL, 0); return 0; }''',
          dependencies: fdt)
+      if fdt_opt == 'system' or
+         fdt_opt == 'enabled' and not have_internal then
+        error('libfdt is too old, version 1.5.1 required')
+      endif
+      fdt = not_found
+    endif
+    if fdt.found()
       fdt_opt = 'system'
     elif have_internal
       fdt_opt = 'internal'


Paolo


Reply via email to