[Qemu-devel] [RFC PATCH for 2.10 4/4] fdt: compile dtc submodule to check it is up-to-date

Philippe Mathieu-Daudé posted 4 patches 8 years, 6 months ago
[Qemu-devel] [RFC PATCH for 2.10 4/4] fdt: compile dtc submodule to check it is up-to-date
Posted by Philippe Mathieu-Daudé 8 years, 6 months ago
Reported-by: John Arbuckle <programmingkidx@gmail.com>
Message-Id: <65ED9743-B53C-4E6A-866F-C883650914CE@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 configure | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 2d803d6a77..386262ec33 100755
--- a/configure
+++ b/configure
@@ -3575,15 +3575,29 @@ EOF
     fdt=yes
   elif test -d ${source_path}/dtc/libfdt ; then
     # have submodule DTC - use it
-    fdt=yes
     dtc_internal="yes"
     mkdir -p dtc
     if [ "$pwd_is_source_path" != "y" ] ; then
-       symlink "$source_path/dtc/Makefile" "dtc/Makefile"
-       symlink "$source_path/dtc/scripts" "dtc/scripts"
+      for f in $(cd $source_path/dtc && ls Makefile* *.?); do
+        symlink "$source_path/dtc/$f" "dtc/$f"
+      done
+      for d in scripts libfdt tests; do
+        symlink "$source_path/dtc/$d" "dtc/$d"
+      done
+      SRC_PATH=$source_path
+    fi
+    make -C dtc 1>/dev/null
+
+    fdt_cflags="-I${source_path}/dtc/libfdt"
+    fdt_libs="-L$(pwd)/dtc/libfdt $fdt_libs"
+    if compile_prog "$fdt_cflags" "$fdt_libs" ; then
+      fdt=yes
+    else
+      error_exit "Your DTC submodule is outdated. Your options:" \
+        "  (1) Preferred: Install the DTC (libfdt) devel package" \
+        "  (2) Update the DTC submodule, using: $git_submodule_path_info" \
+        "      git submodule update --init dtc"
     fi
-    fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
-    fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
   elif test "$fdt" = "yes" ; then
     # have neither and want - prompt for system/submodule install
     error_exit "DTC (libfdt) version >= 1.4.2 not present. Your options:" \
-- 
2.13.3