aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2016-12-15 12:27:14 +0000
committerMark Rutland <mark.rutland@arm.com>2017-01-03 16:35:21 +0000
commit1396ef76ee6e4e6079f032cd89aa50276ec65487 (patch)
treede4a900581b5182d44ea5491b48b4daa8914ccf9
parente3fe71d0a592064adf1bfde81193b23df03c3469 (diff)
configure: fix file detection when cross-compiling
The autotools documentation states that AC_CHECK_FILE cannot be used when cross-compiling [1], because it's meant to check files in the target system, not on the build host. When just giving --host on the configure command line, the script detects cross compilation rather late; and as the file test just happens to execute earlier, this works anyway. However if one gives both --host and --build, cross compilation is detected very early and ./configure complains: checking for /src/linux-arm64... configure: error: cannot check for file existence when cross compiling So replace the checkfile macro usage with a simple "test -f" call (which is the recommended way of checking for files on the build host) and output proper error messages. [1] https://www.gnu.org/software/autoconf/manual/autoconf.html#Files Signed-off-by: Andre Przywara <andre.przywara@arm.com> [Mark: simplified error messages] Signed-off-by: Mark Rutland <mark.rutland@arm.com>
-rw-r--r--configure.ac23
1 files changed, 18 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index ab8f5b3..9944eec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,12 +41,25 @@ AC_ARG_WITH([dtb],
[KERN_DTB="$withval"])
# Ensure that the user has provided us with a sane kernel dir.
-m4_define([CHECKFILES], [KERN_DIR,
- KERN_DTB,
- KERN_IMAGE])
+if ! test -d $KERN_DIR; then
+ AC_MSG_ERROR([Could not find Linux kernel dir: $KERN_DIR.])
+fi
+
+AC_MSG_CHECKING([whether DTB file exists])
+if ! test -f $KERN_DTB; then
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Could not find DTB file: $KERN_DTB])
+else
+ AC_MSG_RESULT([yes])
+fi
-m4_foreach([checkfile], [CHECKFILES],
- [AC_CHECK_FILE([$checkfile], [], AC_MSG_ERROR([No such file or directory: $checkfile]))])
+AC_MSG_CHECKING([whether kernel image exists])
+if ! test -f $KERN_IMAGE; then
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Could not find kernel image: $KERN_IMAGE])
+else
+ AC_MSG_RESULT([yes])
+fi
AC_SUBST([KERNEL_IMAGE], [$KERN_IMAGE])
AC_SUBST([KERNEL_DTB], [$KERN_DTB])