From 94a433897896656a12cc14881cdea102e21ae69d Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Wed, 16 May 2007 16:44:37 +0000 Subject: [PATCH] Changes to split library into a lite and full version. --- configure.ac | 117 +++++++++++++++++++++++++++++---------------- xmltooling/Makefile.am | 22 +++++---- xmltoolingtest/Makefile.am | 4 ++ 3 files changed, 94 insertions(+), 49 deletions(-) diff --git a/configure.ac b/configure.ac index 0130435..5a14755 100644 --- a/configure.ac +++ b/configure.ac @@ -81,44 +81,6 @@ fi AC_CHECK_FUNCS([pthread_rwlock_init]) -# OpenSSL settings -AC_ARG_WITH(openssl, - AC_HELP_STRING([--with-openssl=PATH], [where openssl is installed]), - [if test x_$with_openssl != x_/usr; then - SSLLIBS="-L${with_openssl}/lib -lcrypto -lssl" - SSLFLAGS="-I${with_openssl}/include" - fi]) - -if test "x$SSLLIBS" = "x" ; then - AC_PATH_PROG(PKG_CONFIG, pkg-config) - if test "x$PKG_CONFIG" != x && test "x$PKG_CONFIG" != "xno" ; then - if pkg-config openssl ; then - SSLLIBS="`$PKG_CONFIG --libs openssl`" - SSLFLAGS="`$PKG_CONFIG --cflags openssl`" - else - AC_MSG_ERROR([OpenSSL not supported by pkg-config, try --with-openssl instead]) - fi - fi -fi - -if test "x$SSLLIBS" = "x" ; then - SSLLIBS="-lcrypto -lssl" -fi - -AC_MSG_CHECKING(for OpenSSL libraries) -AC_MSG_RESULT($SSLLIBS) -LIBS="$LIBS $SSLLIBS" -AC_MSG_CHECKING(for OpenSSL cflags) -AC_MSG_RESULT($SSLFLAGS) -CPPFLAGS="$SSLFLAGS $CPPFLAGS" - -AC_CHECK_HEADER([openssl/pem.h],, - AC_MSG_ERROR([unable to find openssl header files])) -AC_MSG_CHECKING(for ERR_load_CRYPTO_string) -AC_TRY_LINK_FUNC([ERR_load_CRYPTO_strings],, - AC_MSG_ERROR([unable to link with openssl libraries])) -AC_MSG_RESULT(yes) - # libcurl settings AC_PATH_PROG(CURL_CONFIG,curl-config) AC_ARG_WITH(curl, @@ -213,10 +175,19 @@ AC_ARG_WITH(xmlsec, if test x_$with_xmlsec != x_no; then if test x_$with_xmlsec != x_/usr; then - LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS" - CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS" + XMLSEC_CPPFLAGS="-I${with_xmlsec}/include" + XMLSEC_LDFLAGS="-L${with_xmlsec}/lib" fi - LIBS="-lxml-security-c $LIBS" + XMLSEC_LIBS="-lxml-security-c" + + # save and append master flags + save_CPPFLAGS = "$CPPFLAGS" + save_LDFLAGS = "$LDFLAGS" + save_LIBS = "$LIBS" + CPPFLAGS = "$XMLSEC_CPPFLAGS $CPPFLAGS" + LDFLAGS = "$XMLSEC_LDFLAGS $LDFLAGS" + LIBS = "$XMLSEC_LIBS $LIBS" + AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find XML-Security header files])) AC_MSG_CHECKING([XML-Security version]) AC_PREPROC_IFELSE( @@ -232,6 +203,70 @@ int i = 0; [#include ], [XSECPlatformUtils::Initialise()],, [AC_MSG_ERROR([unable to link with XML-Sec])]) + + # restore master flags + CPPFLAGS = "$save_CPPFLAGS" + LDFLAGS = "$save_LDFLAGS" + LIBS = "$save_LIBS" + + AC_LANG(C) + + # OpenSSL settings + AC_ARG_WITH(openssl, + AC_HELP_STRING([--with-openssl=PATH], [where openssl is installed]), + [if test x_$with_openssl != x_/usr; then + SSLFLAGS="-I${with_openssl}/include" + SSLLIBS="-L${with_openssl}/lib -lcrypto -lssl" + fi]) + + if test "x$SSLLIBS" = "x" ; then + AC_PATH_PROG(PKG_CONFIG, pkg-config) + if test "x$PKG_CONFIG" != x && test "x$PKG_CONFIG" != "xno" ; then + if pkg-config openssl ; then + SSLLIBS="`$PKG_CONFIG --libs openssl`" + SSLFLAGS="`$PKG_CONFIG --cflags openssl`" + else + AC_MSG_ERROR([OpenSSL not supported by pkg-config, try --with-openssl instead]) + fi + fi + fi + + if test "x$SSLLIBS" = "x" ; then + SSLLIBS="-lcrypto -lssl" + fi + + AC_MSG_CHECKING(for OpenSSL cflags) + AC_MSG_RESULT($SSLFLAGS) + XMLSEC_CPPFLAGS="$XMLSEC_CPPFLAGS $SSLFLAGS" + AC_MSG_CHECKING(for OpenSSL libraries) + AC_MSG_RESULT($SSLLIBS) + XMLSEC_LIBS="$XMLSEC_LIBS $SSLLIBS" + + # save and append master flags + save_CPPFLAGS = "$CPPFLAGS" + save_LDFLAGS = "$LDFLAGS" + save_LIBS = "$LIBS" + CPPFLAGS = "$XMLSEC_CPPFLAGS $CPPFLAGS" + LDFLAGS = "$XMLSEC_LDFLAGS $LDFLAGS" + LIBS = "$XMLSEC_LIBS $LIBS" + + AC_CHECK_HEADER([openssl/pem.h],, + AC_MSG_ERROR([unable to find openssl header files])) + AC_MSG_CHECKING(for ERR_load_CRYPTO_string) + AC_TRY_LINK_FUNC([ERR_load_CRYPTO_strings],, + AC_MSG_ERROR([unable to link with openssl libraries])) + AC_MSG_RESULT(yes) + + # restore master flags + CPPFLAGS = "$save_CPPFLAGS" + LDFLAGS = "$save_LDFLAGS" + LIBS = "$save_LIBS" + + AC_SUBST(XMLSEC_CPPFLAGS) + AC_SUBST(XMLSEC_LDFLAGS) + AC_SUBST(XMLSEC_LIBS) + + AC_LANG(C++) else AC_MSG_WARN([xmlsec disabled, building without signature/encryption support]) AC_DEFINE(XMLTOOLING_NO_XMLSEC,1, diff --git a/xmltooling/Makefile.am b/xmltooling/Makefile.am index 080f2cf..63e6274 100644 --- a/xmltooling/Makefile.am +++ b/xmltooling/Makefile.am @@ -1,6 +1,6 @@ AUTOMAKE_OPTIONS = foreign -lib_LTLIBRARIES = libxmltooling.la +lib_LTLIBRARIES = libxmltooling-lite.la libxmltoolingincludedir = $(includedir)/xmltooling @@ -108,7 +108,6 @@ valinclude_HEADERS = \ noinst_HEADERS = \ internal.h -if BUILD_XMLSEC xmlsec_sources = \ encryption/impl/Decrypter.cpp \ encryption/impl/EncryptedKeyResolver.cpp \ @@ -127,9 +126,6 @@ xmlsec_sources = \ security/impl/XSECCryptoX509CRL.cpp \ signature/impl/SignatureValidator.cpp \ signature/impl/XMLSecSignatureImpl.cpp -else -xmlsec_sources = -endif if BUILD_PTHREAD thread_sources = util/PThreads.cpp @@ -137,7 +133,7 @@ else thread_sources = endif -libxmltooling_la_SOURCES = \ +common_sources = \ AbstractAttributeExtensibleXMLObject.cpp \ AbstractComplexElement.cpp \ AbstractDOMCachingXMLObject.cpp \ @@ -176,9 +172,19 @@ libxmltooling_la_SOURCES = \ ${xmlsec_sources} \ $(thread_sources) -# this is different from the project version -# http://sources.redhat.com/autobook/autobook/autobook_91.html +libxmltooling-lite_la_SOURCES = \ + ${common_sources} + +libxmltooling-lite_la_LDFLAGS = -version-info 1:0:0 + +if BUILD_XMLSEC +lib_LTLIBRARIES = libxmltooling.la +libxmltooling_la_SOURCES = \ + ${common_sources} \ + ${xmlsec_sources} \ + $(thread_sources) libxmltooling_la_LDFLAGS = -version-info 1:0:0 +endif install-exec-hook: for la in $(lib_LTLIBRARIES) ; do rm -f $(DESTDIR)$(libdir)/$$la ; done diff --git a/xmltoolingtest/Makefile.am b/xmltoolingtest/Makefile.am index 4314674..6705fd9 100644 --- a/xmltoolingtest/Makefile.am +++ b/xmltoolingtest/Makefile.am @@ -45,6 +45,10 @@ 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 -- 2.1.4