Determine the location of gcc (using gcc)
I was looking through a couple of configure scripts attempting to glean the way "they" do it, but failed. Also, looking through the man pages doesn't help -- there is just too much information to read the whole thing (and I'm VERY lazy). Google -- I must not have the right phrase 'case I get all kinds of strange and wonderfully useless stuff.
The question: aside from using CC=`which gcc`, is there a way to have gcc report the "real" location of itself. For example, when I build a cross compiler, I often link the files to something less awful to execute -- as the names of the real file get quite lengthy. So, I have a make system (that I wrote) and I want to use the native compiler to cross build one of the programs. That is to say, in the top of the make file I have something like:
CROSS_COMPILE ?= a_reall_long_path_to_the_gcc_string-
but I want to fake a cross build by supplying the path to gcc at the make call, like:
as my gcc sits in /usr/bin. So, configure scripts appear to do this some really nifty way -- and I want to know how too.