summaryrefslogtreecommitdiff
path: root/sysinfo/host/host.sh
blob: b3975aea2d7b011a0d93cfa7b145d97e50db0200 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh

error_msg()
{
	echo $@ >&2
}

host_test()
{
	mb_hdrdir=$(pwd)/build
	mkdir -p $mb_hdrdir || exit 2

	if [ -z "$mb_compiler" ]; then
                echo "config error: compiler not set."
		exit 2
	fi

	$mb_compiler -dM -E - < /dev/null > /dev/null && return 0

	error_msg "config error: invalid compiler."
	exit 2
}

# one: args
for arg ; do
	case "$arg" in
		--help)	usage
			;;
		--compiler=*)
			mb_compiler=${arg#*=}
			;;
		--cflags=*)
			mb_cflags=${arg#*=}
			;;
		*)
			error_msg ${arg#}: "unsupported config argument."
			exit 2
			;;
	esac
done


# two: test
host_test


# all done
exit 0