#!/bin/sh
#
# Generate the value for the HOSTTYPE macro. This used to be done by the
# legacy Nmake *bin/package* command. This implementation is considerably
# simpler and does not perform some of the dubious transformations of the
# original. Such as changing `x86_64` to `i386`.
#
# See issue #297.
#
os_name=$(uname -s | tr '[:upper:]' '[:lower:]')
hw_name=$(uname -m | tr '[:upper:]' '[:lower:]')
# Cygwin on MS Windows is odd in that `uname -s` might output values like
# `CYGWIN_NT-10.0` where we only want the prefix before the first underscore.
if test "${os_name%_*}" = cygwin
then
    os_name=cygwin
fi
echo "$os_name.$hw_name"
