Blame SOURCES/nfs-utils-2.3.3-junction-update.patch

bc9fd4
diff --git a/aclocal/libxml2.m4 b/aclocal/libxml2.m4
bc9fd4
index 5c399b2..8231553 100644
bc9fd4
--- a/aclocal/libxml2.m4
bc9fd4
+++ b/aclocal/libxml2.m4
bc9fd4
@@ -1,15 +1,17 @@
bc9fd4
 dnl Checks for libxml2.so
bc9fd4
 AC_DEFUN([AC_LIBXML2], [
bc9fd4
 
bc9fd4
-  if test "$enable_junction" = yes; then
bc9fd4
+  PKG_PROG_PKG_CONFIG([0.9.0])
bc9fd4
+  AS_IF(
bc9fd4
+    [test "$enable_junction" = "yes"],
bc9fd4
+    [PKG_CHECK_MODULES([XML2], [libxml-2.0 >= 2.4],
bc9fd4
+                       [LIBXML2="${XML2_LIBS}"
bc9fd4
+                        AM_CPPFLAGS="${AM_CPPFLAGS} ${XML2_CFLAGS}"
bc9fd4
+                        AC_DEFINE([HAVE_LIBXML2], [1],
bc9fd4
+                                  [Define to 1 if you have and wish to use libxml2.])],
bc9fd4
+                       [AC_MSG_ERROR([libxml2 not found.])])])
bc9fd4
 
bc9fd4
-    dnl look for the library; do not add to LIBS if found
bc9fd4
-    AC_CHECK_LIB([xml2], [xmlParseFile], [LIBXML2=-lxml2],
bc9fd4
-                 [AC_MSG_ERROR([libxml2 not found.])])
bc9fd4
-    AC_SUBST(LIBXML2)
bc9fd4
-
bc9fd4
-    dnl XXX should also check for presence of xml headers
bc9fd4
-
bc9fd4
-  fi
bc9fd4
+  AC_SUBST([AM_CPPFLAGS])
bc9fd4
+  AC_SUBST(LIBXML2)
bc9fd4
 
bc9fd4
 ])dnl
bc9fd4
diff --git a/configure.ac b/configure.ac
bc9fd4
index cf1c4b9..b458891 100644
bc9fd4
--- a/configure.ac
bc9fd4
+++ b/configure.ac
bc9fd4
@@ -165,7 +165,7 @@ AC_ARG_ENABLE(uuid,
bc9fd4
 	choose_blkid=default)
bc9fd4
 AC_ARG_ENABLE(mount,
bc9fd4
 	[AC_HELP_STRING([--disable-mount],
bc9fd4
-		[Don't build mount.nfs and do use the util-linux mount(8) functionality. @<:@default=no@:>@])],
bc9fd4
+		[Do not build mount.nfs and do use the util-linux mount(8) functionality. @<:@default=no@:>@])],
bc9fd4
 	enable_mount=$enableval,
bc9fd4
 	enable_mount=yes)
bc9fd4
 	AM_CONDITIONAL(CONFIG_MOUNT, [test "$enable_mount" = "yes"])
bc9fd4
@@ -185,7 +185,13 @@ AC_ARG_ENABLE(junction,
bc9fd4
 			[enable support for NFS junctions @<:@default=no@:>@])],
bc9fd4
 	enable_junction=$enableval,
bc9fd4
 	enable_junction=no)
bc9fd4
-AM_CONDITIONAL(CONFIG_JUNCTION, [test "$enable_junction" = "yes" ])
bc9fd4
+	if test "$enable_junction" = yes; then
bc9fd4
+		AC_DEFINE(HAVE_JUNCTION_SUPPORT, 1,
bc9fd4
+                          [Define this if you want junction support compiled in])
bc9fd4
+	else
bc9fd4
+		enable_junction=
bc9fd4
+	fi
bc9fd4
+	AM_CONDITIONAL(CONFIG_JUNCTION, [test "$enable_junction" = "yes" ])
bc9fd4
 
