#!/usr/local/bin/perl # where-is-the-toolchain.pl # # A simple tool to determine the whereabouts of the GNU toolchain for a # specified platform. If a match is not found, a relative path is returned # so that the makefile will fail normally. If a search path is # specified, "/bin" will be stuck on the end of each element. If it is not # specified, the PATH environment variable will be used. # Written 2/3/1998 by Lou Sortman die "usage: $0 {target} [{search path}]\n" if @ARGV<1; ($target,$searchpath)=@ARGV; if (!defined($searchpath)) { $searchpath=$ENV{PATH}; } else { $searchpath=~s#(/bin)?(:|$)#/bin$2#g; } @SEARCH=split(':',$searchpath); for $try (@SEARCH) { if(-x "$try/$target-gcc") { print "$try/$target-\n"; exit(0); } } print "$target-\n"; exit(0);