# $NetBSD: install_threads.tmpl,v 1.1 2005/08/12 19:59:03 jlam Exp $
#
# Require the presence of a pkgsrc Perl installation that supports threads
# during the PRE-INSTALL stage, otherwise we bail out.

PERL5="@PERL5@"

case ${STAGE} in
PRE-INSTALL)
	if [ ! -x "${PERL5}" ]; then
		${ECHO} "==> ${PERL5} does not exist." 1>&2
		exit 1
	fi
	eval `${PERL5} -V:usethreads`
	case $usethreads in
	define*|true|[yY]*)	# possible "yes" values in Perl Config.pm
		# We found what we were looking for (a threaded perl) so
		# do nothing.
		;;
	*)
		${ECHO} "==> ${PKGNAME} requires a Perl that supports threads." 1>&2
		exit 1
		;;
	esac
	;;
esac