#! /bin/bash

case "`uname -s`" in
	Linux)
		GLIBCVERS=$(strings /lib/libc.so.6 | grep '^GLIBC_[0-9][0-9]*\.[0-9]*' | cut -f 2- -d _ | cut -f 1-2 -d . | sed 's@\.@ @g' |  sort -n +0 +1 | tail -1 | sed 's@ @\.@g')

		case "`uname -m`" in
			i?86)
				CPUPLAT="ix86"
				;;
			sun4?)
				CPUPLAT="sparc"
				;;
			*)
				CPUPLAT="`uname -m`"
				;;
		esac

		echo "linux-glibc${GLIBCVERS}-${CPUPLAT}"
		;;
	SunOS)
		SUNMAJVER=$(uname -r | cut -f 1 -d .)
		SUNMINVER=$(uname -r | cut -f 2 -d .)
		SOLVER="$[${SUNMAJVER} - 3].${SUNMINVER}"


		case "`uname -m`" in
			sun4?)
				CPUPLAT="sparc"
				;;
			*)
				CPUPLAT="ix86"
				;;
		esac

		echo "solaris${SOLVER}-${CPUPLAT}"
		;;
esac
