#! /bin/sh

for arg in "$@"; do
	case "$arg" in
		*=*) eval $arg;;
	esac
done

echo EXTRATESTOPTS: $EXTRATESTOPTS

echo -------------------- system information --------------------
uname -a

if which getconf >/dev/null 2>&1; then
	echo
	echo "Processors: $(getconf _NPROCESSORS_ONLN)"
fi

if [ -f /proc/meminfo ]; then
	cat /proc/meminfo | grep ^Mem
fi

if which df >/dev/null 2>&1; then
	echo "Free disk (buildarea): $(df -h . | awk 'NR==2 {print $4}')"
	echo "Free disk (/tmp): $(df -h /tmp | awk 'NR==2 {print $4}')"
fi

if which lsb_release >/dev/null 2>&1; then
	echo
	lsb_release -d -r
fi

if [ -n "$CC" ]; then
	echo
	$CC --version
fi

# Debian/Ubuntu specific
if which dpkg-architecture >/dev/null 2>&1; then
	bds="libc*-dev gcc-?.? binutils"
	bds="$bds libreadline*-dev libncurses*-dev tcl*-dev tk*-dev libdb*-dev"
	bds="$bds zlib*-dev libgdbm-dev blt-dev libssl-dev libbz*-dev"
	bds="$bds libbluetooth-dev libsqlite*-dev libffi*-dev libgpmg1"
	dpkg-architecture -a | grep DEB_BUILD_GNU
	echo
	dpkg -l $bds | grep ^ii
fi

echo -------------------- end system information --------------------
