* [PATCH] boot-wrapper: configure: fix file detection when cross-compiling
@ 2016-11-22 15:15 Andre Przywara
2016-12-15 11:55 ` Mark Rutland
0 siblings, 1 reply; 2+ messages in thread
From: Andre Przywara @ 2016-11-22 15:15 UTC (permalink / raw)
To: linux-arm-kernel
The autotools documentation states that CHECKFILES 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.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
[1] https://www.gnu.org/software/autoconf/manual/autoconf.html#Files
---
configure.ac | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index ab8f5b3..e0daec4 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([You need to specify a valid DTB file, could not find: $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([You need to compile a kernel first, could not find: $KERN_IMAGE])
+else
+ AC_MSG_RESULT([yes])
+fi
AC_SUBST([KERNEL_IMAGE], [$KERN_IMAGE])
AC_SUBST([KERNEL_DTB], [$KERN_DTB])
--
2.9.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] boot-wrapper: configure: fix file detection when cross-compiling
2016-11-22 15:15 [PATCH] boot-wrapper: configure: fix file detection when cross-compiling Andre Przywara
@ 2016-12-15 11:55 ` Mark Rutland
0 siblings, 0 replies; 2+ messages in thread
From: Mark Rutland @ 2016-12-15 11:55 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Nov 22, 2016 at 03:15:01PM +0000, Andre Przywara wrote:
> The autotools documentation states that CHECKFILES 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.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
>
> [1] https://www.gnu.org/software/autoconf/manual/autoconf.html#Files
This looks fine to me. Does this conflict with the Xen patches at all?
To make it easier to pick these all up, could you please fold this into
the Xen series as a preparatory patch?
Thanks,
Mark.
> ---
> configure.ac | 23 ++++++++++++++++++-----
> 1 file changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index ab8f5b3..e0daec4 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([You need to specify a valid DTB file, could not find: $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([You need to compile a kernel first, could not find: $KERN_IMAGE])
> +else
> + AC_MSG_RESULT([yes])
> +fi
>
> AC_SUBST([KERNEL_IMAGE], [$KERN_IMAGE])
> AC_SUBST([KERNEL_DTB], [$KERN_DTB])
> --
> 2.9.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-12-15 11:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-22 15:15 [PATCH] boot-wrapper: configure: fix file detection when cross-compiling Andre Przywara
2016-12-15 11:55 ` Mark Rutland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).