bc9fd4
 AC_ARG_ENABLE(tirpc,
bc9fd4
 	[AC_HELP_STRING([--disable-tirpc],
bc9fd4
diff --git a/support/junction/Makefile.am b/support/junction/Makefile.am
bc9fd4
index 97e7426..be6958b 100644
bc9fd4
--- a/support/junction/Makefile.am
bc9fd4
+++ b/support/junction/Makefile.am
bc9fd4
@@ -30,5 +30,3 @@ libjunction_la_SOURCES	= display.c export-cache.c junction.c \
bc9fd4
 			  locations.c nfs.c path.c xml.c
bc9fd4
 
bc9fd4
 MAINTAINERCLEANFILES	= Makefile.in
bc9fd4
-
bc9fd4
-AM_CPPFLAGS		= -I. -I../include -I/usr/include/libxml2
bc9fd4
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
bc9fd4
index 6f42512..7e8d403 100644
bc9fd4
--- a/utils/mountd/cache.c
bc9fd4
+++ b/utils/mountd/cache.c
bc9fd4
@@ -976,8 +976,9 @@ lookup_export(char *dom, char *path, struct addrinfo *ai)
bc9fd4
 	return found;
bc9fd4
 }
bc9fd4
 
bc9fd4
-#ifdef CONFIG_JUNCTION
bc9fd4
+#ifdef HAVE_JUNCTION_SUPPORT
bc9fd4
 
bc9fd4
+#include <libxml/parser.h>
bc9fd4
 #include "junction.h"
bc9fd4
 
bc9fd4
 struct nfs_fsloc_set {
bc9fd4
@@ -1084,8 +1085,7 @@ static bool locations_to_fslocdata(struct nfs_fsloc_set *locations,
bc9fd4
 	*ttl = 0;
bc9fd4
 
bc9fd4
 	for (;;) {
bc9fd4
-		enum jp_status status;
bc9fd4
-		int len;
bc9fd4
+		int len, status;
bc9fd4
 
bc9fd4
 		status = get_next_location(locations, &server,
bc9fd4
 							&rootpath, ttl);
bc9fd4
@@ -1219,7 +1219,7 @@ nfs_get_basic_junction(const char *junct_path, struct nfs_fsloc_set **locset)
bc9fd4
 		return EINVAL;
bc9fd4
 	}
bc9fd4
 
bc9fd4
-	locset->ns_current = locset->ns_list;
bc9fd4
+	new->ns_current = new->ns_list;
bc9fd4
 	new->ns_ttl = 300;
bc9fd4
 	*locset = new;
bc9fd4
 	return 0;
bc9fd4
@@ -1242,7 +1242,7 @@ static struct exportent *lookup_junction(char *dom, const char *pathname,
bc9fd4
 	status = nfs_get_basic_junction(pathname, &locations);
bc9fd4
 	switch (status) {
bc9fd4
 		xlog(L_WARNING, "Dangling junction %s: %s",
bc9fd4
-			pathname, strerro(status));
bc9fd4
+			pathname, strerror(status));
bc9fd4
 		goto out;
bc9fd4
 	}
bc9fd4
 
bc9fd4
@@ -1252,8 +1252,8 @@ static struct exportent *lookup_junction(char *dom, const char *pathname,
bc9fd4
 
bc9fd4
 	exp = locations_to_export(locations, pathname, parent);
bc9fd4
 
bc9fd4
-	nfs_free_locations(locset->ns_list);
bc9fd4
-	free(locset);
bc9fd4
+	nfs_free_locations(locations->ns_list);
bc9fd4
+	free(locations);
bc9fd4
 
bc9fd4
 out:
bc9fd4
 	xmlCleanupParser();
bc9fd4
@@ -1273,7 +1273,7 @@ static void lookup_nonexport(int f, char *buf, int buflen, char *dom, char *path
bc9fd4
 	free(eep);
bc9fd4
 }
bc9fd4
 
bc9fd4
-#else	/* !CONFIG_JUNCTION */
bc9fd4
+#else	/* !HAVE_JUNCTION_SUPPORT */
bc9fd4
 
bc9fd4
 static void lookup_nonexport(int f, char *buf, int buflen, char *dom, char *path,
bc9fd4
 		struct addrinfo *UNUSED(ai))
bc9fd4
@@ -1281,7 +1281,7 @@ static void lookup_nonexport(int f, char *buf, int buflen, char *dom, char *path
bc9fd4
 	dump_to_cache(f, buf, buflen, dom, path, NULL, 0);
bc9fd4
 }
bc9fd4
 
bc9fd4
-#endif	/* !CONFIG_JUNCTION */
bc9fd4
+#endif	/* !HAVE_JUNCTION_SUPPORT */
bc9fd4
 
bc9fd4
 static void nfsd_export(int f)
bc9fd4
 {
bc9fd4
diff --git a/utils/nfsref/Makefile.am b/utils/nfsref/Makefile.am
bc9fd4
index 2b2bb53..2409dd0 100644
bc9fd4
--- a/utils/nfsref/Makefile.am
bc9fd4
+++ b/utils/nfsref/Makefile.am
bc9fd4
@@ -27,13 +27,11 @@ noinst_HEADERS		= nfsref.h
bc9fd4
 
bc9fd4
 sbin_PROGRAMS		= nfsref
bc9fd4
 nfsref_SOURCES		= add.c lookup.c nfsref.c remove.c
bc9fd4
-LDADD			= $(LIBXML2) $(LIBCAP) \
bc9fd4
-			  ../../support/nfs/libnfs.la \
bc9fd4
-			  ../../support/junction/libjunction.la
bc9fd4
+LDADD			= ../../support/nfs/libnfs.la \
bc9fd4
+			  ../../support/junction/libjunction.la \
bc9fd4
+			  $(LIBXML2) $(LIBCAP)
bc9fd4
 
bc9fd4
 man8_MANS		= nfsref.man
bc9fd4
 
bc9fd4
 MAINTAINERCLEANFILES	= Makefile.in
bc9fd4
 
bc9fd4
-AM_CPPFLAGS		= -I. -I../../support/include
bc9fd4
-##AM_LDFLAGS		= -Wl,--as-needed