* Fix build system when USE="-threads"
* Add DESTDIR in order to prevent sandbox failure

--- a/configure.ac
+++ b/configure.ac
@@ -124,6 +124,7 @@
 AC_CXX_HAVE_LSTRING
 
 ACX_PTHREAD
+AM_CONDITIONAL([THREADS], [test "x${acx_pthread_ok}" = "xyes"])
 
 # Checks for library functions.
 #AC_FUNC_ERROR_AT_LINE
--- a/src/xercesc/util/MsgLoaders/MsgCatalog/Makefile.in
+++ b/src/xercesc/util/MsgLoaders/MsgCatalog/Makefile.in
@@ -5,7 +5,7 @@
 prefix = @prefix@
 INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
-mkdir_p = @mkdir_p@
+mkdir_p = @MKDIR_P@
 
 include $(top_srcdir)/version.incl
 
@@ -48,11 +48,11 @@
 # for installing the library
 # for installing the library
 install: $(RESTARGET)
-	$(mkdir_p) $(prefix)/msg
-	$(INSTALL_PROGRAM) $(RESTARGET) $(prefix)/msg
+	$(mkdir_p) $(DESTDIR)/$(prefix)/share/xerces-c/msg
+	$(INSTALL_PROGRAM) $(RESTARGET) $(DESTDIR)/$(prefix)/share/xerces-c/msg
 
 uninstall: 
-	-rm -f $(prefix)/msg/$(RESFILES)
+	-rm -f $(DESTDIR)/$(prefix)/share/xerces-c/msg/$(RESFILES)
 
 
 # Needed to support "make dist"
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -21,7 +21,7 @@
 
 check_PROGRAMS =                                ${testprogs}
 
-LDADD =	                                        ${top_builddir}/src/libxerces-c.la
+LDADD =	                                        $(top_builddir)/src/libxerces-c.la $(PTHREAD_LIBS)
 # the  -I${top_builddir}/src is needed to pick the xercesc/util/Xerces_autoconf_config.hpp 
 # header file when doing out-of-tree builds
 AM_CPPFLAGS =                                   -I${top_builddir}/src -I${top_srcdir}/src
@@ -86,8 +86,10 @@
 #                                               src/ParserTest/ParserTest_Parser.cpp \
 #                                               src/ParserTest/ParserTest_Parser.hpp
 
+if THREADS
 testprogs +=                                    ThreadTest
 ThreadTest_SOURCES =                            src/ThreadTest/ThreadTest.cpp
+endif
 
 # Fails to compile under gcc 4 (ambiguous calls to NullPointerException)
 # dcargill says this is obsolete and we can delete it.
