From ae332749eee056f59bf902a65ffb012fcf181875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Mon, 30 Oct 2023 09:28:54 +0100 Subject: build,qt: Build Qt with -fPIC if required or requested * configure.ac: Add option to enable building the Qt 6 binding with -fPIC. Fix typo and mention default for --enable-no-direct-extern-access option. * m4/qt6.m4: Add -fPIC to GPGME_QT6_CFLAGS if requested or if Qt 6 was built with reduce_relocations. -- GnuPG-bug-id: 6781 --- m4/qt6.m4 | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'm4') diff --git a/m4/qt6.m4 b/m4/qt6.m4 index e87fc244..8a3322a7 100644 --- a/m4/qt6.m4 +++ b/m4/qt6.m4 @@ -34,20 +34,37 @@ AC_DEFUN([FIND_QT6], fi if test "$have_qt6_libs" = "yes"; then + if test "$have_w32_system" != yes; then + mkspecsdir=$($PKG_CONFIG --variable mkspecsdir Qt6Platform) + if test -z "$mkspecsdir"; then + AC_MSG_WARN([Failed to determine Qt's mkspecs directory. Cannot check its build configuration.]) + fi + fi + + # check if we need -fPIC + if test -z "$use_reduce_relocations" && test -n "$mkspecsdir"; then + AC_MSG_CHECKING([whether Qt was built with -fPIC]) + if grep -q "QT_CONFIG .* reduce_relocations" $mkspecsdir/qconfig.pri; then + use_reduce_relocations="yes" + else + use_reduce_relocations="no" + fi + AC_MSG_RESULT([$use_reduce_relocations]) + fi + if test "$use_reduce_relocations" = yes; then + GPGME_QT6_CFLAGS="$GPGME_QT6_CFLAGS -fPIC" + fi + + # check if we need -mno-direct-extern-access if test "$have_no_direct_extern_access" = yes; then - if test -z "$use_no_direct_extern_access" && test "$have_w32_system" != yes; then - mkspecsdir=$($PKG_CONFIG --variable mkspecsdir Qt6Platform) - if test -n "$mkspecsdir"; then - AC_MSG_CHECKING([whether Qt was built with -mno-direct-extern-access]) - if grep -q "QT_CONFIG .* no_direct_extern_access" $mkspecsdir/qconfig.pri; then - use_no_direct_extern_access="yes" - else - use_no_direct_extern_access="no" - fi - AC_MSG_RESULT([$use_no_direct_extern_access]) + if test -z "$use_no_direct_extern_access" && test -n "$mkspecsdir"; then + AC_MSG_CHECKING([whether Qt was built with -mno-direct-extern-access]) + if grep -q "QT_CONFIG .* no_direct_extern_access" $mkspecsdir/qconfig.pri; then + use_no_direct_extern_access="yes" else - AC_MSG_WARN([Failed to determine Qt's mkspecs directory. Cannot check its build configuration.]) + use_no_direct_extern_access="no" fi + AC_MSG_RESULT([$use_no_direct_extern_access]) fi if test "$use_no_direct_extern_access" = yes; then GPGME_QT6_CFLAGS="$GPGME_QT6_CFLAGS -mno-direct-extern-access" -- cgit v1.2.3