configure: Qt6: pass -spec linux-clang/g++ if compiling on Linux

Otherwise `qmake` might add compiler flags that aren't understood by
the other one.

Actual issue that triggered this change: on Arch with Qt 6.5.2 no
matter what `CC`/`CXX` are set to, `qmake` always assumes `g++` & uses
`linux-g++` as the spec, adding `-mno-direct-extern-access`. `clang`'s
equivalent is `-fno-direct-access-external-data`, though.
This commit is contained in:
Moritz Bunkus 2023-08-20 15:45:01 +02:00
parent 974cc0e5f0
commit eade36c82d
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
2 changed files with 24 additions and 4 deletions

11
NEWS.md
View File

@ -1,3 +1,14 @@
# Version ?
## Bug fixes
* build system: fixed detection of Qt6 if `clang` is used for compilation on
Linux. In that case Qt's `qmake` added a `gcc`-specific option that `clang`
doesn't understand, `-mno-direct-extern-access`. `configure` will now pass
the parameter `-spec linux-clang` to `qmake` so that it uses the correct
compiler flags.
# Version 79.0 "Funeral Pyres" 2023-08-20
## New features and enhancements

View File

@ -22,6 +22,15 @@ check_qt6() {
return
fi
QMAKE_SPEC=""
if "$QMAKE6" -query | grep -F -q "QMAKE_XSPEC:linux-g++"; then
if test x"$COMPILER_TYPE" = xclang; then
QMAKE_SPEC="-spec linux-clang"
else
QMAKE_SPEC="-spec linux-g++"
fi
fi
rm -f src/mkvtoolnix-gui/static_plugins.cpp
qmake_dir="`mktemp -d`"
@ -57,7 +66,7 @@ EOT
old_wd="$PWD"
cd "$qmake_dir"
"$QMAKE6" -makefile -nocache configure_non_gui.pro > /dev/null
"$QMAKE6" -makefile -nocache $QMAKE_SPEC configure_non_gui.pro > /dev/null
result=$?
if test $result = 0; then
@ -81,7 +90,7 @@ HEADERS = configure.h
SOURCES = configure.cpp
EOT
"$QMAKE6" -makefile -nocache configure.pro > /dev/null 2> /dev/null
"$QMAKE6" -makefile -nocache $QMAKE_SPEC configure.pro > /dev/null 2> /dev/null
result2=$?
if test $result2 != 0; then
@ -106,7 +115,7 @@ HEADERS = configure.h
SOURCES = configure.cpp
EOT
"$QMAKE6" -makefile -nocache configure.pro > /dev/null
"$QMAKE6" -makefile -nocache $QMAKE_SPEC configure.pro > /dev/null
result2=$?
if test $result2 = 0; then
@ -119,7 +128,7 @@ EOT
fi
fi
"$QMAKE6" -query > "$qmake_dir/configure.properties"
"$QMAKE6" -query $QMAKE_SPEC > "$qmake_dir/configure.properties"
result3=$?
cd "$old_wd"