[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r2223: Only compile TorSslSocket if we're building against a Qt wit (in trunk: . src/util src/vidalia/network)



Author: edmanm
Date: 2007-12-16 19:32:04 -0500 (Sun, 16 Dec 2007)
New Revision: 2223

Modified:
   trunk/CMakeLists.txt
   trunk/config.h.in
   trunk/src/util/CMakeLists.txt
   trunk/src/util/torsslsocket.cpp
   trunk/src/util/torsslsocket.h
   trunk/src/vidalia/network/geoipresolver.cpp
Log:
Only compile TorSslSocket if we're building against a Qt with SSL support, so we don't get moc warnings.

Modified: trunk/CMakeLists.txt
===================================================================
--- trunk/CMakeLists.txt	2007-12-16 21:38:47 UTC (rev 2222)
+++ trunk/CMakeLists.txt	2007-12-17 00:32:04 UTC (rev 2223)
@@ -62,6 +62,15 @@
   endif(HAVE_QSYSTEMTRAYICON_H)
 endif(NOT APPLE)
 
+## Check for QSslSocket
+check_include_file_cxx("qsslsocket.h" HAVE_QSSLSOCKET_H)
+if(HAVE_QSSLSOCKET_H)
+  check_symbol_exists(QT_NO_OPENSSL "QtGlobal" QT_NO_SSL_SUPPORT)
+  if(NOT QT_NO_SSL_SUPPORT)
+    set(USE_QSSLSOCKET 1)
+  endif(NOT QT_NO_SSL_SUPPORT)
+endif(HAVE_QSSLSOCKET_H)
+
 ## Write out a configuration file
 configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in

Modified: trunk/config.h.in
===================================================================
--- trunk/config.h.in	2007-12-16 21:38:47 UTC (rev 2222)
+++ trunk/config.h.in	2007-12-17 00:32:04 UTC (rev 2223)
@@ -1,3 +1,6 @@
 
 #cmakedefine HAVE_QSYSTEMTRAYICON_H
 
+#cmakedefine HAVE_QSSLSOCKET_H
+
+#cmakedefine USE_QSSLSOCKET

Modified: trunk/src/util/CMakeLists.txt
===================================================================
--- trunk/src/util/CMakeLists.txt	2007-12-16 21:38:47 UTC (rev 2222)
+++ trunk/src/util/CMakeLists.txt	2007-12-17 00:32:04 UTC (rev 2223)
@@ -31,14 +31,16 @@
   process.cpp
   stringutil.cpp
   torsocket.cpp
-  torsslsocket.cpp
   zlibbytearray.cpp
 )
-qt4_wrap_cpp(util_SRCS
-  torsocket.h
-  torsslsocket.h
-)
+qt4_wrap_cpp(util_SRCS torsocket.h)
 
+
+if(USE_QSSLSOCKET)
+  set(util_SRCS ${util_SRCS} torsslsocket.cpp)
+  qt4_wrap_cpp(util_SRCS torsslsocket.h)
+endif(USE_QSSLSOCKET)
+
 if(WIN32)
   set(util_SRCS ${util_SRCS}
     win32.cpp

Modified: trunk/src/util/torsslsocket.cpp
===================================================================
--- trunk/src/util/torsslsocket.cpp	2007-12-16 21:38:47 UTC (rev 2222)
+++ trunk/src/util/torsslsocket.cpp	2007-12-17 00:32:04 UTC (rev 2223)
@@ -27,7 +27,6 @@
 
 #include "torsslsocket.h"
 
-#if QT_VERSION >= 0x040300 && !defined(QT_NO_OPENSSL)
 #include <QDataStream>
 #include <QStringList>
 
@@ -171,5 +170,3 @@
   }
 }
 
-#endif
-

Modified: trunk/src/util/torsslsocket.h
===================================================================
--- trunk/src/util/torsslsocket.h	2007-12-16 21:38:47 UTC (rev 2222)
+++ trunk/src/util/torsslsocket.h	2007-12-17 00:32:04 UTC (rev 2223)
@@ -28,9 +28,6 @@
 #ifndef _TORSSLSOCKET_H
 #define _TORSSLSOCKET_H
 
-#include <QtGlobal>
-
-#if QT_VERSION >= 0x040300 && !defined(QT_NO_OPENSSL)
 #include <QSslSocket>
 #include <QHostAddress>
 
@@ -82,5 +79,4 @@
 };
 
 #endif
-#endif
 

Modified: trunk/src/vidalia/network/geoipresolver.cpp
===================================================================
--- trunk/src/vidalia/network/geoipresolver.cpp	2007-12-16 21:38:47 UTC (rev 2222)
+++ trunk/src/vidalia/network/geoipresolver.cpp	2007-12-17 00:32:04 UTC (rev 2223)
@@ -26,11 +26,11 @@
  */
 
 #include <torsocket.h>
-#include <torsslsocket.h>
 #include "geoipresolver.h"
+#include "config.h"
 
-#if QT_VERSION >= 0x040300 && !defined(QT_NO_OPENSSL)
-#define USE_SSL 1
+#if defined(USE_QSSLSOCKET)
+#include <torsslsocket.h>
 #endif
 
 /** Host for the geo ip information. */ 
@@ -211,7 +211,7 @@
   }
 
   /* Create a socket used to request the geo ip information. */
-#if defined(USE_SSL)
+#if defined(USE_QSSLSOCKET)
   TorSslSocket *socket = new TorSslSocket(_socksAddr, _socksPort);
 #else
   TorSocket *socket = new TorSocket(_socksAddr, _socksPort);
@@ -228,7 +228,7 @@
   _requestList.insert(socket, request);
   
   /* Connect so we can send our request and return the request ID. */
-#if defined(USE_SSL)
+#if defined(USE_QSSLSOCKET)
   if (TorSslSocket::supportsSsl()) {
     QByteArray caCert(":/geoip/cacert_root.crt");
     socket->addCaCertificate(QSslCertificate(caCert));