#!/bin/bash --rcfile
export localstatedir="/var"

export prefix="/usr"

export CPP="arm-angstrom-linux-gnueabi-gcc -E"

export mandir="/usr/share/man"

export STRIP="arm-angstrom-linux-gnueabi-strip"

export STAGING_SIPDIR="/OE/angstrom-dev/sysroots/x86_64-linux/usr/share/sip"

export BUILD_CXXFLAGS="-isystem/OE/angstrom-dev/sysroots/x86_64-linux/usr/include -O2 -g -fpermissive"

export OBJCOPY="arm-angstrom-linux-gnueabi-objcopy"

export AR="arm-angstrom-linux-gnueabi-ar"

export F77="ccache arm-angstrom-linux-gnueabi-g77 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp"

export USER="koen"

export PSTAGING_ACTIVE="1"

export libexecdir="/usr/libexec"

export HOME="/home/koen"

export LPM_INSTALL_DIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/ti/ti-local-power-manager-tree"

export datadir="/usr/share"

export RANLIB="arm-angstrom-linux-gnueabi-ranlib"

export BUILD_CXX="ccache g++"

export SDK_LDFLAGS="-L/OE/angstrom-dev/sysroots/x86_64-linux/usr/lib -Wl,-rpath-link,/OE/angstrom-dev/sysroots/x86_64-linux/usr/lib -Wl,-O1"

export LD="arm-angstrom-linux-gnueabi-ld"

export EXTRA_OEMAKE="-j4"

export LDFLAGS="-L/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/lib -Wl,-rpath-link,/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/lib -Wl,-O1 -Wl,--hash-style=gnu"

export TARGET_CXXFLAGS="-isystem/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/include -fexpensive-optimizations -frename-registers -fomit-frame-pointer -O2 -ggdb3 -fpermissive"

export STY="3985.pts-0.dominion"

export CODEC_INSTALL_DIR_RECIPE="/usr/share/ti/ti-codecs-tree"

export MAKE="make"

export CODEC_INSTALL_DIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/ti/ti-codecs-tree"

export includedir="/usr/include"

export TARGET_CPPFLAGS="-isystem/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/include"

export CE_INSTALL_DIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/ti/ti-codec-engine-tree"

export ORG_PATH="/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/X11/bin:/usr/local/bin:/usr/local/enlightenment/bin:/usr/local/j2re1.4.1/bin:/usr/X11/bin:/usr/local/bin:/usr/local/enlightenment/bin:/usr/local/j2re1.4.1/bin"

export OPIEDIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi"

export BUILD_CC="ccache gcc"

export BUILD_LDFLAGS="-L/OE/angstrom-dev/sysroots/x86_64-linux/usr/lib -Wl,-rpath-link,/OE/angstrom-dev/sysroots/x86_64-linux/usr/lib -Wl,-rpath,/OE/angstrom-dev/sysroots/x86_64-linux/usr/lib -Wl,-O1"

export CONFIG_SITE="/OE/org.openembedded.dev/site/endian-little /OE/org.openembedded.dev/site/common-linux /OE/org.openembedded.dev/site/common-glibc /OE/org.openembedded.dev/site/arm-common /OE/org.openembedded.dev/site/arm-linux /OE/org.openembedded.dev/site/common /OE/org.openembedded.dev/site/common"

unset TARGET_ARCH

export CXXFLAGS="-isystem/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/include -fexpensive-optimizations -frename-registers -fomit-frame-pointer -O2 -ggdb3 -fpermissive -fvisibility-inlines-hidden"

