Browse Source

xml: Configure for roxml and expat

Serj Kalichev 3 years ago
parent
commit
36c1541440

+ 295 - 346
configure.ac

@@ -37,6 +37,7 @@ AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
 AC_CHECK_SIZEOF(size_t)
 
+
 #########################################
 # See if linker supports version scripts
 #########################################
@@ -67,6 +68,7 @@ EOF
 fi
 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
 
+
 ################################
 # Deal with debugging options
 ################################
@@ -77,6 +79,7 @@ AC_ARG_ENABLE(debug,
               [enable_debug=no])
 AM_CONDITIONAL(DEBUG,test x$enable_debug = xyes)
 
+
 ################################
 # Compile in testc tests
 ################################
@@ -88,350 +91,19 @@ AC_ARG_ENABLE(testc,
 AM_CONDITIONAL(TESTC,test x$enable_testc = xyes)
 
 
-################################
-# Check for mandatory faux library
-################################
-AC_ARG_WITH(faux,
-            [AS_HELP_STRING([--with-faux=DIR],
-                            [Search DIR directory for faux library files [default=yes]])],
-            [use_faux=$withval],
-            [use_faux=yes])
-
-AS_IF([test x$use_faux != xyes],
-  [
-    CPPFLAGS="-I${use_faux} ${CPPFLAGS}"
-    LDFLAGS="-L${use_faux}/.libs ${LDFLAGS}"
-  ]
-)
-
-AC_CHECK_HEADERS([faux/faux.h],
-	[],
-	[AC_MSG_ERROR([cannot find <faux/faux.h> header file])]
-	)
-AC_SEARCH_LIBS([faux_zmalloc], [faux],
-	[],
-	[AC_MSG_ERROR([cannot find working faux library])]
-	)
-
-
-
-################################
-# Check for the roxml library
-################################
-AC_ARG_WITH(libroxml,
-            [AS_HELP_STRING([--with-libroxml=DIR],
-                            [Use roxml as the XML parser implementation [default=no]])],
-            [use_roxml=$withval],
-            [use_roxml=no])
-
-AC_ARG_WITH(libexpat,
-            [AS_HELP_STRING([--with-libexpat=DIR],
-                            [Use expat as the XML parser implementation [default=no]])],
-            [use_expat=$withval],
-            [use_expat=no])
-
-AC_ARG_WITH(libxml2,
-            [AS_HELP_STRING([--with-libxml2=DIR],
-                            [Use libxml2 as the XML parser implementation [default=no]])],
-            [use_libxml2=$withval],
-            [use_libxml2=no])
-
-XML_LDFLAGS=""
-XML_CFLAGS=""
-XML_LIBS=""
-
-if test "$xml_backend" = "expat" -o "$xml_backend" = "auto"; then
-    if test "$xml_backend" = "auto"; then
-        # on auto select, we try to detect the library
-        use_expat="yes"
-    fi
-    case x$use_expat in
-      xyes)
-        # we choose to NOT rely on pkg-config on this one. Instead, we
-        # check for the library and the header file - that should be
-        # enough.
-        AC_CHECK_HEADER([expat.h],
-                        [expat_h_found=yes],
-                        [expat_h_found=no],
-                        [/* force include check */])
-        if test "x$expat_h_found" != "xyes"; then
-            AC_CHECK_HEADER([bsdxml.h],
-                            [expat_h_found=yes],
-                            [expat_h_found=no],
-                            [/* force include check */])
-            if test "x$expat_h_found" != "xyes"; then
-                if test "$xml_backend" = "auto"; then
-                    AC_MSG_WARN([cannot find <expat.h> header file])
-                else
-                    AC_MSG_ERROR([cannot find <expat.h> header file])
-                fi
-            fi
-        fi
-        XML_CFLAGS=""
-
-        AC_CHECK_LIB([expat],
-                     [XML_ParserCreate],
-                     [expat_lib_found=yes],
-                     [expat_lib_found=no],
-                     [])
-        if test "x$expat_lib_found" != "xyes"; then
-            AC_CHECK_LIB([bsdxml],
-                         [XML_ParserCreate],
-                         [expat_lib_found=yes],
-                         [expat_lib_found=no],
-                         [])
-            if test "x$expat_lib_found" != "xno"; then
-                XML_LIBS="-lbsdxml"
-                AC_DEFINE([HAVE_LIB_BSDXML],
-                          [],
-                          [libbsdxml-based XML backend])
-            else
-                if test "$xml_backend" = "auto"; then
-                    AC_MSG_WARN([cannot find expat library])
-                else
-                    AC_MSG_ERROR([cannot find expat library])
-                fi
-            fi
-        else
-            XML_LIBS="-lexpat"
-        fi
-        XML_LDFLAGS=""
-
-        AC_DEFINE([HAVE_LIB_EXPAT],
-                  [],
-                  [libexpat-based XML backend])
-        xml_backend="found"
-        found_xml_backend="expat"
-        ;;
-      *)
-        # this is probably broken. We consider that the user supplied path is
-        # a non-standard path. But we're not going to check anything.
-        AC_MSG_WARN([--with-expat=DIR is probably broken, just trying])
-        XML_LDFLAGS="-L${use_expat}/lib"
-        XML_CFLAGS="-I${use_expat}/include"
-        XML_LIBS="-lexpat"
-        AC_MSG_CHECKING([for expat support])
-        AC_MSG_RESULT([yes])
-        AC_MSG_NOTICE([headers for expat hopefully in ${use_expat}/include])
-        AC_MSG_NOTICE([library expat hopefully in ${use_expat}/lib])
-        AC_DEFINE([HAVE_LIB_EXPAT],
-                  [],
-                  [expat-based XML backend])
-        xml_backend="found"
-        found_xml_backend="expat"
-        ;;
-    esac
-else
-    AC_MSG_CHECKING([for libexpat support])
-    AC_MSG_RESULT([no])
-fi
-
-if test "$xml_backend" = "roxml" -o "$xml_backend" = "auto"; then
-    if test "$xml_backend" = "auto"; then
-        # on auto select, we try to detect the library
-        use_roxml="yes"
-    fi
-    case x$use_roxml in
-      xyes)
-        # we choose to NOT rely on pkg-config on this one. We may do it as
-        # libroxml provides a .pc file but some environment (both cross-compile
-        # or native environment) may lack this support. The good thing is that
-        # it doesn't add much complexity to the configure.ac file (and we
-        # may move these tests to another m4 file later).
-
-        # the header is installed in the standard path
-        AC_CHECK_HEADER([roxml.h],
-                        [roxml_h_found=yes],
-                        [roxml_h_found=no],
-                        [/* force include check */])
-        if test "x$roxml_h_found" != "xyes"; then
-            if test "$xml_backend" = "auto"; then
-                AC_MSG_WARN([cannot find <roxml.h> header file])
-            else
-                AC_MSG_ERROR([cannot find <roxml.h> header file])
-            fi
-        fi
-        XML_CFLAGS=""
-
-        # the library is installed in the standard path
-        AC_CHECK_LIB([roxml],
-                     [roxml_load_doc],
-                     [roxml_lib_found=yes],
-                     [roxml_lib_found=no],
-                     [])
-        if test "x$roxml_lib_found" != "xyes"; then
-            if test "$xml_backend" = "auto"; then
-                AC_MSG_WARN([cannot find roxml library])
-            else
-                AC_MSG_ERROR([cannot find roxml library])
-            fi
-        fi
-        XML_LDFLAGS=""
-        XML_LIBS="-lroxml"
-
-        AC_DEFINE([HAVE_LIB_ROXML],
-                  [],
-                  [libroxml-based XML backend])
-        xml_backend="found"
-        found_xml_backend="roxml"
-        ;;
-
-      *)
-        # first, we check if we're not looking for an alternate include
-        # directory -for example, if the user feeds the script with the
-        # option --with-roxml=/usr/local
-        # NOTE: we search for include/roxml.h and inc/roxml.h to defeat
-        # the caching algorithm of the configure script. If someone knows
-        # a better way, please do not hesitate
-        roxml_CFLAGS="$CFLAGS"
-        CFLAGS="$CFLAGS -I${use_roxml}"
-        AC_CHECK_HEADER([include/roxml.h],
-                        [roxml_h_found=yes],
-                        [roxml_h_found=no],
-                        [/* force include check */])
-        if test "x$roxml_h_found" = "xno"; then
-            # the directory might be a source directory, so check
-            # if the include file is to be found here
-            AC_CHECK_HEADER([inc/roxml.h],
-                            [roxml_h_found=yes],
-                            [roxml_h_found=no],
-                            [/* force include check */])
-            if test "x$roxml_h_found" = "xno"; then
-                if test "$xml_backend" = "auto"; then
-                    AC_MSG_WARN([cannot find <roxml.h> header file])
-                else
-                    AC_MSG_ERROR([cannot find <roxml.h> header file])
-                fi
-            fi
-            XML_CFLAGS="-I${use_roxml}/inc"
-            AC_MSG_NOTICE([header file <roxml.h> found in ${use_roxml}/inc])
-        else
-            XML_CFLAGS="-I${use_roxml}/include"
-            AC_MSG_NOTICE([header file <roxml.h> found in ${use_roxml}/include])
-        fi
-        CFLAGS="$roxml_CFLAGS"
-
-        # we're doing both previous checks, but we are trying to find a library
-        # now, so the check themselves are a bit different
-        # NOTE: we search for roxml_load_doc and roxml_close to defeat
-        # the caching algorithm of the configure script. If someone knows
-        # a better way, please do not hesitate.
-        roxml_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS -L${use_roxml}/lib"
-        AC_CHECK_LIB([roxml],
-                     [roxml_load_doc],
-                     [roxml_lib_found=yes],
-                     [roxml_lib_found=no],
-                     [])
-        LDFLAGS=$roxml_LDFLAGS
-        if test "x$roxml_lib_found" = "xno"; then
-            LDFLAGS="$LDFLAGS -L${use_roxml}"
-            AC_CHECK_LIB([roxml],
-                         [roxml_close],
-                         [roxml_lib_found=yes],
-                         [roxml_lib_found=no],
-                         [])
-            LDFLAGS=$roxml_LDFLAGS
-            if test "x$roxml_lib_found" = "xno"; then
-                if test "$xml_backend" = "auto"; then
-                    AC_MSG_WARN([cannot find roxml library])
-                else
-                    AC_MSG_ERROR([cannot find roxml library])
-                fi
-            fi
-            XML_LDFLAGS="-L${use_roxml}"
-            XML_LIBS="-lroxml"
-            AC_MSG_NOTICE([library libroxml found in ${use_roxml}])
-        else
-            XML_LDFLAGS="-L${use_roxml}/lib"
-            XML_LIBS="-lroxml"
-            AC_MSG_NOTICE([library libroxml found in ${use_roxml}/lib])
-        fi
-
-        AC_DEFINE([HAVE_LIB_ROXML],
-                  [],
-                  [libroxml-based XML backend])
-        xml_backend="found"
-        found_xml_backend="roxml"
-        ;;
-    esac
-else
-    AC_MSG_CHECKING([for libroxml support])
-    AC_MSG_RESULT([no])
-fi
-
-
-
-case x$use_libxml2 in
-
-	xno)
-	/bin/true
-	;;
-
-	xyes)
-	# I would love to avoid using pkg-config (which may not be available on
-	# some compilation environment) but doing so really add a lot of
-	# complexity to the system, as the headers don't lie in a standard
-	# directory (they lie in a subdirectory of a standard include directory;
-	# not the same thing for configure scripts).
-	LIBXML2_CFLAGS="`pkg-config libxml-2.0 --cflags`"
-	LIBXML2_LDFLAGS="`pkg-config libxml-2.0 --libs-only-L`"
-	LIBXML2_LIBS="`pkg-config libxml-2.0 --libs-only-l`"
-	AC_CHECK_LIB([xml2],
-		[xmlNewDoc],
-		[],
-		[AC_MSG_ERROR([cannot find libxml2 headers])],
-		[])
-	# the header file is installed in a subdirectory of one of the standard
-	# include directory. This might prove to be a problem if the cross-
-	# compile environment is not complete enough (i.e. if it misses
-	# pkg-config, or if pkg-config returns wrong values). In most cases, the
-	# environment is likely to be OK so we will never hit any issue.
-	saved_CFLAGS="$CFLAGS"
-	CFLAGS="$CFLAGS $LIBXML2_CFLAGS"
-	AC_CHECK_HEADER([libxml/tree.h],
-		[],
-		[AC_MSG_ERROR([cannot find libxml2 headers])],
-		[])
-	CFLAGS="$saved_CFLAGS"
-	AC_DEFINE([HAVE_LIB_LIBXML2],
-		[],
-		[libxml2-based XML backend])
-	;;
-
-	*)
-	# this is probably broken. We consider that the user supplied path is
-	# a non-standard path. But we're not going to check anything.
-	AC_MSG_WARN([--with-libxml2=DIR is probably broken, just trying])
-	LIBXML2_LDFLAGS="-L${use_libxml2}/lib"
-	LIBXML2_CFLAGS="-I${use_libxml2}/include/libxml2"
-	LIBXML2_LIBS="-lxml2"
-	AC_MSG_CHECKING([for libxml2 support])
-	AC_MSG_RESULT([yes])
-	AC_MSG_NOTICE([headers for libxml2 hopefully in ${use_libxml2}/include/libxml2])
-	AC_MSG_NOTICE([library libxml2 hopefully in ${use_libxml2}/lib])
-	AC_DEFINE([HAVE_LIB_LIBXML2],
-		[],
-		[libxml2-based XML backend])
-	;;
-esac
-
-AC_SUBST(LIBXML2_LIBS)
-AC_SUBST(LIBXML2_LDFLAGS)
-AC_SUBST(LIBXML2_CFLAGS)
-
-
 ################################
 # Search for network functions (like connect())
 ################################
 AC_SEARCH_LIBS([socket], [socket])
 
