rm -f em_path.h
echo "You will now be asked for the root directory of the ACK sources.
This directory will not be changed by the installation process.
"
while :
do
	echo $E_FLAG "Please give the root of the ACK source tree,
an absolute path: [$SRC_HOME] $E_SFX"
	. $FDIR/get_answer
	case $ANS in
	'') 	ANS="$SRC_HOME" ;;
	esac
	SRC_HOME="$ANS"
	case $SRC_HOME in
	/*)	break;
		;;
	*)	echo "$SRC_HOME is not an absolute path; try again"
		;;
	esac
done
echo "You will now be asked for a configuration directory. This is
the directory in which the compilations will take place. The tree that
resides in it will have the same structure as the ACK source tree, but
the directories will usually only contain Makefiles and .o files.
"
while :
do
	echo $E_FLAG "Please give the root of the configuration tree,
an absolute path: [$CONFIG] $E_SFX"
	. $FDIR/get_answer
	case $ANS in
	'')	ANS="$CONFIG";;
	esac
	CONFIG="$ANS"
	case $CONFIG in
	/*)	break;
		;;
	*)	echo "$CONFIG is not an absolute path; try again"
		;;
	esac
done
echo "You will now be asked for the root directory of the ACK binaries. After
installation, this directory will have subdirectories bin, lib, lib.bin,
man, h, config, include, modules, doc.
Four of these directories will contain stuff that depends on the machine
for which the ACK binaries are made: bin, modules, config, and lib.bin. The
other sub-directories (lib, man, h, include and doc) will contain
machine-independent stuff.
This information may be useful if you want to use ACK on different platforms
and you have a shared file system. See the installation manual.
"
while :
do
	echo $E_FLAG "Please give the root of the ACK binaries,
an absolute path: [$TARGET_HOME] $E_SFX"
	. $FDIR/get_answer
	case $ANS in
	'')	ANS="$TARGET_HOME";;
	esac
	TARGET_HOME="$ANS"
	case $TARGET_HOME in
	/*)	break;
		;;
	*)	echo "$TARGET_HOME is not an absolute path; try again"
		;;
	esac
done
sed -e "/^#define[ 	]*EM_DIR/s@\".*\"@\"$TARGET_HOME\"@" <$FDIR/em_path.h.src >em_path.h

echo "You will now be asked for the type of the system that you want
ACK binaries produced for. This is not neccessarily the system you
run this program on. In this case, if you have not done so already,
you will have to install ACK on the current machine first.
"
echo "Give me the type of the system, the current choice is:
vax_bsd4_1a	VAX11 with BSD4.1a
vax_bsd4_2	VAX11 with BSD4.2
vax_sysV_2	VAX11 with System V.2
i386		Intel 80386 system running Xenix System V
sun3		Sun 3 M68020 workstation 
sun2		Sun 2 M68000 workstation
m68_sysV_0	Motorola 68000 with Uniplus System V.0 Unix
m68020		Motorola M68020 VME131 running Unix System V/68 R2V2.1
sparc		SUN SPARC workstation running SunOs 4
sparc_solaris	SUN SPARC workstation running solaris 2
ANY		Neither of the above
"
echo $E_FLAG "system type: [$SYSNAME] $E_SFX"
. $FDIR/get_answer
case $ANS in
'')	ANS="$SYSNAME";;
esac
SYSNAME="$ANS"

while :
do
echo $E_FLAG "Is this the system you are running on? (y/n) [$CURRENT] $E_SFX"
. $FDIR/get_answer
case $ANS in
'')	ANS="$CURRENT";;
esac
case X$ANS in
Xj*|Xy*|X)	UTIL_HOME=$TARGET_HOME
	CURRENT=y
	break
	;;
Xn*)	CURRENT=n
	echo "You will now be asked for the root directory of ACK on the current machine.
This tree will not be changed by the installation process.
"
	while :
	do
		echo $E_FLAG "Please give the root of a runnable ACK tree,
an absolute path: [$UTIL_HOME] $E_SFX"
		. $FDIR/get_answer
		case $ANS in
		'')	ANS="$UTIL_HOME" ;;
		esac
		UTIL_HOME="$ANS"
		case $UTIL_HOME in
		/*)	break;
			;;
		*)	echo "$UTIL_HOME is not an absolute path; try again"
			;;
		esac
	done
	break
	;;
*)	echo "I do not understand your answer ($ANS). Try again."
	;;
esac
done

while :
do
echo "The system to install ACK for is $SYSNAME,
the root of the ACK source tree is $SRC_HOME,
the root of the configuration tree is $CONFIG,
the root of the ACK binary tree to be created is $TARGET_HOME,
and the root of a runnable ACK binary tree is $UTIL_HOME.
If the machine to compile ACK for is the current machine, the last two names
may be identical."
echo $E_FLAG "Are you satisfied with all this? (y/n) $E_SFX"
. $FDIR/get_answer
case X$ANS in
Xj*|Xy*|X)	break
	;;
Xn*)	echo Ok, I will give you another chance....
	. get_sys
	break
	;;
*)	echo "I do not understand your answer ($ANS). Try again."
	;;
esac
done
