Re: 2.2.18pre12 fix for some distros
On Sat, Sep 30, 2000 at 03:13:02PM +0100, Alan Cox wrote: > > Please replace which with "command -v" which is required by SuS in /bin/sh. > > command -v breaks on some setups. One problem can be seen easily by doing this > > # command -v ls > alias ls='ls --color=tty' .bashrc is only read for interactive shells. Besides, if which is a bash alias as well, $ command -v which alias which='type -path' $ it will break too, $ which which $ I think what you can do is to ignore the value returned by command -v, and just use it is an indication that this thing exists. After all, if you can find it using command -v, just calling it will work too. Something like if command -v gcc272 > /dev/null 2> /dev/null; then echo gcc272; else \ echo gcc; fi -- Debian GNU/Linux 2.2 is out! ( http://www.debian.org/ ) Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: 2.2.18pre12 fix for some distros
In article <[EMAIL PROTECTED]>, Alan Cox <[EMAIL PROTECTED]> wrote: >I'll play with the proposed which based fixes first, unless you have clever >ideas ? Include a script in scripts/kwhich that tells you the path to a certain binary. Below is a simple implementation. If you condense it you can even include it in the Makefile verbatim, though a seperate script seems cleaner to me. % ./kwhich unknowncc gcc272 gcc cc /usr/bin/gcc272 #! /bin/sh # kwhich 1.0 (C) 2000 Miquel van Smoorenburg # This program is GPLed if [ $# -lt 1 ] then echo "Usage: $0 cmd [cmd..]" >&2 exit 1 fi IFS=: for cmd in $* do for path in $PATH do if [ -x "$path/$cmd" ] then echo "$path/$cmd" exit 0 fi done done echo "$*: not found" >&2 exit 1 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: 2.2.18pre12 fix for some distros
> Please replace which with "command -v" which is required by SuS in /bin/sh. command -v breaks on some setups. One problem can be seen easily by doing this # command -v ls alias ls='ls --color=tty' Because I build kernels with several compilers for several architectures I have gcc aliased, and I am sure I am not alone in that. I'll play with the proposed which based fixes first, unless you have clever ideas ? - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: 2.2.18pre12 fix for some distros
Alan Cox <[EMAIL PROTECTED]> wrote: > Those distros that use which versions that are alias magic in bash > need this to build 2.2.18pre12 Please replace which with "command -v" which is required by SuS in /bin/sh. -- Debian GNU/Linux 2.2 is out! ( http://www.debian.org/ ) Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: 2.2.18pre12 fix for some distros
On Sat, Sep 30, 2000 at 01:16:21AM +0100, Alan Cox wrote: > -CC =$(CROSS_COMPILE)$(shell if [ -n "`which gcc272 2>/dev/null`" ]; then echo >"`which gcc272`";\ > - else if [ -n "`which kgcc 2>/dev/null`" ]; then echo "`which kgcc`"; else\ > +CC =$(CROSS_COMPILE)$(shell if [ -n "`which gcc272 >/dev/null 2>/dev/null`" ]; >then echo "`which gcc272`";\ > + else if [ -n "`which kgcc >/dev/null 2>/dev/null`" ]; then echo "`which >kgcc`"; else\ Doesn't work here in a couple of Slackware systems (I don't remember version numbers). 'which' seems to print the error message to stdout, not stderr so the compiler of choice will be 'which: no gcc272 in (/bin:/usr/bin:/usr/X11/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin)' How about something like CC =$(CROSS_COMPILE)$(shell if [ -x /usr/bin/gcc272 -o -x /usr/local/bin/gcc272 ]; then echo "gcc272"; \ else if [ -x /usr/bin/kgcc -o -x /usr/local/bin/kgcc ]; then echo "kgcc"; \ else echo "cc"; fi ; fi) -D__KERNEL__ -I$(HPATH) Or wherever kgcc and gcc272 are installed in those systems where they have them. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: 2.2.18pre12 fix for some distros
[AC] > -CC =$(CROSS_COMPILE)$(shell if [ -n "`which gcc272 2>/dev/null`" ]; then echo >"`which gcc272`";\ > - else if [ -n "`which kgcc 2>/dev/null`" ]; then echo "`which kgcc`"; else\ > +CC =$(CROSS_COMPILE)$(shell if [ -n "`which gcc272 >/dev/null 2>/dev/null`" ]; >then echo "`which gcc272`";\ > + else if [ -n "`which kgcc >/dev/null 2>/dev/null`" ]; then echo "`which >kgcc`"; else\ Two bugs. Horst found one, which is easily fixed by exorcising all quote marks and if statements: CC=$(CROSS_COMPILE)$(shell which gcc272 2>/dev/null || \ which kgcc 2>/dev/null || echo gcc) -D__KERNEL__ -I$(HPATH) There is one bug left though. `which` gives an absolute path so $(CROSS_COMPILE) is now useless. Try this instead: CC=$(shell if [ -n "$(CROSS_COMPILE)" ]; then echo $(CROSS_COMPILE)cc; else \ which gcc272 2>/dev/null || which kgcc 2>/dev/null || echo cc; fi) \ -D__KERNEL__ -I$(HPATH)/include Note that we still win on punctuation and length. Peter - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
Re: 2.2.18pre12 fix for some distros
2.2.18pre12 fix for some distros said: > Those distros that use which versions that are alias magic in bash > need this to build 2.2.18pre12 No dice on Red Hat 6.9.5, it selects cc (and barfs). The unpatched version works. In any case, with "> /dev/null" you are throwing away the result you are looking for. Or did you mean something along the lines: if which kgcc > /dev/null 2> /dev/null ; then ... -- Horst von Brand [EMAIL PROTECTED] Casilla 9G, Vin~a del Mar, Chile +56 32 672616 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/