+
 ################################
 # Check for regex.h
 ################################
 AC_CHECK_HEADERS(regex.h, [],
     AC_MSG_ERROR([regex.h not found: regular expressions are not supported]))
 
+
 ################################
 # Internal getopt()
 ################################
@@ -458,12 +130,14 @@ else
     AC_MSG_RESULT([no])
 fi
 
+
 ################################
 # Check for locale.h
 ################################
 AC_CHECK_HEADERS(locale.h, [],
     AC_MSG_WARN([locale.h not found: the locales is not supported]))
 
+
 ################################
 # Check for CODESET within nl_langinfo
 ################################
@@ -482,6 +156,7 @@ AC_DEFUN([AM_LANGINFO_CODESET],
 ])
 AM_LANGINFO_CODESET
 
+
 ################################
 # Check for pwd.h and grp.h
 ################################
@@ -490,12 +165,14 @@ AC_CHECK_HEADERS(pwd.h, [],
 AC_CHECK_HEADERS(grp.h, [],
     AC_MSG_WARN([grp.h not found: the grp operations is not supported]))
 
+
 ################################
 # Check for chroot
 ################################
 AC_CHECK_FUNCS(chroot, [],
     AC_MSG_WARN([chroot() not found: the choot is not supported]))
 
+
 ################################
 # Check for dlopen
 ################################
@@ -528,28 +205,300 @@ AC_SUBST([CLISH_PLUGIN_BUILTIN_LIBS])
 #AC_CONFIG_FILES([clish/plugin_builtin.c])
 
 
+################################
+# Check for mandatory faux library
+################################
+AC_ARG_WITH(faux,
+            [AS_HELP_STRING([--with-faux=DIR],
+                            [Search DIR directory for faux library files [default=yes]])],
+            [use_faux=$withval],
+            [use_faux=yes])
+
+AS_IF([test x$use_faux != xyes],
+  [
+    CPPFLAGS="-I${use_faux} ${CPPFLAGS}"
+    LDFLAGS="-L${use_faux}/.libs ${LDFLAGS}"
+  ]
+)
+
+AC_CHECK_HEADERS([faux/faux.h],
+	[],
+	[AC_MSG_ERROR([cannot find <faux/faux.h> header file])]
+	)
+AC_SEARCH_LIBS([faux_zmalloc], [faux],
+	[],
+	[AC_MSG_ERROR([cannot find working faux library])]
+	)
+
+
+################################
+# Check for the libxml2 library
+################################
+AC_ARG_WITH(libxml2,
+	[AS_HELP_STRING([--with-libxml2=DIR],
+		[Use libxml2 as the XML parser implementation [default=no]])],
+	[use_libxml2=$withval],
+	[use_libxml2=no])
+
+case x$use_libxml2 in
+xno)
+	/bin/true
+	;;
+xyes)
+	# I would love to avoid using pkg-config (which may not be available on
+	# some compilation environment) but doing so really add a lot of
+	# complexity to the system, as the headers don't lie in a standard
+	# directory (they lie in a subdirectory of a standard include directory;
+	# not the same thing for configure scripts).
+	LIBXML2_CFLAGS="`pkg-config libxml-2.0 --cflags`"
+	LIBXML2_LDFLAGS="`pkg-config libxml-2.0 --libs-only-L`"
+	LIBXML2_LIBS="`pkg-config libxml-2.0 --libs-only-l`"
+	AC_CHECK_LIB([xml2],
+		[xmlNewDoc],
+		[],
+		[AC_MSG_ERROR([cannot find libxml2 headers])],
+		[])
+	# the header file is installed in a subdirectory of one of the standard
+	# include directory. This might prove to be a problem if the cross-
+	# compile environment is not complete enough (i.e. if it misses
+	# pkg-config, or if pkg-config returns wrong values). In most cases, the
+	# environment is likely to be OK so we will never hit any issue.
+	saved_CFLAGS="$CFLAGS"
+	CFLAGS="$CFLAGS $LIBXML2_CFLAGS"
+	AC_CHECK_HEADER([libxml/tree.h],
+		[],
+		[AC_MSG_ERROR([cannot find libxml2 headers])],
+		[/* */])
+	CFLAGS="$saved_CFLAGS"
+	AC_DEFINE([HAVE_LIB_LIBXML2],
+		[],
+		[libxml2-based XML backend])
+	;;
+*)
+	# this is probably broken. We consider that the user supplied path is
+	# a non-standard path. But we're not going to check anything.
+	AC_MSG_WARN([--with-libxml2=DIR is probably broken, just trying])
+	LIBXML2_LDFLAGS="-L${use_libxml2}/lib"
+	LIBXML2_CFLAGS="-I${use_libxml2}/include/libxml2"
+	LIBXML2_LIBS="-lxml2"
+	AC_MSG_CHECKING([for libxml2 support])
+	AC_MSG_RESULT([yes])
+	AC_MSG_NOTICE([headers for libxml2 hopefully in ${use_libxml2}/include/libxml2])
+	AC_MSG_NOTICE([library libxml2 hopefully in ${use_libxml2}/lib])
+	AC_DEFINE([HAVE_LIB_LIBXML2],
+		[],
+		[libxml2-based XML backend])
+	;;
+esac
+
+AC_SUBST(LIBXML2_LIBS)
+AC_SUBST(LIBXML2_LDFLAGS)
+AC_SUBST(LIBXML2_CFLAGS)
+
+
+################################
+# Check for the roxml library
+################################
+AC_ARG_WITH(roxml,
+	[AS_HELP_STRING([--with-roxml=DIR],
+		[Use roxml as the XML parser implementation [default=no]])],
+	[use_roxml=$withval],
+	[use_roxml=no])
+
+case x$use_roxml in
+xno)
+	/bin/true
+	;;
+xyes)
+	# we choose to NOT rely on pkg-config on this one. We may do it as
+	# roxml provides a .pc file but some environment (both cross-compile
+	# or native environment) may lack this support. The good thing is that
+	# it doesn't add much complexity to the configure.ac file (and we
+	# may move these tests to another m4 file later).
+	# The header is installed in the standard path
+	AC_CHECK_HEADER([roxml.h],
+		[],
+		[AC_MSG_ERROR([cannot find <roxml.h> header file])],
+		[/* */])
+	# The library is installed in the standard path
+	AC_CHECK_LIB([roxml],
+		[roxml_load_doc],
+		[],
+		[AC_MSG_ERROR([cannot find roxml library])],
+		[])
+	ROXML_CFLAGS=""
+	ROXML_LDFLAGS=""
+	ROXML_LIBS="-lroxml"
+	AC_DEFINE([HAVE_LIB_ROXML],
+		[],
+		[roxml-based XML backend])
+	;;
+*)
+	# first, we check if we're not looking for an alternate include
+	# directory -for example, if the user feeds the script with the
+	# option --with-roxml=/usr/local
+	# NOTE: we search for include/roxml.h and inc/roxml.h to defeat
+	# the caching algorithm of the configure script. If someone knows
+	# a better way, please do not hesitate
+	saved_CFLAGS="$CFLAGS"
+	CFLAGS="$CFLAGS -I${use_roxml}"
+	AC_CHECK_HEADER([include/roxml.h],
+		[roxml_h_found=yes],
+		[roxml_h_found=no],
+		[/* */])
+	if test "x$roxml_h_found" = "xno"; then
+		# the directory might be a source directory, so check
+		# if the include file is to be found here
+		AC_CHECK_HEADER([inc/roxml.h],
+			[roxml_h_found=yes],
+			[roxml_h_found=no],
+			[/* */])
+		if test "x$roxml_h_found" = "xno"; then
+			AC_MSG_ERROR([cannot find <roxml.h> header file])
+		fi
+		ROXML_CFLAGS="-I${use_roxml}/inc"
+		AC_MSG_NOTICE([header file <roxml.h> found in ${use_roxml}/inc])
+	else
+		ROXML_CFLAGS="-I${use_roxml}/include"
+		AC_MSG_NOTICE([header file <roxml.h> found in ${use_roxml}/include])
+	fi
+	CFLAGS="$saved_CFLAGS"
+	# we're doing both previous checks, but we are trying to find a library
+	# now, so the check themselves are a bit different
+	# NOTE: we search for roxml_load_doc and roxml_close to defeat
+	# the caching algorithm of the configure script. If someone knows
+	# a better way, please do not hesitate.
+	saved_LDFLAGS="$LDFLAGS"
+	LDFLAGS="$LDFLAGS -L${use_roxml}/lib"
+	AC_CHECK_LIB([roxml],
+		[roxml_load_doc],
+		[roxml_lib_found=yes],
+		[roxml_lib_found=no],
+		[])
+	LDFLAGS="$saved_LDFLAGS"
+	if test "x$roxml_lib_found" = "xno"; then
+		LDFLAGS="$LDFLAGS -L${use_roxml}"
+		AC_CHECK_LIB([roxml],
+			[roxml_close],
+			[],
+			[AC_MSG_ERROR([cannot find roxml library])],
+			[])
+		LDFLAGS=$saved_LDFLAGS
+		ROXML_LDFLAGS="-L${use_roxml}"
+		ROXML_LIBS="-lroxml"
+		AC_MSG_NOTICE([library roxml found in ${use_roxml}])
+	else
+		ROXML_LDFLAGS="-L${use_roxml}/lib"
+		ROXML_LIBS="-lroxml"
+		AC_MSG_NOTICE([library roxml found in ${use_roxml}/lib])
+	fi
+	AC_DEFINE([HAVE_LIB_ROXML],
+		[],
+		[roxml-based XML backend])
+	;;
+esac
+
+AC_SUBST(ROXML_LIBS)
+AC_SUBST(ROXML_LDFLAGS)
+AC_SUBST(ROXML_CFLAGS)
+
+
+################################
+# Check for the expat library
+################################
+AC_ARG_WITH(expat,
+            [AS_HELP_STRING([--with-expat=DIR],
+                            [Use expat as the XML parser implementation [default=no]])],
+            [use_expat=$withval],
+            [use_expat=no])
+
+case x$use_expat in
+xno)
+	/bin/true
+	;;
+xyes)
+	# we choose to NOT rely on pkg-config on this one. Instead, we
+	# check for the library and the header file - that should be
+	# enough.
+	AC_CHECK_HEADER([expat.h],
+		[expat_h_found=yes],
+		[expat_h_found=no],
+		[/* */])
+	if test "x$expat_h_found" != "xyes"; then
+		AC_CHECK_HEADER([bsdxml.h],
+			[expat_h_found=yes],
+			[expat_h_found=no],
+			[/* */])
+		if test "x$expat_h_found" != "xyes"; then
+			AC_MSG_ERROR([cannot find <expat.h> header file])
+		fi
+	fi
+	EXPAT_CFLAGS=""
+	AC_CHECK_LIB([expat],
+		[XML_ParserCreate],
+		[expat_lib_found=yes],
+		[expat_lib_found=no],
+		[])
+	if test "x$expat_lib_found" != "xyes"; then
+		AC_CHECK_LIB([bsdxml],
+			[XML_ParserCreate],
+			[],
+			[AC_MSG_ERROR([cannot find expat library])],
+			[])
+		EXPAT_LIBS="-lbsdxml"
+		AC_DEFINE([HAVE_LIB_BSDXML],
+			[],
+			[libbsdxml-based XML backend])
+	else
+		EXPAT_LIBS="-lexpat"
+	fi
+	EXPAT_LDFLAGS=""
+	AC_DEFINE([HAVE_LIB_EXPAT],
+		[],
+		[expat-based XML backend])
+	;;
+*)
+	# this is probably broken. We consider that the user supplied path is
+	# a non-standard path. But we're not going to check anything.
+	AC_MSG_WARN([--with-expat=DIR is probably broken, just trying])
+	EXPAT_LDFLAGS="-L${use_expat}/lib"
+	EXPAT_CFLAGS="-I${use_expat}/include"
+	EXPAT_LIBS="-lexpat"
+	AC_MSG_CHECKING([for expat support])
+	AC_MSG_RESULT([yes])
+	AC_MSG_NOTICE([headers for expat hopefully in ${use_expat}/include])
+	AC_MSG_NOTICE([library expat hopefully in ${use_expat}/lib])
+	AC_DEFINE([HAVE_LIB_EXPAT],
+		[],
+		[expat-based XML backend])
+	;;
+esac
+
+AC_SUBST(EXPAT_LIBS)
+AC_SUBST(EXPAT_LDFLAGS)
+AC_SUBST(EXPAT_CFLAGS)
+
+
 ################################
 # Check for Lua support
 ################################
 AC_ARG_WITH(lua,
-            [AS_HELP_STRING([--with-lua=DIR],
-                            [Build Lua ACTION plugin [default=no]])],
-            [use_lua=$withval],
-            [use_lua=no])
+	[AS_HELP_STRING([--with-lua=DIR],
+		[Build Lua ACTION plugin [default=no]])],
+	[use_lua=$withval],
+	[use_lua=no])
 AM_CONDITIONAL(WITH_LUA,test x$use_lua != xno)
 
 if test x$use_lua != xno; then
