# HG changeset patch # User Paper # Date 1715203633 14400 # Node ID 3dbf01233fec99ef21b895ac4eaa7f368e2c617b # Parent 8b9db17d1e5f8a052b0f70ba9cfc716e9d9900e2 autoconf: add a check for some weird Qt PIC requirements diff -r 8b9db17d1e5f -r 3dbf01233fec configure.ac --- a/configure.ac Wed May 08 16:47:25 2024 -0400 +++ b/configure.ac Wed May 08 17:27:13 2024 -0400 @@ -11,9 +11,9 @@ dnl need C compiler for utf8proc AC_PROG_CC +AC_LANG([C++]) dnl Do we have a C++17 compiler -: ${CXXFLAGS=""} AC_PROG_CXX AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory]) @@ -23,21 +23,35 @@ dnl Qt? -AS_IF([test "${enable_qt}" != "no"], [ - PKG_CHECK_MODULES([QT], [Qt5Core >= 5.7.0 Qt5Widgets Qt5Gui], [ - QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix Qt5Core)" - QT_HOST_PATH="$(eval $PKG_CONFIG --variable=host_bins Qt5Core)" - QT_VERSION="$(eval $PKG_CONFIG --modversion Qt5Gui)" - AC_PATH_PROGS(QT_MOC, [moc-qt5 moc], moc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"]) - AC_PATH_PROGS(QT_RCC, [rcc-qt5 rcc], rcc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"]) - AC_PATH_PROGS(QT_UIC, [uic-qt5 uic], uic, ["${QT_HOST_PATH}" "${QT_PATH}/bin"]) - AC_PATH_PROGS(QT_LRELEASE, [lrelease-qt5 lrelease], lrelease, ["${QT_HOST_PATH}" "${QT_PATH}/bin"]) - AC_PATH_PROGS(QT_LUPDATE, [lupdate-qt5 lupdate], lupdate, ["${QT_HOST_PATH}" "${QT_PATH}/bin"]) - ], [ - AC_MSG_ERROR([${QT_PKG_ERRORS}]) - ]) +PKG_CHECK_MODULES([QT], [Qt5Core >= 5.7.0 Qt5Widgets Qt5Gui], [ + QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix Qt5Core)" + QT_HOST_PATH="$(eval $PKG_CONFIG --variable=host_bins Qt5Core)" + QT_VERSION="$(eval $PKG_CONFIG --modversion Qt5Gui)" + AC_PATH_PROGS(QT_MOC, [moc-qt5 moc], moc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"]) + AC_PATH_PROGS(QT_RCC, [rcc-qt5 rcc], rcc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"]) + AC_PATH_PROGS(QT_UIC, [uic-qt5 uic], uic, ["${QT_HOST_PATH}" "${QT_PATH}/bin"]) + AC_PATH_PROGS(QT_LRELEASE, [lrelease-qt5 lrelease], lrelease, ["${QT_HOST_PATH}" "${QT_PATH}/bin"]) + AC_PATH_PROGS(QT_LUPDATE, [lupdate-qt5 lupdate], lupdate, ["${QT_HOST_PATH}" "${QT_PATH}/bin"]) +], [ + AC_MSG_ERROR([${QT_PKG_ERRORS}.]) ]) +dnl On some platforms (see: Debian), Qt is built with +dnl `-reduce-relocations`, which requires applications +dnl to be built with position-independent code. +dnl +dnl Unfortunately there's no way to check for this +dnl without using qmake (bleugh), so we use this check +dnl to see if qglobal.h can be included without PIC. + +saved_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $QT_CFLAGS" +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([#include ], [])], + [CXXFLAGS="$saved_CXXFLAGS"], + [CXXFLAGS="$saved_CXXFLAGS -fPIC"] +) + dnl need this for moc AC_PROG_MKDIR_P AC_SUBST([MKDIR_P])