From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LsaIz-0001eS-Mh for mharc-grub-devel@gnu.org; Sat, 11 Apr 2009 06:19:21 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LsaIx-0001dz-Ky for grub-devel@gnu.org; Sat, 11 Apr 2009 06:19:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LsaIx-0001dT-0q for grub-devel@gnu.org; Sat, 11 Apr 2009 06:19:19 -0400 Received: from [199.232.76.173] (port=59297 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LsaIw-0001dO-Tm for grub-devel@gnu.org; Sat, 11 Apr 2009 06:19:18 -0400 Received: from mail.nexedi.com ([91.121.25.85]:50176 helo=nexedi.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LsaIw-0001AR-JY for grub-devel@gnu.org; Sat, 11 Apr 2009 06:19:18 -0400 Received: from [10.8.0.46] (unknown [10.8.0.46]) by nexedi.com (Postfix) with ESMTP id B989F3D9FA for ; Sat, 11 Apr 2009 12:19:16 +0200 (CEST) From: "Yoshinori K. Okuji" Organization: enbug.org To: The development of GRUB 2 Date: Sat, 11 Apr 2009 19:19:22 +0900 User-Agent: KMail/1.9.10 References: <20090411005826.oahebrl8ys0w0o0k-cebfxv@webmail.spamcop.net> In-Reply-To: <20090411005826.oahebrl8ys0w0o0k-cebfxv@webmail.spamcop.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200904111919.22519.okuji@enbug.org> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: [PATCH] Fix target tool check logic X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Apr 2009 10:19:19 -0000 On Saturday 11 April 2009 13:58:26 Pavel Roskin wrote: > Hello! > > I promised this patch long ago, but didn't have a chance to implement > and test it. This patch would help users test GRUB using > cross-compilers. Many users would prefer to compile native GRUB > utilities (grub-mkimage etc) but create the bootloader for another > platform. This is currently impossible. To compile the bootloader > for a foreign architecture, you have to cross-compile the GRUB > utilities. > > The current logic is broken. The check for the target compiler is > made if the canonical name for the build and the host are identical, > that is if we are cross-compiling the GRUB utilities. The matches the > incorrect comment, but doesn't match the intention of the code. > > The intention is to check for the target compiler and other tools > after we have already found the tools for compiling for the host. > > If the target has not been specified on the command line, there is no > need to look for the target tools. It is assumed that the host and > the target are the same, whether we are cross-compiling or not. The > host tools can be used. The target specified on the command line is > stored in $target_alias. Thus, if $target_alias is empty, we don't > check for the target tools. > > Further, if somebody specified the host and the target in the same > way, there is no need to check for the target tools. They will be the > same. Some package build system like to specify all possible > switches, so they will be happy. > > However, if the host and the target are specified in different ways on > the command line, we need to check for the target tools. That > includes the case when the host has not been specified at all. > > Even if the canonical names are the same, we should check for the > target tools. If $host_alias and $target_alias are different, > configure can find different compilers. For example, if somebody runs > > ./configure --host=powerpc-linux --target=powerpc-linux-uclibc > > and both powerpc-linux-gcc and powerpc-linux-uclibc-gcc are present in > $PATH, the former would be used for the host and the later for the > target. Generally, if the user took care to specify different values, > we should take care not to ignore that. > > ChangeLog: > * configure.ac: Change the logic when we check for target tools. > Do it when the target is specified and it's different from the > specified value of the host. > > --- configure.ac > +++ configure.ac > @@ -231,8 +231,8 @@ > AC_SUBST(TARGET_OBJ2ELF) > AC_MSG_RESULT([$TARGET_OBJ2ELF]) > > -# For cross-compiling. > -if test "x$build" != "x$host"; then > +# Find tools for the target. > +if test -n "$target_alias" && test "x$host_alias" != "x$target_alias"; "test -n" should be avoided. Maybe this is not necessary nowadays, but my old lesson was to use "test x$target_alias != x" instead for portability. Well, "!=" was not very portable, either, maybe. > then # XXX this depends on the implementation of autoconf! > tmp_ac_tool_prefix="$ac_tool_prefix" > ac_tool_prefix=$target_alias- Regards, Okuji