export TERMCAP="SC|screen|VT 100/ANSI X3.64 virtual terminal:\
	:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:bs:bt=\E[Z:\
	:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:ct=\E[3g:\
	:do=^J:nd=\E[C:pt:rc=\E8:rs=\Ec:sc=\E7:st=\EH:up=\EM:\
	:le=^H:bl=^G:cr=^M:it#8:ho=\E[H:nw=\EE:ta=^I:is=\E)0:\
	:li#33:co#162:am:xn:xv:LP:sr=\EM:al=\E[L:AL=\E[%dL:\
	:cs=\E[%i%d;%dr:dl=\E[M:DL=\E[%dM:dc=\E[P:DC=\E[%dP:\
	:im=\E[4h:ei=\E[4l:mi:IC=\E[%d@:ks=\E[?1h\E=:\
	:ke=\E[?1l\E>:vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l:\
	:ti=\E[?1049h:te=\E[?1049l:us=\E[4m:ue=\E[24m:so=\E[3m:\
	:se=\E[23m:md=\E[1m:mr=\E[7m:me=\E[m:ms:\
	:Co#8:pa#64:AF=\E[3%dm:AB=\E[4%dm:op=\E[39;49m:AX:\
	:as=\E(0:ae=\E(B:\
	:ac=\140\140aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++,,hhII00:\
	:k0=\E[10~:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:\
	:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:\
	:F1=\E[23~:F2=\E[24~:F3=\E[25~:F4=\E[26~:F5=\E[28~:\
	:F6=\E[29~:F7=\E[31~:F8=\E[32~:F9=\E[33~:FA=\E[34~:\
	:kb=^H:kh=\E[1~:@1=\E[1~:kH=\E[4~:@7=\E[4~:kN=\E[6~:\
	:kP=\E[5~:kI=\E[2~:kD=\E[3~:ku=\EOA:kd=\EOB:kr=\EOC:\
	:kl=\EOD:km:"

export BUILD_F77="ccache g77"

export STAGING_IDLDIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/idl"

export bindir="/usr/bin"

export BIOS_INSTALL_DIR_RECIPE="/usr/share/ti/ti-dspbios-tree"

export FC_INSTALL_DIR_RECIPE="/usr/share/ti/ti-framework-components-tree"

export BUILD_LD="ld"

export BB_ENV_EXTRAWHITE="MACHINE DISTRO ANGSTROM_MODE ANGSTROMLIBC"

export SDK_CFLAGS="-isystem/OE/angstrom-dev/sysroots/x86_64-linux/usr/include -isystem/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/include -fexpensive-optimizations -frename-registers -fomit-frame-pointer -O2 -ggdb3"

export exec_prefix="/usr"

export SHLVL="2"

export LANG="C"

export WINDOW="4"

export LINUXUTILS_INSTALL_DIR_RECIPE="/usr/share/ti/ti-linuxutils-tree"

export oldincludedir="/usr/include"

export CCLD="ccache arm-angstrom-linux-gnueabi-gcc -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp"

export SHELLCMDS="bash --rcfile $TERMRCFILE"

export QPEDIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi"

export CMEM_INSTALL_DIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/ti/ti-linuxutils-tree"

export XDAIS_INSTALL_DIR_RECIPE="/usr/share/ti/ti-xdais-tree"

export BBPATH="/OE/:/OE/build/:/OE/org.openembedded.dev/"

export EDMA3_LLD_INSTALL_DIR_RECIPE="/usr/share/ti/ti-edma3lld-tree"

export SSH_TTY="/dev/pts/0"

export CMEM_INSTALL_DIR_RECIPE="/usr/share/ti/ti-linuxutils-tree"

export base_libdir="/lib"

export OLDPWD="/OE/org.openembedded.dev/recipes/addons"

export LOGNAME="koen"

export BIOS_INSTALL_DIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/ti/ti-dspbios-tree"

export PATH="/OE/angstrom-dev/sysroots/x86_64-linux/usr/bin/armv7a-angstrom-linux-gnueabi:/OE/angstrom-dev/sysroots/x86_64-linux/usr/bin/armv7a-angstrom-linux-gnueabi:/OE/angstrom-dev/sysroots/x86_64-linux/usr/sbin:/OE/angstrom-dev/sysroots/x86_64-linux/usr/bin:/OE/angstrom-dev/cross/armv7a//bin:/OE/angstrom-dev/sysroots/x86_64-linux/sbin:/OE/angstrom-dev/sysroots/x86_64-linux/bin:/OE/bitbake/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/X11/bin:/usr/local/bin:/usr/local/enlightenment/bin:/usr/local/j2re1.4.1/bin:/usr/X11/bin:/usr/local/bin:/usr/local/enlightenment/bin:/usr/local/j2re1.4.1/bin"

