dnl Detect CUnit if it is installed (used for unit testing)
dnl
dnl Note that we pass any specified CPPFLAGS and LDFLAGS into the Makefile
@@ -584,13 +594,32 @@ AC_ARG_WITH([xml2config],
[AS_HELP_STRING([--with-xml2config=FILE], [specify an alternative xml2-config file])],
[XML2CONFIG="$withval"], [XML2CONFIG=""])
+XML2_LDFLAGS=""
+XML2_CPPFLAGS=""
+
if test "x$XML2CONFIG" = "x"; then
dnl XML2CONFIG was not specified, so search within the current path
AC_PATH_PROG([XML2CONFIG], [xml2-config])
- dnl If we couldn't find xml2-config, display a warning
+ dnl If we couldn't find xml2-config, display a warning if pkg-config fails too
if test "x$XML2CONFIG" = "x"; then
- 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.])
+ 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 Extract the linker and include flags
+ XML2_LDFLAGS=`$XML2CONFIG --libs`
+ XML2_CPPFLAGS=`$XML2CONFIG --cflags`
+
+ dnl Extract the version
+ POSTGIS_LIBXML2_VERSION=`$XML2CONFIG --version`
fi
else
dnl XML2CONFIG was specified; display a message to the user