[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r2476: Make UPnP support optional (off by default). Add a FindMiniU (in vidalia/trunk: . cmake src/vidalia src/vidalia/config)
Author: edmanm
Date: 2008-04-01 22:00:36 -0400 (Tue, 01 Apr 2008)
New Revision: 2476
Added:
vidalia/trunk/cmake/FindMiniUPnPc.cmake
Modified:
vidalia/trunk/
vidalia/trunk/CMakeLists.txt
vidalia/trunk/config.h.in
vidalia/trunk/src/vidalia/CMakeLists.txt
vidalia/trunk/src/vidalia/config/serversettings.cpp
Log:
r290@lysithea: edmanm | 2008-04-01 22:00:19 -0400
Make UPnP support optional (off by default). Add a FindMiniUPnPc.cmake for
checking for the miniupnpc library and location of header files.
Property changes on: vidalia/trunk
___________________________________________________________________
svk:merge ticket from /local/vidalia/trunk [r290] on 90112fd6-a33b-4cea-8d39-48ff1d78625c
Modified: vidalia/trunk/CMakeLists.txt
===================================================================
--- vidalia/trunk/CMakeLists.txt 2008-04-02 02:00:32 UTC (rev 2475)
+++ vidalia/trunk/CMakeLists.txt 2008-04-02 02:00:36 UTC (rev 2476)
@@ -62,6 +62,12 @@
endif(MSVC OR UNIX)
endif(USE_QSSLSOCKET)
+## UPnP support is currently optional (disabled by default)
+option(USE_MINIUPNPC "Enable UPnP support using the MiniUPnPc library." OFF)
+if (USE_MINIUPNPC)
+ include(${CMAKE_SOURCE_DIR}/cmake/FindMiniUPnPc.cmake)
+endif(USE_MINIUPNPC)
+
## Check for system header files
check_include_file("limits.h" HAVE_LIMITS_H)
check_include_file("sys/limits.h" HAVE_SYS_LIMITS_H)
Added: vidalia/trunk/cmake/FindMiniUPnPc.cmake
===================================================================
--- vidalia/trunk/cmake/FindMiniUPnPc.cmake (rev 0)
+++ vidalia/trunk/cmake/FindMiniUPnPc.cmake 2008-04-02 02:00:36 UTC (rev 2476)
@@ -0,0 +1,41 @@
+##
+## $Id$
+##
+## This file is part of Vidalia, and is subject to the license terms in the
+## LICENSE file, found in the top level directory of this distribution. If
+## you did not receive the LICENSE file with this file, you may obtain it
+## from the Vidalia source package distributed by the Vidalia Project at
+## http://www.vidalia-project.net/. No part of Vidalia, including this file,
+## may be copied, modified, propagated, or distributed except according to
+## the terms described in the LICENSE file.
+##
+
+message(STATUS "Looking for MiniUPnPc")
+
+## Find the MiniUPnPc library
+find_library(MINIUPNPC_LIBRARY
+ NAMES miniupnpc
+ PATHS ${MINIUPNPC_LIBRARY_DIR}
+)
+if (NOT MINIUPNPC_LIBRARY)
+ message(FATAL_ERROR
+ "Could not find libminiupnpc. Try configuring with -DMINIUPNPC_LIBRARY_DIR=<path>.")
+endif(NOT MINIUPNPC_LIBRARY)
+
+## Check that we can find MiniUPnPc header files
+if (MINIUPNPC_INCLUDE_DIR)
+ message(STATUS "Including ${MINIUPNPC_INCLUDE_DIR}")
+ set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES}
+ ${MINIUPNPC_INCLUDE_DIR}
+ )
+endif(MINIUPNPC_INCLUDE_DIR)
+
+check_include_file(miniupnpc/miniupnpc.h HAVE_MINIUPNPC_H)
+if (NOT HAVE_MINIUPNPC_H)
+ message(FATAL_ERROR
+ "Could not find miniupnpc.h. Try configuring with -DMINIUPNPC_INCLUDE_DIR=<path>.")
+endif(NOT HAVE_MINIUPNPC_H)
+
+## Proudly display victory
+message(STATUS "Looking for MiniUPnPc - found")
+
Property changes on: vidalia/trunk/cmake/FindMiniUPnPc.cmake
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: vidalia/trunk/config.h.in
===================================================================
--- vidalia/trunk/config.h.in 2008-04-02 02:00:32 UTC (rev 2475)
+++ vidalia/trunk/config.h.in 2008-04-02 02:00:36 UTC (rev 2476)
@@ -26,5 +26,9 @@
#cmakedefine SIZEOF_INT @SIZEOF_INT@
+#cmakedefine HAVE_MINIUPNPC_H
+
+#cmakedefine USE_MINIUPNPC
+
#endif
Modified: vidalia/trunk/src/vidalia/CMakeLists.txt
===================================================================
--- vidalia/trunk/src/vidalia/CMakeLists.txt 2008-04-02 02:00:32 UTC (rev 2475)
+++ vidalia/trunk/src/vidalia/CMakeLists.txt 2008-04-02 02:00:36 UTC (rev 2476)
@@ -16,7 +16,6 @@
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/config
${CMAKE_CURRENT_SOURCE_DIR}/help/browser
- ${MINIUPNPC_INCLUDE_DIR}
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/res/vidalia_win.rc.in
@@ -62,7 +61,6 @@
config/portvalidator.cpp
config/serverpage.cpp
config/serversettings.cpp
- config/upnpcontrol.cpp
config/torsettings.cpp
config/vidaliasettings.cpp
config/vsettings.cpp
@@ -82,11 +80,19 @@
config/portvalidator.h
config/serverpage.h
config/serversettings.h
- config/upnpcontrol.h
config/torsettings.h
config/vidaliasettings.h
config/vsettings.h
)
+if (USE_MINIUPNPC)
+ include_directories(${MINIUPNPC_INCLUDE_DIR})
+ set(vidalia_SRCS ${vidalia_SRCS}
+ config/upnpcontrol.cpp
+ )
+ qt4_wrap_cpp(vidalia_SRCS
+ config/upnpcontrol.h
+ )
+endif(USE_MINIUPNPC)
## Help browser sources
set(vidalia_SRCS ${vidalia_SRCS}
@@ -237,19 +243,17 @@
endif(APPLE)
add_dependencies(${vidalia_BIN} translations)
-## Link in miniupnpc
-find_library(MINIUPNPC
- NAMES miniupnpc
- PATHS ${MINIUPNPC_LIBRARY_DIR}
-)
## Link to the Qt libraries and other libraries built as a part of Vidalia
target_link_libraries(${vidalia_BIN}
${QT_LIBRARIES}
- ${MINIUPNPC}
torcontrol
util
)
+if (USE_MINIUPNPC)
+ target_link_libraries(${vidalia_BIN} ${MINIUPNPC_LIBRARY})
+endif(USE_MINIUPNPC)
+
if (MINGW)
target_link_libraries(${vidalia_BIN}
ole32
Modified: vidalia/trunk/src/vidalia/config/serversettings.cpp
===================================================================
--- vidalia/trunk/src/vidalia/config/serversettings.cpp 2008-04-02 02:00:32 UTC (rev 2475)
+++ vidalia/trunk/src/vidalia/config/serversettings.cpp 2008-04-02 02:00:36 UTC (rev 2476)
@@ -17,10 +17,14 @@
#include <QHostInfo>
#include <net.h>
#include <stringutil.h>
+#include <config.h>
#include "serversettings.h"
#include "torsettings.h"
+
+#ifdef USE_MINIUPNPC
#include "upnpcontrol.h"
+#endif
/** Define the set of characters that are valid in a nickname. */
#define VALID_NICKNAME_CHARS \
@@ -163,8 +167,10 @@
void
ServerSettings::configurePortForwarding()
{
+#ifdef USE_MINIUPNPC
UPNPControl *pUNPControl = UPNPControl::Instance();
pUNPControl->forwardPort(getORPort());
+#endif
}
/** Virtual method called when we retrieve a server-related setting from Tor.