diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-21 09:00:54 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-21 10:08:35 (GMT) |
commit | 078f3ec042251af6bb9d9c194f29782c9e7b08a5 (patch) | |
tree | f134d5e438cbf2accd2014b4fb6a9c7c14ab84eb /configure | |
parent | 34b7a176a2bb531723991c6afc5f02ed0b981291 (diff) | |
download | Qt-078f3ec042251af6bb9d9c194f29782c9e7b08a5.zip Qt-078f3ec042251af6bb9d9c194f29782c9e7b08a5.tar.gz Qt-078f3ec042251af6bb9d9c194f29782c9e7b08a5.tar.bz2 |
Fix linking to uninstalled libraries after LIBS_PRIVATE.
On ELF systems, the static linker isn't allowed to find a linked
library's dependencies using the -L flag. That means if you're linking
lib or app X against a library A, and library A links against library
B, then -L$QTDIR/lib won't apply to B.
Before LIBS_PRIVATE, we had -lB, so it did apply. Now we need to find
another solution.
The solution is one of:
a) install the libraries before linking anything against them
b) set LD_LIBRARY_PATH
c) set -rpath or -rpath-link
Reviewed-by: TrustMe
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -47,6 +47,11 @@ QMAKE_VARS_FILE=.qmake.vars # utility functions #------------------------------------------------------------------------------- +shellEscape() +{ + echo "$@" | sed 's/ /\ /g' +} + # Adds a new qmake variable to the cache # Usage: QMakeVar mode varname contents # where mode is one of: set, add, del @@ -89,6 +94,29 @@ getQMakeConf() { print }' "$tmpSPEC/qmake.conf" } +# relies on $TEST_COMPILER being set correctly +compilerSupportsFlag() +{ + cat >conftest.cpp <<EOF +int main() { return 0; } +EOF + "$TEST_COMPILER" "$@" -o /dev/null conftest.cpp + ret=$? + rm -f conftest.cpp conftest.o + return $? +} + +# relies on $TEST_COMPILER being set correctly +linkerSupportsFlag() +{ + lflags=-Wl + for flag; do + safe_flag=`shellEscape "$flag"` + lflags=$lflags,$safe_flag + done + compilerSupportsFlag "$lflags" +} + #------------------------------------------------------------------------------- # operating system detection #------------------------------------------------------------------------------- @@ -7008,6 +7036,13 @@ QMAKE_LIBDIR_QT = \$\$QT_BUILD_TREE/lib EOF +# Ensure we can link to uninistalled libraries +if linkerSupportsFlag -rpath-link "$outpath/lib"; then + echo "QMAKE_LFLAGS += -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib" >> "$CACHEFILE.tmp" +elif linkerSupportsFlag -rpath "$outpath/lib"; then + echo "QMAKE_LFLAGS += -Wl,-rpath,\$\$QT_BUILD_TREE/lib" >> "$CACHEFILE.tmp" +fi + if [ -n "$QT_CFLAGS_PSQL" ]; then echo "QT_CFLAGS_PSQL = $QT_CFLAGS_PSQL" >> "$CACHEFILE.tmp" fi |