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

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