Blame sysinfo/host/host.sh

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