5 kx #!/bin/bash
5 kx
5 kx UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
5 kx UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
5 kx UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
5 kx UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
5 kx
5 kx case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
5 kx i*:CYGWIN*:*)
5 kx echo ${UNAME_MACHINE}-pc-cygwin
5 kx exit ;;
5 kx *:MINGW*:*)
5 kx echo ${UNAME_MACHINE}-pc-mingw32
5 kx exit ;;
5 kx amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
5 kx echo x86_64-unknown-cygwin
5 kx exit ;;
5 kx i*86:Linux:*:*)
5 kx if [ -f /etc/slackware-version ]; then
5 kx system=`cat /etc/slackware-version | cut -f 1 -d ' ' | tr 'S' 's'`
5 kx echo ${UNAME_MACHINE}-${system}-linux
5 kx else
5 kx echo ${UNAME_MACHINE}-unknown-linux-gnu
5 kx fi
5 kx exit ;;
5 kx x86_64:Linux:*:*)
5 kx if [ -f /etc/slamd64-version ]; then
5 kx system=`cat /etc/slamd64-version | cut -f 1 -d ' ' | tr 'S' 's'`
5 kx echo x86_64-${system}-linux
5 kx elif [ -f /etc/slackware-version ]; then
5 kx system=`cat /etc/slackware-version | cut -f 1 -d ' ' | tr 'S' 's'`
5 kx echo x86_64-${system}-linux
5 kx elif [ -f /etc/os-release ]; then
5 kx system=`cat /etc/os-release | grep -e '^ID=' | cut -f 2 -d '='`
5 kx echo x86_64-linux-gnu
5 kx else
5 kx echo x86_64-unknown-linux-gnu
5 kx fi
5 kx exit ;;
5 kx esac
5 kx
5 kx ####### echo "unknown-unknown-unknown-unknown"
5 kx
5 kx cat >&2 <<EOF
5 kx
5 kx `basename $0`: unable to reciognize build system type
5 kx
5 kx MACHINE = '${UNAME_MACHINE}'
5 kx SYSTEM = '${UNAME_SYSTEM}'
5 kx RELEASE = '${UNAME_RELEASE}'
5 kx VERSION = '${UNAME_VERSION}'
5 kx
5 kx EOF
5 kx
5 kx exit 1