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