diff --git a/Data/PostgreSQL/Makefile b/Data/PostgreSQL/Makefile index 3abed04aa..5882ea9ef 100644 --- a/Data/PostgreSQL/Makefile +++ b/Data/PostgreSQL/Makefile @@ -6,41 +6,7 @@ include $(POCO_BASE)/build/rules/global -ifeq (0, $(shell test -e /usr/include/postgresql; echo $$?)) -INCLUDE += -I/usr/include/postgresql -endif -ifeq (0, $(shell test -e /usr/local/include/postgresql; echo $$?)) -INCLUDE += -I/usr/local/include/postgresql -endif -ifeq (0, $(shell test -e /usr/local/postgresql/include; echo $$?)) -INCLUDE += -I/usr/local/postgresql/include -endif -ifeq (0, $(shell test -e /opt/postgresql/include; echo $$?)) -INCLUDE += -I/opt/postgresql/include -endif -ifeq (0, $(shell test -e /usr/local/opt/libpq/include; echo $$?)) -INCLUDE += -I/usr/local/opt/libpq/include -endif - -ifeq (0, $(shell test -e /usr/lib$(LIB64SUFFIX)/postgresql; echo $$?)) -SYSLIBS += -L/usr/lib$(LIB64SUFFIX)/postgresql -endif -ifeq (0, $(shell test -e /usr/local/lib$(LIB64SUFFIX)/postgresql; echo $$?)) -SYSLIBS += -L/usr/local/lib$(LIB64SUFFIX)/postgresql -endif -ifeq (0, $(shell test -e /usr/local/postgresql/lib$(LIB64SUFFIX); echo $$?)) -SYSLIBS += -L/usr/local/postgresql/lib$(LIB64SUFFIX) -endif -ifeq (0, $(shell test -e /opt/postgresql/lib$(LIB64SUFFIX); echo $$?)) -SYSLIBS += -L/opt/postgresql/lib$(LIB64SUFFIX) -endif -ifeq (0, $(shell test -e /opt/postgresql/lib$(LIB64SUFFIX); echo $$?)) -SYSLIBS += -L/opt/postgresql/lib$(LIB64SUFFIX) -endif -ifeq (0, $(shell test -e /usr/local/opt/libpq/lib; echo $$?)) -SYSLIBS += -L/usr/local/opt/libpq/lib$(LIB64SUFFIX) -endif -SYSLIBS += -lpq +include PostgreSQL.make objects = Extractor Binder SessionImpl Connector \ PostgreSQLStatementImpl PostgreSQLException \ diff --git a/Data/PostgreSQL/PostgreSQL.make b/Data/PostgreSQL/PostgreSQL.make new file mode 100644 index 000000000..7b9248b24 --- /dev/null +++ b/Data/PostgreSQL/PostgreSQL.make @@ -0,0 +1,52 @@ +# +# PostgreSQL.make +# +# Makefile fragment for finding PostgreSQL library +# + +ifndef POCO_PGSQL_INCLUDE +ifeq (0, $(shell test -e /usr/include/postgresql; echo $$?)) +INCLUDE += -I/usr/include/postgresql +endif +ifeq (0, $(shell test -e /usr/local/include/postgresql; echo $$?)) +INCLUDE += -I/usr/local/include/postgresql +endif +ifeq (0, $(shell test -e /usr/local/postgresql/include; echo $$?)) +INCLUDE += -I/usr/local/postgresql/include +endif +ifeq (0, $(shell test -e /opt/postgresql/include; echo $$?)) +INCLUDE += -I/opt/postgresql/include +endif +ifeq (0, $(shell test -e /usr/local/opt/libpq/include; echo $$?)) +INCLUDE += -I/usr/local/opt/libpq/include +endif +endif + +ifndef POCO_PGSQL_LIB +ifeq (0, $(shell test -e /usr/lib$(LIB64SUFFIX)/postgresql; echo $$?)) +SYSLIBS += -L/usr/lib$(LIB64SUFFIX)/postgresql +endif +ifeq (0, $(shell test -e /usr/local/lib$(LIB64SUFFIX)/postgresql; echo $$?)) +SYSLIBS += -L/usr/local/lib$(LIB64SUFFIX)/postgresql +endif +ifeq (0, $(shell test -e /usr/local/postgresql/lib$(LIB64SUFFIX); echo $$?)) +SYSLIBS += -L/usr/local/postgresql/lib$(LIB64SUFFIX) +endif +ifeq (0, $(shell test -e /opt/postgresql/lib$(LIB64SUFFIX); echo $$?)) +SYSLIBS += -L/opt/postgresql/lib$(LIB64SUFFIX) +endif +ifeq (0, $(shell test -e /opt/postgresql/lib$(LIB64SUFFIX); echo $$?)) +SYSLIBS += -L/opt/postgresql/lib$(LIB64SUFFIX) +endif +ifeq (0, $(shell test -e /usr/local/opt/libpq/lib; echo $$?)) +SYSLIBS += -L/usr/local/opt/libpq/lib$(LIB64SUFFIX) +endif +endif +SYSLIBS += -lpq + +ifdef POCO_PGSQL_INCLUDE +INCLUDE += -I$(POCO_PGSQL_INCLUDE) +endif +ifdef POCO_PGSQL_LIB +SYSLIBS += -L$(POCO_PGSQL_LIB) +endif diff --git a/Data/PostgreSQL/testsuite/Makefile b/Data/PostgreSQL/testsuite/Makefile index fd56a861a..23fc02dd8 100644 --- a/Data/PostgreSQL/testsuite/Makefile +++ b/Data/PostgreSQL/testsuite/Makefile @@ -6,40 +6,7 @@ include $(POCO_BASE)/build/rules/global -ifeq (0, $(shell test -e /usr/include/postgresql; echo $$?)) -INCLUDE += -I/usr/include/postgresql -endif -ifeq (0, $(shell test -e /usr/local/include/postgresql; echo $$?)) -INCLUDE += -I/usr/local/include/postgresql -endif -ifeq (0, $(shell test -e /usr/local/postgresql/include; echo $$?)) -INCLUDE += -I/usr/local/postgresql/include -endif -ifeq (0, $(shell test -e /opt/postgresql/include; echo $$?)) -INCLUDE += -I/opt/postgresql/include -endif -ifeq (0, $(shell test -e /usr/local/opt/libpq/include; echo $$?)) -INCLUDE += -I/usr/local/opt/libpq/include -endif - -ifeq (0, $(shell test -e /usr/lib$(LIB64SUFFIX)/postgresql; echo $$?)) -SYSLIBS += -L/usr/lib$(LIB64SUFFIX)/postgresql -endif -ifeq (0, $(shell test -e /usr/local/lib$(LIB64SUFFIX)/postgresql; echo $$?)) -SYSLIBS += -L/usr/local/lib$(LIB64SUFFIX)/postgresql -endif -ifeq (0, $(shell test -e /usr/local/postgresql/lib$(LIB64SUFFIX); echo $$?)) -SYSLIBS += -L/usr/local/postgresql/lib$(LIB64SUFFIX) -endif -ifeq (0, $(shell test -e /opt/postgresql/lib$(LIB64SUFFIX); echo $$?)) -SYSLIBS += -L/opt/postgresql/lib$(LIB64SUFFIX) -endif -ifeq (0, $(shell test -e /opt/postgresql/lib$(LIB64SUFFIX); echo $$?)) -SYSLIBS += -L/opt/postgresql/lib$(LIB64SUFFIX) -endif -ifeq (0, $(shell test -e /usr/local/opt/libpq/lib; echo $$?)) -SYSLIBS += -L/usr/local/opt/libpq/lib$(LIB64SUFFIX) -endif +include $(POCO_BASE)/Data/PostgreSQL/PostgreSQL.make # Note: linking order is important, do not change it. SYSLIBS += -lpq -lz -lpthread -ldl diff --git a/configure b/configure index 9085f0c9c..24f03ec0c 100755 --- a/configure +++ b/configure @@ -108,6 +108,12 @@ Options: --mysql-include= Specify the directory where MySQL header files are located. + --pgsql-lib= + Specify the directory where PostgreSQL library is located. + + --pgsql-include= + Specify the directory where PostgreSQL header files are located. + --cflags= Pass additional flags to compiler. Example: --cflags=-wall @@ -190,6 +196,12 @@ while [ $# -ge 1 ]; do --mysql-include=*) mysqlinclude="`echo ${1} | awk '{print substr($0,17)}'`" ;; + --pgsql-lib=*) + pgsqllib="`echo ${1} | awk '{print substr($0,13)}'`" ;; + + --pgsql-include=*) + pgsqlinclude="`echo ${1} | awk '{print substr($0,17)}'`" ;; + --cflags=*) flags="$flags `echo ${1} | awk '{print substr($0,10)}'`" ;; @@ -322,16 +334,22 @@ if [ -n "$librarypath" ] ; then echo "POCO_ADD_LIBRARY = $librarypath" >>$build/config.make fi if [ -n "$odbclib" ] ; then - echo "POCO_ODBC_LIB = $odbclib" >>$build/config.make + echo "POCO_ODBC_LIB = $odbclib" >>$build/config.make fi if [ -n "$odbcinclude" ] ; then - echo "POCO_ODBC_INCLUDE = $odbcinclude" >>$build/config.make + echo "POCO_ODBC_INCLUDE = $odbcinclude" >>$build/config.make fi if [ -n "$mysqllib" ] ; then - echo "POCO_MYSQL_LIB = $mysqllib" >>$build/config.make + echo "POCO_MYSQL_LIB = $mysqllib" >>$build/config.make fi if [ -n "$mysqlinclude" ] ; then - echo "POCO_MYSQL_INCLUDE = $mysqlinclude" >>$build/config.make + echo "POCO_MYSQL_INCLUDE = $mysqlinclude" >>$build/config.make +fi +if [ -n "$pgsqllib" ] ; then + echo "POCO_PGSQL_LIB = $pgsqllib" >>$build/config.make +fi +if [ -n "$pgsqlinclude" ] ; then + echo "POCO_PGSQL_INCLUDE = $pgsqlinclude" >>$build/config.make fi if [ -n "$unbundled" ] ; then echo "POCO_UNBUNDLED = 1" >>$build/config.make @@ -360,10 +378,22 @@ if [ -n "$librarypath" ] ; then echo "export POCO_ADD_LIBRARY" >>$build/config.make fi if [ -n "$odbclib" ] ; then - echo "export POCO_ODBC_LIB" >>$build/config.make + echo "export POCO_ODBC_LIB" >>$build/config.make fi if [ -n "$odbcinclude" ] ; then - echo "export POCO_ODBC_INCLUDE" >>$build/config.make + echo "export POCO_ODBC_INCLUDE" >>$build/config.make +fi +if [ -n "$mysqllib" ] ; then + echo "export POCO_MYSQL_LIB" >>$build/config.make +fi +if [ -n "$mysqlinclude" ] ; then + echo "export POCO_MYSQL_INCLUDE" >>$build/config.make +fi +if [ -n "$pgsqllib" ] ; then + echo "export POCO_PGSQL_LIB" >>$build/config.make +fi +if [ -n "$pgsqlinclude" ] ; then + echo "export POCO_PGSQL_INCLUDE" >>$build/config.make fi if [ -n "$unbundled" ] ; then echo "export POCO_UNBUNDLED" >>$build/config.make