[OpenBIOS] [RFC] cross-compiler detection does not work with dash

Blue Swirl blauwirbel at gmail.com
Fri Apr 23 21:16:53 CEST 2010


On 4/23/10, Andreas Färber <andreas.faerber at web.de> wrote:
> Am 23.04.2010 um 14:44 schrieb Andreas Färber:
>
>
> > On Ubuntu Karmic `./config/scripts/switch-arch cross-ppc` did not
> recognize my powerpc-elf-gcc. The GNOME Terminal appears to use bash, where
> `type -p powerpc-elf-gcc && echo yah` works, but /bin/sh is dash, where it
> does not:
> > echo "type -p powerpc-elf-gcc && echo yah" | /bin/sh
> >
>
>  ...and if we actually do it like that, without 2>/dev/null, we see:
>  -p: not found
>
>  So dash's `type` does not seem to support the -p parameter, whatever that
> does. Without -p it works, too.

-p makes the output either the path or nothing if not found. Without
-p there may be messages to stderr, so the patch should also add 2>&1.

>  Andreas
>
>  diff --git a/config/scripts/switch-arch b/config/scripts/switch-arch
>  index c145e86..b7511e7 100755
>  --- a/config/scripts/switch-arch
>  +++ b/config/scripts/switch-arch
>  @@ -88,7 +88,7 @@ select_prefix()
>   {
>      for TARGET in ${1}-linux-gnu- ${1}-elf- ${1}-eabi-
>      do
>  -        if type -p ${TARGET}gcc > /dev/null
>  +        if type ${TARGET}gcc > /dev/null
>
>          then
>              return
>          fi
>
>
>  --
>  OpenBIOS                 http://openbios.org/
>  Mailinglist:
> http://lists.openbios.org/mailman/listinfo
>  Free your System - May the Forth be with you
>



More information about the OpenBIOS mailing list