1
# has is the same as which, except it handles cross environments
3
if [ -z "$CROSS_COMPILE" ]; then
8
check_sys_root || return 1
10
# subshell to prevent pollution of caller's IFS
14
if [ -x "$CROSS_SYS_ROOT/$p/$1" ]; then
15
echo "$CROSS_SYS_ROOT/$p/$1"
24
has "$1" >/dev/null || fail "can't find $1"
30
*) set -- "/usr/include/$1" ;;
33
check_sys_root || return 1
35
test -r "$CROSS_SYS_ROOT$1"
40
check_sys_root || return 1
42
# subshell to prevent pollution of caller's environment
44
PATH=/sbin:$PATH # for ldconfig
46
# This relatively common in a sys-root; libs are installed but
47
# ldconfig hasn't run there, so ldconfig -p won't work.
48
if [ "$OS" = Linux -a ! -f "$CROSS_SYS_ROOT/etc/ld.so.cache" ]; then
49
echo "Please run ldconfig -r \"$CROSS_SYS_ROOT\" to generate ld.so.cache"
50
# fall through; ldconfig test below should fail
52
ldconfig -p ${CROSS_SYS_ROOT+-r "$CROSS_SYS_ROOT"} | grep -Fq "$1"
58
# subshell to trap removal of tmpfile
61
trap 'rm -f "$tmpfile"; exit' 0 1 2 15
62
tmpfile=`mktemp` || return 1
63
ld "$@" -o "$tmpfile" >/dev/null 2>&1
68
# this function is used commonly above
70
[ -z "$CROSS_COMPILE" ] && return 0
71
if [ -z "$CROSS_SYS_ROOT" ]; then
72
echo "please set CROSS_SYS_ROOT in the environment"
75
if [ ! -d "$CROSS_SYS_ROOT" ]; then
76
echo "no sys-root found at $CROSS_SYS_ROOT"
83
echo " *** `basename "$0"` FAILED${*+: $*}"
88
echo " *** `basename "$0"` FAILED${*+: $*}"