From: Olivier Courtin Date: Mon, 23 Nov 2009 14:26:45 +0000 (+0000) Subject: Add libxml2 version information in postgis_full_version. Add libxml2 support informat... X-Git-Tag: 1.5.0b1~192 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d1f3fe6f0566b85af544a7ef9d05b0656433a6fb;p=postgis Add libxml2 version information in postgis_full_version. Add libxml2 support information in postgis_version. Add new postgis_libxml_version function. Add doc entry for this new function. git-svn-id: http://svn.osgeo.org/postgis/trunk@4885 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/configure.ac b/configure.ac index b79cd1847..b49c088d4 100644 --- a/configure.ac +++ b/configure.ac @@ -371,7 +371,7 @@ if test "$FOUND_LIBXML2" = "1"; then XML2_CPPFLAGS=`$XML2CONFIG --cflags` dnl Extract the version - XML2_VERSION=`$XML2CONFIG --version` + POSTGIS_LIBXML2_VERSION=`$XML2CONFIG --version` dnl Check headers file CPPFLAGS_SAVE="$CPPFLAGS" @@ -388,6 +388,9 @@ if test "$FOUND_LIBXML2" = "1"; then AC_DEFINE_UNQUOTED([HAVE_LIBXML2], [$HAVE_LIBXML2], [libxml/tree.h libxml/parser.h libxml/xpath.h libxml/xpathInternals.h header]) AC_SUBST([HAVE_LIBXML2]) + + AC_DEFINE_UNQUOTED([POSTGIS_LIBXML2_VERSION], ["$POSTGIS_LIBXML2_VERSION"], [PostGIS libxml2 version]) + AC_SUBST([POSTGIS_LIBXML2_VERSION]) fi @@ -570,6 +573,10 @@ dnl Define version macros dnl POSTGIS_VERSION="$POSTGIS_MAJOR_VERSION.$POSTGIS_MINOR_VERSION USE_GEOS=1 USE_PROJ=1 USE_STATS=1" +if test "$HAVE_LIBXML2" = "1"; then + POSTGIS_VERSION="$POSTGIS_VERSION USE_LIBXML2=1" +fi + POSTGIS_LIB_VERSION="$POSTGIS_MAJOR_VERSION.$POSTGIS_MINOR_VERSION.$POSTGIS_MICRO_VERSION" POSTGIS_BUILD_DATE=`date -u "+%Y-%m-%d %H:%M:%S"` POSTGIS_SCRIPTS_SVNREV=`perl utils/read_scripts_version.pl` @@ -625,7 +632,7 @@ AC_MSG_RESULT([ PostgreSQL config: ${PGCONFIG}]) AC_MSG_RESULT([ PostgreSQL version: ${PGSQL_MAJOR_VERSION}.${PGSQL_MINOR_VERSION}]) AC_MSG_RESULT([ PROJ4 version: ${POSTGIS_PROJ_VERSION}]) AC_MSG_RESULT([ Libxml2 config: ${XML2CONFIG}]) -AC_MSG_RESULT([ Libxml2 version: ${XML2_VERSION}]) +AC_MSG_RESULT([ Libxml2 version: ${POSTGIS_LIBXML2_VERSION}]) AC_MSG_RESULT([ PostGIS debug level: ${POSTGIS_DEBUG_LEVEL}]) AC_MSG_RESULT() AC_MSG_RESULT([ -------- Documentation Generation -------- ]) diff --git a/doc/reference_management.xml b/doc/reference_management.xml index c5a1b2c5f..1c44c1a95 100644 --- a/doc/reference_management.xml +++ b/doc/reference_management.xml @@ -331,6 +331,7 @@ the_geom IS NULL) , , , , @@ -376,11 +377,58 @@ the_geom IS NULL) , , , , + + + PostGIS_LibXML_Version + + Returns the version number of the libxml2 + library. + + + + + + text PostGIS_LibXML_Version + + + + + + + + Description + + Returns the version number of the LibXML2 library, or + NULL if LibXML2 support is not enabled. + + + + Examples + + SELECT PostGIS_LibXML_Version(); + postgis_libxml_version +---------------------- + 2.7.6 +(1 row) + + + + See Also + + , , , , + + + PostGIS_Lib_Build_Date @@ -454,6 +502,7 @@ the_geom IS NULL) , , , , @@ -500,6 +549,7 @@ the_geom IS NULL) , , , , @@ -545,6 +595,7 @@ the_geom IS NULL) , , , , @@ -733,6 +784,7 @@ the_geom IS NULL) , ,, , diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c index 63d7bc822..bb8ee4236 100644 --- a/postgis/lwgeom_functions_basic.c +++ b/postgis/lwgeom_functions_basic.c @@ -38,6 +38,7 @@ Datum postgis_autocache_bbox(PG_FUNCTION_ARGS); Datum postgis_scripts_released(PG_FUNCTION_ARGS); Datum postgis_version(PG_FUNCTION_ARGS); Datum postgis_lib_version(PG_FUNCTION_ARGS); +Datum postgis_libxml_version(PG_FUNCTION_ARGS); Datum postgis_lib_build_date(PG_FUNCTION_ARGS); Datum LWGEOM_length2d_linestring(PG_FUNCTION_ARGS); Datum LWGEOM_length_linestring(PG_FUNCTION_ARGS); @@ -193,6 +194,25 @@ Datum postgis_autocache_bbox(PG_FUNCTION_ARGS) } +PG_FUNCTION_INFO_V1(postgis_libxml_version); +Datum postgis_libxml_version(PG_FUNCTION_ARGS) +{ +#if HAVE_LIBXML2 + char *ver = POSTGIS_LIBXML2_VERSION; + text *result; + result = lwalloc(VARHDRSZ + strlen(ver)); + SET_VARSIZE(result, VARHDRSZ + strlen(ver)); + memcpy(VARDATA(result), ver, strlen(ver)); + PG_RETURN_POINTER(result); +#else + PG_RETURN_NULL(); +#endif +} + + + + + /** * Recursively count points in a SERIALIZED lwgeom */ @@ -3470,4 +3490,4 @@ Datum ST_CollectionExtract(PG_FUNCTION_ARGS) lwgeom_free(lwgeom); PG_RETURN_POINTER(output); -} \ No newline at end of file +} diff --git a/postgis/postgis.sql.in.c b/postgis/postgis.sql.in.c index 05dc8f372..74ef91e3f 100644 --- a/postgis/postgis.sql.in.c +++ b/postgis/postgis.sql.in.c @@ -3407,6 +3407,10 @@ CREATE OR REPLACE FUNCTION postgis_geos_version() RETURNS text AS 'MODULE_PATHNAME' LANGUAGE 'C' IMMUTABLE; +CREATE OR REPLACE FUNCTION postgis_libxml_version() RETURNS text + AS 'MODULE_PATHNAME' + LANGUAGE 'C' IMMUTABLE; + CREATE OR REPLACE FUNCTION postgis_scripts_build_date() RETURNS text AS _POSTGIS_SQL_SELECT_POSTGIS_BUILD_DATE LANGUAGE 'sql' IMMUTABLE; @@ -3423,6 +3427,7 @@ DECLARE libver text; projver text; geosver text; + libxmlver text; usestats bool; dbproc text; relproc text; @@ -3431,6 +3436,9 @@ BEGIN SELECT postgis_lib_version() INTO libver; SELECT postgis_proj_version() INTO projver; SELECT postgis_geos_version() INTO geosver; +#if HAVE_LIBXML2 + SELECT postgis_libxml_version() INTO libxmlver; +#endif SELECT postgis_uses_stats() INTO usestats; SELECT postgis_scripts_installed() INTO dbproc; SELECT postgis_scripts_released() INTO relproc; @@ -3445,6 +3453,10 @@ BEGIN fullver = fullver || ' PROJ="' || projver || '"'; END IF; + IF libxmlver IS NOT NULL THEN + fullver = fullver || ' LIBXML="' || libxmlver || '"'; + END IF; + IF usestats THEN fullver = fullver || ' USE_STATS'; END IF; @@ -6273,4 +6285,4 @@ CREATE OR REPLACE FUNCTION ST_MinimumBoundingCircle(geometry) LANGUAGE 'sql' IMMUTABLE STRICT; COMMIT; -#include "postgis_drop.sql.in.c" \ No newline at end of file +#include "postgis_drop.sql.in.c" diff --git a/postgis/sqldefines.h.in b/postgis/sqldefines.h.in index 4cad91d5d..07fc95364 100644 --- a/postgis/sqldefines.h.in +++ b/postgis/sqldefines.h.in @@ -8,6 +8,7 @@ #define POSTGIS_GEOS_VERSION @POSTGIS_GEOS_VERSION@ #define POSTGIS_PROJ_VERSION @POSTGIS_PROJ_VERSION@ #define POSTGIS_LIB_VERSION @POSTGIS_LIB_VERSION@ +#define POSTGIS_LIBXML2_VERSION @POSTGIS_LIBXML2_VERSION@ /* * Define the build date and the version number diff --git a/postgis_config.h.in b/postgis_config.h.in index 93cbab664..b0de37400 100644 --- a/postgis_config.h.in +++ b/postgis_config.h.in @@ -64,6 +64,9 @@ /* libxml/tree.h libxml/parser.h header */ #undef HAVE_LIBXML2 +/* PostGIS libxml2 version */ +#undef POSTGIS_LIBXML2_VERSION + /* PostGIS library version */ #undef POSTGIS_LIB_VERSION