Implement --with-sytem-postgreql and --with-libq-path; cleanup unused #define

This commit is contained in:
Lionel Elie Mamane
2011-11-17 23:17:21 +01:00
parent 412e178a40
commit 7bab4645ce
4 changed files with 54 additions and 36 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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<

View File

@@ -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" );