Make -dbus-linked the default on all platforms

[ChangeLog][QtDBus] The QtDBus library now links directly to the
libdbus-1 system library if it was detected at configure time. To force
linking to the library, pass option -dbus-linked to configure; to force
dynamically loading at runtime, use -dbus-runtime.

Task-number: QTBUG-14131
Change-Id: Ie33d1f22f85b465ab0ce166b8f17b8491eae1c21
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
Thiago Macieira 2014-12-11 14:32:59 -08:00
parent 8233e401b1
commit a2f501f939
2 changed files with 29 additions and 14 deletions

29
configure vendored
View File

@ -1986,7 +1986,8 @@ while [ "$#" -gt 0 ]; do
if [ "$VAL" = "no" ] || [ "$VAL" = "linked" ] || [ "$VAL" = "runtime" ]; then
CFG_DBUS="$VAL"
elif [ "$VAL" = "yes" ]; then
CFG_DBUS="runtime"
# keep as auto, we'll auto-detect whether to go linked or runtime later
CFG_DBUS=auto
else
UNKNOWN_OPT=yes
fi
@ -1998,6 +1999,13 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
dbus-runtime)
if [ "$VAL" = "yes" ]; then
CFG_DBUS="runtime"
else
UNKNOWN_OPT=yes
fi
;;
nis)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_NIS="$VAL"
@ -2631,8 +2639,8 @@ Additional options:
-pch ............... Use precompiled header support.
-no-dbus ........... Do not compile the Qt D-Bus module.
+ -dbus .............. Compile the Qt D-Bus module and dynamically load libdbus-1.
-dbus-linked ....... Compile the Qt D-Bus module and link to libdbus-1.
+ -dbus-linked ....... Compile the Qt D-Bus module and link to libdbus-1.
-dbus-runtime ...... Compile the Qt D-Bus module and dynamically load libdbus-1.
-reduce-relocations ..... Reduce relocations in the libraries through extra
linker optimizations (Qt/X11 and Qt for Embedded Linux only;
@ -5027,10 +5035,10 @@ if [ "$CFG_ICONV" != "no" ]; then
fi
# auto-detect libdbus-1 support
if [ "$CFG_DBUS" = "auto" ]; then
CFG_DBUS="runtime"
fi
if [ "$CFG_DBUS" = "linked" ]; then
# auto: detect if libdbus-1 is present; if so, link to it
# linked: fail if libdbus-1 is not present; otherwise link to it
# runtime: no detection (cannot fail), load libdbus-1 at runtime
if [ "$CFG_DBUS" = "auto" ] || [ "$CFG_DBUS" = "linked" ]; then
if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --atleast-version="$MIN_DBUS_1_VERSION" dbus-1 2>/dev/null; then
QT_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null`
QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null`
@ -5046,14 +5054,19 @@ if [ "$CFG_DBUS" = "linked" ]; then
QT_CFLAGS_DBUS=`env -i PATH="$PATH" pkg-config --cflags dbus-1 2>/dev/null`
fi
QMakeVar set QT_HOST_CFLAGS_DBUS "$QT_CFLAGS_DBUS"
CFG_DBUS=linked
else
if [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
# Failed to compile the test, so it's an error if CFG_DBUS is "linked"
if [ "$CFG_DBUS" = "linked" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
echo "The Qt D-Bus module cannot be enabled because libdbus-1 version $MIN_DBUS_1_VERSION was not found."
[ -z "$PKG_CONFIG" ] && echo " Use of pkg-config is not enabled, maybe you want to pass -pkg-config?"
echo " Turn on verbose messaging (-v) to $0 to see the final report."
echo " If you believe this message is in error you may use the continue"
echo " switch (-continue) to $0 to continue."
exit 101
else
# CFG_DBUS is "auto" here
CFG_DBUS=runtime
fi
fi
fi

View File

@ -904,13 +904,15 @@ void Configure::parseCmdLine()
} else if (configCmdLine.at(i) == "-no-qdbus") {
dictionary[ "DBUS" ] = "no";
} else if (configCmdLine.at(i) == "-qdbus") {
dictionary[ "DBUS" ] = "yes";
dictionary[ "DBUS" ] = "auto";
} else if (configCmdLine.at(i) == "-no-dbus") {
dictionary[ "DBUS" ] = "no";
} else if (configCmdLine.at(i) == "-dbus") {
dictionary[ "DBUS" ] = "yes";
dictionary[ "DBUS" ] = "auto";
} else if (configCmdLine.at(i) == "-dbus-linked") {
dictionary[ "DBUS" ] = "linked";
} else if (configCmdLine.at(i) == "-dbus-runtime") {
dictionary[ "DBUS" ] = "runtime";
} else if (configCmdLine.at(i) == "-audio-backend") {
dictionary[ "AUDIO_BACKEND" ] = "yes";
} else if (configCmdLine.at(i) == "-no-audio-backend") {
@ -2023,8 +2025,8 @@ bool Configure::displayHelp()
desc("LIBPROXY", "no", "-no-libproxy", "Do not compile in libproxy support.");
desc("LIBPROXY", "yes", "-libproxy", "Compile in libproxy support (for cross compilation targets).\n");
desc("DBUS", "no", "-no-dbus", "Do not compile in D-Bus support.");
desc("DBUS", "yes", "-dbus", "Compile in D-Bus support and load libdbus-1\ndynamically.");
desc("DBUS", "linked", "-dbus-linked", "Compile in D-Bus support and link to libdbus-1.\n");
desc("DBUS", "runtime", "-dbus-runtime", "Compile in D-Bus support and load libdbus-1\ndynamically.");
desc("AUDIO_BACKEND", "no","-no-audio-backend", "Do not compile in the platform audio backend into\nQt Multimedia.");
desc("AUDIO_BACKEND", "yes","-audio-backend", "Compile in the platform audio backend into Qt Multimedia.\n");
desc("WMF_BACKEND", "no","-no-wmf-backend", "Do not compile in the windows media foundation backend\ninto Qt Multimedia.");
@ -2496,7 +2498,7 @@ void Configure::autoDetection()
if (dictionary["LIBPROXY"] == "auto")
dictionary["LIBPROXY"] = checkAvailability("LIBPROXY") ? "yes" : "no";
if (dictionary["DBUS"] == "auto")
dictionary["DBUS"] = checkAvailability("DBUS") ? "yes" : "no";
dictionary["DBUS"] = checkAvailability("DBUS") ? "linked" : "runtime";
if (dictionary["QML_DEBUG"] == "auto")
dictionary["QML_DEBUG"] = dictionary["QML"] == "yes" ? "yes" : "no";
if (dictionary["AUDIO_BACKEND"] == "auto")
@ -2966,7 +2968,7 @@ void Configure::generateOutputVars()
if (dictionary[ "LIBPROXY" ] == "yes")
qtConfig += "libproxy";
if (dictionary[ "DBUS" ] == "yes")
if (dictionary[ "DBUS" ] == "runtime")
qtConfig += "dbus";
else if (dictionary[ "DBUS" ] == "linked")
qtConfig += "dbus dbus-linked";
@ -3076,7 +3078,7 @@ void Configure::generateOutputVars()
qmakeVars += QString("OPENSSL_LIBS += -L%1/lib").arg(opensslPath);
}
}
if (dictionary[ "DBUS" ] != "no") {
if (dictionary[ "DBUS" ] == "linked") {
if (!dbusPath.isEmpty()) {
qmakeVars += QString("QT_CFLAGS_DBUS = -I%1/include").arg(dbusPath);
qmakeVars += QString("QT_LIBS_DBUS = -L%1/lib").arg(dbusPath);