[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting a list of available C compilers
From: |
Ralf Wildenhues |
Subject: |
Re: Getting a list of available C compilers |
Date: |
Sun, 1 Nov 2009 01:49:47 +0100 |
User-agent: |
Mutt/1.5.20 (2009-08-09) |
* Harlan Stenn wrote on Sun, Nov 01, 2009 at 01:09:36AM CET:
> If I have a script that will generate the list of unique (more or less,
> I expect this will be a bit of a moving target) C compilers, I can:
>
> for i in `cc-list`
> do
> build CC=$i
> done
>
> and our "build" script will produce (for example):
>
> A.`config.guess`-$cc/
>
> in which a build is done using that C compiler.
You will do a lot of duplicate work with something like the following,
as several of the names are bound to be alternates for the same
compiler, or only minimal variations of one compiler. Untested.
The gcc[0-9-]* glob is merely to avoid hitting gccbug or gccmakedep,
and the list is certainly far from any completion, and subjective.
Since you're using config.guess already anyway, might as well check
for `config.guess`-gcc while you're at it (works only if $host and
$host_alias coincide though).
Cheers,
Ralf
names='gcc gcc[0-9_-]* cc c89 c99 cgcc clang llvm-gcc sdcc tcc
xlc xlc_r bgxlc icc ecc pgcc pathcc ccc nvcc cl bcc bcc32'
cc_list=
save_IFS=$IFS
IFS=:
for dir in $PATH /usr/ucb; do
IFS=$save_IFS
for name in $names
for ext in '' .exe; do
cand=$dir/$name$ext
if test -f "$cand"; then
cc_list="$cc_list $cand"
break
fi
done
done
done
IFS=$save_IFS