From patchwork Thu Dec 15 12:27:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 9475999 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B455460825 for ; Thu, 15 Dec 2016 12:28:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A132E28764 for ; Thu, 15 Dec 2016 12:28:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9609C28766; Thu, 15 Dec 2016 12:28:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F18A328764 for ; Thu, 15 Dec 2016 12:28:58 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cHV7N-0005nP-9F; Thu, 15 Dec 2016 12:26:37 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cHV7L-0005nF-Ui for xen-devel@lists.xenproject.org; Thu, 15 Dec 2016 12:26:36 +0000 Received: from [193.109.254.147] by server-7.bemta-6.messagelabs.com id 6C/FD-29440-BFB82585; Thu, 15 Dec 2016 12:26:35 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTfdXd1C EwftZ5hbft0xmcmD0OPzhCksAYxRrZl5SfkUCa0b3H+WCR/wV89c9YGxgPMXbxcjFISSwmVHi 75XTLBDOckaJRY3v2boYOTnYBHQldtx8zQxiiwioS/Ts+gJWxCxwnkli7Y4jrCAJYQEviX1/2 sBsFgFVif7TS8CaeQWsJT4/PgYWlxCQk2g4fx9oEAcHp4CNxPFJgSBhIaCStq83WCcwci9gZF jFqFGcWlSWWqRraKSXVJSZnlGSm5iZo2toYKaXm1pcnJiempOYVKyXnJ+7iRHoXwYg2MF4eWP AIUZJDiYlUd6LjUERQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4+7uAcoJFqempFWmZOcBAg0lL cPAoifCqAINNiLe4IDG3ODMdInWKUVFKnHc/SJ8ASCKjNA+uDRbclxhlpYR5GYEOEeIpSC3Kz SxBlX/FKM7BqCTMKwAyniczrwRu+iugxUxAi0WX+IMsLklESEk1MO6/kNLas1aoSl/1DONp9q 6LQY7srVPCNqw7fDAo53/GOpOKm/vq9BfL3d+0OkjzqNPSZP2KyAuvta5ILT9ufPker0Adg4B HkfisfNW+prQNB1+6J7vWliq8f7o16NS/cwn3fD9wPqh/vPe724WnV+qrrqrdv+cgtSzC9nnP 9fMTPt7nXbPktIMSS3FGoqEWc1FxIgDimyjCaQIAAA== X-Env-Sender: andre.przywara@arm.com X-Msg-Ref: server-16.tower-27.messagelabs.com!1481804794!77232945!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 56731 invoked from network); 15 Dec 2016 12:26:34 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-16.tower-27.messagelabs.com with SMTP; 15 Dec 2016 12:26:34 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2EFA51516; Thu, 15 Dec 2016 04:26:34 -0800 (PST) Received: from e104803-lin.lan (unknown [10.1.207.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 934613F3D6; Thu, 15 Dec 2016 04:26:32 -0800 (PST) From: Andre Przywara To: Mark Rutland Date: Thu, 15 Dec 2016 12:27:14 +0000 Message-Id: <20161215122718.21422-2-andre.przywara@arm.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20161215122718.21422-1-andre.przywara@arm.com> References: <20161215122718.21422-1-andre.przywara@arm.com> Cc: Stefano Stabellini , Catalin Marinas , Julien Grall , linux-arm-kernel@lists.infradead.org, Ian Campbell , xen-devel@lists.xenproject.org, Christoffer Dall Subject: [Xen-devel] [PATCH v3 1/5] configure: fix file detection when cross-compiling X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Andre Przywara [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])