tc-is-cross-compiler()
authorMike Frysinger <vapier@gentoo.org>
Mon, 13 Dec 2004 23:49:07 +0000 (23:49 +0000)
committerMike Frysinger <vapier@gentoo.org>
Mon, 13 Dec 2004 23:49:07 +0000 (23:49 +0000)
eclass/toolchain-funcs.eclass

index f1a4eb2fcd53fb82d22bda16836daefea6d50dd1..5b54c6fabc578710158f6cbdc6136024518e9c64 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.11 2004/12/07 22:30:24 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.12 2004/12/13 23:49:07 vapier Exp $
 #
 # Author: Toolchain Ninjas <ninjas@gentoo.org>
 #
@@ -87,6 +87,16 @@ tc-export() {
        done
 }
 
+# A simple way to see if we're using a cross-compiler ...
+tc-is-cross-compiler() {
+       local ret tmpfile=$(emktemp).c
+       echo 'int main(){return 0;}' > "${tmpfile}"
+       $(tc-getCC) "${tmpfile}" -o "${tmpfile}".bin
+       "${tmpfile}".bin &>/dev/null
+       ret=$?
+       rm -f "${tmpfile}" "${tmpfile}".bin
+}
+
 
 # Returns the version as by `$CC -dumpversion`
 gcc-fullversion() {