From: Scott Cantor Date: Thu, 17 May 2007 03:20:27 +0000 (+0000) Subject: Cleaned up source for dual build X-Git-Tag: 1.0-alpha1~23 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-xmltooling.git;a=commitdiff_plain;h=bb0c520dfdbe4c889508b0869edad550e8388605 Cleaned up source for dual build --- diff --git a/configure.ac b/configure.ac index fe8c241..39563a8 100644 --- a/configure.ac +++ b/configure.ac @@ -175,8 +175,8 @@ AC_ARG_WITH(xmlsec, if test x_$with_xmlsec != x_no; then if test x_$with_xmlsec != x_/usr; then - CPPFLAGS="-I${with_xmlsec}/include" - LDFLAGS="-L${with_xmlsec}/lib" + CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS" + LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS" fi XMLSEC_LIBS="-lxml-security-c" diff --git a/xmltooling/Makefile.am b/xmltooling/Makefile.am index 07d52d8..b8f756b 100644 --- a/xmltooling/Makefile.am +++ b/xmltooling/Makefile.am @@ -1,9 +1,9 @@ AUTOMAKE_OPTIONS = foreign if BUILD_XMLSEC -lib_LTLIBRARIES = libxmltooling-lite.la -else lib_LTLIBRARIES = libxmltooling-lite.la libxmltooling.la +else +lib_LTLIBRARIES = libxmltooling-lite.la endif libxmltoolingincludedir = $(includedir)/xmltooling @@ -172,23 +172,19 @@ common_sources = \ util/URLEncoder.cpp \ util/XMLConstants.cpp \ util/XMLHelper.cpp \ - validation/ValidatorSuite.cpp \ - ${xmlsec_sources} \ + validation/ValidatorSuite.cpp \ $(thread_sources) libxmltooling_lite_la_SOURCES = \ ${common_sources} - +libxmltooling_lite_la_CPPFLAGS = -DXMLTOOLING_LITE libxmltooling_lite_la_LDFLAGS = -version-info 1:0:0 if BUILD_XMLSEC -libxmltooling_la_CPPFLAGS = "$(CPPFLAGS) $(XMLSEC_CPPFLAGS)" -libxmltooling_la_LDFLAGS = "$(LDFLAGS) $(XMLSEC_LDFLAGS) $(XMLSEC_LIBS)" +libxmltooling_la_LDFLAGS = $(XMLSEC_LIBS) -version-info 1:0:0 libxmltooling_la_SOURCES = \ ${common_sources} \ - ${xmlsec_sources} \ - $(thread_sources) -libxmltooling_la_LDFLAGS = -version-info 1:0:0 + ${xmlsec_sources} endif install-exec-hook: diff --git a/xmltooling/XMLToolingConfig.cpp b/xmltooling/XMLToolingConfig.cpp index f1e929e..468a29c 100644 --- a/xmltooling/XMLToolingConfig.cpp +++ b/xmltooling/XMLToolingConfig.cpp @@ -23,6 +23,7 @@ #include "internal.h" #include "exceptions.h" #include "XMLToolingConfig.h" +#include "encryption/Encryption.h" #include "encryption/Encrypter.h" #include "impl/UnknownElement.h" #include "security/TrustEngine.h" @@ -80,6 +81,7 @@ DECL_XMLTOOLING_EXCEPTION_FACTORY(IOException,xmltooling); namespace xmltooling { static XMLToolingInternalConfig g_config; +#ifndef XMLTOOLING_NO_XMLSEC static vector g_openssl_locks; extern "C" void openssl_locking_callback(int mode,int n,const char *file,int line) @@ -90,12 +92,13 @@ namespace xmltooling { g_openssl_locks[n]->unlock(); } - #ifndef WIN32 +# ifndef WIN32 extern "C" unsigned long openssl_thread_id(void) { return (unsigned long)(pthread_self()); } - #endif +# endif +#endif } XMLToolingConfig& XMLToolingConfig::getConfig() @@ -260,7 +263,9 @@ bool XMLToolingInternalConfig::init() registerStorageServices(); m_urlEncoder = new URLEncoder(); +#ifndef XMLTOOLING_NO_XMLSEC m_keyInfoResolver = KeyInfoResolverManager.newPlugin(INLINE_KEYINFO_RESOLVER,NULL); +#endif // Register xml:id as an ID attribute. static const XMLCh xmlid[] = UNICODE_LITERAL_2(i,d); @@ -272,12 +277,14 @@ bool XMLToolingInternalConfig::init() return false; } +#ifndef XMLTOOLING_NO_XMLSEC // Set up OpenSSL locking. for (int i=0; i()); g_openssl_locks.clear(); +#endif SchemaValidators.destroyValidators(); XMLObjectBuilder::destroyBuilders(); @@ -298,15 +307,16 @@ void XMLToolingInternalConfig::term() StorageServiceManager.deregisterFactories(); termSOAPTransports(); SOAPTransportManager.deregisterFactories(); + #ifndef XMLTOOLING_NO_XMLSEC TrustEngineManager.deregisterFactories(); CredentialResolverManager.deregisterFactories(); KeyInfoResolverManager.deregisterFactories(); m_algorithmMap.clear(); -#endif delete m_keyInfoResolver; m_keyInfoResolver = NULL; +#endif delete m_replayCache; m_replayCache = NULL; diff --git a/xmltooling/XMLToolingConfig.h b/xmltooling/XMLToolingConfig.h index f9f1946..1cbb650 100644 --- a/xmltooling/XMLToolingConfig.h +++ b/xmltooling/XMLToolingConfig.h @@ -60,10 +60,14 @@ namespace xmltooling { { MAKE_NONCOPYABLE(XMLToolingConfig); protected: +#ifndef XMLTOOLING_NO_XMLSEC XMLToolingConfig() : m_keyInfoResolver(NULL), m_replayCache(NULL), m_templateEngine(NULL), m_urlEncoder(NULL), clock_skew_secs(180) {} - + /** Global KeyInfoResolver instance. */ KeyInfoResolver* m_keyInfoResolver; +#else + XMLToolingConfig() : m_replayCache(NULL), m_templateEngine(NULL), m_urlEncoder(NULL), clock_skew_secs(180) {} +#endif /** Global ReplayCache instance. */ ReplayCache* m_replayCache; @@ -146,6 +150,7 @@ namespace xmltooling { */ virtual ParserPool& getValidatingParser() const=0; +#ifndef XMLTOOLING_NO_XMLSEC /** * Sets the global KeyInfoResolver instance. * This method must be externally synchronized with any code that uses the object. @@ -163,6 +168,7 @@ namespace xmltooling { const KeyInfoResolver* getKeyInfoResolver() const { return m_keyInfoResolver; } +#endif /** * Sets the global ReplayCache instance. diff --git a/xmltooling/base.h b/xmltooling/base.h index cb13d98..237f798 100644 --- a/xmltooling/base.h +++ b/xmltooling/base.h @@ -30,6 +30,10 @@ #include #endif +#ifdef XMLTOOLING_LITE +# define XMLTOOLING_NO_XMLSEC 1 +#endif + // Windows and GCC4 Symbol Visibility Macros #ifdef WIN32 #define XMLTOOL_IMPORT __declspec(dllimport) diff --git a/xmltooling/impl/UnknownElement.cpp b/xmltooling/impl/UnknownElement.cpp index 83ba6b8..5a6c2c9 100644 --- a/xmltooling/impl/UnknownElement.cpp +++ b/xmltooling/impl/UnknownElement.cpp @@ -34,7 +34,9 @@ using namespace xmltooling; using namespace log4cpp; using namespace std; +#ifndef XMLTOOLING_NO_XMLSEC using xmlsignature::Signature; +#endif void UnknownElementImpl::releaseDOM() const { diff --git a/xmltooling/soap/impl/CURLSOAPTransport.cpp b/xmltooling/soap/impl/CURLSOAPTransport.cpp index 796b313..6f599f4 100644 --- a/xmltooling/soap/impl/CURLSOAPTransport.cpp +++ b/xmltooling/soap/impl/CURLSOAPTransport.cpp @@ -412,7 +412,11 @@ void CURLSOAPTransport::send(istream& in) // Set request headers. curl_easy_setopt(m_handle,CURLOPT_HTTPHEADER,m_headers); +#ifndef XMLTOOLING_NO_XMLSEC if (m_ssl_callback || m_cred || m_trustEngine) { +#else + if (m_ssl_callback) { +#endif curl_easy_setopt(m_handle,CURLOPT_SSL_CTX_FUNCTION,xml_ssl_ctx_callback); curl_easy_setopt(m_handle,CURLOPT_SSL_CTX_DATA,this); diff --git a/xmltooling/util/TemplateEngine.cpp b/xmltooling/util/TemplateEngine.cpp index 510a8f1..c9f44b8 100644 --- a/xmltooling/util/TemplateEngine.cpp +++ b/xmltooling/util/TemplateEngine.cpp @@ -23,8 +23,6 @@ #include "internal.h" #include "util/TemplateEngine.h" -#include - using namespace xmltooling; using namespace std; @@ -86,15 +84,6 @@ void TemplateEngine::process( const XMLToolingException* e ) const { - // Create a timestamp - time_t now = time(NULL); -#ifdef HAVE_CTIME_R - char nowbuf[32]; - ctime_r(&now); -#else - const char* nowbuf = ctime(&now); -#endif - const char* line = buf.c_str(); const char* thispos; diff --git a/xmltoolingtest/Makefile.am b/xmltoolingtest/Makefile.am index 6705fd9..ea120ed 100644 --- a/xmltoolingtest/Makefile.am +++ b/xmltoolingtest/Makefile.am @@ -1,10 +1,20 @@ AUTOMAKE_OPTIONS = foreign if BUILD_UNITTEST + bin_PROGRAMS = xmltoolingtest -xmltoolingtest_CXXFLAGS = $(CXXFLAGS) $(CXXTESTFLAGS) +xmltoolingtest_CXXFLAGS = $(CXXTESTFLAGS) +if BUILD_XMLSEC +xmltoolingtest_LDFLAGS = $(XMLSEC_LIBS) +xmltoolingtest_LDADD = $(top_builddir)/xmltooling/libxmltooling.la +else +xmltoolingtest_LDADD = $(top_builddir)/xmltooling/libxmltooling-lite.la +endif + else + bin_PROGRAMS = + endif if BUILD_XMLSEC @@ -45,10 +55,4 @@ do-cxxtestgen: $(nodist_xmltoolingtest_SOURCES): %.cpp: %.h $(MAKE) do-cxxtestgen HFILE=$< CPPFILE=$@ -if BUILD_XMLSEC -xmltoolingtest_LDADD = $(top_builddir)/xmltooling/libxmltooling.la -else -xmltoolingtest_LDADD = $(top_builddir)/xmltooling/libxmltooling-lite.la -endif - EXTRA_DIST = xmltoolingtest.vcproj $(xmltoolingtest_h) data