comparison configure.ac @ 289:3dbf01233fec

autoconf: add a check for some weird Qt PIC requirements
author Paper <paper@paper.us.eu.org>
date Wed, 08 May 2024 17:27:13 -0400
parents 8b9db17d1e5f
children 9347e2eaf6e5
comparison
equal deleted inserted replaced
288:8b9db17d1e5f 289:3dbf01233fec
9 9
10 AM_INIT_AUTOMAKE([-Wall -Wportability foreign subdir-objects]) 10 AM_INIT_AUTOMAKE([-Wall -Wportability foreign subdir-objects])
11 11
12 dnl need C compiler for utf8proc 12 dnl need C compiler for utf8proc
13 AC_PROG_CC 13 AC_PROG_CC
14 AC_LANG([C++])
14 15
15 dnl Do we have a C++17 compiler 16 dnl Do we have a C++17 compiler
16 : ${CXXFLAGS=""}
17 AC_PROG_CXX 17 AC_PROG_CXX
18 AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory]) 18 AX_CXX_COMPILE_STDCXX([17], [noext], [mandatory])
19 19
20 dnl Init libtool 20 dnl Init libtool
21 AM_PROG_AR 21 AM_PROG_AR
22 LT_INIT 22 LT_INIT
23 23
24 24
25 dnl Qt? 25 dnl Qt?
26 AS_IF([test "${enable_qt}" != "no"], [ 26 PKG_CHECK_MODULES([QT], [Qt5Core >= 5.7.0 Qt5Widgets Qt5Gui], [
27 PKG_CHECK_MODULES([QT], [Qt5Core >= 5.7.0 Qt5Widgets Qt5Gui], [ 27 QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix Qt5Core)"
28 QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix Qt5Core)" 28 QT_HOST_PATH="$(eval $PKG_CONFIG --variable=host_bins Qt5Core)"
29 QT_HOST_PATH="$(eval $PKG_CONFIG --variable=host_bins Qt5Core)" 29 QT_VERSION="$(eval $PKG_CONFIG --modversion Qt5Gui)"
30 QT_VERSION="$(eval $PKG_CONFIG --modversion Qt5Gui)" 30 AC_PATH_PROGS(QT_MOC, [moc-qt5 moc], moc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
31 AC_PATH_PROGS(QT_MOC, [moc-qt5 moc], moc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"]) 31 AC_PATH_PROGS(QT_RCC, [rcc-qt5 rcc], rcc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
32 AC_PATH_PROGS(QT_RCC, [rcc-qt5 rcc], rcc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"]) 32 AC_PATH_PROGS(QT_UIC, [uic-qt5 uic], uic, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
33 AC_PATH_PROGS(QT_UIC, [uic-qt5 uic], uic, ["${QT_HOST_PATH}" "${QT_PATH}/bin"]) 33 AC_PATH_PROGS(QT_LRELEASE, [lrelease-qt5 lrelease], lrelease, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
34 AC_PATH_PROGS(QT_LRELEASE, [lrelease-qt5 lrelease], lrelease, ["${QT_HOST_PATH}" "${QT_PATH}/bin"]) 34 AC_PATH_PROGS(QT_LUPDATE, [lupdate-qt5 lupdate], lupdate, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
35 AC_PATH_PROGS(QT_LUPDATE, [lupdate-qt5 lupdate], lupdate, ["${QT_HOST_PATH}" "${QT_PATH}/bin"]) 35 ], [
36 ], [ 36 AC_MSG_ERROR([${QT_PKG_ERRORS}.])
37 AC_MSG_ERROR([${QT_PKG_ERRORS}])
38 ])
39 ]) 37 ])
38
39 dnl On some platforms (see: Debian), Qt is built with
40 dnl `-reduce-relocations`, which requires applications
41 dnl to be built with position-independent code.
42 dnl
43 dnl Unfortunately there's no way to check for this
44 dnl without using qmake (bleugh), so we use this check
45 dnl to see if qglobal.h can be included without PIC.
46
47 saved_CXXFLAGS="$CXXFLAGS"
48 CXXFLAGS="$CXXFLAGS $QT_CFLAGS"
49 AC_COMPILE_IFELSE(
50 [AC_LANG_PROGRAM([#include <qglobal.h>], [])],
51 [CXXFLAGS="$saved_CXXFLAGS"],
52 [CXXFLAGS="$saved_CXXFLAGS -fPIC"]
53 )
40 54
41 dnl need this for moc 55 dnl need this for moc
42 AC_PROG_MKDIR_P 56 AC_PROG_MKDIR_P
43 AC_SUBST([MKDIR_P]) 57 AC_SUBST([MKDIR_P])
44 58