# #-- 100-compile.pre--#
# source the master var file when it's there
if [ -f ../.tpkg.var.master ]
then
	source ../.tpkg.var.master
else
	(
		cd ..
		[ -f  "${TPKG_SRCDIR}/setup-env.sh" ] \
		    && sh "${TPKG_SRCDIR}/setup-env.sh" 
	) && source ../.tpkg.var.master
fi
# use .tpkg.var.test for in test variable passing
[ -f .tpkg.var.test ] && source .tpkg.var.test

echo "" > restore-srcdir-configure-settings
for f in `grep 'CONFIG_[FH][IE][LA][ED][SE]' "${SRCROOT}/configure.ac" | sed -e 's/^.*(\[//g' -e 's/\])//g'`
do
	if [ -f "${SRCROOT}/$f" ]
	then
		mv "${SRCROOT}/${f}" "${SRCROOT}/${f}.build" && \
			echo "$f" >> restore-srcdir-configure-settings
	fi
done
rm -fr "${BUILDDIR}/build"
mkdir  "${BUILDDIR}/build"
cd "${BUILDDIR}/build"
"${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-debug-anchor
