diff --git a/Crypto/samples/genrsakey/Makefile b/Crypto/samples/genrsakey/Makefile index 3e34524cd..2cfa8b585 100644 --- a/Crypto/samples/genrsakey/Makefile +++ b/Crypto/samples/genrsakey/Makefile @@ -8,7 +8,8 @@ include $(POCO_BASE)/build/rules/global -SYSLIBS += -lssl -lcrypto +# Note: linking order is important, do not change it. +SYSLIBS += -lssl -lcrypto -lz -ldl objects = genrsakey diff --git a/Crypto/testsuite/Makefile b/Crypto/testsuite/Makefile index 7687e0142..a20381808 100644 --- a/Crypto/testsuite/Makefile +++ b/Crypto/testsuite/Makefile @@ -8,7 +8,8 @@ include $(POCO_BASE)/build/rules/global -SYSLIBS += -lssl -lcrypto +# Note: linking order is important, do not change it. +SYSLIBS += -lssl -lcrypto -lz -ldl objects = CryptoTestSuite Driver \ CryptoTest RSATest diff --git a/Data/MySQL/Makefile b/Data/MySQL/Makefile index d061e8291..0e0e3833a 100644 --- a/Data/MySQL/Makefile +++ b/Data/MySQL/Makefile @@ -8,7 +8,7 @@ include $(POCO_BASE)/build/rules/global -SYSLIBS += -L/usr/local/lib/mysql -L/usr/lib/mysql -L/usr/mysql/lib/mysql +SYSLIBS += -L/usr/local/lib$(LIB64SUFFIX)/mysql -L/usr/lib$(LIB64SUFFIX)/mysql -L/usr/mysql/lib$(LIB64SUFFIX)/mysql -L/usr/local/mysql/lib$(LIB64SUFFIX) -lmysqlclient INCLUDE += -I/usr/local/include/mysql/ -I/usr/include/mysql/ -I/usr/mysql/include/mysql SYSFLAGS += -DTHREADSAFE -DNO_TCL diff --git a/Data/MySQL/testsuite/Makefile b/Data/MySQL/testsuite/Makefile index 83423009a..e917928dc 100644 --- a/Data/MySQL/testsuite/Makefile +++ b/Data/MySQL/testsuite/Makefile @@ -9,7 +9,9 @@ include $(POCO_BASE)/build/rules/global INCLUDE += -I./../include -I/usr/local/include/mysql -I/usr/include/mysql/ -I/usr/mysql/include/mysql -SYSLIBS += -L/usr/local/lib/mysql -L/usr/lib/mysql -L/usr/mysql/lib/mysql -lmysqlclient -lz + +# Note: linking order is important, do not change it. +SYSLIBS += -L/usr/local/lib$(LIB64SUFFIX)/mysql -L/usr/lib$(LIB64SUFFIX)/mysql -L/usr/mysql/lib$(LIB64SUFFIX)/mysql -L/usr/local/mysql/lib$(LIB64SUFFIX) -lmysqlclient -lz -lpthread -ldl objects = MySQLTestSuite Driver MySQLTest SQLExecutor diff --git a/Data/ODBC/Makefile b/Data/ODBC/Makefile index 487c80ccc..00165235c 100644 --- a/Data/ODBC/Makefile +++ b/Data/ODBC/Makefile @@ -15,10 +15,10 @@ include $(POCO_BASE)/build/rules/global # adjust for the target system (usually '/usr/lib' or '/usr/local/lib') -ODBCLIBDIR = /usr/lib +ODBCLIBDIR = /usr/lib$(LIB64SUFFIX) INCLUDE += -I/usr/local/include -I/usr/include -I/usr/include/odbc -I/usr/local/include/odbc -SYSLIBS += -L/usr/local/lib/odbc -L/usr/lib/odbc -L/usr/lib -L/usr/local/lib +SYSLIBS += -L/usr/lib$(LIB64SUFFIX) -L/usr/local/lib$(LIB64SUFFIX) -L/usr/lib$(LIB64SUFFIX)/odbc -L/usr/local/lib$(LIB64SUFFIX)/odbc ifeq ($(POCO_CONFIG),MinGW) # -DODBCVER=0x0300: SQLHandle declaration issue diff --git a/Data/ODBC/testsuite/Makefile b/Data/ODBC/testsuite/Makefile index 17fd0fd4e..071f1c242 100644 --- a/Data/ODBC/testsuite/Makefile +++ b/Data/ODBC/testsuite/Makefile @@ -14,6 +14,12 @@ include $(POCO_BASE)/build/rules/global +# adjust for the target system (usually '/usr/lib' or '/usr/local/lib') +ODBCLIBDIR = /usr/lib$(LIB64SUFFIX) + +INCLUDE += -I/usr/local/include -I/usr/include -I/usr/include/odbc -I/usr/local/include/odbc +SYSLIBS += -L/usr/local/lib$(LIB64SUFFIX)/odbc -L/usr/lib$(LIB64SUFFIX)/odbc -L/usr/lib$(LIB64SUFFIX) -L/usr/local/lib$(LIB64SUFFIX) + ifeq ($(POCO_CONFIG),MinGW) # Lack of unixODBC or iODBC is not an error for MinGW platform since it uses Windows odbc32.lib else @@ -30,6 +36,12 @@ endif endif endif +########################################################################################################### +# Note: # +# Do not change linking order or move this line up, these libs have to be linked in this order and last. # +########################################################################################################### +SYSLIBS += -lltdl -ldl + objects = ODBCTestSuite Driver \ ODBCDB2Test ODBCMySQLTest ODBCOracleTest ODBCPostgreSQLTest \ ODBCSQLiteTest ODBCSQLServerTest ODBCTest SQLExecutor diff --git a/JSON/testsuite/Makefile b/JSON/testsuite/Makefile index f3ccd9f51..36149b2b3 100644 --- a/JSON/testsuite/Makefile +++ b/JSON/testsuite/Makefile @@ -12,6 +12,6 @@ objects = Driver JSONTest JSONTestSuite target = testrunner target_version = 1 -target_libs = PocoFoundation PocoJSON CppUnit +target_libs = PocoJSON PocoFoundation CppUnit include $(POCO_BASE)/build/rules/exec diff --git a/Makefile b/Makefile index 4c85f26c6..398f4a5b1 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,11 @@ ifndef POCO_BUILD export POCO_BUILD=$(POCO_BASE) endif +# if we've built both static and shared, install shared +ifeq ($(LINKMODE),BOTH) +SHAREDONLY='(' -name static -prune ')' -o +endif + .PHONY: all libexecs cppunit tests samples clean distclean install all: libexecs tests samples @@ -31,18 +36,18 @@ cppunit: install: libexecs mkdir -p $(INSTALLDIR)/include/Poco - mkdir -p $(INSTALLDIR)/lib + mkdir -p $(INSTALLDIR)/lib$(LIB64SUFFIX) mkdir -p $(INSTALLDIR)/bin for comp in $(COMPONENTS) ; do \ if [ -d "$(POCO_BASE)/$$comp/include" ] ; then \ cp -Rf $(POCO_BASE)/$$comp/include/* $(INSTALLDIR)/include/ ; \ fi ; \ if [ -d "$(POCO_BUILD)/$$comp/bin" ] ; then \ - find $(POCO_BUILD)/$$comp/bin -perm -700 -type f -exec cp -f {} $(INSTALLDIR)/bin \; ; \ + find $(POCO_BUILD)/$$comp/bin $(SHAREDONLY) '(' -perm -700 -type f -exec cp -f {} $(INSTALLDIR)/bin \; ')' ; \ fi ; \ done - find $(POCO_BUILD)/lib -name "libPoco*" -type f -exec cp -f {} $(INSTALLDIR)/lib \; - find $(POCO_BUILD)/lib -name "libPoco*" -type l -exec cp -Rf {} $(INSTALLDIR)/lib \; + find $(POCO_BUILD)/lib -name "libPoco*" -type f -exec cp -f {} $(INSTALLDIR)/lib$(LIB64SUFFIX) \; + find $(POCO_BUILD)/lib -name "libPoco*" -type l -exec cp -Rf {} $(INSTALLDIR)/lib$(LIB64SUFFIX) \; libexecs = Foundation-libexec XML-libexec JSON-libexec Util-libexec Net-libexec Crypto-libexec NetSSL_OpenSSL-libexec Data-libexec Data/SQLite-libexec Data/ODBC-libexec Data/MySQL-libexec Zip-libexec PageCompiler-libexec PageCompiler/File2Page-libexec PDF-libexec CppParser-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 diff --git a/NetSSL_OpenSSL/samples/HTTPSTimeServer/Makefile b/NetSSL_OpenSSL/samples/HTTPSTimeServer/Makefile index 6cf648239..f2a6927a1 100644 --- a/NetSSL_OpenSSL/samples/HTTPSTimeServer/Makefile +++ b/NetSSL_OpenSSL/samples/HTTPSTimeServer/Makefile @@ -8,7 +8,8 @@ include $(POCO_BASE)/build/rules/global -SYSLIBS += -lssl -lcrypto +# Note: linking order is important, do not change it. +SYSLIBS += -lssl -lcrypto -lz -ldl objects = HTTPSTimeServer diff --git a/NetSSL_OpenSSL/samples/Mail/Makefile b/NetSSL_OpenSSL/samples/Mail/Makefile index e0f0be20d..36538f712 100644 --- a/NetSSL_OpenSSL/samples/Mail/Makefile +++ b/NetSSL_OpenSSL/samples/Mail/Makefile @@ -8,6 +8,9 @@ include $(POCO_BASE)/build/rules/global +# Note: linking order is important, do not change it. +SYSLIBS += -lssl -lcrypto -lz -ldl + objects = Mail target = Mail diff --git a/NetSSL_OpenSSL/samples/download/Makefile b/NetSSL_OpenSSL/samples/download/Makefile index 050b06a69..04a12c435 100644 --- a/NetSSL_OpenSSL/samples/download/Makefile +++ b/NetSSL_OpenSSL/samples/download/Makefile @@ -8,7 +8,8 @@ include $(POCO_BASE)/build/rules/global -SYSLIBS += -lssl -lcrypto +# Note: linking order is important, do not change it. +SYSLIBS += -lssl -lcrypto -lz -ldl objects = download diff --git a/NetSSL_OpenSSL/testsuite/Makefile b/NetSSL_OpenSSL/testsuite/Makefile index 46f010d9f..45fd0efe8 100644 --- a/NetSSL_OpenSSL/testsuite/Makefile +++ b/NetSSL_OpenSSL/testsuite/Makefile @@ -8,7 +8,8 @@ include $(POCO_BASE)/build/rules/global -SYSLIBS += -lssl -lcrypto +# Note: linking order is important, do not change it. +SYSLIBS += -lssl -lcrypto -lz -ldl objects = NetSSLTestSuite Driver \ HTTPSClientSessionTest HTTPSClientTestSuite HTTPSServerTest HTTPSServerTestSuite \ diff --git a/PDF/samples/Image/Makefile b/PDF/samples/Image/Makefile index 40a54a55f..81f645f5a 100644 --- a/PDF/samples/Image/Makefile +++ b/PDF/samples/Image/Makefile @@ -12,6 +12,6 @@ objects = Image target = Image target_version = 1 -target_libs = PocoFoundation PocoPDF +target_libs = PocoPDF PocoFoundation include $(POCO_BASE)/build/rules/exec diff --git a/PDF/samples/Text/Makefile b/PDF/samples/Text/Makefile index 23c3cb993..85b5589c6 100644 --- a/PDF/samples/Text/Makefile +++ b/PDF/samples/Text/Makefile @@ -12,6 +12,6 @@ objects = Text target = Text target_version = 1 -target_libs = PocoFoundation PocoPDF +target_libs = PocoPDF PocoFoundation include $(POCO_BASE)/build/rules/exec diff --git a/PageCompiler/samples/HTTPTimeServer/Makefile b/PageCompiler/samples/HTTPTimeServer/Makefile index ed45790d7..70a50f6a3 100644 --- a/PageCompiler/samples/HTTPTimeServer/Makefile +++ b/PageCompiler/samples/HTTPTimeServer/Makefile @@ -9,7 +9,7 @@ include $(POCO_BASE)/build/rules/global # Where to find the PageCompiler executable -PAGECOMPILER = $(POCO_BASE)/PageCompiler/bin/$(POCO_HOST_OSNAME)/$(POCO_HOST_OSARCH)/cpspc +PAGECOMPILER = $(POCO_BASE)/PageCompiler/bin/$(POCO_HOST_OSNAME)/$(POCO_HOST_OSARCH)/cpspc$(OSARCH_POSTFIX) objects = HTTPTimeServerApp TimeHandler diff --git a/Util/testsuite/Makefile b/Util/testsuite/Makefile index b0413e771..e0dc4caaf 100644 --- a/Util/testsuite/Makefile +++ b/Util/testsuite/Makefile @@ -21,6 +21,6 @@ objects = AbstractConfigurationTest ConfigurationTestSuite \ target = testrunner target_version = 1 -target_libs = PocoJSON PocoUtil PocoXML PocoFoundation CppUnit +target_libs = PocoUtil PocoXML PocoJSON PocoFoundation CppUnit include $(POCO_BASE)/build/rules/exec diff --git a/build/rules/global b/build/rules/global index dc954ccb9..2b65b3558 100644 --- a/build/rules/global +++ b/build/rules/global @@ -116,19 +116,6 @@ endif # include $(POCO_BASE)/build/config/$(POCO_CONFIG) -# -# Check if a 64bit build is requested -# -ifndef OSARCH_64BITS -OSARCH_64BITS = 0 -endif - -ifeq ($(OSARCH_64BITS),1) -OSARCH_POSTFIX = 64 -else -OSARCH_POSTFIX = -endif - # # Determine operating system # @@ -144,6 +131,37 @@ OSARCH := $(POCO_TARGET_OSARCH) endif HOSTNAME := $(shell hostname) +# +# Check if a 64bit build is requested +# +ifndef OSARCH_64BITS +OSARCH_64BITS = 0 +endif + +ifeq ($(OSARCH_64BITS),1) +OSARCH_POSTFIX = 64 +else +OSARCH_POSTFIX = +endif + +# +# Detect distro +# + +# Fedora, Redhat, Centos. +REDHATISH = $(if $(wildcard /etc/redhat-release /etc/centos-release /etc/fedora-release),1) +# Debian, Ubuntu +DEBIANISH = $(if $(wildcard /etc/debian_version),1) + +# +# Adjust suffix for 64-bit lib directory +# +ifneq ($(REDHATISH),) +LIB64SUFFIX = $(if $(filter $(OSARCH),x86_64 sparc64 ppc64),64,) +else ifneq ($(DEBIANISH),) +LIB64SUFFIX = $(if $(filter $(OSARCH),x86_64 sparc64 ppc64),/x86_64-linux-gnu,) +endif + # # Find out current component # diff --git a/configure b/configure index 55dafdf1a..8bcd39f21 100755 --- a/configure +++ b/configure @@ -19,7 +19,7 @@ Options: --help Display this help screen. - --config= + --config= Use the given build configuration. Available configurations are: @@ -62,10 +62,10 @@ Options: --omit={,} Do not build the specified component(s). Example: --omit=Data/MySQL,Data/ODBC,Zip - + --include-path= Add search path for header files. - + --library-path= Add search path for library files. @@ -78,14 +78,14 @@ Options: statically for embedded targets. --unbundled - Use system-provided zlib, pcre, expat and sqlite instead of + Use system-provided zlib, pcre, expat and sqlite instead of bundled ones. - + --static Build static libraries. Overrides default mode, which depends upon target. Can be specified together with --shared to build both. - + --shared Build shared libraries. Overrides default mode, which depends upon target. Can be specified together @@ -100,13 +100,6 @@ build=`pwd` cd `dirname $0` base=`pwd` cd $build -if [ `uname` = "QNX" ] ; then - EXPR=expr - NOTFOUND=0 -else - EXPR="expr --" - NOTFOUND="" -fi tests="tests" samples="samples" @@ -118,104 +111,84 @@ unbundled="" static="" shared="" # parse arguments -while [ "$1" != "" ] ; do - val=`$EXPR "$1" : '--config=\(.*\)'` - if [ "$val" != "$NOTFOUND" ] ; then - config=$val - fi - - val=`$EXPR "$1" : '--prefix=\(.*\)'` - if [ "$val" != "$NOTFOUND" ] ; then - prefix=$val - fi +while [ $# -ge 1 ]; do + case "$1" in + --config=*) + config="${1:9}" ;; - val=`$EXPR $1 : '--stdcxx-base=\(.*\)'` - if [ "$val" != "$NOTFOUND" ] ; then - stdcxx_base=$val - fi + --prefix=*) + prefix="${1:9}" ;; - val=`$EXPR "$1" : '--omit=\(.*\)'` - if [ "$val" != "$NOTFOUND" ] ; then - omit="$omit `echo $val | tr ',;' ' '`" - fi + --stdcxx-base=*) + stdcxx_base="${1:14}" ;; - val=`$EXPR "$1" : '--include-path=\(.*\)'` - if [ "$val" != "$NOTFOUND" ] ; then - includepath="$includepath `echo $val | tr ',;' ' '`" - fi + --omit=*) + omit="`echo ${1:7} | tr ',;' ' '`" ;; - val=`$EXPR "$1" : '--library-path=\(.*\)'` - if [ "$val" != "$NOTFOUND" ] ; then - librarypath="$librarypath `echo $val | tr ',;' ' '`" - fi + --include-path=*) + includepath="`echo ${1:15} | tr ',;' ' '`" ;; - val=`$EXPR "$1" : '--cflags=\(.*\)'` - if [ "$val" != "$NOTFOUND" ] ; then - flags="$flags $val" - fi - - if [ "$1" = "--no-samples" ] ; then - samples="" - fi - - if [ "$1" = "--no-tests" ] ; then - tests="" - fi - - if [ "$1" = "--no-wstring" ] ; then - flags="$flags -DPOCO_NO_WSTRING" - fi + --library-path=*) + librarypath="`echo ${1:15} | tr ',;' ' '`" ;; - if [ "$1" = "--no-fpenvironment" ] ; then - flags="$flags -DPOCO_NO_FPENVIRONMENT" - fi + --cflags=*) + cflags="${1:9}" ;; - if [ "$1" = "--no-sharedmemory" ] ; then - flags="$flags -DPOCO_NO_SHAREDMEMORY" - fi + --no-samples) + samples="" ;; - if [ "$1" = "--no-sharedlibs" ] ; then - flags="$flags -DPOCO_NO_SHAREDLIBS" - fi + --no-tests) + tests="" ;; - if [ "$1" = "--poquito" ] ; then - flags="$flags -DPOCO_NO_FILECHANNEL -DPOCO_NO_SPLITTERCHANNEL -DPOCO_NO_SYSLOGCHANNEL -DPOCO_UTIL_NO_INIFILECONFIGURATION -DPOCO_UTIL_NO_XMLCONFIGURATION" - fi + --no-wstring) + flags="$flags -DPOCO_NO_WSTRING" ;; - if [ "$1" = "--unbundled" ] ; then - flags="$flags -DPOCO_UNBUNDLED" - unbundled=1 - fi + --no-fpevnironment) + flags="$flags -DPOCO_NO_PFENVIRONMENT" ;; - if [ "$1" = "--static" ] ; then - static=1 - fi - - if [ "$1" = "--shared" ] ; then - shared=1 - fi - - if [ "$1" = "--help" ] ; then + --no-sharedmemory) + flags="$flags -DPOCO_NO_SHAREDMEMORY" ;; + + --no-sharedlibs) + flags="$flags -DPOCO_NO_SHAREDLIBS" ;; + + --poquito) + flags="$flags -DPOCO_NO_FILECHANNEL -DPOCO_NO_SPLITTERCHANNEL -DPOCO_NO_SYSLOGCHANNEL -DPOCO_UTIL_NO_INIFILECONFIGURATION -DPOCO_UTIL_NO_XMLCONFIGURATION" ;; + + --unbundled) + flags="$flags -DPOCO_UNBUNDLED" + unbundled=1 + ;; + + --static) + static=1 ;; + + --shared) + shared=1 ;; + + --help) + showhelp + exit 0 + ;; + + *) showhelp - exit 0 - fi + exit 1 + ;; + esac - shift + shift done - # autodetect build environment # ...special cases for CYGWIN or MinGW if [ "$config" = "" ] ; then - config=`uname` - cyg=`$EXPR $config : '\(CYGWIN\).*'` - if [ "$cyg" = "CYGWIN" ] ; then - config=CYGWIN - else - ming=`$EXPR $config : '\(MINGW\).*'` - if [ "$ming" = "MINGW" ] ; then - config=MinGW - fi - fi + config=`uname` + case "$config" in + CYGWIN*) + config=CYGWIN ;; + MINGW*) + config=MinGW ;; + esac fi if [ ! -f "$base/build/config/$config" ] ; then @@ -226,7 +199,7 @@ if [ ! -f "$base/build/config/$config" ] ; then exit 1 fi -if [ "$prefix" = "" ] ; then +if [ -z "$prefix" ] ; then prefix=/usr/local fi @@ -240,11 +213,11 @@ if [ "$base" != "$build" ] ; then cp $base/Makefile $build fi -if [ "$static" != "" -a "$shared" != "" ] ; then +if [ -n "$static" -a -n "$shared" ] ; then linkmode=BOTH -elif [ "$static" != "" ] ; then +elif [ -n "$static" ] ; then linkmode=STATIC -elif [ "$shared" != "" ] ; then +elif [ -n "$shared" ] ; then linkmode=SHARED else linkmode="" @@ -258,42 +231,49 @@ echo "POCO_BUILD = $build" >>$build/config.make echo "POCO_PREFIX = $prefix" >>$build/config.make echo "POCO_FLAGS = $flags" >>$build/config.make echo "OMIT = $omit" >>$build/config.make -if [ "$stdcxx_base" != "" ] ; then +if [ -n "$stdcxx_base" ] ; then echo "STDCXX_BASE = $stdcxx_base" >>$build/config.make fi -if [ "$includepath" != "" ] ; then +if [ -n "$includepath" ] ; then echo "POCO_ADD_INCLUDE = $includepath" >>$build/config.make fi -if [ "$librarypath" != "" ] ; then +if [ -n "$librarypath" ] ; then echo "POCO_ADD_LIBRARY = $librarypath" >>$build/config.make fi -if [ "$unbundled" != "" ] ; then +if [ -n "$unbundled" ] ; then echo "POCO_UNBUNDLED = 1" >>$build/config.make fi -if [ "$linkmode" != "" ] ; then +if [ -n "$linkmode" ] ; then echo "LINKMODE = $linkmode" >>$build/config.make fi -echo "export POCO_CONFIG" >>$build/config.make -echo "export POCO_BASE" >>$build/config.make -echo "export POCO_BUILD" >>$build/config.make -echo "export POCO_PREFIX" >>$build/config.make -echo "export POCO_FLAGS" >>$build/config.make -if [ "$stdcxx_base" != "" ] ; then + +cat <<__EOF__ >>$build/config.make +export POCO_CONFIG +export POCO_BASE +export POCO_BUILD +export POCO_PREFIX +export POCO_FLAGS +__EOF__ + +if [ -n "$stdcxx_base" ] ; then echo "export STDCXX_BASE" >>$build/config.make fi -if [ "$includepath" != "" ] ; then +if [ -n "$includepath" ] ; then echo "export POCO_ADD_INCLUDE" >>$build/config.make fi -if [ "$librarypath" != "" ] ; then +if [ -n "$librarypath" ] ; then echo "export POCO_ADD_LIBRARY" >>$build/config.make fi -if [ "$unbundled" != "" ] ; then +if [ -n "$unbundled" ] ; then echo "export POCO_UNBUNDLED" >>$build/config.make fi -if [ "$linkmode" != "" ] ; then +if [ -n "$linkmode" ] ; then echo "export LINKMODE" >>$build/config.make fi -echo ".PHONY: poco" >>$build/config.make -echo "poco: libexecs $tests $samples" >>$build/config.make + +cat <<__EOF__ >>$build/config.make +.PHONY: poco +poco: libexecs $tests $samples +__EOF__ echo "Configured for $config"