export TARGET_CFLAGS="-isystem/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/include -fexpensive-optimizations -frename-registers -fomit-frame-pointer -O2 -ggdb3"

export base_bindir="/bin"

export PWD="/OE/org.openembedded.dev/recipes/ti"

export DMAI_INSTALL_DIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/ti/ti-dmai-tree"

export servicedir="/srv"

export BUILD_CPP="cpp"

unset MACHINE

export SDK_CXXFLAGS="-isystem/OE/angstrom-dev/sysroots/x86_64-linux/usr/include -isystem/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/include -fexpensive-optimizations -frename-registers -fomit-frame-pointer -O2 -ggdb3 -fpermissive"

export sbindir="/usr/sbin"

export CFLAGS="-isystem/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/include -fexpensive-optimizations -frename-registers -fomit-frame-pointer -O2 -ggdb3"

export BUILD_AR="ar"

export sharedstatedir="/com"

export LINK_INSTALL_DIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/ti/ti-dsplink-tree/packages"

export DMAI_INSTALL_DIR_RECIPE="/usr/share/ti/ti-dmai-tree"

export XDG_DATA_DIRS="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share"

export CODEGEN_INSTALL_DIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/ti/ti-cgt6x-tree"

export OBJDUMP="arm-angstrom-linux-gnueabi-objdump"

export BUILD_CFLAGS="-isystem/OE/angstrom-dev/sysroots/x86_64-linux/usr/include -O2 -g"

export QTDIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/qt2"

export CPPFLAGS="-isystem/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/include"

export XAUTHORITY="/home/koen/.Xauthority"

export CODEGEN_INSTALL_DIR_RECIPE="/usr/share/ti/ti-cgt6x-tree"

unset DISTRO

export QMAKE_MKSPEC_PATH="/OE/angstrom-dev/sysroots/x86_64-linux/usr/share/qmake"

export SYSBIOS_INSTALL_DIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/ti/ti-sysbios-tree"

export PKG_CONFIG_DIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/lib/pkgconfig"

export docdir="/usr/share/doc"

export palmtopdir="/usr/lib/opie"

export infodir="/usr/share/info"

export libdir="/usr/lib"

export CC="ccache arm-angstrom-linux-gnueabi-gcc -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp"

export BIOSUTILS_INSTALL_DIR_RECIPE="/usr/share/ti/ti-biosutils-tree"

export SSH_CLIENT="172.20.1.5 65062 22"

export XDC_INSTALL_DIR_RECIPE="/usr/share/ti/ti-xdctools-tree"

export TARGET_LDFLAGS="-L/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/lib -Wl,-rpath-link,/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/lib -Wl,-O1 -Wl,--hash-style=gnu"

export TERM="screen"

export XDAIS_INSTALL_DIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/ti/ti-xdais-tree"

export LINK_INSTALL_DIR_RECIPE="/usr/share/ti/ti-dsplink-tree/packages"

export DSPLIB_INSTALL_DIR_RECIPE="/usr/share/ti/ti-dsplib-tree"

export SHELL="/bin/bash"

export BUILD_CCLD="gcc"

export LINUXUTILS_INSTALL_DIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/ti/ti-linuxutils-tree"

export palmqtdir="/usr/lib/opie"

export DSPLIB_INSTALL_DIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/ti/ti-dsplib-tree"

export base_sbindir="/sbin"

export CXX="ccache arm-angstrom-linux-gnueabi-g++ -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp"

export BIOSUTILS_INSTALL_DIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/ti/ti-biosutils-tree"

export PKG_CONFIG_DISABLE_UNINSTALLED="yes"

export PKG_CONFIG_SYSROOT_DIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi"

export LPM_INSTALL_DIR_RECIPE="/usr/share/ti/ti-local-power-manager-tree"

