aboutsummaryrefslogtreecommitdiff
path: root/bin/9l
blob: a427f2a5eecfab874dc30de17b9901c50c729e29 (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
#!/bin/sh

extralibs="-lm"
tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}"
case "$tag" in
*OpenBSD*)	ld=gcc
		extralibs="$extralibs -lutil -lpthread"
		;;
*BSD*)		ld=gcc
		extralibs="$extralibs -lutil"
		;;
*Linux*)	ld=gcc
		extralibs="$extralibs -lutil -lpthread"
		;;
*Darwin*)	ld=gcc ;;
*SunOS*)	ld="${CC9:-cc} -g"
		extralibs="$extralibs -lrt -lpthread -lsocket -lnsl"
		# Record paths to shared libraries to avoid needing LD_LIBRARY_PATH 
		for i in "$@"
		do
			case "$i" in
			-L*)
				s=`echo $i | sed 's/-L/-R/'`
				extralibs="$extralibs $s"
				;;
			esac
		done
		;;
*)
	echo do not know how to link on "$tag" 1>&2
	exit 1
esac

exec $ld -L$PLAN9/lib "$@" $extralibs