From 90a8e859bfedb129f16fe9ddc60f7c7dfb1e0ec2 Mon Sep 17 00:00:00 2001 From: Aleksandar Fabijanic Date: Mon, 20 Aug 2012 00:57:17 +0000 Subject: [PATCH] - SF #3552774: Don't hide default target in subordinate makefile - SF #3534307: Building IPv6 for Linux by default - SF #3516844: poco missing symbols with external >=lipcre-8.13 - fix of rev. 1952 fix (porting rev.1913 from 1.4.4 (fixed SF# 3550553)) --- CHANGELOG | 3 +++ Data/ODBC/Makefile | 18 +++++++------- Data/ODBC/testsuite/Makefile | 20 +++++++-------- Foundation/Makefile | 5 +++- Foundation/include/Poco/Config.h | 5 ++++ Makefile | 27 +++++++++++--------- Net/include/Poco/Net/IPAddress.h | 6 +++-- Net/include/Poco/Net/Net.h | 9 ++++--- Net/src/NetworkInterface.cpp | 9 +++++-- Net/src/SocketAddress.cpp | 2 ++ NetSSL_OpenSSL/src/SecureSocketImpl.cpp | 13 +++++----- build/rules/global | 32 +++++++++++++++++++++++- configure | 33 ++++++++++++++++--------- 13 files changed, 123 insertions(+), 59 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4cc015632..0d21d16fe 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -29,6 +29,9 @@ Release 1.5.0 (2012-08-??) - fixed SF# 3012166: IPv6 patch - added SF# 3558085: Add formatter to MACAddress object - fixed SF# 3535990: POCO_HAVE_IPv6 without POCO_WIN32_UTF8 conflict +- fixed SF #3552774: Don't hide default target in subordinate makefile +- fixed SF #3534307: Building IPv6 for Linux by default +- fixed SF #3516844: poco missing symbols with external >=lipcre-8.13 Release 1.4.4 (2012-08-??) ========================== diff --git a/Data/ODBC/Makefile b/Data/ODBC/Makefile index cc45323c4..62db264d1 100644 --- a/Data/ODBC/Makefile +++ b/Data/ODBC/Makefile @@ -14,16 +14,14 @@ include $(POCO_BASE)/build/rules/global -# adjust for the target system (usually '/usr/lib' or '/usr/local/lib') -ODBCLIBDIR = /usr/lib$(LIB64SUFFIX) ifeq ($(LINKMODE),STATIC) LIBLINKEXT = $(STATICLIBLINKEXT) else LIBLINKEXT = $(SHAREDLIBLINKEXT) endif -INCLUDE += -I/usr/local/include -I/usr/include -I/usr/include/odbc -I/usr/local/include/odbc -SYSLIBS += -L/usr/lib$(LIB64SUFFIX) -L/usr/local/lib$(LIB64SUFFIX) -L/usr/lib$(LIB64SUFFIX)/odbc -L/usr/local/lib$(LIB64SUFFIX)/odbc +INCLUDE += $(POCO_ODBC_INCLUDE) +SYSLIBS += $(POCO_ODBC_LIBRARY) ifeq ($(POCO_CONFIG),MinGW) # -DODBCVER=0x0300: SQLHandle declaration issue @@ -36,23 +34,25 @@ CXXFLAGS += -DODBCVER=0x0300 -DNOMINMAX # CYGWIN platform has its own ODBC library in /lib/w32api SYSLIBS += -L/lib/w32api -lodbc32 -lodbccp32 else -ifeq (0, $(shell test -e $(ODBCLIBDIR)/libodbc$(LIBLINKEXT); echo $$?)) +ifeq (0, $(shell test -e $(POCO_ODBC_LIBRARY)/libodbc$(LIBLINKEXT); echo $$?)) SYSLIBS += -lodbc -lodbcinst COMMONFLAGS += -DPOCO_UNIXODBC else -ifeq (0, $(shell test -h $(ODBCLIBDIR)/libodbc$(LIBLINKEXT); echo $$?)) +ifeq (0, $(shell test -h $(POCO_ODBC_LIBRARY)/libodbc$(LIBLINKEXT); echo $$?)) SYSLIBS += -lodbc -lodbcinst COMMONFLAGS += -DPOCO_UNIXODBC else -ifeq (0, $(shell test -e $(ODBCLIBDIR)/libiodbc$(LIBLINKEXT); echo $$?)) +ifeq (0, $(shell test -e $(POCO_ODBC_LIBRARY)/libiodbc$(LIBLINKEXT); echo $$?)) SYSLIBS += -liodbc -liodbcinst COMMONFLAGS += -DPOCO_IODBC -I/usr/include/iodbc else -ifeq (0, $(shell test -h $(ODBCLIBDIR)/libiodbc$(LIBLINKEXT); echo $$?)) +ifeq (0, $(shell test -h $(POCO_ODBC_LIBRARY)/libiodbc$(LIBLINKEXT); echo $$?)) SYSLIBS += -liodbc -liodbcinst -I/usr/include/iodbc COMMONFLAGS += -DPOCO_IODBC else -$(error No ODBC library found. Please install unixODBC or iODBC and try again) +ifndef (POCO_NO_ODBC) +$(warning No ODBC library found. Please install unixODBC or iODBC.) +endif endif endif endif diff --git a/Data/ODBC/testsuite/Makefile b/Data/ODBC/testsuite/Makefile index e73f4456e..7c65a0a81 100644 --- a/Data/ODBC/testsuite/Makefile +++ b/Data/ODBC/testsuite/Makefile @@ -14,16 +14,14 @@ include $(POCO_BASE)/build/rules/global -# adjust for the target system (usually '/usr/lib' or '/usr/local/lib') -ODBCLIBDIR = /usr/lib$(LIB64SUFFIX) ifeq ($(LINKMODE),STATIC) LIBLINKEXT = $(STATICLIBLINKEXT) else LIBLINKEXT = $(SHAREDLIBLINKEXT) endif -INCLUDE += -I/usr/local/include -I/usr/include -I/usr/include/odbc -I/usr/local/include/odbc -SYSLIBS += -L/usr/lib$(LIB64SUFFIX) -L/usr/local/lib$(LIB64SUFFIX) -L/usr/lib$(LIB64SUFFIX)/odbc -L/usr/local/lib$(LIB64SUFFIX)/odbc +INCLUDE += $(POCO_ODBC_INCLUDE) +SYSLIBS += $(POCO_ODBC_LIBRARY) ifeq ($(POCO_CONFIG),MinGW) # -DODBCVER=0x0300: SQLHandle declaration issue @@ -33,26 +31,28 @@ else ifeq ($(POCO_CONFIG),CYGWIN) # -DODBCVER=0x0300: SQLHandle declaration issue # -DNOMINMAX : MIN/MAX macros defined in windows conflict with libstdc++ CXXFLAGS += -DODBCVER=0x0300 -DNOMINMAX -# CYGWIN platform has its own ODBC library in /lib/w32api +# CYGWIN platform has its own ODBC library in /lib/w32api SYSLIBS += -L/lib/w32api -lodbc32 -lodbccp32 else -ifeq (0, $(shell test -e $(ODBCLIBDIR)/libodbc$(LIBLINKEXT); echo $$?)) +ifeq (0, $(shell test -e $(POCO_ODBC_LIBRARY)/libodbc$(LIBLINKEXT); echo $$?)) SYSLIBS += -lodbc -lodbcinst COMMONFLAGS += -DPOCO_UNIXODBC else -ifeq (0, $(shell test -h $(ODBCLIBDIR)/libodbc$(LIBLINKEXT); echo $$?)) +ifeq (0, $(shell test -h $(POCO_ODBC_LIBRARY)/libodbc$(LIBLINKEXT); echo $$?)) SYSLIBS += -lodbc -lodbcinst COMMONFLAGS += -DPOCO_UNIXODBC else -ifeq (0, $(shell test -e $(ODBCLIBDIR)/libiodbc$(LIBLINKEXT); echo $$?)) +ifeq (0, $(shell test -e $(POCO_ODBC_LIBRARY)/libiodbc$(LIBLINKEXT); echo $$?)) SYSLIBS += -liodbc -liodbcinst COMMONFLAGS += -DPOCO_IODBC -I/usr/include/iodbc else -ifeq (0, $(shell test -h $(ODBCLIBDIR)/libiodbc$(LIBLINKEXT); echo $$?)) +ifeq (0, $(shell test -h $(POCO_ODBC_LIBRARY)/libiodbc$(LIBLINKEXT); echo $$?)) SYSLIBS += -liodbc -liodbcinst -I/usr/include/iodbc COMMONFLAGS += -DPOCO_IODBC else -$(error No ODBC library found. Please install unixODBC or iODBC and try again) +ifndef (POCO_NO_ODBC) +$(warning No ODBC library found. Please install unixODBC or iODBC.) +endif endif endif endif diff --git a/Foundation/Makefile b/Foundation/Makefile index a6252c6dd..0b9fa0e02 100644 --- a/Foundation/Makefile +++ b/Foundation/Makefile @@ -43,8 +43,11 @@ pcre_objects = pcre_chartables pcre_compile pcre_globals pcre_maketables \ pcre_utf8_objects = pcre_ucd pcre_tables +ifndef POCO_UNBUNDLED +$(warning POCO_NO_ODBC NOT defined) +endif + ifdef POCO_UNBUNDLED - objects += $(pcre_utf8_objects) SYSLIBS += -lpcre -lz else objects += $(zlib_objects) $(pcre_objects) $(pcre_utf8_objects) diff --git a/Foundation/include/Poco/Config.h b/Foundation/include/Poco/Config.h index 3c521308f..8ddd79329 100644 --- a/Foundation/include/Poco/Config.h +++ b/Foundation/include/Poco/Config.h @@ -121,4 +121,9 @@ // #define POCO_UTIL_NO_XMLCONFIGURATION +// No IPv6 support +// Define to disable IPv6 +// #define POCO_NET_NO_IPv6 + + #endif // Foundation_Config_INCLUDED diff --git a/Makefile b/Makefile index 398f4a5b1..420cc6656 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ # sinclude config.make +sinclude config.build ifndef POCO_BASE $(warning WARNING: POCO_BASE is not defined. Assuming current directory.) @@ -24,7 +25,8 @@ ifeq ($(LINKMODE),BOTH) SHAREDONLY='(' -name static -prune ')' -o endif -.PHONY: all libexecs cppunit tests samples clean distclean install +# TESTS and SAMPLES are set by confgure script in config.make +poco: libexecs $(if $(TESTS),tests) $(if $(SAMPLES),samples) all: libexecs tests samples @@ -53,6 +55,7 @@ libexecs = Foundation-libexec XML-libexec JSON-libexec Util-libexec Net-libexec tests = Foundation-tests XML-tests JSON-tests Util-tests Net-tests Crypto-tests NetSSL_OpenSSL-tests Data-tests Data/SQLite-tests Data/ODBC-tests Data/MySQL-tests Zip-tests PDF-tests CppParser-tests samples = Foundation-samples XML-samples JSON-samples Util-samples Net-samples Crypto-samples NetSSL_OpenSSL-samples Data-samples Zip-samples PageCompiler-samples PDF-samples +.PHONY: poco all libexecs cppunit tests samples clean distclean install .PHONY: $(libexecs) .PHONY: $(tests) .PHONY: $(samples) @@ -66,7 +69,7 @@ Foundation-libexec: Foundation-tests: Foundation-libexec cppunit $(MAKE) -C $(POCO_BASE)/Foundation/testsuite - + Foundation-samples: Foundation-libexec $(MAKE) -C $(POCO_BASE)/Foundation/samples @@ -75,7 +78,7 @@ XML-libexec: Foundation-libexec XML-tests: XML-libexec cppunit $(MAKE) -C $(POCO_BASE)/XML/testsuite - + XML-samples: XML-libexec $(MAKE) -C $(POCO_BASE)/XML/samples @@ -84,7 +87,7 @@ JSON-libexec: Foundation-libexec JSON-tests: JSON-libexec cppunit $(MAKE) -C $(POCO_BASE)/JSON/testsuite - + JSON-samples: JSON-libexec $(MAKE) -C $(POCO_BASE)/JSON/samples @@ -93,7 +96,7 @@ Util-libexec: Foundation-libexec XML-libexec Util-tests: Util-libexec cppunit $(MAKE) -C $(POCO_BASE)/Util/testsuite - + Util-samples: Util-libexec $(MAKE) -C $(POCO_BASE)/Util/samples @@ -102,7 +105,7 @@ Net-libexec: Foundation-libexec Net-tests: Net-libexec cppunit $(MAKE) -C $(POCO_BASE)/Net/testsuite - + Net-samples: Net-libexec Foundation-libexec XML-libexec Util-libexec $(MAKE) -C $(POCO_BASE)/Net/samples @@ -111,7 +114,7 @@ Crypto-libexec: Foundation-libexec Crypto-tests: Crypto-libexec cppunit $(MAKE) -C $(POCO_BASE)/Crypto/testsuite - + Crypto-samples: Crypto-libexec Foundation-libexec Util-libexec $(MAKE) -C $(POCO_BASE)/Crypto/samples @@ -120,7 +123,7 @@ NetSSL_OpenSSL-libexec: Foundation-libexec Net-libexec Util-libexec Crypto-libe NetSSL_OpenSSL-tests: NetSSL_OpenSSL-libexec cppunit $(MAKE) -C $(POCO_BASE)/NetSSL_OpenSSL/testsuite - + NetSSL_OpenSSL-samples: NetSSL_OpenSSL-libexec $(MAKE) -C $(POCO_BASE)/NetSSL_OpenSSL/samples @@ -129,7 +132,7 @@ Data-libexec: Foundation-libexec Data-tests: Data-libexec cppunit $(MAKE) -C $(POCO_BASE)/Data/testsuite - + Data-samples: Data-libexec Data-libexec Data/SQLite-libexec $(MAKE) -C $(POCO_BASE)/Data/samples @@ -156,13 +159,13 @@ Zip-libexec: Foundation-libexec Net-libexec Util-libexec XML-libexec Zip-tests: Zip-libexec cppunit $(MAKE) -C $(POCO_BASE)/Zip/testsuite - + Zip-samples: Zip-libexec $(MAKE) -C $(POCO_BASE)/Zip/samples PageCompiler-libexec: Net-libexec Util-libexec XML-libexec Foundation-libexec $(MAKE) -C $(POCO_BASE)/PageCompiler - + PageCompiler-samples: PageCompiler-libexec $(MAKE) -C $(POCO_BASE)/PageCompiler/samples @@ -174,7 +177,7 @@ PDF-libexec: Foundation-libexec PDF-tests: PDF-libexec cppunit $(MAKE) -C $(POCO_BASE)/PDF/testsuite - + PDF-samples: PDF-libexec $(MAKE) -C $(POCO_BASE)/PDF/samples diff --git a/Net/include/Poco/Net/IPAddress.h b/Net/include/Poco/Net/IPAddress.h index e23035f66..eb276e120 100644 --- a/Net/include/Poco/Net/IPAddress.h +++ b/Net/include/Poco/Net/IPAddress.h @@ -80,8 +80,10 @@ public: enum Family /// Possible address families for IP addresses. { - IPv4, - IPv6 + IPv4 +#ifdef POCO_HAVE_IPv6 + ,IPv6 +#endif }; IPAddress(); diff --git a/Net/include/Poco/Net/Net.h b/Net/include/Poco/Net/Net.h index dc1b2fd70..943433955 100644 --- a/Net/include/Poco/Net/Net.h +++ b/Net/include/Poco/Net/Net.h @@ -96,10 +96,13 @@ void Net_API uninitializeNetwork(); } } // namespace Poco::Net -// Define to enable IPv6 support -#if !defined (POCO_HAVE_IPv6) +// Default to enabled IPv6 support if not explicitly disabled +#if !defined(POCO_NET_NO_IPv6) && !defined (POCO_HAVE_IPv6) #define POCO_HAVE_IPv6 -#endif // POCO_HAVE_IPv6 +#elif defined(POCO_NET_NO_IPv6) && defined (POCO_HAVE_IPv6) + #undef POCO_HAVE_IPv6 +#endif // POCO_NET_NO_IPv6, POCO_HAVE_IPv6 + #if !defined(s6_addr16) #if defined(POCO_OS_FAMILY_WINDOWS) diff --git a/Net/src/NetworkInterface.cpp b/Net/src/NetworkInterface.cpp index d415b8d41..4abb97b29 100644 --- a/Net/src/NetworkInterface.cpp +++ b/Net/src/NetworkInterface.cpp @@ -280,6 +280,7 @@ bool NetworkInterfaceImpl::supportsIPv4() const bool NetworkInterfaceImpl::supportsIPv6() const { +#ifdef POCO_HAVE_IPv6 AddressList::const_iterator it = _addressList.begin(); AddressList::const_iterator end = _addressList.end(); for (; it != end; ++it) @@ -287,7 +288,7 @@ bool NetworkInterfaceImpl::supportsIPv6() const if (IPAddress::IPv6 == it->get().family()) return true; } - +#endif return false; } @@ -1241,7 +1242,11 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) continue; } - if (family == AF_INET || family == AF_INET6) + if (family == AF_INET +#ifdef POCO_HAVE_IPv6 + || family == AF_INET6 +#endif + ) { intf = NetworkInterface(std::string(currIface->ifa_name), address, subnetMask, broadcastAddress, ifIndex); if ((upOnly && intf.isUp()) || !upOnly) diff --git a/Net/src/SocketAddress.cpp b/Net/src/SocketAddress.cpp index e2ad07be1..f79a15fc9 100644 --- a/Net/src/SocketAddress.cpp +++ b/Net/src/SocketAddress.cpp @@ -358,11 +358,13 @@ int SocketAddress::af() const std::string SocketAddress::toString() const { std::string result; +#if defined(POCO_HAVE_IPv6) if (host().family() == IPAddress::IPv6) result.append("["); result.append(host().toString()); if (host().family() == IPAddress::IPv6) result.append("]"); +#endif result.append(":"); NumberFormatter::append(result, port()); return result; diff --git a/NetSSL_OpenSSL/src/SecureSocketImpl.cpp b/NetSSL_OpenSSL/src/SecureSocketImpl.cpp index 7a9e9d035..37eee98a3 100644 --- a/NetSSL_OpenSSL/src/SecureSocketImpl.cpp +++ b/NetSSL_OpenSSL/src/SecureSocketImpl.cpp @@ -140,7 +140,13 @@ void SecureSocketImpl::connect(const SocketAddress& address, const Poco::Timespa poco_assert (!_pSSL); _pSocket->connect(address, timeout); + Poco::Timespan receiveTimeout = _pSocket->getReceiveTimeout(); + Poco::Timespan sendTimeout = _pSocket->getSendTimeout(); + _pSocket->setReceiveTimeout(timeout); + _pSocket->setSendTimeout(timeout); connectSSL(performHandshake); + _pSocket->setReceiveTimeout(receiveTimeout); + _pSocket->setSendTimeout(sendTimeout); } @@ -149,15 +155,8 @@ void SecureSocketImpl::connectNB(const SocketAddress& address) if (_pSSL) reset(); poco_assert (!_pSSL); - _pSocket->connectNB(address); - Poco::Timespan receiveTimeout = _pSocket->getReceiveTimeout(); - Poco::Timespan sendTimeout = _pSocket->getSendTimeout(); - _pSocket->setReceiveTimeout(timeout); - _pSocket->setSendTimeout(timeout); connectSSL(false); - _pSocket->setReceiveTimeout(receiveTimeout); - _pSocket->setSendTimeout(sendTimeout); } diff --git a/build/rules/global b/build/rules/global index d76b67ace..74d53b1fb 100644 --- a/build/rules/global +++ b/build/rules/global @@ -25,7 +25,7 @@ endif # # Include some optional make configuration # -sinclude $(POCO_BASE)/config.build +sinclude $(POCO_BASE)/config.make # # Check for PROJECT_BASE @@ -270,6 +270,36 @@ INCLUDE = $(foreach p,$(POCO_ADD_INCLUDE),-I$(p)) -Iinclude $(foreach p,$(COMPON # LIBRARY = $(foreach p,$(POCO_ADD_LIBRARY),-L$(p)) -L$(LIBPATH) $(POCO_LIBRARY) +# +# Build ODBC Include directory List if not supplied from config +# +ifndef POCO_ODBC_INCLUDE +POCO_ODBC_INCLUDE = -I/usr/local/include -I/usr/include -I/usr/include/odbc -I/usr/local/include/odbc +endif + +# +# Build ODBC library directory if not supplied from config +# +ifndef POCO_NO_ODBC +ifndef POCO_ODBC_LIBRARY +ifeq (0, $(shell test -e $/usr/lib/libodbc$(LIBLINKEXT); echo $$?)) +POCO_ODBC_LIBRARY = /usr/lib$(LIB64SUFFIX) +else +ifeq (0, $(shell test -e $/usr/local/lib/libodbc$(LIBLINKEXT); echo $$?)) +POCO_ODBC_LIBRARY = /usr/local/lib$(LIB64SUFFIX) +else +ifeq (0, $(shell test -e $/usr/local/lib/libodbc$(LIBLINKEXT); echo $$?)) +POCO_ODBC_LIBRARY = /usr/lib$(LIB64SUFFIX)/odbc +else +ifeq (0, $(shell test -e $/usr/local/lib/libodbc$(LIBLINKEXT); echo $$?)) +POCO_ODBC_LIBRARY = /usr/local/lib$(LIB64SUFFIX)/odbc +endif +endif +endif +endif +endif +endif + # # Strip Command definition # diff --git a/configure b/configure index 0c48909f7..b268982bc 100755 --- a/configure +++ b/configure @@ -59,6 +59,10 @@ Options: Compile with -DPOCO_NO_SHAREDLIBS. For systems that don't support shared library loading. + --no-ipv6 + Compile with -DPOCO_NET_NO_IPv6. + For systems that don't support IPv6. + --omit={,} Do not build the specified component(s). Example: --omit=Data/MySQL,Data/ODBC,Zip @@ -101,8 +105,8 @@ cd `dirname $0` base=`pwd` cd $build -tests="tests" -samples="samples" +tests=1 +samples=1 flags="" omit="" includepath="" @@ -114,25 +118,25 @@ shared="" while [ $# -ge 1 ]; do case "$1" in --config=*) - config="${1:9}" ;; + config="`echo ${1} | awk '{print substr($0,10)}'`" ;; --prefix=*) - prefix="${1:9}" ;; + prefix="`echo ${1} | awk '{print substr($0,10)}'`" ;; --stdcxx-base=*) - stdcxx_base="${1:14}" ;; + stdcxx_base="`echo ${1} | awk '{print substr($0,15)}'`" ;; --omit=*) - omit="`echo ${1:7} | tr ',;' ' '`" ;; + omit="`echo ${1} | awk '{print substr($0,8)}' | tr ',;' ' '`" ;; --include-path=*) - includepath="`echo ${1:15} | tr ',;' ' '`" ;; + includepath="`echo ${1} | awk '{print substr($0,16)}' | tr ',;' ' '`" ;; --library-path=*) - librarypath="`echo ${1:15} | tr ',;' ' '`" ;; + librarypath="`echo ${1} | awk '{print substr($0,16)}' | tr ',;' ' '`" ;; --cflags=*) - cflags="${1:9}" ;; + cflags="`echo ${1} | awk '{print substr($0,10)}'`" ;; --no-samples) samples="" ;; @@ -151,6 +155,9 @@ while [ $# -ge 1 ]; do --no-sharedlibs) flags="$flags -DPOCO_NO_SHAREDLIBS" ;; + + --no-ipv6) + flags="$flags -DPOCO_NET_NO_IPv6" ;; --poquito) flags="$flags -DPOCO_NO_FILECHANNEL -DPOCO_NO_SPLITTERCHANNEL -DPOCO_NO_SYSLOGCHANNEL -DPOCO_UTIL_NO_INIFILECONFIGURATION -DPOCO_UTIL_NO_XMLCONFIGURATION" ;; @@ -271,9 +278,11 @@ if [ -n "$linkmode" ] ; then echo "export LINKMODE" >>$build/config.make fi -cat <<__EOF__ >>$build/config.make -.PHONY: poco -poco: libexecs $tests $samples +# create config.make +echo '# config.build generated by configure script' >$build/config.build +cat <<__EOF__ >>$build/config.build +TESTS = $tests +SAMPLES = $samples __EOF__ echo "Configured for $config"