#! /bin/sh

# the relationship between cacao and boehm-gc is too tight
# for the ports CONFIGURE_STYLE= autoconf automake

echo "***********************************************************************************"
pwd
echo "$@"
env
set
echo "***********************************************************************************"

export PWD
export PATH="/usr/local/exodus/bin:/usr/local/bin:/usr/bin:/bin"

export AUTOCONF_VERSION=2.59
export AUTOMAKE_VERSION=1.9

cd ${WRKSRC}

	set -x

	# Files:
	# src/vm/jit/i386/openbsd3 (jit runtime support)
	# src/boehm-gc/openbsd_pthreads.c (openbsd thread support for boehm-gc)
	# src/boehm-gc/openbsd.c (os dependant initializations)

	tar -zxf ${FILESDIR}/openbsd3.tar.gz

	if test ! -d /usr/src/lib; then
		echo "***********************************************************************************"
		echo "$0: configure will eventually fail without OpenBSD sources for libc and libpthread"
		echo "$0: you don't need all of the OpenBSD source; nor does it need to be compiled"
		echo "$0: you just need to have access to private include files in the right relative positions."
		echo "$0: hint:"
		echo "$0: cd /usr; cvs -drepository co -P src/lib/libc"
		echo "$0: cd /usr; cvs -drepository co -P src/lib/libpthread"
		echo "***********************************************************************************"
	fi

	# boehm-gc source withing cacao must be autoconf'd and automake'd first

	cd src/boehm-gc
	pwd
	autoconf
	automake

	# cacao itself must be autoconf'd and automake'd second

	cd ../..
	pwd
	autoconf
	automake
