#!/usr/bin/env bash
# $LastChangedDate: 2010-05-25 21:26:05 -0400 (Tue, 25 May 2010) $
# LEGAL:  COPYRIGHT (C) 2010 JIM E. BROOKS WWW.PALOMINO3D.ORG
# Desc:   Echo name of operating-system as lower-case.
#         If error, prints nothing (OS isn't recognized).
#-------------------------------------------------------------------------------

# Detect which OS from environment variable.
UNAME=`uname -s`
if   ( echo $OSTYPE | grep -q -i linux   ) || [ "$UNAME" = "Linux"   ]; then
    echo "linux"
elif ( echo $OSTYPE | grep -q -i freebsd ) || [ "$UNAME" = "FreeBSD" ]; then
    echo "freebsd"
elif ( echo $OSTYPE | grep -q -i darwin  ) || [ "$UNAME" = "Darwin"  ]; then
    echo "darwin"
elif ( echo $OSTYPE | grep -q -i cygwin  ) || [ "$UNAME" = "cygwin"  ]; then
    echo "cygwin"  # [2009/12] needed for tools/clean.sh
else
    # Silently exit.  Makefile will catch nothing printed.
    exit 1
fi
exit 0
