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
|
|
|
|
|
2019-02-08 12:28:15 -08:00
|
|
|
CC="${CC:-}"
|
|
|
|
CXX="${CXX:-}"
|
|
|
|
PKG_CONF_PATH="${PKG_CONF_PATH:-}"
|
|
|
|
WINDRES="${WINDRES:-}"
|
|
|
|
|
2010-12-30 02:52:02 +01:00
|
|
|
# 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
|
|
|
|
2019-11-01 08:46:39 -07:00
|
|
|
printf %s 'Checking for suitable working C compiler ... '
|
|
|
|
|
2015-06-16 20:40:25 -03:00
|
|
|
cc_works=0
|
2019-07-27 09:58:17 -07:00
|
|
|
add_opt CC no
|
2015-06-16 20:40:25 -03:00
|
|
|
if [ "$CC" ]; then
|
2020-01-04 18:27:58 +01:00
|
|
|
$CC -o "$TEMP_EXE" "$TEMP_C" >/dev/null 2>&1 && cc_works=1
|
2015-06-16 20:40:25 -03:00
|
|
|
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
|
2020-01-04 18:27:58 +01:00
|
|
|
$CC -o "$TEMP_EXE" "$TEMP_C" >/dev/null 2>&1 && {
|
2017-11-21 08:42:48 -08:00
|
|
|
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'
|
2018-05-02 09:15:20 -07:00
|
|
|
HAVE_CC='yes'
|
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
|
|
|
|
|
2019-11-01 08:46:39 -07:00
|
|
|
printf %s\\n "$CC $cc_status"
|
2015-06-16 20:40:25 -03:00
|
|
|
|
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
|
|
|
|
2019-11-01 08:46:39 -07:00
|
|
|
printf %s 'Checking for suitable working C++ compiler ... '
|
|
|
|
|
2015-06-16 20:40:25 -03:00
|
|
|
cxx_works=0
|
2019-07-27 09:58:17 -07:00
|
|
|
add_opt CXX no
|
2015-06-16 20:40:25 -03:00
|
|
|
if [ "$CXX" ]; then
|
2020-01-04 18:27:58 +01:00
|
|
|
$CXX -o "$TEMP_EXE" "$TEMP_CXX" >/dev/null 2>&1 && cxx_works=1
|
2015-06-16 20:40:25 -03:00
|
|
|
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
|
2020-01-04 18:27:58 +01:00
|
|
|
$CXX -o "$TEMP_EXE" "$TEMP_CXX" >/dev/null 2>&1 && {
|
2017-11-21 08:42:48 -08:00
|
|
|
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'
|
2018-05-02 09:15:20 -07:00
|
|
|
HAVE_CXX='yes'
|
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
|
|
|
|
|
2019-11-01 08:46:39 -07:00
|
|
|
printf %s\\n "$CXX $cxx_status"
|
2015-06-16 20:40:25 -03:00
|
|
|
|
2015-06-16 20:45:35 -03:00
|
|
|
if [ "$cxx_works" = '0' ] && [ "$USE_LANG_CXX" = 'yes' ]; then
|
2018-05-02 09:15:20 -07:00
|
|
|
die : 'Warning: A working C++ compiler was not found, C++ features will be disabled.'
|
2010-12-30 02:52:02 +01:00
|
|
|
fi
|
2014-09-14 17:49:51 -03:00
|
|
|
|
|
|
|
if [ "$OS" = "Win32" ]; then
|
2019-11-01 09:00:35 -07:00
|
|
|
printf %s 'Checking for windres ... '
|
|
|
|
|
|
|
|
WINDRES="${WINDRES:-$(exists "${CROSS_COMPILE}windres" || :)}"
|
|
|
|
|
|
|
|
printf %s\\n "${WINDRES:=none}"
|
|
|
|
|
|
|
|
if [ "$WINDRES" = none ]; then
|
|
|
|
die 1 'Error: Cannot proceed without windres.'
|
2014-09-14 17:49:51 -03:00
|
|
|
fi
|
|
|
|
fi
|
2015-04-19 09:31:08 -03:00
|
|
|
|
2019-11-01 08:38:35 -07:00
|
|
|
printf %s 'Checking for pkg-config ... '
|
2019-10-31 22:32:28 -07:00
|
|
|
|
2019-11-01 08:38:35 -07:00
|
|
|
PKG_CONF_PATH="${PKG_CONF_PATH:-$(exists "${CROSS_COMPILE}pkgconf" ||
|
|
|
|
exists "${CROSS_COMPILE}pkg-config" || :)}"
|
2015-04-19 10:56:57 -03:00
|
|
|
|
2019-11-01 08:38:35 -07:00
|
|
|
printf %s\\n "${PKG_CONF_PATH:=none}"
|
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
|