RetroArch/qb/qb.comp.sh

101 lines
2.4 KiB
Bash
Raw Normal View History

2011-06-25 15:11:18 +00:00
. qb/config.comp.sh
2010-12-30 01:52:02 +00:00
TEMP_C=.tmp.c
TEMP_CXX=.tmp.cxx
TEMP_EXE=.tmp
2012-06-12 20:16:16 +00:00
ECHOBUF="Checking operating system"
#echo -n "Checking operating system"
if [ -n "$CROSS_COMPILE" ]; then
case "$CROSS_COMPILE" in
*'-mingw32'*) OS='Win32';;
*);;
esac
fi
2014-09-17 20:37:39 +00:00
if [ -z "$CROSS_COMPILE" ] || [ -z "$OS" ]; then
case "$(uname)" in
'Linux') OS='Linux';;
*'BSD') OS='BSD';;
'Darwin') OS='Darwin';;
'CYGWIN'*) OS='Cygwin';;
'Haiku') OS='Haiku';;
2014-10-28 23:27:14 +00:00
'MINGW'*) OS='Win32';;
*) OS="Win32";;
esac
fi
2015-04-19 11:53:09 +00:00
DISTRO=''
if [ -e /etc/lsb-release ]; then
. /etc/lsb-release
DISTRO="(${DISTRIB_DESCRIPTION} ${DISTRIB_RELEASE})"
fi
echo "$ECHOBUF ... $OS ${DISTRO}"
2010-12-30 01:52:02 +00:00
# Checking for working C compiler
2012-06-12 20:16:16 +00:00
if [ "$USE_LANG_C" = 'yes' ]; then
ECHOBUF="Checking for suitable working C compiler"
# echo -n "Checking for suitable working C compiler"
cat << EOF > "$TEMP_C"
#include <stdio.h>
int main(void) { puts("Hai world!"); return 0; }
EOF
2014-06-19 21:32:12 +00:00
if [ -z "$CC" ]; then
2015-04-19 11:53:09 +00:00
for CC in ${CC:=$(which ${CROSS_COMPILE}gcc ${CROSS_COMPILE}cc ${CROSS_COMPILE}clang 2>/dev/null)} ''; do
2014-06-19 21:32:12 +00:00
"$CC" -o "$TEMP_EXE" "$TEMP_C" >/dev/null 2>&1 && break
done
fi
2012-06-12 20:16:16 +00:00
[ "$CC" ] || { echo "$ECHOBUF ... Not found. Exiting."; exit 1;}
echo "$ECHOBUF ... $CC"
rm -f "$TEMP_C" "$TEMP_EXE"
2010-12-30 01:52:02 +00:00
fi
2012-06-12 20:16:16 +00:00
# Checking for working C++
if [ "$USE_LANG_CXX" = 'yes' ]; then
ECHOBUF="Checking for suitable working C++ compiler"
# echo -n "Checking for suitable working C++ compiler"
cat << EOF > "$TEMP_CXX"
#include <iostream>
int main() { std::cout << "Hai guise" << std::endl; return 0; }
EOF
2014-06-19 21:32:12 +00:00
if [ -z "$CXX" ]; then
2015-04-19 11:53:09 +00:00
for CXX in ${CXX:=$(which ${CROSS_COMPILE}g++ ${CROSS_COMPILE}c++ ${CROSS_COMPILE}clang++ 2>/dev/null)} ''; do
2014-06-19 21:32:12 +00:00
"$CXX" -o "$TEMP_EXE" "$TEMP_CXX" >/dev/null 2>&1 && break
done
fi
2012-06-12 20:16:16 +00:00
[ "$CXX" ] || { echo "$ECHOBUF ... Not found. Exiting."; exit 1;}
echo "$ECHOBUF ... $CXX"
rm -f "$TEMP_CXX" "$TEMP_EXE"
2010-12-30 01:52:02 +00:00
fi
2014-09-14 20:49:51 +00:00
if [ "$OS" = "Win32" ]; then
ECHOBUF="Checking for windres"
if [ -z "$WINDRES" ]; then
WINDRES=$(which ${CROSS_COMPILE}windres)
[ "$WINDRES" ] || { echo "$ECHOBUF ... Not found. Exiting."; exit 1; }
fi
echo "$ECHOBUF ... $WINDRES"
fi
2015-04-19 13:56:57 +00:00
ECHOBUF="Checking for pkg-config"
[ -n "$PKG_CONF_PATH" ] || {
PKG_CONF_PATH="none"
for path in $(which "${CROSS_COMPILE}pkg-config" 2>/dev/null) ''; do
[ -n "$path" ] && {
PKG_CONF_PATH=$path;
break;
}
done
}
2015-04-19 13:56:57 +00:00
echo "$ECHOBUF ... $PKG_CONF_PATH"
if [ "$PKG_CONF_PATH" = "none" ]; then
echo "Warning: pkg-config not found, package checks will fail."
fi