plan9port/bin/9l
2004-03-26 02:09:17 +00:00

34 lines
670 B
Bash
Executable file

#!/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"
;;
*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