qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v1 1/1] configure: Probe for libfdt_env.h


From: peter . crosthwaite
Subject: [Qemu-devel] [PATCH v1 1/1] configure: Probe for libfdt_env.h
Date: Wed, 22 May 2013 11:50:22 +1000

From: Peter Crosthwaite <address@hidden>

Currently QEMU provides a local clone of the file libfdt_env.h in
/include. This file is supposed to come with the libfdt package and is
only needed for broken installs of libfdt. Unfortunately, libfdt 1.3
stable is tagged with this bug so we cant realistically remove the
clone. So instead, use a configure time probe - check to see if the
host is already providing this file, and if so, don't use QEMUs
local clone of libfdt.h.

Moved include/libfdt_env.h to include/libfdt/libfdt_env.h so it can be
treated as a special case.

For newer (development) versions of libfdt this probe will succeed and
include/libfdt/libfdt_env.h will simply be ignored.

For older versions -Iinclude/libfdt will be added to CFLAGS.

Manifests as a bug when building QEMU with modern libfdt. The new
version of libfdt does not compile when QEMUs libfdt_env.h takes
precedence over the hosts.

Reported-by: Nathan Rossi <address@hidden>
Signed-off-by: Peter Crosthwaite <address@hidden>
---
To replicate bug (install latest dtc from src to host and make):
git submodule update --init dtc
cd dtc
git checkout master
make
sudo make install PREFIX=/usr/local
cd ..
./configure --target-list="arm-softmmu" --enable-fdt
make

 configure                   | 14 ++++++++++++++
 include/libfdt/libfdt_env.h | 36 ++++++++++++++++++++++++++++++++++++
 include/libfdt_env.h        | 36 ------------------------------------
 3 files changed, 50 insertions(+), 36 deletions(-)
 create mode 100644 include/libfdt/libfdt_env.h
 delete mode 100644 include/libfdt_env.h

diff --git a/configure b/configure
index 5ae7e4a..f59c49b 100755
--- a/configure
+++ b/configure
@@ -2550,6 +2550,20 @@ EOF
   fi
 fi
 
+##########################################
+# libfdt_env.h probe
+
+if test "$fdt" == "yes" ; then
+  cat > $TMPC << EOF
+#include <libfdt_env.h>
+int main(void) { return 0; }
+EOF
+  if ! compile_prog "" "$fdt_libs" ; then
+  #system libfdt_env is bad - use QEMUs inbuilt snapshot
+  fdt_cflags="-I\$(SRC_PATH)/include/libfdt $fdt_cflags"
+  fi
+fi
+
 libs_softmmu="$libs_softmmu $fdt_libs"
 
 ##########################################
diff --git a/include/libfdt/libfdt_env.h b/include/libfdt/libfdt_env.h
new file mode 100644
index 0000000..3667d4c
--- /dev/null
+++ b/include/libfdt/libfdt_env.h
@@ -0,0 +1,36 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright IBM Corp. 2008
+ * Authors: Hollis Blanchard <address@hidden>
+ *
+ */
+
+#ifndef _LIBFDT_ENV_H
+#define _LIBFDT_ENV_H
+
+#include "qemu/bswap.h"
+
+#ifdef HOST_WORDS_BIGENDIAN
+#define fdt32_to_cpu(x)  (x)
+#define cpu_to_fdt32(x)  (x)
+#define fdt64_to_cpu(x)  (x)
+#define cpu_to_fdt64(x)  (x)
+#else
+#define fdt32_to_cpu(x)  bswap32(x)
+#define cpu_to_fdt32(x)  bswap32(x)
+#define fdt64_to_cpu(x)  bswap64(x)
+#define cpu_to_fdt64(x)  bswap64(x)
+#endif
+
+#endif /* _LIBFDT_ENV_H */
diff --git a/include/libfdt_env.h b/include/libfdt_env.h
deleted file mode 100644
index 3667d4c..0000000
--- a/include/libfdt_env.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * Copyright IBM Corp. 2008
- * Authors: Hollis Blanchard <address@hidden>
- *
- */
-
-#ifndef _LIBFDT_ENV_H
-#define _LIBFDT_ENV_H
-
-#include "qemu/bswap.h"
-
-#ifdef HOST_WORDS_BIGENDIAN
-#define fdt32_to_cpu(x)  (x)
-#define cpu_to_fdt32(x)  (x)
-#define fdt64_to_cpu(x)  (x)
-#define cpu_to_fdt64(x)  (x)
-#else
-#define fdt32_to_cpu(x)  bswap32(x)
-#define cpu_to_fdt32(x)  bswap32(x)
-#define fdt64_to_cpu(x)  bswap64(x)
-#define cpu_to_fdt64(x)  bswap64(x)
-#endif
-
-#endif /* _LIBFDT_ENV_H */
-- 
1.8.3.rc1.44.gb387c77.dirty




reply via email to

[Prev in Thread] Current Thread [Next in Thread]