mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 16:09:37 -05:00
Attempt to detect best UPnP library available
Because we don't support libupnp-1.8.x yet avoid using that library If libupnp-1.6.x is available use that, if not try to use miniupnc if if unavailble print a warning and disable RetroShare UPnP support
This commit is contained in:
parent
2498f945f4
commit
fb4f206427
@ -653,7 +653,11 @@ SOURCES += util/folderiterator.cc \
|
||||
equals(RS_UPNP_LIB, miniupnpc) {
|
||||
HEADERS += upnp/upnputil.h upnp/upnphandler_miniupnp.h
|
||||
SOURCES += upnp/upnputil.c upnp/upnphandler_miniupnp.cc
|
||||
} else {
|
||||
}
|
||||
equals(RS_UPNP_LIB, "upnp ixml") { ## libupnp-1.8.x
|
||||
# Not supported yet
|
||||
}
|
||||
equals(RS_UPNP_LIB, "upnp ixml threadutil") { ## libupnp-1.6.x
|
||||
HEADERS += upnp/UPnPBase.h upnp/upnphandler_linux.h
|
||||
SOURCES += upnp/UPnPBase.cpp upnp/upnphandler_linux.cc
|
||||
DEFINES *= RS_USE_LIBUPNP
|
||||
|
@ -1586,9 +1586,11 @@ int RsServer::StartupRetroShare()
|
||||
mNetMgr->addNetListener(mProxyStack);
|
||||
#endif
|
||||
|
||||
#if defined(RS_USE_LIBMINIUPNPC) || defined(RS_USE_LIBUPNP)
|
||||
// Original UPnP Interface.
|
||||
pqiNetAssistFirewall *mUpnpMgr = new upnphandler();
|
||||
mNetMgr->addNetAssistFirewall(1, mUpnpMgr);
|
||||
#endif // defined(RS_USE_LIBMINIUPNPC) || defined(RS_USE_LIBUPNP)
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
|
@ -203,10 +203,17 @@ no_rs_broadcast_discovery:CONFIG -= rs_broadcast_discovery
|
||||
# use (pthread, "") usually depends on platform.
|
||||
isEmpty(RS_THREAD_LIB):RS_THREAD_LIB = pthread
|
||||
|
||||
# Specify UPnP library to use appending the following assignation to qmake
|
||||
# command line 'RS_UPNP_LIB=miniupnpc' the name of the UPNP library to use
|
||||
# (miniupnpc, "upnp ixml threadutil") usually depends on platform.
|
||||
isEmpty(RS_UPNP_LIB):RS_UPNP_LIB = upnp ixml threadutil
|
||||
# Specify UPnP library to use, appending the following assignation to qmake
|
||||
# command line
|
||||
# 'RS_UPNP_LIB=none' do not compile UPnP support
|
||||
# 'RS_UPNP_LIB=miniupnpc' to use miniupnpc
|
||||
# 'RS_UPNP_LIB="upnp ixml threadutil"' to use libupnp-1.6.x
|
||||
# 'RS_UPNP_LIB="upnp ixml"' to use libupnp-1.8.x
|
||||
# Which library is better suited usually depends on the platform.
|
||||
# See http://miniupnp.free.fr/ and http://pupnp.sourceforge.net/ for more
|
||||
# information about the libraries. Autodetection is attempted by default.
|
||||
#RS_UPNP_LIB=
|
||||
|
||||
|
||||
###########################################################################################################################################################
|
||||
#
|
||||
@ -302,7 +309,7 @@ defineReplace(linkStaticLibs) {
|
||||
return($$retSlib)
|
||||
}
|
||||
|
||||
## This function return pretarget deps for the static the libraries contained in
|
||||
## This function return pretarget deps for the static libraries contained in
|
||||
## the variable given as paramether.
|
||||
defineReplace(pretargetStaticLibs) {
|
||||
libsVarName = $$1
|
||||
@ -705,6 +712,40 @@ macx-* {
|
||||
QT += macextras
|
||||
}
|
||||
|
||||
# If not yet defined attempt UPnP library autodetection should works at least
|
||||
# for miniupnc libupnp-1.6.x and libupnp-1.8.x
|
||||
isEmpty(RS_UPNP_LIB) {
|
||||
__TEMP_UPNP_LIBS = upnp ixml threadutil
|
||||
for(mLib, __TEMP_UPNP_LIBS) {
|
||||
attemptPath=$$findFileInPath(lib$${mLib}.a, QMAKE_LIBDIR)
|
||||
isEmpty(attemptPath):attemptPath=$$findFileInPath(lib$${mLib}.so, QMAKE_LIBDIR)
|
||||
!isEmpty(attemptPath):RS_UPNP_LIB += $${mLib}
|
||||
}
|
||||
|
||||
## Workaround as libupnp-1.8.x is not supported yet
|
||||
equals(RS_UPNP_LIB, "upnp ixml"):RS_UPNP_LIB=
|
||||
## END Workaround as libupnp-1.8.x is not supported yet
|
||||
|
||||
isEmpty(RS_UPNP_LIB) {
|
||||
__TEMP_UPNP_LIBS=$$findFileInPath(libminiupnpc.a, QMAKE_LIBDIR)
|
||||
!isEmpty(__TEMP_UPNP_LIBS):RS_UPNP_LIB=miniupnpc
|
||||
__TEMP_UPNP_LIBS=$$findFileInPath(libminiupnpc.so, QMAKE_LIBDIR)
|
||||
!isEmpty(__TEMP_UPNP_LIBS):RS_UPNP_LIB=miniupnpc
|
||||
}
|
||||
|
||||
isEmpty(RS_UPNP_LIB) {
|
||||
warning("RS_UPNP_LIB detection failed, UPnP support disabled!")
|
||||
} else {
|
||||
message("Autodetected RS_UPNP_LIB=$$RS_UPNP_LIB")
|
||||
}
|
||||
}
|
||||
|
||||
equals(RS_UPNP_LIB, none):RS_UPNP_LIB=
|
||||
equals(RS_UPNP_LIB, miniupnpc):DEFINES*=RS_USE_LIBMINIUPNPC
|
||||
equals(RS_UPNP_LIB, "upnp ixml"):DEFINES*=RS_USE_LIBUPNP_1_8_X
|
||||
## libupnp-1.6.x
|
||||
equals(RS_UPNP_LIB, "upnp ixml threadutil"):DEFINES*=RS_USE_LIBUPNP
|
||||
|
||||
|
||||
## Retrocompatibility assignations, get rid of this ASAP
|
||||
isEmpty(BIN_DIR) : BIN_DIR = $${RS_BIN_DIR}
|
||||
|
Loading…
Reference in New Issue
Block a user