export FC_INSTALL_DIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/ti/ti-framework-components-tree"

export MAIL="/var/mail/koen"

export PKG_CONFIG_PATH="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/lib/pkgconfig:/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/pkgconfig"

export _="/OE/bitbake/bin/bitbake"

export SYSBIOS_INSTALL_DIR_RECIPE="/usr/share/ti/ti-sysbios-tree"

export BUILD_CPPFLAGS="-isystem/OE/angstrom-dev/sysroots/x86_64-linux/usr/include"

export PATCH_GET="0"

export NM="arm-angstrom-linux-gnueabi-nm"

export MANIFEST="/OE/org.openembedded.dev/recipes/ti/files/./manifest"

export SDK_CPPFLAGS="-isystem/OE/angstrom-dev/sysroots/x86_64-linux/usr/include -isystem/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/include"

export CE_INSTALL_DIR_RECIPE="/usr/share/ti/ti-codec-engine-tree"

export SSH_CONNECTION="172.20.1.5 65062 172.20.3.1 22"

export BUILD_STRIP="strip"

export XDC_INSTALL_DIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/ti/ti-xdctools-tree"

export AS="arm-angstrom-linux-gnueabi-as"

export BUILD_RANLIB="ranlib"

export sysconfdir="/etc"

export EDMA3_LLD_INSTALL_DIR="/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/ti/ti-edma3lld-tree"

die() {
	oefatal "$*"

}

oewarn() {
	echo "WARNING:" "$*"

}

oe_machinstall() {
	# Purpose: Install machine dependent files, if available
	#          If not available, check if there is a default
	#          If no default, just touch the destination
	# Example:
	#                $1  $2   $3         $4
	# oe_machinstall -m 0644 fstab /OE/angstrom-dev/work/armv7a-angstrom-linux-gnueabi/ti-devshell-1.0-r0/image/etc/fstab
	#
	# TODO: Check argument number?
	#
	filename=`basename $3`
	dirname=`dirname $3`

	for o in `echo task-compile:local:beagleboard:angstrom:linux-gnueabi:arm:build-linux:fail-fast:pn-ti-devshell:armv7a:omap3:libc-glibc | tr ':' ' '`; do
		if [ -e $dirname/$o/$filename ]; then
			oenote $dirname/$o/$filename present, installing to $4
			install $1 $2 $dirname/$o/$filename $4
			return
		fi
	done
#	oenote overrides specific file NOT present, trying default=$3...
	if [ -e $3 ]; then
		oenote $3 present, installing to $4
		install $1 $2 $3 $4
	else
		oenote $3 NOT present, touching empty $4
		touch $4
	fi

}

