aboutsummaryrefslogtreecommitdiffstats
path: root/tools/check/funcs.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/check/funcs.sh')
-rw-r--r--tools/check/funcs.sh106
1 files changed, 0 insertions, 106 deletions
diff --git a/tools/check/funcs.sh b/tools/check/funcs.sh
deleted file mode 100644
index 054c579f15..0000000000
--- a/tools/check/funcs.sh
+++ /dev/null
@@ -1,106 +0,0 @@
-# has is the same as which, except it handles cross environments
-has() {
- if [ -z "$CROSS_COMPILE" ]; then
- command which "$@"
- return $?
- fi
-
- check_sys_root || return 1
-
- # subshell to prevent pollution of caller's IFS
- (
- IFS=:
- for p in $PATH; do
- if [ -x "$CROSS_SYS_ROOT/$p/$1" ]; then
- echo "$CROSS_SYS_ROOT/$p/$1"
- return 0
- fi
- done
- return 1
- )
-}
-
-has_or_fail() {
- has "$1" >/dev/null || fail "can't find $1"
-}
-
-has_header() {
- check_sys_root || return 1
-
- case $1 in
- /*) ;;
- *)
- if [ -r "$CROSS_SYS_ROOT/usr/include/$1" ]; then
- return 0
- fi
- for path in ${CHECK_INCLUDES}; do
- if [ -r "$CROSS_SYS_ROOT${path}/$1" ]; then
- return 0
- fi
- done
- ;;
- esac
-
- return 1
-}
-
-has_lib() {
- check_sys_root || return 1
-
- # subshell to prevent pollution of caller's environment
- (
- PATH=/sbin:$PATH # for ldconfig
- LIBRARIES="$CHECK_LIB /usr/lib"
-
- # This relatively common in a sys-root; libs are installed but
- # ldconfig hasn't run there, so ldconfig -p won't work.
- if [ "$OS" = Linux -a ! -f "$CROSS_SYS_ROOT/etc/ld.so.cache" ]; then
- echo "Please run ldconfig -r \"$CROSS_SYS_ROOT\" to generate ld.so.cache"
- # fall through; ldconfig test below should fail
- fi
- if [ "${OS}" = "Linux" ]; then
- ldconfig -p ${CROSS_SYS_ROOT+-r "$CROSS_SYS_ROOT"} | grep -Fq "$1"
- return $?
- fi
- if [ "${OS}" = "NetBSD" ]; then
- ls -1 ${LIBRARIES} | grep -Fq "$1"
- return $?
- fi
- return 1
- )
-}
-
-test_link() {
- # subshell to trap removal of tmpfile
- (
- unset tmpfile
- trap 'rm -f "$tmpfile"; exit' 0 1 2 15
- tmpfile=`mktemp` || return 1
- ld "$@" -o "$tmpfile" >/dev/null 2>&1
- return $?
- )
-}
-
-# this function is used commonly above
-check_sys_root() {
- [ -z "$CROSS_COMPILE" ] && return 0
- if [ -z "$CROSS_SYS_ROOT" ]; then
- echo "please set CROSS_SYS_ROOT in the environment"
- return 1
- fi
- if [ ! -d "$CROSS_SYS_ROOT" ]; then
- echo "no sys-root found at $CROSS_SYS_ROOT"
- return 1
- fi
-}
-
-warning() {
- echo
- echo " *** `basename "$0"` FAILED${*+: $*}"
-}
-
-fail() {
- echo
- echo " *** `basename "$0"` FAILED${*+: $*}"
- exit 1
-}