Index: buildsys.mk.in ================================================================== --- buildsys.mk.in +++ buildsys.mk.in @@ -199,11 +199,11 @@ ${CPP} ${CPPFLAGS} ${OBJCFLAGS} -M $< | \ sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.plugin.o:/' >$@ || \ { rm -f $@; false; } .mm.mm.dep: - ${CPP} ${CPPFLAGS} ${OBJCPPFLAGS} -M $< | \ + ${CPP} ${CPPFLAGS} ${OBJCXXFLAGS} -M $< | \ sed 's/^\([^\.]*\)\.o:/\1.o \1.lib.o \1.plugin.o:/' >$@ || \ { rm -f $@; false; } .S.S.dep: ${CPP} ${CPPFLAGS} ${ASFLAGS} -M $< | \ @@ -511,29 +511,29 @@ .mm.o: ${COMPILE_STATUS} in="$<"; \ out="$@"; \ - if ${OBJCXX} ${OBJCXXFLAGS} ${OBJCFLAGS} ${CXXFLAGS} ${CPPFLAGS} ${OBJCXXFLAGS_$@} -c -o $@ $<; then \ + if ${OBJCXX} ${OBJCXXFLAGS} ${CPPFLAGS} ${OBJCXXFLAGS_$@} -c -o $@ $<; then \ ${COMPILE_OK}; \ else \ ${COMPILE_FAILED}; \ fi .mm.lib.o: ${COMPILE_LIB_STATUS} in="$<"; \ out="$@"; \ - if ${OBJCXX} ${LIB_CFLAGS} ${OBJCXXFLAGS} ${OBJCFLAGS} ${CXXFLAGS} ${CPPFLAGS} ${OBJCXXFLAGS_$@} -c -o $@ $<; then \ + if ${OBJCXX} ${LIB_CFLAGS} ${OBJCXXFLAGS} ${CPPFLAGS} ${OBJCXXFLAGS_$@} -c -o $@ $<; then \ ${COMPILE_LIB_OK}; \ else \ ${COMPILE_LIB_FAILED}; \ fi .mm.plugin.o: ${COMPILE_PLUGIN_STATUS} in="$<"; \ out="$@"; \ - if ${OBJCXX} ${PLUGIN_CFLAGS} ${OBJCXXFLAGS} ${OBJCFLAGS} ${CXXFLAGS} ${CPPFLAGS} ${OBJCXXFLAGS_$@} -c -o $@ $<; then \ + if ${OBJCXX} ${PLUGIN_CFLAGS} ${OBJCXXFLAGS} ${CPPFLAGS} ${OBJCXXFLAGS_$@} -c -o $@ $<; then \ ${COMPILE_PLUGIN_OK}; \ else \ ${COMPILE_PLUGIN_FAILED}; \ fi Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -17,18 +17,19 @@ AC_LANG([Objective C++]) AC_PROG_OBJCXX(clang++ g++) AC_PROG_OBJCXXCPP AC_PROG_LN_S AC_PROG_INSTALL +AC_PROG_EGREP CPP="$OBJCXXCPP" CPPFLAGS="$CPPFLAGS $OBJCPPFLAGS $($OBJFW_CONFIG --cppflags)" OBJCFLAGS="$OBJCFLAGS -Wall $($OBJFW_CONFIG --objcflags)" LDFLAGS="$LDFLAGS $($OBJFW_CONFIG --ldflags --rpath)" LIBS="$LIBS $($OBJFW_CONFIG --libs)" -AX_CHECK_COMPILER_FLAGS(-std=c++11, [CXXFLAGS="$CXXFLAGS -std=c++11"], [ +AX_CHECK_COMPILER_FLAGS(-std=c++11, [OBJCXXFLAGS="$OBJCXXFLAGS -std=c++11"], [ AC_MSG_ERROR(You need a compiler that supports C++11!) ]) AX_CHECK_COMPILER_FLAGS(-pipe, [OBJCFLAGS="$OBJCFLAGS -pipe"]) AX_CHECK_COMPILER_FLAGS(-fno-common, [OBJCFLAGS="$OBJCFLAGS -fno-common"]) @@ -85,10 +86,24 @@ AC_MSG_ERROR(You need Qt5Widgets >= 5.5 installed!) ]) AS_IF([test x"$GOBJC" = x"yes"], [ OBJCFLAGS="$OBJCFLAGS -Wwrite-strings -Wpointer-arith -Werror" ]) + +AC_MSG_CHECKING(whether Qt requires PIC) +AC_EGREP_CPP(yes, [ + #include + + #ifdef QT_REDUCE_RELOCATIONS + yes + #endif +], [ + OBJCXXFLAGS="$LIB_CFLAGS $OBJCXXFLAGS" + AC_MSG_RESULT(yes) +], [ + AC_MSG_RESULT(no) +]) BUILDSYS_INIT dnl We don't call AC_PROG_CPP or AC_PROG_OBJC, but only AC_PROG_OBJCPPCXX and dnl set CPP and OBJCC to OBJCPPCXX and add OBJCXXCPPFLAGS to CPPFLAGS, thus we