RetroArch/qb/qb.comp.sh

70 lines
1.9 KiB
Bash
Raw Normal View History

2010-12-30 01:52:02 +00:00
. qb/conf.comp.sh
TEMP_C=.tmp.c
TEMP_CXX=.tmp.cxx
TEMP_EXE=.tmp
echo -n "Checking operating system ... "
OS="Win32" # whatever ;D
2011-02-04 12:46:51 +00:00
unamestr="`uname -a`"
2011-06-25 11:57:46 +00:00
if [ ! -z "`echo "$unamestr" | grep -i Linux`" ]; then
2010-12-30 01:52:02 +00:00
OS="Linux"
2011-06-25 11:57:46 +00:00
elif [ ! -z "`echo "$unamestr" | grep -i Darwin`" ]; then
2010-12-30 01:52:02 +00:00
OS="Darwin"
2011-06-25 11:57:46 +00:00
elif [ ! -z "`echo "$unamestr" | grep -i BSD`" ]; then
2010-12-30 01:52:02 +00:00
OS="BSD"
2011-06-25 11:57:46 +00:00
elif [ ! -z "`echo "$unamestr" | grep -i MINGW32`" ]; then
OS="MinGW"
elif [ ! -z "`echo "$unamestr" | grep -i NT`" ]; then
2010-12-30 01:52:02 +00:00
OS="Cygwin"
fi
echo $OS
# Checking for working C compiler
if [ "$USE_LANG_C" = yes ]; then
echo "Checking for working C compiler ..."
if [ -z $CC ]; then
CC=`which gcc cc 2> /dev/null | grep ^/ | head -n 1`
fi
if [ -z $CC ]; then
echo "Could not find C compiler in path. Exiting ..."
exit 1
fi
echo -n "Checking if $CC is a suitable compiler ... "
answer=no
echo "#include <stdio.h>" > $TEMP_C
echo "int main(void) { puts(\"Hai world!\"); return 0; }" >> $TEMP_C
$CC -o $TEMP_EXE $TEMP_C 2>/dev/null >/dev/null && answer=yes
echo $answer
rm -rf $TEMP_C $TEMP_EXE
[ $answer = no ] && echo "Can't find suitable C compiler. Exiting ..." && exit 1
fi
# Checking for working C++ compiler
if [ "$USE_LANG_CXX" = "yes" ]; then
echo "Checking for working C++ compiler ..."
if [ -z $CXX ]; then
CXX=`which g++ c++ 2> /dev/null | grep ^/ | head -n 1`
fi
if [ -z $CXX ]; then
2011-02-07 10:14:46 +00:00
echo "Could not find C++ compiler in path. Exiting ..."
2010-12-30 01:52:02 +00:00
exit 1
fi
echo -n "Checking if $CXX is a suitable compiler ... "
answer=no
echo "#include <iostream>" > $TEMP_CXX
echo "int main() { std::cout << \"Hai guise\" << std::endl; return 0; }" >> $TEMP_CXX
$CXX -o $TEMP_EXE $TEMP_CXX 2>/dev/null >/dev/null && answer=yes
echo $answer
rm -rf $TEMP_CXX $TEMP_EXE
[ $answer = no ] && echo "Can't find suitable C++ compiler. Exiting ..." && exit 1
fi