Skip to content

Commit

Permalink
qb: Fix the qt configure check with older compilers.
Browse files Browse the repository at this point in the history
  • Loading branch information
orbea committed Jan 15, 2020
1 parent 243505b commit d41b777
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ endif
DEF_FLAGS += -Wall $(INCLUDE_DIRS) -I. -Ideps -Ideps/stb

CFLAGS += $(DEF_FLAGS)
CXXFLAGS += $(DEF_FLAGS) -std=c++11 -D__STDC_CONSTANT_MACROS
CXXFLAGS += $(DEF_FLAGS) -D__STDC_CONSTANT_MACROS
OBJCFLAGS := $(CFLAGS) -D__STDC_CONSTANT_MACROS

ifeq ($(HAVE_CXX), 1)
Expand Down
4 changes: 4 additions & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ ifeq ($(HAVE_STACK_USAGE), 1)
DEF_FLAGS += -fstack-usage
endif

ifeq ($(HAVE_CXX11), 1)
CXXFLAGS += $(CXX11_CFLAGS)
endif

ifeq ($(HAVE_GL_CONTEXT),)
HAVE_GL_CONTEXT = 0
HAVE_GL_MODERN = 0
Expand Down
7 changes: 5 additions & 2 deletions qb/config.libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
# check_header, check_macro and check_switch are not used.

check_switch '' C99 -std=gnu99 "Cannot find C99 compatible compiler."
check_switch '' NOUNUSED -Wno-unused-result
check_switch cxx CXX11 -std=c++11 ''
check_switch '' NOUNUSED -Wno-unused-result ''
add_define MAKEFILE NOUNUSED "$HAVE_NOUNUSED"
check_switch '' NOUNUSED_VARIABLE -Wno-unused-variable
check_switch '' NOUNUSED_VARIABLE -Wno-unused-variable ''
add_define MAKEFILE NOUNUSED_VARIABLE "$HAVE_NOUNUSED_VARIABLE"

# There are still broken 64-bit Linux distros out there. :)
Expand Down Expand Up @@ -264,6 +265,8 @@ if [ "$HAVE_SDL2" = 'yes' ] && [ "$HAVE_SDL" = 'yes' ]; then
HAVE_SDL=no
fi

check_enabled CXX11 CXX C++ 'C++11 support is' false

check_platform Haiku DISCORD 'Discord is' false
check_enabled CXX DISCORD discord 'The C++ compiler is' false
check_enabled CXX QT 'Qt companion' 'The C++ compiler is' false
Expand Down
2 changes: 1 addition & 1 deletion qb/config.moc.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
QT_VERSION=qt5
QT_FLAGS="$QT5CORE_CFLAGS $QT5CORE_LIBS"
QT_FLAGS="$CXX11_CFLAGS $QT5CORE_CFLAGS $QT5CORE_LIBS"

add_define MAKEFILE QT_VERSION "$QT_VERSION"
8 changes: 6 additions & 2 deletions qb/qb.libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,16 @@ check_switch()
printf %s\\n 'int main(void) { return 0; }' > "$TEMP_CODE"
answer='no'
printf %s "Checking for availability of switch $3 in $COMPILER ... "
$(printf %s "$COMPILER") -o "$TEMP_EXE" "$TEMP_CODE" "$3" \
$(printf %s "$COMPILER") -o "$TEMP_EXE" "$TEMP_CODE" \
$(printf %s "$BUILD_DIRS $CFLAGS $3 -Werror $LDFLAGS") \
>>config.log 2>&1 && answer='yes'
eval "HAVE_$2=\"$answer\""
printf %s\\n "$answer"
rm -f -- "$TEMP_CODE" "$TEMP_EXE"
if [ "$answer" = 'no' ] && [ "${4:-}" ]; then
if [ "$answer" = 'yes' ]; then
eval "${2}_CFLAGS=\"$3\""
PKG_CONF_USED="$PKG_CONF_USED $2"
elif [ "${4:-}" ]; then
die 1 "$4"
fi
}
Expand Down

0 comments on commit d41b777

Please sign in to comment.