RetroArch/qb/qb.comp.sh

106 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
# 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
HAVE_CC=no
2015-06-16 23:40:25 +00:00
if [ "$CC" ]; then
"$CC" -o "$TEMP_EXE" "$TEMP_C" >/dev/null 2>&1 && cc_works=1
else
2017-11-21 16:42:48 +00:00
for cc in gcc cc clang; do
CC="$(exists "${CROSS_COMPILE}${cc}")" || CC=""
if [ "$CC" ]; then
"$CC" -o "$TEMP_EXE" "$TEMP_C" >/dev/null 2>&1 && {
cc_works=1; break
}
fi
2015-06-16 23:40:25 +00:00
done
fi
2017-11-21 16:42:48 +00:00
rm -f -- "$TEMP_C" "$TEMP_EXE"
2015-06-16 23:40:25 +00:00
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'
HAVE_CC='yes'
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
printf %s\\n "Checking for suitable working C compiler ... $CC $cc_status"
2015-06-16 23:40:25 +00:00
2015-06-17 17:31:20 +00:00
if [ "$cc_works" = '0' ] && [ "$USE_LANG_C" = 'yes' ]; then
die 1 'Error: Cannot proceed without a working C compiler.'
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
HAVE_CXX=no
2015-06-16 23:40:25 +00:00
if [ "$CXX" ]; then
"$CXX" -o "$TEMP_EXE" "$TEMP_CXX" >/dev/null 2>&1 && cxx_works=1
else
2017-11-21 16:42:48 +00:00
for cxx in g++ c++ clang++; do
CXX="$(exists "${CROSS_COMPILE}${cxx}")" || CXX=""
if [ "$CXX" ]; then
"$CXX" -o "$TEMP_EXE" "$TEMP_CXX" >/dev/null 2>&1 && {
cxx_works=1; break
}
fi
2015-06-16 23:40:25 +00:00
done
fi
2017-11-21 16:42:48 +00:00
rm -f -- "$TEMP_CXX" "$TEMP_EXE"
2015-06-16 23:40:25 +00:00
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'
HAVE_CXX='yes'
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
printf %s\\n "Checking for suitable working C++ compiler ... $CXX $cxx_status"
2015-06-16 23:40:25 +00:00
2015-06-16 23:45:35 +00:00
if [ "$cxx_works" = '0' ] && [ "$USE_LANG_CXX" = 'yes' ]; then
die : 'Warning: A working C++ compiler was not found, C++ features will be disabled.'
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
2017-11-21 16:42:48 +00:00
WINDRES="$(exists "${CROSS_COMPILE}windres")" || WINDRES=""
[ -z "$WINDRES" ] && die 1 "$echobuf ... Not found. Exiting."
2014-09-14 20:49:51 +00:00
fi
printf %s\\n "$echobuf ... $WINDRES"
2014-09-14 20:49:51 +00:00
fi
2017-11-21 16:42:48 +00:00
if [ -z "$PKG_CONF_PATH" ]; then
PKG_CONF_PATH="none"
for pkgconf in pkgconf pkg-config; do
2017-11-21 16:42:48 +00:00
PKGCONF="$(exists "${CROSS_COMPILE}${pkgconf}")" || PKGCONF=""
[ "$PKGCONF" ] && {
PKG_CONF_PATH="$PKGCONF"
break
}
done
2017-11-21 16:42:48 +00:00
fi
2015-04-19 13:56:57 +00:00
printf %s\\n "Checking for pkg-config ... $PKG_CONF_PATH"
2015-04-19 13:56:57 +00:00
if [ "$PKG_CONF_PATH" = "none" ]; then
die : 'Warning: pkg-config not found, package checks will fail.'
2015-04-19 13:56:57 +00:00
fi