aboutsummaryrefslogtreecommitdiffstats
path: root/acinclude.m4
diff options
context:
space:
mode:
authorJeffrey Smith <whydoubt@gmail.com>2015-08-28 00:21:01 -0500
committerJeff Morriss <jeff.morriss.ws@gmail.com>2015-09-10 13:00:34 +0000
commita2fec2188654bd80ae8567862c546c33bf5eb698 (patch)
tree838c81f092000fecea422df024a208a6ccf2cb4a /acinclude.m4
parent5eee0b9e4459ab95083524bc1d430524e63f44d2 (diff)
Check if -fPIC is needed for Qt5 code to compile
On many systems, Qt5 requires that code compiled against it must compile with -fPIC. The preferred place to determine whether this is necessary is at configure time. This change adds the auto-tool code to make that happen and removes the hack put in place as an interim solution. Bug: 11230 Change-Id: I6e583c67bb67d168a30c0af05a8cd0a070522ba0 Reviewed-on: https://code.wireshark.org/review/10281 Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m430
1 files changed, 30 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index b92e455d5f..82b288a999 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -2064,6 +2064,34 @@ AC_DEFUN([AC_WIRESHARK_QT_MODULE_CHECK],
fi
])
+AC_DEFUN([AC_WIRESHARK_QT_ADD_PIC_IF_NEEDED],
+[
+ AC_LANG_PUSH([C++])
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $Qt_CFLAGS"
+ AC_MSG_CHECKING([whether Qt works without -fPIC])
+ AC_PREPROC_IFELSE(
+ [AC_LANG_SOURCE([[#include <QtCore>]])],
+ [AC_MSG_RESULT(yes)],
+ [
+ AC_MSG_RESULT(no)
+ AC_MSG_CHECKING([whether Qt works with -fPIC])
+ CPPFLAGS="$CPPFLAGS -fPIC"
+ AC_PREPROC_IFELSE(
+ [AC_LANG_SOURCE([[#include <QtCore>]])],
+ [
+ AC_MSG_RESULT(yes)
+ Qt_CFLAGS="$Qt_CFLAGS -fPIC"
+ ],
+ [
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR(Couldn't compile Qt without -fPIC nor with -fPIC)
+ ])
+ ])
+ CPPFLAGS="$save_CPPFLAGS"
+ AC_LANG_POP([C++])
+])
+
dnl AC_WIRESHARK_QT_CHECK([MINIMUM-VERSION, REQUESTED-MAJOR_VERSION,
dnl [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]])
dnl Test for Qt and define Qt_CFLAGS and Qt_LIBS.
@@ -2121,6 +2149,8 @@ AC_DEFUN([AC_WIRESHARK_QT_CHECK],
AC_WIRESHARK_QT_MODULE_CHECK(MacExtras, $1, $qt_version_to_check,
AC_DEFINE(QT_MACEXTRAS_LIB, 1, [Define if we have QtMacExtras]))
+ AC_WIRESHARK_QT_ADD_PIC_IF_NEEDED
+
AC_SUBST(Qt_LIBS)
# Run Action-If-Found