aboutsummaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
authorIngo Klöcker <[email protected]>2022-10-14 12:16:47 +0000
committerIngo Klöcker <[email protected]>2022-10-14 12:16:47 +0000
commit2ff09f474fb908dff83cce79c9d84b4fa21f5d7b (patch)
treef694d8fb42bc9f7d84c7b1576c736a6973fa6a59 /m4
parentbuild,qt: Fail check for Qt if moc wasn't found (diff)
downloadgpgme-2ff09f474fb908dff83cce79c9d84b4fa21f5d7b.tar.gz
gpgme-2ff09f474fb908dff83cce79c9d84b4fa21f5d7b.zip
build,qt: Check whether building with -fPIC is needed
m4/qt6.m4: Use build test to check whether -fPIC is needed for building a Qt application. --
Diffstat (limited to 'm4')
-rw-r--r--m4/qt6.m437
1 files changed, 28 insertions, 9 deletions
diff --git a/m4/qt6.m4 b/m4/qt6.m4
index 0eef5543..9ad82952 100644
--- a/m4/qt6.m4
+++ b/m4/qt6.m4
@@ -60,22 +60,41 @@ AC_DEFUN([FIND_QT6],
dnl we check here that we can actually compile / link a qt application
dnl for host.
OLDCPPFLAGS=$CPPFLAGS
- CPPFLAGS=$GPGME_QT6_CFLAGS
- if ! test "$have_w32_system" = yes; then
- CPPFLAGS="$CPPFLAGS -fpic"
- fi
OLDLIBS=$LIBS
+
+ # try building without -fPIC
+ CPPFLAGS=$GPGME_QT6_CFLAGS
LIBS=$GPGME_QT6_LIBS
AC_LANG_PUSH(C++)
- AC_MSG_CHECKING([whether a simple qt program can be built])
+ AC_MSG_CHECKING([whether a simple qt program can be built without -fPIC])
AC_LINK_IFELSE([AC_LANG_SOURCE([
- #include <QCoreApplication>
- int main (int argc, char **argv) {
- QCoreApplication app(argc, argv);
- app.exec();
+ #include <QCoreApplication>
+ int main (int argc, char **argv) {
+ QCoreApplication app(argc, argv);
+ app.exec();
}])], [have_qt6_libs='yes'], [have_qt6_libs='no'])
AC_MSG_RESULT([$have_qt6_libs])
AC_LANG_POP()
+
+ if test "$have_qt6_libs" = "no" -a "$have_w32_system" != yes; then
+ # try building with -fPIC
+ CPPFLAGS="$GPGME_QT6_CFLAGS -fPIC"
+ LIBS=$GPGME_QT6_LIBS
+ AC_LANG_PUSH(C++)
+ AC_MSG_CHECKING([whether a simple qt program can be built with -fPIC])
+ AC_LINK_IFELSE([AC_LANG_SOURCE([
+ #include <QCoreApplication>
+ int main (int argc, char **argv) {
+ QCoreApplication app(argc, argv);
+ app.exec();
+ }])], [
+ have_qt6_libs='yes'
+ GPGME_QT6_CFLAGS="$GPGME_QT6_CFLAGS -fPIC"
+ ], [have_qt6_libs='no'])
+ AC_MSG_RESULT([$have_qt6_libs])
+ AC_LANG_POP()
+ fi
+
CPPFLAGS=$OLDCPPFLAGS
LIBS=$OLDLIBS
fi