diff options
-rw-r--r-- | configure.in | 52 | ||||
-rw-r--r-- | connectivity/source/drivers/postgresql/makefile.mk | 28 | ||||
-rw-r--r-- | connectivity/source/drivers/postgresql/pq_driver.hxx | 8 | ||||
-rwxr-xr-x | set_soenv.in | 2 |
4 files changed, 54 insertions, 36 deletions
diff --git a/configure.in b/configure.in index a628175e27e0..99566667b837 100644 --- a/configure.in +++ b/configure.in @@ -1090,7 +1090,8 @@ AC_ARG_WITH(lucene-analyzers-jar, AC_ARG_WITH(system-mysql, AS_HELP_STRING([--with-system-mysql], [Use MySQL libraries already on system, for building the MySQL Connector/LibreOffice - extension. Requires MYSQLCONFIG to point to the mysql_config executable.]),, + extension. If the the mysql_config executable is not in PATH, use MYSQLCONFIG to + point to it.]),, [with_system_mysql="$with_system_libs"]) AC_ARG_WITH(libmysql-path, @@ -1108,6 +1109,22 @@ AC_ARG_WITH(system-mysql-cppconn, [Use MySQL C++ Connector libraries already on system.]),, [with_system_mysql_cppconn="$with_system_libs"]) +AC_ARG_WITH(system-postgresql, + AS_HELP_STRING([--with-system-postgresql], + [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC + extension. If pg_config is not in PATH, use PGCONFIG to point to it.]),, + [with_system_postgresql="$with_system_libs"]) + +AC_ARG_WITH(libpq-path, + AS_HELP_STRING([--with-libpq-path], + [Use this PostgreSQL C interface (libpq) installation for building + the PostgreSQL-SDBC extension.]) + [ + Usage: --with-libpq-path=<absolute path to + your libq installation> + ], +,) + AC_ARG_WITH(system-hsqldb, AS_HELP_STRING([--with-system-hsqldb], [Use hsqldb already on system.]),, @@ -5218,7 +5235,7 @@ if test "$ENABLE_MYSQLC" = "YES"; then dnl =================================================================== dnl Check for system MySQL dnl =================================================================== - AC_MSG_CHECKING([for mysql pre-requisites]) + AC_MSG_CHECKING([for MySQL prerequisites]) if test "$with_system_mysql" = "yes"; then AC_MSG_RESULT([external MySQL]) SYSTEM_MYSQL=YES @@ -5365,23 +5382,44 @@ dnl Check for PostgreSQL stuff dnl =================================================================== if test "x$enable_ext_postgresql_sdbc" = "xyes"; then - AC_PATH_PROG(PGCONFIG, pg_config) - if test -z "$PGCONFIG"; then - AC_MSG_ERROR([pg_config needed]) + AC_MSG_CHECKING([for PostgreSQL prerequisites]) + if test "$with_system_postgresql" = "yes"; then + AC_MSG_RESULT([external PostgreSQL]) + SYSTEM_POSTGRESQL=YES + AC_PATH_PROG(PGCONFIG, pg_config) + if test -z "$PGCONFIG"; then + AC_MSG_ERROR([pg_config needed; set PGCONFIG if not in PATH]) + fi + POSTGRESQL_INC=-I$(pg_config --includedir) + POSTGRESQL_LIB="-L$(pg_config --libdir) -lpq" + else + SYSTEM_POSTGRESQL=NO + if test -n "$with_libpq_path"; then + AC_MSG_RESULT([external libpq]) + POSTGRESQL_LIB="-L${with_libpq_path}/lib/ -lpq" + POSTGRESQL_INC=-I"${with_libpq_path}/include/" + else + AC_MSG_ERROR([not given. Please specify either --with-system-postgresql or --with-libpq-path]) + fi fi + AC_MSG_CHECKING([for PostgreSQL C interface]) save_CFLAGS=$CFLAGS + save_CPPFLAGS=$CPPFLAGS save_LIBS=$LIBS - CFLAGS="-I`pg_config --includedir`" + CPPFLAGS="${POSTGRESQL_INC}" + LIBS="${POSTGRESQL_LIB}" AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], []) AC_CHECK_LIB(pq, PQconnectdbParams, [], [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], []) CFLAGS=$save_CFLAGS + CPPFLAGS=$save_CPPFLAGS LIBS=$save_LIBS BUILD_POSTGRESQL_SDBC=YES - SYSTEM_POSTGRESQL=YES # only option atm :-) fi AC_SUBST(BUILD_POSTGRESQL_SDBC) AC_SUBST(SYSTEM_POSTGRESQL) +AC_SUBST(POSTGRESQL_INC) +AC_SUBST(POSTGRESQL_LIB) dnl =================================================================== dnl Check for system beanshell diff --git a/connectivity/source/drivers/postgresql/makefile.mk b/connectivity/source/drivers/postgresql/makefile.mk index 8c8c022f3444..8b026892be1b 100644 --- a/connectivity/source/drivers/postgresql/makefile.mk +++ b/connectivity/source/drivers/postgresql/makefile.mk @@ -39,9 +39,6 @@ NO_DEFAULT_STL=TRUE .IF "$(BUILD_POSTGRESQL_SDBC)" == "YES" -.IF "$(SYSTEM_POSTGRESQL)" != "YES" -.INCLUDE : $(SOLARINCDIR)$/postgresql/postgresql-version.mk -.ENDIF #------------------------------------------------------------------- # uno component naming scheme @@ -51,22 +48,8 @@ PQ_SDBC_MAJOR=0 PQ_SDBC_MINOR=8 PQ_SDBC_MICRO=1 PQ_SDBC_VERSION=$(PQ_SDBC_MAJOR).$(PQ_SDBC_MINOR).$(PQ_SDBC_MICRO) -.IF "$(SYSTEM_POSTGRESQL)" == "YES" -POSTGRESQL_MAJOR:=$(shell @pg_config --version | awk '{ print $$2 }' | cut -d. -f1) -POSTGRESQL_MINOR:=$(shell @pg_config --version | awk '{ print $$2 }' | cut -d. -f2) -POSTGRESQL_MICRO:=$(shell @pg_config --version | awk '{ print $$2 }' | cut -d. -f3) -.ENDIF - -.IF "$(SYSTEM_POSTGRESQL)" != "YES" -POSTGRESQL_INCLUDES=-I$(SOLARINCDIR)$/postgresql -.ELSE -POSTGRESQL_INCLUDES:=-I$(shell @pg_config --includedir) -.ENDIF -CFLAGS+=$(POSTGRESQL_INCLUDES) \ - -DPOSTGRESQL_MAJOR=$(POSTGRESQL_MAJOR) \ - -DPOSTGRESQL_MINOR=$(POSTGRESQL_MINOR) \ - -DPOSTGRESQL_MICRO=$(POSTGRESQL_MICRO) \ +CFLAGS+=$(POSTGRESQL_INC) \ -DPQ_SDBC_MAJOR=$(PQ_SDBC_MAJOR) \ -DPQ_SDBC_MINOR=$(PQ_SDBC_MINOR) \ -DPQ_SDBC_MICRO=$(PQ_SDBC_MICRO) @@ -87,10 +70,13 @@ DEF1NAME= $(SHL1TARGET) SHL1VERSIONMAP=$(SOLARENV)$/src$/reg-component.map # use the static version +# LEM 17/11/2011: removed everything except libpq proper; +# as per instructions in libpq documentation. +# If it turns out the rest was needed, reenable it. .IF "$(GUI)"=="WNT" -PQLIB=libpq.lib wsock32.lib advapi32.lib +POSTGRESQL_LIB=libpq.lib #wsock32.lib advapi32.lib .ELSE -PQLIB=-lpq -lcrypt +POSTGRESQL_LIB=-lpq #-lcrypt .ENDIF SHL2TARGET=postgresql-sdbc-impl.uno LIB2TARGET=$(SLB)$/$(SHL2TARGET).lib @@ -134,7 +120,7 @@ SHL2STDLIBS= \ $(CPPUHELPERLIB) \ $(SALLIB) \ $(SALHELPERLIB) \ - $(PQLIB) + $(POSTGRESQL_LIB) SHL2LIBS= $(LIB2TARGET) SHL2DEF= $(MISC)$/$(SHL2TARGET).def diff --git a/connectivity/source/drivers/postgresql/pq_driver.hxx b/connectivity/source/drivers/postgresql/pq_driver.hxx index e0a95ecfae84..99ef233f37f1 100644 --- a/connectivity/source/drivers/postgresql/pq_driver.hxx +++ b/connectivity/source/drivers/postgresql/pq_driver.hxx @@ -49,14 +49,6 @@ namespace pq_sdbc_driver MY_STRINGIFY(PQ_SDBC_MINOR) "." \ MY_STRINGIFY(PQ_SDBC_MICRO) -#define POSTGRES_MAJOR 7 -#define POSTGRES_MINOR 3 -#define POSTGRES_MICRO 2 -#define POSTGRESQL_VERSION MY_STRINGIFY(POSTGRESQL_MAJOR) "." \ - MY_STRINGIFY(POSTGRESQL_MINOR) "." \ - MY_STRINGIFY(POSTGRESQL_MICRO) - - struct MutexHolder { osl::Mutex m_mutex; }; // use this to switch off sdbc support ! // typedef cppu::WeakComponentImplHelper2< diff --git a/set_soenv.in b/set_soenv.in index 78bc7040d6e7..7a265ebb4015 100755 --- a/set_soenv.in +++ b/set_soenv.in @@ -2004,6 +2004,8 @@ ToFile( "REDLAND_CFLAGS", "@REDLAND_CFLAGS@", "e" ); ToFile( "REDLAND_LIBS", "@REDLAND_LIBS@", "e" ); ToFile( "BUILD_POSTGRESQL_SDBC", "@BUILD_POSTGRESQL_SDBC@", "e" ); ToFile( "SYSTEM_POSTGRESQL", "@SYSTEM_POSTGRESQL@", "e" ); +ToFile( "POSTGRESQL_INC", "@POSTGRESQL_INC@", "e" ); +ToFile( "POSTGRESQL_LIB", "@POSTGRESQL_LIB@", "e" ); ToFile( "SYSTEM_HUNSPELL", "@SYSTEM_HUNSPELL@", "e" ); ToFile( "HUNSPELL_CFLAGS", "@HUNSPELL_CFLAGS@", "e" ); ToFile( "HUNSPELL_LIBS", "@HUNSPELL_LIBS@", "e" ); |