-    if test x$use_lua != xyes; then
-        CPPFLAGS="${CPPFLAGS} -I$use_lua/include"
-	LDFLAGS="${LDFLAGS} -L$use_lua/lib"
-    fi
-    LUA_VERSION="5.1"
-    AX_LUA_HEADERS()
-    AX_LUA_LIBS()
+	if test x$use_lua != xyes; then
+		CPPFLAGS="${CPPFLAGS} -I$use_lua/include"
+		LDFLAGS="${LDFLAGS} -L$use_lua/lib"
+	fi
+	LUA_VERSION="5.1"
+	AX_LUA_HEADERS()
+	AX_LUA_LIBS()
 fi
 
 
-
-
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT

+ 1 - 1
klish/kdb.h

@@ -16,7 +16,7 @@
 // instead "%s". Consider db ID as an "internal native name". The "name"
 // field can differ from ID and it's just used within scheme to refer db.
 // Consider it as alias of ID.
-#define KDB_SONAME_FMT "kdb_%s.so"
+#define KDB_SONAME_FMT "libkdb_%s.so"
 
 // db's API version symbols
 #define KDB_MAJOR_FMT "kdb_%s_major"

+ 5 - 1
klish/kdb/Makefile.am

@@ -1,4 +1,8 @@
 EXTRA_DIST += \
