[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Fix target tool check logic

From: Pavel Roskin
Subject: [PATCH] Fix target tool check logic
Date: Sat, 11 Apr 2009 00:58:26 -0400
User-agent: Internet Messaging Program (IMP) H3 (4.1.4)


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.

        * 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.

@@ -231,8 +231,8 @@

-# 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"; then
   # XXX this depends on the implementation of autoconf!

Pavel Roskin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]