oe_libinstall() {
	# Purpose: Install a library, in all its forms
	# Example
	#
	# oe_libinstall libltdl /OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/lib/
	# oe_libinstall -C src/libblah libblah /OE/angstrom-dev/work/armv7a-angstrom-linux-gnueabi/ti-devshell-1.0-r0/image//usr/lib/
	dir=""
	libtool=""
	silent=""
	require_static=""
	require_shared=""
	staging_install=""
	while [ "$#" -gt 0 ]; do
		case "$1" in
		-C)
			shift
			dir="$1"
			;;
		-s)
			silent=1
			;;
		-a)
			require_static=1
			;;
		-so)
			require_shared=1
			;;
		-*)
			oefatal "oe_libinstall: unknown option: $1"
			;;
		*)
			break;
			;;
		esac
		shift
	done

	libname="$1"
	shift
	destpath="$1"
	if [ -z "$destpath" ]; then
		oefatal "oe_libinstall: no destination path specified"
	fi
	if echo "$destpath/" | egrep '^/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/lib/' >/dev/null
	then
		staging_install=1
	fi

	__runcmd () {
		if [ -z "$silent" ]; then
			echo >&2 "oe_libinstall: $*"
		fi
		$*
	}

	if [ -z "$dir" ]; then
		dir=`pwd`
	fi

	dotlai=$libname.lai

	# Sanity check that the libname.lai is unique
	number_of_files=`(cd $dir; find . -name "$dotlai") | wc -l`
	if [ $number_of_files -gt 1 ]; then
		oefatal "oe_libinstall: $dotlai is not unique in $dir"
	fi


	dir=$dir`(cd $dir;find . -name "$dotlai") | sed "s/^\.//;s/\/$dotlai\$//;q"`
	olddir=`pwd`
	__runcmd cd $dir

	lafile=$libname.la

	# If such file doesn't exist, try to cut version suffix
	if [ ! -f "$lafile" ]; then
		libname1=`echo "$libname" | sed 's/-[0-9.]*$//'`
		lafile1=$libname.la
		if [ -f "$lafile1" ]; then
			libname=$libname1
			lafile=$lafile1
		fi
	fi

	if [ -f "$lafile" ]; then
		# libtool archive
		eval `cat $lafile|grep "^library_names="`
		libtool=1
	else
		library_names="$libname.so* $libname.dll.a"
	fi

	__runcmd install -d $destpath/
	dota=$libname.a
	if [ -f "$dota" -o -n "$require_static" ]; then
		__runcmd install -m 0644 $dota $destpath/
	fi
	if [ -f "$dotlai" -a -n "$libtool" ]; then
		if test -n "$staging_install"
		then
			# stop libtool using the final directory name for libraries
			# in staging:
			__runcmd rm -f $destpath/$libname.la
			__runcmd sed -e 's/^installed=yes$/installed=no/' \
				     -e '/^dependency_libs=/s,/OE/angstrom-dev/work/armv7a-angstrom-linux-gnueabi/ti-devshell-1.0-r0[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*\),/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/lib/\1,g' \
				     -e "/^dependency_libs=/s,\([[:space:]']\)/usr/lib,\1/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/lib,g" \
				     $dotlai >$destpath/$libname.la
		else
			__runcmd install -m 0644 $dotlai $destpath/$libname.la
		fi
	fi

	for name in $library_names; do
		files=`eval echo $name`
		for f in $files; do
			if [ ! -e "$f" ]; then
				if [ -n "$libtool" ]; then
					oefatal "oe_libinstall: $dir/$f not found."
				fi
			elif [ -L "$f" ]; then
				__runcmd cp -P "$f" $destpath/
			elif [ ! -L "$f" ]; then
				libfile="$f"
				__runcmd install -m 0755 $libfile $destpath/
			fi
		done
	done

	if [ -z "$libfile" ]; then
		if  [ -n "$require_shared" ]; then
			oefatal "oe_libinstall: unable to locate shared library"
		fi
	elif [ -z "$libtool" ]; then
		# special case hack for non-libtool .so.#.#.# links
		baselibfile=`basename "$libfile"`
		if (echo $baselibfile | grep -qE '^lib.*\.so\.[0-9.]*$'); then
			sonamelink=`arm-angstrom-linux-gnueabi-readelf -d $libfile |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'`
			solink=`echo $baselibfile | sed -e 's/\.so\..*/.so/'`
			if [ -n "$sonamelink" -a x"$baselibfile" != x"$sonamelink" ]; then
				__runcmd ln -sf $baselibfile $destpath/$sonamelink
			fi
			__runcmd ln -sf $baselibfile $destpath/$solink
		fi
	fi

	__runcmd cd "$olddir"

}

oe_soinstall() {
	# Purpose: Install shared library file and
	#          create the necessary links
	# Example:
	#
	# oe_
	#
	#oenote installing shared library $1 to $2
	#
	libname=`basename $1`
	install -m 755 $1 $2/$libname
	sonamelink=`arm-angstrom-linux-gnueabi-readelf -d $1 |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'`
	solink=`echo $libname | sed -e 's/\.so\..*/.so/'`
	ln -sf $libname $2/$sonamelink
	ln -sf $libname $2/$solink

}

