RetroArch/qb/qb.comp.sh

95 lines
2.2 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
# Checking for working C compiler
2015-06-16 23:40:25 +00:00
cat << EOF > "$TEMP_C"
2012-06-12 20:16:16 +00:00
#include <stdio.h>
int main(void) { puts("Hai world!"); return 0; }
EOF
2015-06-16 23:40:25 +00:00
cc_works=0
if [ "$CC" ]; then
"$CC" -o "$TEMP_EXE" "$TEMP_C" >/dev/null 2>&1 && cc_works=1
else
for CC in ${CC:=$(which ${CROSS_COMPILE}gcc ${CROSS_COMPILE}cc ${CROSS_COMPILE}clang 2>/dev/null)} ''; do
"$CC" -o "$TEMP_EXE" "$TEMP_C" >/dev/null 2>&1 && cc_works=1 && break
done
fi
rm -f "$TEMP_C" "$TEMP_EXE"
cc_status='does not work'
2015-06-17 17:31:20 +00:00
if [ "$cc_works" = '1' ]; then
2015-06-16 23:40:25 +00:00
cc_status='works'
2015-06-17 13:21:55 +00:00
elif [ -z "$CC" ]; then
2015-06-16 23:40:25 +00:00
cc_status='not found'
fi
echo "Checking for suitable working C compiler ... $CC $cc_status"
2015-06-17 17:31:20 +00:00
if [ "$cc_works" = '0' ] && [ "$USE_LANG_C" = 'yes' ]; then
2015-06-16 23:40:25 +00:00
echo "Error: Cannot proceed without a working C compiler."
exit 1
2010-12-30 01:52:02 +00:00
fi
2012-06-12 20:16:16 +00:00
# Checking for working C++
2015-06-16 23:40:25 +00:00
cat << EOF > "$TEMP_CXX"
2012-06-12 20:16:16 +00:00
#include <iostream>
int main() { std::cout << "Hai guise" << std::endl; return 0; }
EOF
2015-06-16 23:40:25 +00:00
cxx_works=0
if [ "$CXX" ]; then
"$CXX" -o "$TEMP_EXE" "$TEMP_CXX" >/dev/null 2>&1 && cxx_works=1
else
for CXX in ${CXX:=$(which ${CROSS_COMPILE}g++ ${CROSS_COMPILE}c++ ${CROSS_COMPILE}clang++ 2>/dev/null)} ''; do
"$CXX" -o "$TEMP_EXE" "$TEMP_CXX" >/dev/null 2>&1 && cxx_works=1 && break
done
fi
rm -f "$TEMP_CXX" "$TEMP_EXE"
cxx_status='does not work'
2015-06-16 23:45:35 +00:00
if [ "$cxx_works" = '1' ]; then
2015-06-16 23:40:25 +00:00
cxx_status='works'
2015-06-17 13:21:55 +00:00
elif [ -z "$CXX" ]; then
2015-06-16 23:40:25 +00:00
cxx_status='not found'
fi
echo "Checking for suitable working C++ compiler ... $CXX $cxx_status"
2015-06-16 23:45:35 +00:00
if [ "$cxx_works" = '0' ] && [ "$USE_LANG_CXX" = 'yes' ]; then
2015-06-16 23:40:25 +00:00
echo "Error: Cannot proceed without a working C++ compiler."
exit 1
2010-12-30 01:52:02 +00:00
fi
2014-09-14 20:49:51 +00:00
if [ "$OS" = "Win32" ]; then
2015-06-16 23:40:25 +00:00
echobuf="Checking for windres"
2014-09-14 20:49:51 +00:00
if [ -z "$WINDRES" ]; then
WINDRES=$(which ${CROSS_COMPILE}windres)
2015-06-16 23:40:25 +00:00
[ "$WINDRES" ] || { echo "$echobuf ... Not found. Exiting."; exit 1; }
2014-09-14 20:49:51 +00:00
fi
2015-06-16 23:40:25 +00:00
echo "$echobuf ... $WINDRES"
2014-09-14 20:49:51 +00:00
fi
2015-04-19 13:56:57 +00:00
[ -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
2015-06-16 23:40:25 +00:00
echo "Checking for pkg-config ... $PKG_CONF_PATH"
2015-04-19 13:56:57 +00:00
if [ "$PKG_CONF_PATH" = "none" ]; then
echo "Warning: pkg-config not found, package checks will fail."
fi