linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] boot-wrapper: configure: fix file detection when cross-compiling
Date: Thu, 15 Dec 2016 11:55:09 +0000	[thread overview]
Message-ID: <20161215115509.GC21758@leverpostej> (raw)
In-Reply-To: <20161122151501.16643-1-andre.przywara@arm.com>

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
> 

      reply	other threads:[~2016-12-15 11:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161215115509.GC21758@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).