-	klish/kdb/libxml2/Makefile.am
+	klish/kdb/libxml2/Makefile.am \
+	klish/kdb/roxml/Makefile.am \
+	klish/kdb/expat/Makefile.am
 
 include $(top_srcdir)/klish/kdb/libxml2/Makefile.am
+include $(top_srcdir)/klish/kdb/roxml/Makefile.am
+include $(top_srcdir)/klish/kdb/expat/Makefile.am

+ 9 - 0
klish/kdb/expat/Makefile.am

@@ -0,0 +1,9 @@
+lib_LTLIBRARIES += libkdb-expat.la
+libkdb_expat_la_SOURCES =
+libkdb_expat_la_LDFLAGS = $(AM_LDFLAGS) $(EXPAT_LDFLAGS) $(VERSION_INFO)
+libkdb_expat_la_LIBS = $(EXPAT_LIBS)
+libkdb_expat_la_CFLAGS = $(AM_LDFLAGS) $(EXPAT_CFLAGS)
+
+libkdb_expat_la_SOURCES += \
+	klish/kdb/xml-common/load.c \
+	klish/kdb/expat/expat_api.c

+ 0 - 0
klish/kdb/expat/shell_expat.c → klish/kdb/expat/expat_api.c


+ 9 - 0
klish/kdb/roxml/Makefile.am

@@ -0,0 +1,9 @@
+lib_LTLIBRARIES += libkdb-roxml.la
+libkdb_roxml_la_SOURCES =
+libkdb_roxml_la_LDFLAGS = $(AM_LDFLAGS) $(ROXML_LDFLAGS) $(VERSION_INFO)
+libkdb_roxml_la_LIBS = $(ROXML_LIBS)
+libkdb_roxml_la_CFLAGS = $(AM_LDFLAGS) $(ROXML_CFLAGS)
+
+libkdb_roxml_la_SOURCES += \
+	klish/kdb/xml-common/load.c \
+	klish/kdb/roxml/roxml_api.c

+ 0 - 0
klish/kdb/roxml/shell_roxml.c → klish/kdb/roxml/roxml_api.c