--- a/ldap/Makefile.in
+++ b/ldap/Makefile.in
@@ -1,7 +1,20 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-libs export clean distclean::
+ifdef MOZ_FOLD_LIBS
+# Trick the nspr build system into not building shared libraries.
+# bug #851869.
+EXTRA_MAKE_FLAGS := SHARED_LIBRARY= IMPORT_LIBRARY= SHARED_LIB_PDB=
+else
+# Work around libVersionPoint conflict between all three libraries.
+# See bug #838566.
+EXTRA_MAKE_FLAGS :=
+endif
+
+libs clean distclean::
$(MAKE) -C $(DEPTH)/ldap/sdks/c-sdk $@
+export::
+ $(MAKE) -C $(DEPTH)/ldap/sdks/c-sdk $@ $(EXTRA_MAKE_FLAGS)
+