summaryrefslogtreecommitdiff
path: root/sysselect.sh
blob: 85a8ec8133d55b283caaac7ca2613fec1cc64e9a (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
#!/bin/sh

uname_sys=`uname -s`
posixy="posixy"
if test $uname_sys = "Linux"; then
	sys="linux"
elif test $uname_sys = "Darwin"; then
	sys="osx"
elif test $uname_sys = "FreeBSD"; then
	sys="freebsd"
elif test $uname_sys = "Plan9"; then
	sys="plan9"
        posixy="NOTPOSIXY"
fi

uname_arch=`uname -m`
if test $uname_arch = "x86_64"; then
	arch="x64"
elif test $uname_arch = "amd64"; then
	arch="x64"
fi

# check for system prefixes on .myr src
for suffix in myr s; do
	for platform in $posixy-$sys-$arch \
		$posixy-$sys \
		$posixy-$arch \
		$posixy \
		$sys-$arch \
		$sys \
		$arch 
	do
		if test -f $1+$platform.$suffix; then
			found=true
			echo $1+$platform.$suffix
			exit
		fi
	done
	if test "x$found" = "x"; then
		if test -f $1.$suffix; then
			found=true
			echo $1.$suffix
			exit
		fi
	fi
done