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
|
|
|
|
|
2011-06-25 12:10:40 +00:00
|
|
|
ECHOBUF="Checking operating system ... "
|
2010-12-30 01:52:02 +00:00
|
|
|
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
|
|
|
|
|
2011-06-25 12:10:40 +00:00
|
|
|
echo $ECHOBUF $OS
|
2010-12-30 01:52:02 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2011-06-25 12:10:40 +00:00
|
|
|
ECHOBUF="Checking if $CC is a suitable compiler ..."
|
2010-12-30 01:52:02 +00:00
|
|
|
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
|
2011-06-25 12:10:40 +00:00
|
|
|
echo $ECHOBUF $answer
|
2010-12-30 01:52:02 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2011-06-25 12:10:40 +00:00
|
|
|
ECHOBUF="Checking if $CXX is a suitable compiler ..."
|
2010-12-30 01:52:02 +00:00
|
|
|
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
|
2011-06-25 12:10:40 +00:00
|
|
|
echo $ECHOBUF $answer
|
2010-12-30 01:52:02 +00:00
|
|
|
|
|
|
|
rm -rf $TEMP_CXX $TEMP_EXE
|
|
|
|
|
|
|
|
[ $answer = no ] && echo "Can't find suitable C++ compiler. Exiting ..." && exit 1
|
|
|
|
fi
|
|
|
|
|