Skip to content

Commit

Permalink
Adding check for postgres >= 9.6 IOT support parallel functions
Browse files Browse the repository at this point in the history
  • Loading branch information
tsl-karlp committed Jun 15, 2018
1 parent 690cf05 commit 5ec05a7
Show file tree
Hide file tree
Showing 3 changed files with 199 additions and 97 deletions.
133 changes: 114 additions & 19 deletions configure.ac
Expand Up @@ -44,37 +44,37 @@ if test "x${GITCMD}" = "xyes" -a "x${DOTGITDIR}" = "xyes"; then
else
GIT_COMMIT_HASH=
fi
POINTCLOUD_VERSION="$(cat Version.config)$GIT_COMMIT_HASH"
POINTCLOUD_VERSION="$(cat Version.config)"
AC_SUBST([POINTCLOUD_VERSION])
AC_DEFINE_UNQUOTED([POINTCLOUD_VERSION], ["$POINTCLOUD_VERSION"], [Pointcloud version])

dnl ===========================================================================
dnl Detect ZLib if it is installed
dnl Detect ZLib if it is installed
dnl ===========================================================================

ZLIB_LDFLAGS=""
AC_CHECK_HEADER([zlib.h], [
ZLIB_CPPFLAGS="$CPPFLAGS"
AC_CHECK_LIB([z],
[inflate],
[ZLIB_LDFLAGS="$LDFLAGS -lz"],
AC_CHECK_LIB([z],
[inflate],
[ZLIB_LDFLAGS="$LDFLAGS -lz"],
[AC_MSG_ERROR([could not locate zlib])]
)
],
[
AC_MSG_ERROR([could not locate zlib])
])

AC_SUBST([ZLIB_CPPFLAGS])
AC_SUBST([ZLIB_LDFLAGS])


dnl ===========================================================================
dnl Detect CUnit if it is installed
dnl Detect CUnit if it is installed
dnl ===========================================================================

AC_ARG_WITH([cunit],
[AS_HELP_STRING([--with-cunit=DIR], [specify the base cunit install directory])],
AC_ARG_WITH([cunit],
[AS_HELP_STRING([--with-cunit=DIR], [specify the base cunit install directory])],
[CUNITDIR="$withval"], [CUNITDIR=""])

if test "x$CUNITDIR" = "xyes"; then
Expand All @@ -85,7 +85,7 @@ if test "x$CUNITDIR" != "x"; then

dnl CUNITDIR was specified, so let's look there!

dnl Build the linker and include flags
dnl Build the linker and include flags
CUNIT_LDFLAGS="-L${CUNITDIR}/lib"
CUNIT_CPPFLAGS="-I${CUNITDIR}/include"

Expand All @@ -102,9 +102,9 @@ fi
dnl Run the header/link tests
AC_CHECK_HEADER([CUnit/CUnit.h], [
CUNIT_CPPFLAGS="$CPPFLAGS"
AC_CHECK_LIB([cunit],
[CU_initialize_registry],
[CUNIT_LDFLAGS="$LDFLAGS -lcunit" FOUND_CUNIT="YES"],
AC_CHECK_LIB([cunit],
[CU_initialize_registry],
[CUNIT_LDFLAGS="$LDFLAGS -lcunit" FOUND_CUNIT="YES"],
[FOUND_CUNIT="NO"]
)
],
Expand Down Expand Up @@ -181,9 +181,9 @@ AC_SUBST([PGXS])

dnl Extract the version information from pg_config
dnl Note: we extract the major & minor separately, ensure they are numeric, and then combine to give
dnl the final version. This is to guard against user error...
PGSQL_MAJOR_VERSION=`$PG_CONFIG --version | sed 's/[[A-Za-z ]]*//' | cut -d. -f1 | sed 's/[[^0-9]]//g'`
PGSQL_MINOR_VERSION=`$PG_CONFIG --version | sed 's/[[A-Za-z ]]*//' | cut -d. -f2 | sed 's/[[^0-9]]//g'`
dnl the final version. This is to guard against user error...
PGSQL_MAJOR_VERSION=`$PG_CONFIG --version | sed 's/[[A-Za-z ]]*//' | cut -d. -f1 | sed 's/[[^0-9]]//g'`
PGSQL_MINOR_VERSION=`$PG_CONFIG --version | sed 's/[[A-Za-z ]]*//' | cut -d. -f2 | sed 's/[[^0-9]]//g'`
PGSQL_FULL_VERSION=`$PG_CONFIG --version`
PGSQL_VERSION="$PGSQL_MAJOR_VERSION$PGSQL_MINOR_VERSION"

Expand All @@ -195,7 +195,7 @@ AC_MSG_RESULT([checking PostgreSQL version... $PGSQL_FULL_VERSION])
dnl Ensure that we are using PostgreSQL >= 9.0
if test ! "$PGSQL_MAJOR_VERSION" -ge 9; then
AC_MSG_ERROR([PointCloud requires PostgreSQL >= 9.0])
fi
fi

dnl Extract the linker and include flags for the frontend (for programs that use libpq)
PGSQL_FE_LDFLAGS=-L`$PG_CONFIG --libdir`" -lpq"
Expand Down Expand Up @@ -278,6 +278,61 @@ AC_SUBST([LIBXML2_VERSION])
AC_SUBST([XML2_LDFLAGS])
AC_SUBST([XML2_CPPFLAGS])

dnl ===========================================================================
dnl Detect LibGHT
dnl ===========================================================================

AC_ARG_WITH([libght],
[AS_HELP_STRING([--with-libght=DIR], [specify the base libght installation directory])],
[GHTDIR="$withval"], [GHTDIR=""])

if test "x$GHTDIR" = "xyes"; then
AC_MSG_ERROR([you must specify a parameter to --with-libght, e.g. --with-libght=/opt/local])
fi

if test "x$GHTDIR" = "x"; then
dnl GHTDIR was not specified, so search in usual system places
AC_CHECK_HEADER([ght.h], [GHT_CPPFLAGS="$CPPFLAGS" FOUND_GHT_H="YES"], [FOUND_GHT_H="NO"])
AC_CHECK_LIB([ght], [ght_init], [GHT_LDFLAGS="-lght" FOUND_GHT_LIB="YES"], [FOUND_GHT_LIB="NO"])
elif test "x$GHTDIR" != "xno"; then
dnl GHTDIR was specified, so let's look there!


dnl Extract the linker and include flags
GHT_LDFLAGS="-L${GHTDIR}/lib -lght"
GHT_CPPFLAGS="-I${GHTDIR}/include"

dnl Check headers file
CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$GHT_CPPFLAGS $XML2_CPPFLAGS"

dnl Check libraries file
LIBS_SAVE="$LIBS"
LIBS="$GHT_LDFLAGS $XML2_LDFLAGS"

AC_CHECK_HEADER([ght.h], [FOUND_GHT_H="YES"], [FOUND_GHT_H="NO"])
AC_CHECK_LIB([ght], [ght_init], [FOUND_GHT_LIB="YES"], [FOUND_GHT_LIB="NO"])

dnl back to the originals
LIBS="${LIBS_SAVE}"
CPPFLAGS="${CPPFLAGS_SAVE}"
fi

if test "x$FOUND_GHT_H" = "xYES" -a "x$FOUND_GHT_LIB" = "xYES"; then
AC_DEFINE([HAVE_LIBGHT], [1], [Have libght])
GHT_STATUS="enabled"
if test $GHTDIR; then
GHT_STATUS="$GHTDIR"
fi
else
GHT_LDFLAGS=""
GHT_CPPFLAGS=""
GHT_STATUS="disabled"
fi

AC_SUBST([GHT_LDFLAGS])
AC_SUBST([GHT_CPPFLAGS])

dnl ===========================================================================
dnl Detect LazPerf
dnl ===========================================================================
Expand Down Expand Up @@ -325,6 +380,42 @@ fi
AC_SUBST([LAZPERF_STATUS])
AC_SUBST([LAZPERF_CPPFLAGS])


dnl ===========================================================================
dnl Figure out if we are postgres >= 9.6 and support PARALLEL


dnl Extract the version information from pg_config
dnl Note: we extract the major & minor separately, ensure they are numeric, and then combine to give
dnl the final version. This is to guard against user error...
PGSQL_FULL_VERSION=`"$PG_CONFIG" --version`

PGSQL_MAJOR_VERSION=`echo $PGSQL_FULL_VERSION | sed 's/[[^0-9]]*\([[0-9]]*\).*/\1/'`
PGSQL_MINOR_VERSION=`$PG_CONFIG --version | sed 's/[[^0-9]]*\([[0-9]]\)\.\([[0-9]]\).*/\2/'`

if test $PGSQL_MAJOR_VERSION -gt 9; then
dnl ==================================================================
dnl Starting with PostgreSQL 10, major is the new minor
dnl This is to prevent things like 10.31 ranking higher than 11.0
dnl===================================================================
PGSQL_MINOR_VERSION=0
fi


AC_MSG_RESULT([checking PostgreSQL version... $PGSQL_FULL_VERSION])

POSTGIS_PGSQL_VERSION="$PGSQL_MAJOR_VERSION$PGSQL_MINOR_VERSION"

HAVE_PARALLEL=
HAVE_PARALLEL_AGG=
if test $POSTGIS_PGSQL_VERSION -ge 96; then
HAVE_PARALLEL="PARALLEL SAFE"
HAVE_PARALLEL_AGG=", PARALLEL = safe"
fi
AC_SUBST([HAVE_PARALLEL])
AC_SUBST([HAVE_PARALLEL_AGG])


dnl ===========================================================================
dnl Figure out where this script is running

Expand All @@ -336,10 +427,13 @@ dnl ===========================================================================
dnl Output the relevant files
dnl ===========================================================================

AC_OUTPUT([
AC_CONFIG_FILES(pgsql/pointcloud.sql)


AC_OUTPUT([
config.mk
])

dnl ===========================================================================
dnl Display the configuration status information
dnl ===========================================================================
Expand All @@ -355,6 +449,7 @@ AC_MSG_RESULT([ PostgreSQL config: ${PG_CONFIG}])
AC_MSG_RESULT([ PostgreSQL version: ${PGSQL_FULL_VERSION}])
AC_MSG_RESULT([ Libxml2 config: ${XML2CONFIG}])
AC_MSG_RESULT([ Libxml2 version: ${LIBXML2_VERSION}])
AC_MSG_RESULT([ LibGHT status: ${GHT_STATUS}])
AC_MSG_RESULT([ LazPerf status: ${LAZPERF_STATUS}])
AC_MSG_RESULT([ CUnit status: ${CUNIT_STATUS}])
AC_MSG_RESULT()
4 changes: 2 additions & 2 deletions pgsql/Makefile
Expand Up @@ -45,8 +45,8 @@ $(EXTENSION).control: $(EXTENSION).control.in Makefile
$(SED) -e 's/@POINTCLOUD_VERSION@/$(EXTVERSION)/' \
-e 's/@POINTCLOUD_VERSION_MAJOR@/$(EXTVERSION_MAJOR)/' $< > $@

$(EXTENSION)--$(EXTVERSION).sql: $(EXTENSION).sql.in Makefile
$(SED) -e 's/@POINTCLOUD_VERSION@/$(EXTVERSION)/' $< > $@
$(EXTENSION)--$(EXTVERSION).sql: $(EXTENSION).sql Makefile
cat $< > $@

# NOTE: relies on PERL being defined by PGXS
$(EXTENSION)--%--$(EXTVERSION).sql: $(EXTENSION)--$(EXTVERSION).sql ../util/proc_upgrade.pl
Expand Down

0 comments on commit 5ec05a7

Please sign in to comment.