#!/bin/sh

#	Copyright (c) 1990 by Carrick Sean Casey.
#	For copying and distribution information, see the file COPYING.

#	See if a system has certain library routines. (yuck)

echo "Checking to see if you have $1()..."

case $1 in
strerror)
	call="strerror(0);"
	;;
strtol)
	call="strtol(0);"
	;;
*)
	echo ""
	echo "hasfunc: error: unknown func $1. Assuming you don't have it."
	exit 1
	;;
esac

cat >> tmp.c <<EOF
main()
{
	$call
}
EOF

if cc -o /dev/null tmp.c > /dev/null 2>&1; then
	echo "You do."
	rm -f tmp.c tmp.o
	exit 0
else
	echo "You don't."
	rm -f tmp.c tmp.o
	exit 1
fi
