#!/bin/sh
#
# @(#)findfiles.sh	1.4 12/7/92 11:26:28 - Elan Computer Group, Inc. (c) 1992
#
if [ -f /bin/sh5 -a "x$__ALREADY_RUNNING_WITH_SH5__" != "xyes" ] ; then
	__ALREADY_RUNNING_WITH_SH5__="yes"
	export __ALREADY_RUNNING_WITH_SH5__
	exec /bin/sh5 $0 $@
	exit
fi

# So children won't think they're already running /bin/sh5!
__ALREADY_RUNNING_WITH_SH5__=no
export __ALREADY_RUNNING_WITH_SH5__

LPATH="`(IFS=:; echo $LD_LIBRARY_PATH)`"
SEARCH="/lib /usr/lib /usr/local/lib $LPATH"
ERROR=0

findlib()
{
	for DIR in $SEARCH
	do
		if [ -f $DIR/$1 ]; then
			return 0
		fi
	done
	echo Library $LIB not found
	return 1
}

for file 
do
	case x$file in
		x-l*)	LIB=lib`echo "x$file" | sed 's/x-l//'`.a
			if findlib $LIB ; then
				FOUND=1
			else
				ERROR=1
			fi
			;;
		x*)	if [ ! -f $file ] ; then
				echo File $file not found
				ERROR=1
			fi
			;;
	esac
done

exit $ERROR
