From: Olivier Courtin Date: Fri, 18 Dec 2009 19:08:20 +0000 (+0000) Subject: Libxml become mandatory. Cf #344. Modify configure step, remove all HAVE_LIBXML2... X-Git-Tag: 1.5.0b1~69 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1358086804fc69bbc041b052e47a5e0577faab98;p=postgis Libxml become mandatory. Cf #344. Modify configure step, remove all HAVE_LIBXML2 from code, sql and unit tests. Update documentation git-svn-id: http://svn.osgeo.org/postgis/trunk@5032 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/configure.ac b/configure.ac index 77f5860e4..1e2279997 100644 --- a/configure.ac +++ b/configure.ac @@ -353,7 +353,7 @@ AC_SUBST([POSTGIS_PGSQL_VERSION]) dnl =========================================================================== dnl Detect libxml2 if it is installed -dnl (needed to GeomFromGML function, but not required to PostGIS build) +dnl (needed to GeomFromGML and GeomFromKML functions) dnl =========================================================================== AC_ARG_WITH([xml2config], @@ -366,9 +366,7 @@ if test "x$XML2CONFIG" = "x"; then dnl If we couldn't find xml2-config, display a warning if test "x$XML2CONFIG" = "x"; then - AC_MSG_WARN([could not find xml2-config from libxml2, some imports functions will be deactivated]) - else - FOUND_LIBXML2=1 + AC_MSG_ERROR([could not find xml2-config from libxml2 within the current path. You may need to try re-running configure with a --with-xml2config parameter.]) fi else dnl XML2CONFIG was specified; display a message to the user @@ -377,49 +375,34 @@ else else if test -f $XML2CONFIG; then AC_MSG_RESULT([Using user-specified xml2-config file: $XML2CONFIG]) - FOUND_LIBXML2=1 else AC_MSG_ERROR([the user-specified xml2-config file $XML2CONFIG does not exist]) fi fi fi -dnl xml2-config founded, retrieve flags and version -if test "$FOUND_LIBXML2" = "1"; then - - dnl Extract the linker and include flags - XML2_LDFLAGS=`$XML2CONFIG --libs` - XML2_CPPFLAGS=`$XML2CONFIG --cflags` - dnl Extract the version - POSTGIS_LIBXML2_VERSION=`$XML2CONFIG --version` +dnl Extract the linker and include flags +XML2_LDFLAGS=`$XML2CONFIG --libs` +XML2_CPPFLAGS=`$XML2CONFIG --cflags` - dnl Check headers file - CPPFLAGS_SAVE="$CPPFLAGS" - CPPFLAGS="$XML2_CPPFLAGS" - AC_CHECK_HEADERS([libxml/tree.h libxml/parser.h libxml/xpath.h libxml/xpathInternals.h], - [HAVE_LIBXML2=1], - [AC_MSG_ERROR([could not find headers include related to libxml2])]) +dnl Extract the version +POSTGIS_LIBXML2_VERSION=`$XML2CONFIG --version` - dnl Ensure we can link against libxml2 - LIBS_SAVE="$LIBS" - LIBS="$XML2_LDFLAGS" - AC_CHECK_LIB([xml2], [xmlInitParser], [], [AC_MSG_ERROR([could not find libxml2])], []) +dnl Check headers file +CPPFLAGS_SAVE="$CPPFLAGS" +CPPFLAGS="$XML2_CPPFLAGS" +AC_CHECK_HEADERS([libxml/tree.h libxml/parser.h libxml/xpath.h libxml/xpathInternals.h], + [], [AC_MSG_ERROR([could not find headers include related to libxml2])]) - AC_DEFINE_UNQUOTED([HAVE_LIBXML2], [$HAVE_LIBXML2], - [libxml/tree.h libxml/parser.h libxml/xpath.h libxml/xpathInternals.h header]) - AC_SUBST([HAVE_LIBXML2]) +dnl Ensure we can link against libxml2 +LIBS_SAVE="$LIBS" +LIBS="$XML2_LDFLAGS" +AC_CHECK_LIB([xml2], [xmlInitParser], [], [AC_MSG_ERROR([could not find libxml2])], []) - AC_DEFINE_UNQUOTED([POSTGIS_LIBXML2_VERSION], ["$POSTGIS_LIBXML2_VERSION"], [PostGIS libxml2 version]) - AC_SUBST([POSTGIS_LIBXML2_VERSION]) -fi +AC_DEFINE_UNQUOTED([POSTGIS_LIBXML2_VERSION], ["$POSTGIS_LIBXML2_VERSION"], [PostGIS libxml2 version]) +AC_SUBST([POSTGIS_LIBXML2_VERSION]) -POSTGIS_HAVE_LIBXML2=0 -if test "x$HAVE_LIBXML2" = "x1"; then - POSTGIS_HAVE_LIBXML2=1 -fi -AC_DEFINE([POSTGIS_HAVE_LIBXML2]) -AC_SUBST([POSTGIS_HAVE_LIBXML2]) dnl =========================================================================== diff --git a/doc/reference_constructor.xml b/doc/reference_constructor.xml index a636505e8..8ade2d2c8 100644 --- a/doc/reference_constructor.xml +++ b/doc/reference_constructor.xml @@ -347,9 +347,6 @@ SELECT ST_GeomFromEWKT('CIRCULARSTRING(220268 150415 1,220227 150505 2,220227 15 Description Constructs a PostGIS ST_Geometry object from the OGC GML representation. - - Requires compilation with libxml2 2.5+ - ST_GeomFromGML works only for GML Geometry fragments. It throws an error if you try to use it on a whole GML document. OGC GML versions supported: @@ -367,7 +364,7 @@ SELECT ST_GeomFromEWKT('CIRCULARSTRING(220268 150415 1,220227 150505 2,220227 15 OGC GML standards, cf: http://www.opengeospatial.org/standards/gml: - Availability: 1.5 - requires libxml2 >= 2.5+ + Availability: 1.5 &Z_support; GML allow mixed dimensions (2D and 3D inside the same MultiGeometry for instance). As PostGIS geometries don't, ST_GeomFromGML convert the whole geometry to 2D if a missing Z dimension is found once. @@ -433,9 +430,6 @@ SELECT ST_GeomFromEWKT('CIRCULARSTRING(220268 150415 1,220227 150505 2,220227 15 Description Constructs a PostGIS ST_Geometry object from the OGC KML representation. - - Requires compilation with libxml2 2.5+ - ST_GeomFromKML works only for KML Geometry fragments. It throws an error if you try to use it on a whole KML document. OGC KML versions supported: @@ -447,7 +441,7 @@ SELECT ST_GeomFromEWKT('CIRCULARSTRING(220268 150415 1,220227 150505 2,220227 15 OGC KML standards, cf: http://www.opengeospatial.org/standards/kml: - Availability: 1.5 - requires libxml2 >= 2.5+ + Availability: 1.5 &Z_support; ST_GeomFromKML function not support SQL/MM curves geometries. @@ -487,7 +481,7 @@ SELECT ST_GeomFromEWKT('CIRCULARSTRING(220268 150415 1,220227 150505 2,220227 15 Description &sqlmm_compliant; SQL-MM 3: 5.1.50 (except for curves support). - Availability: 1.5 - requires libxml2 >= 2.5+ + Availability: 1.5 See Also diff --git a/doc/reference_management.xml b/doc/reference_management.xml index 7ab33a053..acdacd5af 100644 --- a/doc/reference_management.xml +++ b/doc/reference_management.xml @@ -404,8 +404,7 @@ the_geom IS NULL) Description - Returns the version number of the LibXML2 library, or - NULL if LibXML2 support is not enabled. + Returns the version number of the LibXML2 library. Availability: 1.5 diff --git a/doc/release_notes.xml b/doc/release_notes.xml index 86c47344b..c20809d7e 100644 --- a/doc/release_notes.xml +++ b/doc/release_notes.xml @@ -18,7 +18,7 @@ The versions below are the *minimum* requirements for PostGIS 1.5 PostgreSQL 8.3 and higher on all platforms GEOS 3.0 and higher only (GEOS 3.2+ to take advantage of all features) - libxml2 2.5+ to enable ST_GeomFromGML/KML functionality + libxml2 2.5+ related to new ST_GeomFromGML/KML functionality PROJ4 4.5 and higher only diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c index 8ca3777f1..29e7a3d31 100644 --- a/postgis/lwgeom_functions_basic.c +++ b/postgis/lwgeom_functions_basic.c @@ -201,16 +201,12 @@ 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 } diff --git a/postgis/lwgeom_in_gml.c b/postgis/lwgeom_in_gml.c index 6573dfec5..920adce8c 100644 --- a/postgis/lwgeom_in_gml.c +++ b/postgis/lwgeom_in_gml.c @@ -39,7 +39,6 @@ #include "executor/spi.h" -#if HAVE_LIBXML2 #include #include #include @@ -1576,5 +1575,3 @@ static LWGEOM* parse_gml(xmlNodePtr xnode, bool *hasz, int *root_srid) lwerror("invalid GML representation"); return NULL; /* Never reach */ } - -#endif /* if HAVE_LIBXML2 */ diff --git a/postgis/lwgeom_in_kml.c b/postgis/lwgeom_in_kml.c index 70fc95aa7..06452e192 100644 --- a/postgis/lwgeom_in_kml.c +++ b/postgis/lwgeom_in_kml.c @@ -32,7 +32,6 @@ #include "liblwgeom.h" -#if HAVE_LIBXML2 #include #include @@ -466,5 +465,3 @@ static LWGEOM* parse_kml(xmlNodePtr xnode, bool *hasz) lwerror("invalid KML representation"); return NULL; /* Never reach */ } - -#endif /* if HAVE_LIBXML2 */ diff --git a/postgis/postgis.sql.in.c b/postgis/postgis.sql.in.c index cfa492435..8f5246ff5 100644 --- a/postgis/postgis.sql.in.c +++ b/postgis/postgis.sql.in.c @@ -3428,9 +3428,7 @@ 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; @@ -4503,7 +4501,6 @@ CREATE OR REPLACE FUNCTION ST_Equals(geometry,geometry) LANGUAGE 'SQL' IMMUTABLE STRICT; -#if HAVE_LIBXML2 ----------------------------------------------------------------------- -- GML & KML INPUT -- Availability: 1.5.0 @@ -4523,7 +4520,6 @@ CREATE OR REPLACE FUNCTION ST_GeomFromKML(text) AS 'MODULE_PATHNAME','geom_from_kml' LANGUAGE 'C' IMMUTABLE STRICT; -#endif ----------------------------------------------------------------------- -- SVG OUTPUT ----------------------------------------------------------------------- diff --git a/postgis/sqldefines.h.in b/postgis/sqldefines.h.in index af0be9349..1ca43fb34 100644 --- a/postgis/sqldefines.h.in +++ b/postgis/sqldefines.h.in @@ -19,9 +19,4 @@ #define _POSTGIS_SQL_SELECT_POSTGIS_BUILD_DATE 'SELECT ''@POSTGIS_BUILD_DATE@''::text AS version' #define _POSTGIS_SQL_SELECT_POSTGIS_SCRIPTS_VERSION 'SELECT ''@POSTGIS_SCRIPTS_VERSION@''::text AS version' -/* - * libxml2 support - */ -#define HAVE_LIBXML2 @POSTGIS_HAVE_LIBXML2@ - #endif /* _LWPGIS_DEFINES */ diff --git a/postgis/uninstall_postgis.sql.in.c b/postgis/uninstall_postgis.sql.in.c index 04a55866c..a71c3d662 100644 --- a/postgis/uninstall_postgis.sql.in.c +++ b/postgis/uninstall_postgis.sql.in.c @@ -249,12 +249,9 @@ DROP FUNCTION AsGML(geometry); DROP FUNCTION ST_AsGML(geometry, int4); DROP FUNCTION AsGML(geometry, int4); DROP FUNCTION _ST_AsGML(int4, geometry, int4, int4); - -#if HAVE_LIBXML2 DROP FUNCTION ST_GeomFromGML(text); DROP FUNCTION ST_GMLToSQL(text); DROP FUNCTION ST_GeomFromKML(text); -#endif ----------------------------------------------------------------------- -- SVG OUTPUT diff --git a/postgis_config.h.in b/postgis_config.h.in index f5c846aea..289c65981 100644 --- a/postgis_config.h.in +++ b/postgis_config.h.in @@ -21,9 +21,6 @@ /* Define to 1 if you have the `proj' library (-lproj). */ #undef HAVE_LIBPROJ -/* libxml/tree.h libxml/parser.h header */ -#undef HAVE_LIBXML2 - /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H diff --git a/regress/Makefile.in b/regress/Makefile.in index f54934559..4e5a5e3b8 100644 --- a/regress/Makefile.in +++ b/regress/Makefile.in @@ -60,6 +60,8 @@ TESTS = \ gml \ svg \ kml \ + in_gml \ + in_kml \ regress_ogc \ regress_bdpoly \ regress_proj \ @@ -87,13 +89,6 @@ ifeq ($(shell expr $(POSTGIS_GEOS_VERSION) ">=" 32),1) TESTS += hausdorff endif -# Some import functions need libxml2 -ifeq ($(shell expr $(HAVE_LIBXML2) "=" 1),1) - TESTS += in_gml - TESTS += in_kml -endif - - all: test