| 1 | # Copyright 1999-2004 Gentoo Foundation |
1 | # Copyright 1999-2004 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.10 2004/12/06 06:18:59 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.11 2004/12/07 22:30:24 vapier Exp $ |
| 4 | # |
4 | # |
| 5 | # Author: Toolchain Ninjas <ninjas@gentoo.org> |
5 | # Author: Toolchain Ninjas <ninjas@gentoo.org> |
| 6 | # |
6 | # |
| 7 | # This eclass contains (or should) functions to get common info |
7 | # This eclass contains (or should) functions to get common info |
| 8 | # about the toolchain (libc/compiler/binutils/etc...) |
8 | # about the toolchain (libc/compiler/binutils/etc...) |
| … | |
… | |
| 57 | tc-getGCJ() { tc-getPROG GCJ gcj; } |
57 | tc-getGCJ() { tc-getPROG GCJ gcj; } |
| 58 | |
58 | |
| 59 | # Returns the name of the C compiler for build |
59 | # Returns the name of the C compiler for build |
| 60 | tc-getBUILD_CC() { |
60 | tc-getBUILD_CC() { |
| 61 | if [ -n "${CC_FOR_BUILD}" ] ; then |
61 | if [ -n "${CC_FOR_BUILD}" ] ; then |
|
|
62 | export BUILD_CC="${CC_FOR_BUILD}" |
| 62 | echo "${CC_FOR_BUILD}" |
63 | echo "${CC_FOR_BUILD}" |
| 63 | return 0 |
64 | return 0 |
| 64 | fi |
65 | fi |
| 65 | |
66 | |
| 66 | local search= |
67 | local search= |
| 67 | if [ -n "${CTARGET}" ] ; then |
68 | if [ -n "${CBUILD}" ] ; then |
| 68 | search="$(type -p "${CTARGET}-gcc")" |
|
|
| 69 | elif [ -n "${CHOST}" ] ; then |
|
|
| 70 | search="$(type -p "${CHOST}-gcc")" |
69 | search="$(type -p "${CBUILD}-gcc")" |
| 71 | fi |
70 | fi |
| 72 | |
71 | |
| 73 | if [ -n "${search}" ] ; then |
72 | if [ -n "${search}" ] ; then |
| 74 | echo "${search##*/}" |
73 | search="${search##*/}" |
| 75 | else |
74 | else |
| 76 | echo "gcc" |
75 | search="gcc" |
| 77 | fi |
76 | fi |
|
|
77 | |
|
|
78 | export BUILD_CC="${search}" |
|
|
79 | echo "${search}" |
| 78 | } |
80 | } |
| 79 | |
81 | |
| 80 | # Quick way to export a bunch of vars at once |
82 | # Quick way to export a bunch of vars at once |
| 81 | tc-export() { |
83 | tc-export() { |
| 82 | local var |
84 | local var |