# Try to guess the name of the platform we're running on
if [ -f /usr/bin/cygwin1.dll ]; then
echo cygwin
-
- elif [[ "$OSTYPE" == "darwin"* ]]; then
- echo macosx
elif [ -f /etc/fedora-release ]; then
local FEDORANAME=`gawk '{if (match($0,/\((.*)\)/,f)) print f[1]}' /etc/fedora-release`
elif [ -x /usr/bin/sw_vers ]; then
local MACOSVER=$(sw_vers -productVersion)
case ${MACOSVER} in
- 10.4*) echo tiger;;
- 10.5*) echo leopard;;
- 10.6*) echo snowleopard;;
- 10.7*) echo lion;;
- 10.8*) echo mountainlion;;
+ 10.11*) echo macosx;;
+ 10.12*) echo sierra;;
esac
elif [ -x /usr/bin/lsb_release ]; then
fi
}
+guess_ostype() {
+ # Try to guess the operating system type (ostype)
+ if [ -f /usr/bin/cygwin1.dll ]; then
+ echo cygwin
+
+ elif [ -f /etc/fedora-release ]; then
+ echo linux
+
+ elif [ -f /etc/redhat-release ]; then
+ echo linux
+
+ elif [ -x /usr/bin/sw_vers ]; then
+ echo macos
+
+ elif [ -x /usr/bin/lsb_release ]; then
+ local DISTRO=$(lsb_release -i -s)
+ local CODENAME=$(lsb_release -c -s)
+ local DESCRIPTION=$(lsb_release -d -s)
+ case ${DISTRO}:${CODENAME}:${DESCRIPTION} in
+ *:*:*Ubuntu*\ 12*) echo linux;;
+ *:*:*Ubuntu*\ 14*) echo linux;;
+ *:*:*Ubuntu*\ 15*) echo linux;;
+ *:xenial*:*Ubuntu*) echo linux;;
+ *:Tikanga*:*) echo linux;;
+ *:Santiago*:*) echo linux;;
+ Scientific:Carbon*:*) echo linux;;
+ *:*:*CentOS*\ 5*) echo linux;;
+ *:*:*CentOS*\ 6*) echo linux;;
+ *:*:*openSUSE\ 12*) echo linux;;
+ *:*:*openSUSE\ 13*) echo linux;;
+ esac
+ fi
+}
+
guess_architecture() {
# Try to guess the architecture of the platform we are running on
ARCH=unknown
exit 1
fi
fi
+echo
+
+# Guess the operating system type -> PLATFORM_OSTYPE
+PLATFORM_OSTYPE=`guess_ostype`
+if [ -z "${PLATFORM_OSTYPE}" ]; then
+ cecho ${WARN} "WARNING: could not determine your Operating System Type (assuming linux)"
+ PLATFORM_OSTYPE=linux
+fi
+
+cecho ${INFO} "Operating System Type detected as: ${PLATFORM_OSTYPE}"
+
+if [ -z "${PLATFORM_OSTYPE}" ]; then
+ # check if PLATFORM_OSTYPE is set and not empty failed
+ cecho ${BAD} "Error: (internal) could not set PLATFORM_OSTYPE"
+ exit 1
+fi
+
+# Guess dynamic shared library file extension -> LDSUFFIX
+if [ ${PLATFORM_OSTYPE} == "linux" ]; then
+ LDSUFFIX=so
+
+elif [ ${PLATFORM_OSTYPE} == "macos" ]; then
+ LDSUFFIX=dylib
+
+elif [ ${PLATFORM_OSTYPE} == "cygwin" ]; then
+ LDSUFFIX=dll
+fi
+
+cecho ${INFO} "Dynamic shared library file extension detected as: *.${LDSUFFIX}"
+
+if [ -z "${LDSUFFIX}" ]; then
+ # check if PLATFORM_OSTYPE is set and not empty failed
+ cecho ${BAD} "Error: (internal) could not set LDSUFFIX"
+ exit 1
+fi
# Source default PACKAGES variables, if none were given so far
if [ -z "${PACKAGES}" ]; then