search_compiler() { if [ -n "$CC" -o -n "$LD" ]; then if [ -z "$LD" ]; then fatal "set LD as well" elif [ -z "$CC" ]; then fatal "set CC as well" fi CC="`$WHICH $CC`" LD="`$WHICH $LD`" return fi for c in $1; do CC="`$WHICH $c`" if [ -n "$CC" ]; then break; fi done if ! [ -x "$CC" ]; then error "no C compiler found, magic script failed" error "please set CC and LD to a working C compiler and linker" exit 1 fi # We want the linker from the same directory. It is unlikely that # it is incompatible with $CC on a system with multiple linkers CCPREFIX="`$DIRNAME "$CC"`" if [ -x "$CCPREFIX/ld" ]; then LD=$CCPREFIX/ld return fi LD="`$WHICH ld`" if [ -x "$LD" ]; then warning "found linker ld in a different directory than the C compiler" else error "no linker found, magic script failed" error "please set LD and CC to a working linker and C compiler" exit 1 fi }