oe_runconf() {
	if [ -x ./configure ] ; then
		cfgcmd="./configure \
		         --build=x86_64-linux 		  --host=arm-angstrom-linux-gnueabi 		  --target=arm-angstrom-linux-gnueabi 		  --prefix=/usr 		  --exec_prefix=/usr 		  --bindir=/usr/bin 		  --sbindir=/usr/sbin 		  --libexecdir=/usr/libexec 		  --datadir=/usr/share 		  --sysconfdir=/etc 		  --sharedstatedir=/com 		  --localstatedir=/var 		  --libdir=/usr/lib 		  --includedir=/usr/include 		  --oldincludedir=/usr/include 		  --infodir=/usr/share/info 		  --mandir=/usr/share/man \
			${EXTRA_OECONF} \
		    $@"
		oenote "Running $cfgcmd..."
		$cfgcmd || oefatal "oe_runconf failed"
	else
		oefatal "no configure script found"
	fi

}

autotools_do_configure() {
	case ti-devshell in
	autoconf*)
	;;
	automake*)
	;;
	*)
		# WARNING: gross hack follows:
		# An autotools built package generally needs these scripts, however only
		# automake or libtoolize actually install the current versions of them.
		# This is a problem in builds that do not use libtool or automake, in the case
		# where we -need- the latest version of these scripts.  e.g. running a build
		# for a package whose autotools are old, on an x86_64 machine, which the old
		# config.sub does not support.  Work around this by installing them manually
		# regardless.
		( for ac in `find . -name configure.in -o -name configure.ac`; do
			rm -f `dirname $ac`/configure
			done )
		if [ -e ./configure.in -o -e ./configure.ac ]; then
			olddir=`pwd`
			cd .
			if [ x"default" = xdefault ]; then
				acpaths=
				for i in `find . -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \
					grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do
					acpaths="$acpaths -I $i"
				done
			else
				acpaths="default"
			fi
			AUTOV=`automake --version |head -n 1 |sed "s/.* //;s/\.[0-9]\+$//"`
			automake --version
			echo "AUTOV is $AUTOV"
			install -d /OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/aclocal
			install -d /OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/aclocal-$AUTOV
			acpaths="$acpaths -I/OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/aclocal-$AUTOV -I /OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/aclocal"
			# autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
			# like it was auto-generated.  Work around this by blowing it away
			# by hand, unless the package specifically asked not to run aclocal.
			if ! echo --exclude=autopoint | grep -q "aclocal"; then
				rm -f aclocal.m4
			fi
			if [ -e configure.in ]; then
			  CONFIGURE_AC=configure.in
			else
			  CONFIGURE_AC=configure.ac
			fi
			if grep "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
			  if grep "sed.*POTFILES" $CONFIGURE_AC >/dev/null; then
			    : do nothing -- we still have an old unmodified configure.ac
			  else
			    oenote Executing glib-gettextize --force --copy
			    echo "no" | glib-gettextize --force --copy
			  fi
			else if grep "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
			  cp /OE/angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/gettext/config.rpath ./
			fi

			fi
			mkdir -p m4
			oenote Executing autoreconf --verbose --install --force --exclude=autopoint $acpaths
			autoreconf -Wcross --verbose --install --force --exclude=autopoint $acpaths || oefatal "autoreconf execution failed."
			if grep "^[[:space:]]*[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then
			  oenote Executing intltoolize --copy --force --automake
			  intltoolize --copy --force --automake
			fi
			cd $olddir
		fi
	;;
	esac
	if [ -e ./configure ]; then
		oe_runconf $@
	else
		oenote "nothing to configure"
	fi

}

oenote() {
	echo "NOTE:" "$*"

}

oedebug() {
	test $# -ge 2 || {
		echo "Usage: oedebug level \"message\""
		true
	}

	test ${OEDEBUG:-0} -ge $1 && {
		shift
		echo "DEBUG:" $*
	}

}

oe_runmake() {
	oenote make -j4  "$@"
	make -j4  "$@" || die "oe_runmake failed"

}

oefatal() {
	echo "FATAL:" "$*"
	true

}

export PS1='[OE::arm-angstrom-linux-gnueabi-angstrom-beagleboard]:\w$ '
alias ./configure=oe_runconf
alias make=oe_runmake
