#!/bin/csh
#
#  Verifies that 'perl' is in the search path and that it's version 4.0.
#
which perl | grep -s "Command not found"
if ($status == 0) then
	which perl
	cat <<EOM

ERROR: Cannot find the 'perl' command in your search path.

You must install Perl (version 4.0 or higher) in order to use Essence.
Perl is a public-domain programming language that is available via
anonymous ftp from a number of sites (for example, ftp.uu.net).
EOM
	exit 1
endif

perl -v | grep -s "version 4"
if ($status != 0) then
	cat <<EOM
ERROR: You must install version 4.0 or higher of Perl in order to use Essence.
EOM

	perl -v
	exit 1
endif

if (`which perl` != "/usr/local/bin/perl") then
	set x = `which perl`
	if (-x /usr/local/bin/perl) then
		cat <<EOM
WARNING: You have at least two versions of Perl on your system:

	/usr/local/bin/perl
	$x

If you do not want Essence to use /usr/local/bin/perl, 
then try using the "change-perl" script in the top-level 
Essence directory to change all of the Essence programs 
to use $x instead.
EOM

	else
		cat <<EOM
ERROR: Perl is not installed as /usr/local/bin/perl on your system.  
Either install perl as /usr/local/bin/perl on your system, 
or try using the "change-perl" script in the top-level Essence 
directory to change all of the Essence programs to use 
$x instead.
EOM
	endif
	exit 1
endif
echo "Perl installation is correct."
exit 0
