Blame sysinfo/host/host.sh

ffea9c
#!/bin/sh
ffea9c
ffea9c
error_msg()
ffea9c
{
ffea9c
	echo $@ >&2
ffea9c
}
ffea9c
ffea9c
host_test()
ffea9c
{
ffea9c
	mb_hdrdir=$(pwd)/build
ffea9c
	mkdir -p $mb_hdrdir || exit 2
ffea9c
ffea9c
	if [ -z "$mb_compiler" ]; then
ffea9c
                echo "config error: compiler not set."
ffea9c
		exit 2
ffea9c
	fi
ffea9c
ffea9c
	$mb_compiler -dM -E - < /dev/null > /dev/null && return 0
ffea9c
ffea9c
	error_msg "config error: invalid compiler."
ffea9c
	exit 2
ffea9c
}
ffea9c
ffea9c
# one: args
ffea9c
for arg ; do
ffea9c
	case "$arg" in
ffea9c
		--help)	usage
ffea9c
			;;
ffea9c
		--compiler=*)
ffea9c
			mb_compiler=${arg#*=}
ffea9c
			;;
ffea9c
		--cflags=*)
ffea9c
			mb_cflags=${arg#*=}
ffea9c
			;;
ffea9c
		*)
ffea9c
			error_msg ${arg#}: "unsupported config argument."
ffea9c
			exit 2
ffea9c
			;;
ffea9c
	esac
ffea9c
done
ffea9c
ffea9c
ffea9c
# two: test
ffea9c
host_test
ffea9c
ffea9c
ffea9c
# all done
ffea9c
exit 0