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],
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
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 ===========================================================================
<refsection>
<title>Description</title>
<para>Constructs a PostGIS ST_Geometry object from the OGC GML representation.</para>
- <note>
- <para>Requires compilation with libxml2 2.5+</para>
- </note>
<para>ST_GeomFromGML works only for GML Geometry fragments. It throws an error if you try to use it on a whole GML document.</para>
<para>
OGC GML versions supported:
OGC GML standards, cf: <ulink url="http://www.opengeospatial.org/standards/gml">http://www.opengeospatial.org/standards/gml</ulink>:
</para>
- <para>Availability: 1.5 - requires libxml2 >= 2.5+</para>
+ <para>Availability: 1.5</para>
<para>&Z_support;</para>
<para>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.</para>
<refsection>
<title>Description</title>
<para>Constructs a PostGIS ST_Geometry object from the OGC KML representation.</para>
- <note>
- <para>Requires compilation with libxml2 2.5+</para>
- </note>
<para>ST_GeomFromKML works only for KML Geometry fragments. It throws an error if you try to use it on a whole KML document.</para>
<para>
OGC KML versions supported:
OGC KML standards, cf: <ulink url="http://www.opengeospatial.org/standards/kml">http://www.opengeospatial.org/standards/kml</ulink>:
</para>
- <para>Availability: 1.5 - requires libxml2 >= 2.5+</para>
+ <para>Availability: 1.5</para>
<para>&Z_support;</para>
<note>
<para>ST_GeomFromKML function not support SQL/MM curves geometries.</para>
<refsection>
<title>Description</title>
<para>&sqlmm_compliant; SQL-MM 3: 5.1.50 (except for curves support).</para>
- <para>Availability: 1.5 - requires libxml2 >= 2.5+</para>
+ <para>Availability: 1.5</para>
</refsection>
<refsection>
<title>See Also</title>
<refsection>
<title>Description</title>
- <para>Returns the version number of the LibXML2 library, or
- <varname>NULL</varname> if LibXML2 support is not enabled.</para>
+ <para>Returns the version number of the LibXML2 library.</para>
<para>Availability: 1.5</para>
</refsection>
<para>The versions below are the *minimum* requirements for PostGIS 1.5</para>
<para>PostgreSQL 8.3 and higher on all platforms</para>
<para>GEOS 3.0 and higher only (GEOS 3.2+ to take advantage of all features)</para>
- <para>libxml2 2.5+ to enable ST_GeomFromGML/KML functionality</para>
+ <para>libxml2 2.5+ related to new ST_GeomFromGML/KML functionality</para>
<para>PROJ4 4.5 and higher only</para>
</simplesect>
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
}
#include "executor/spi.h"
-#if HAVE_LIBXML2
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
lwerror("invalid GML representation");
return NULL; /* Never reach */
}
-
-#endif /* if HAVE_LIBXML2 */
#include "liblwgeom.h"
-#if HAVE_LIBXML2
#include <libxml/tree.h>
#include <libxml/parser.h>
lwerror("invalid KML representation");
return NULL; /* Never reach */
}
-
-#endif /* if HAVE_LIBXML2 */
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;
LANGUAGE 'SQL' IMMUTABLE STRICT;
-#if HAVE_LIBXML2
-----------------------------------------------------------------------
-- GML & KML INPUT
-- Availability: 1.5.0
AS 'MODULE_PATHNAME','geom_from_kml'
LANGUAGE 'C' IMMUTABLE STRICT;
-#endif
-----------------------------------------------------------------------
-- SVG OUTPUT
-----------------------------------------------------------------------
#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 */
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
/* 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 <memory.h> header file. */
#undef HAVE_MEMORY_H
gml \
svg \
kml \
+ in_gml \
+ in_kml \
regress_ogc \
regress_bdpoly \
regress_proj \
TESTS += hausdorff
endif
-# Some import functions need libxml2
-ifeq ($(shell expr $(HAVE_LIBXML2) "=" 1),1)
- TESTS += in_gml
- TESTS += in_kml
-endif
-
-
all: test