mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 07:37:03 +00:00
[10772] Fixed build for different PostgreSQL version at diff platforms.
* Fixed Problem in different place define OID enums. Enums hardcoded in mangos code now as done for many other projects using PostgreSQL * Other PostgreSQL detection fixes. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
1b1d5c1001
commit
06b382abb9
4 changed files with 110 additions and 12 deletions
73
configure.ac
73
configure.ac
|
|
@ -106,7 +106,13 @@ AC_ARG_WITH(postgresql,
|
|||
yes) DO_POSTGRESQL=yes ;;
|
||||
no) DO_POSTGRESQL=no ;;
|
||||
maybe) DO_POSTGRESQL=maybe ;;
|
||||
*) AC_MSG_ERROR(Bad value ${withval} for --with-postgresql) ;;
|
||||
*)
|
||||
if test ! -x "${withval}" ; then
|
||||
AC_MSG_ERROR([${withval} is not a executable file])
|
||||
fi
|
||||
POSTGRE_CONFIG_HOME="${withval}"
|
||||
DO_POSTGRESQL=yes
|
||||
;;
|
||||
esac],
|
||||
[DO_POSTGRESQL=no])
|
||||
|
||||
|
|
@ -121,14 +127,64 @@ AC_ARG_WITH(mysql,
|
|||
[DO_MYSQL=yes])
|
||||
|
||||
# here Postgre
|
||||
AC_MSG_CHECKING(whether to build/link POSTGRESQL)
|
||||
if test "x$DO_POSTGRESQL" = "xyes"; then
|
||||
DO_MYSQL=no
|
||||
POSTGRE_INCLUDES="-I/usr/include/postgresql $POSTGRE_INCLUDES"
|
||||
POSTGRE_LIBS="-L/usr/lib/postresql -lpq -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib $OPENSSL_LIBS $POSTGRE_LIBS "
|
||||
CXXFLAGS="-DDO_POSTGRESQL $CXXFLAGS"
|
||||
case "$DO_POSTGRESQL" in
|
||||
yes|maybe)
|
||||
|
||||
if test -z "$POSTGRE_CONFIG_HOME"; then
|
||||
AC_PATH_PROG([POSTGRE_CONFIG_HOME], [pg_config], [no])
|
||||
fi
|
||||
AC_MSG_RESULT($DO_POSTGRESQL)
|
||||
|
||||
if test "$POSTGRE_CONFIG_HOME" != "no" ; then
|
||||
POSTGRE_VERSION="`$POSTGRE_CONFIG_HOME --version`"
|
||||
POSTGRE_LIBS="-L`$POSTGRE_CONFIG_HOME --libdir` `$POSTGRE_CONFIG_HOME --libs` -lpq $OPENSSL_LIBS $POSTGRE_LIBS"
|
||||
POSTGRE_INCLUDES="-I`$POSTGRE_CONFIG_HOME --includedir` $POSTGRE_INCLUDES"
|
||||
else
|
||||
POSTGRE_VERSION="unknown"
|
||||
POSTGRE_LIBS="-L/usr/lib/postgresql/lib -lpq -lz -lpthread -lcrypt -lnsl -lm $OPENSSL_LIBS $POSTGRE_LIBS"
|
||||
POSTGRE_INCLUDES="-I/usr/include/postgresql $POSTGRE_INCLUDES"
|
||||
fi
|
||||
|
||||
POSTGRESQL_OLD_LIBS="$LIBS" ; LIBS="$LIBS ${POSTGRE_LIBS}"
|
||||
POSTGRESQL_OLD_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS ${POSTGRE_INCLUDES}"
|
||||
AC_CHECK_LIB([pq], [PQsetdbLogin], [HAVE_POSTGRESQL="yes"], [])
|
||||
AC_CHECK_HEADER([libpq-fe.h], [], [HAVE_POSTGRESQL="yes"], [])
|
||||
|
||||
AC_MSG_CHECKING(whether to build/link POSTGRESQL)
|
||||
if test "${HAVE_POSTGRESQL}" != "yes" ; then
|
||||
AC_MSG_RESULT([no])
|
||||
if test "${DO_POSTGRESQL}" = "yes" ; then
|
||||
AC_MSG_ERROR([PostgreSQL not found or incompatible (requested)])
|
||||
else
|
||||
AC_MSG_NOTICE([disabling PostgreSQL (optional)])
|
||||
POSTGRE_VERSION=""
|
||||
POSTGRE_INCLUDES=""
|
||||
POSTGRE_LIBS=""
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT([yes ($POSTGRE_VERSION)])
|
||||
fi
|
||||
AC_MSG_CHECKING([PostgreSQL libs is a thread-safe])
|
||||
AC_RUN_IFELSE([
|
||||
AC_LANG_SOURCE(
|
||||
[[
|
||||
#include <libpq-fe.h>
|
||||
int main() {
|
||||
return !PQisthreadsafe();
|
||||
}
|
||||
]])
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([postgre libs is not thread-safe, check your postgresql installation and /etc/ld.config*])
|
||||
])
|
||||
CPPFLAGS="${POSTGRESQL_OLD_CPPFLAGS}"
|
||||
LIBS="${POSTGRESQL_OLD_LIBS}"
|
||||
CXXFLAGS="-DDO_POSTGRESQL $CXXFLAGS"
|
||||
;;
|
||||
esac
|
||||
|
||||
# here mysql
|
||||
AC_MSG_CHECKING(whether to build/link MYSQL)
|
||||
|
|
@ -201,7 +257,6 @@ AC_CHECK_HEADERS([ arpa/inet.h fcntl.h limits.h locale.h malloc.h netdb.h netine
|
|||
|
||||
AC_CHECK_HEADERS([pthread.h])
|
||||
AC_CHECK_HEADERS([mysql.h mysql/mysql.h])
|
||||
AC_CHECK_HEADERS([libpq-fe.h])
|
||||
AC_CHECK_HEADERS([zlib.h])
|
||||
|
||||
## Check for typedefs, structures, and compiler characteristics.
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ bool DatabasePostgre::Initialize(const char *infoString)
|
|||
sLog.outError( "Could not connect to Postgre database at %s: %s",
|
||||
host.c_str(), PQerrorMessage(mPGconn));
|
||||
PQfinish(mPGconn);
|
||||
mPGconn = NULL;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -25,8 +25,50 @@
|
|||
#include <postgre/libpq-fe.h>
|
||||
#include <postgre/pg_type.h>
|
||||
#else
|
||||
// Define OID's from pg_type.h in postgresql server includes.
|
||||
#define BOOLOID 16
|
||||
#define BYTEAOID 17
|
||||
#define CHAROID 18
|
||||
#define NAMEOID 19
|
||||
#define INT8OID 20
|
||||
#define INT2OID 21
|
||||
#define INT2VECTOROID 22
|
||||
#define INT4OID 23
|
||||
#define REGPROCOID 24
|
||||
#define TEXTOID 25
|
||||
#define OIDOID 26
|
||||
#define TIDOID 27
|
||||
#define XIDOID 28
|
||||
#define CIDOID 29
|
||||
#define OIDVECTOROID 30
|
||||
#define POINTOID 600
|
||||
#define LSEGOID 601
|
||||
#define PATHOID 602
|
||||
#define BOXOID 603
|
||||
#define POLYGONOID 604
|
||||
#define LINEOID 628
|
||||
#define FLOAT4OID 700
|
||||
#define FLOAT8OID 701
|
||||
#define ABSTIMEOID 702
|
||||
#define RELTIMEOID 703
|
||||
#define TINTERVALOID 704
|
||||
#define UNKNOWNOID 705
|
||||
#define CIRCLEOID 718
|
||||
#define CASHOID 790
|
||||
#define INETOID 869
|
||||
#define CIDROID 650
|
||||
#define BPCHAROID 1042
|
||||
#define VARCHAROID 1043
|
||||
#define DATEOID 1082
|
||||
#define TIMEOID 1083
|
||||
#define TIMESTAMPOID 1114
|
||||
#define TIMESTAMPTZOID 1184
|
||||
#define INTERVALOID 1186
|
||||
#define TIMETZOID 1266
|
||||
#define BITOID 1560
|
||||
#define VARBITOID 1562
|
||||
#define NUMERICOID 1700
|
||||
#include <libpq-fe.h>
|
||||
//#include <pg_type.h>
|
||||
#endif
|
||||
|
||||
class QueryResultPostgre : public QueryResult
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10771"
|
||||
#define REVISION_NR "10772"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue