diff --git a/indra/cmake/LLPhysicsExtensions.cmake b/indra/cmake/LLPhysicsExtensions.cmake
index 51b860b281c1cd8c8087c631845b9249d2160eee..289d74ab1627cf69b04f05a3107a72463109b618 100644
--- a/indra/cmake/LLPhysicsExtensions.cmake
+++ b/indra/cmake/LLPhysicsExtensions.cmake
@@ -2,26 +2,49 @@
 include(Linking)
 include(Prebuilt)
 
+# There are three possible solutions to provide the llphysicsextensions:
+# - The full source package, selected by -DHAVOK:BOOL=ON
+# - The stub source package, selected by -DHAVOK:BOOL=OFF 
+# - The prebuilt package available to those with sublicenses, selected by -DHAVOK_TPV:BOOL=ON
+
+if (INSTALL_PROPRIETARY)
+   set(HAVOK ON CACHE BOOL "Use Havok physics library")
+endif (INSTALL_PROPRIETARY)
+
+
 # Note that the use_prebuilt_binary macros below do not in fact include binaries;
 # the llphysicsextensions_* packages are source only and are built here.
 # The source package and the stub package both build libraries of the same name.
-if (NOT USE_LL_STUBS)
-   use_prebuilt_binary( ndPhysicsStub )
-   if (WINDOWS)
-      set(LLPHYSICSEXTENSIONS_LIBRARIES 
-         debug ${ARCH_PREBUILT_DIRS_DEBUG}/nd_hacdConvexDecomposition.lib
-         optimized ${ARCH_PREBUILT_DIRS_RELEASE}/nd_hacdConvexDecomposition.lib
-         debug ${ARCH_PREBUILT_DIRS_DEBUG}/hacd.lib
-         optimized ${ARCH_PREBUILT_DIRS_RELEASE}/hacd.lib
-         debug ${ARCH_PREBUILT_DIRS_DEBUG}/nd_Pathing.lib
-         optimized ${ARCH_PREBUILT_DIRS_RELEASE}/nd_Pathing.lib)
-   else ()
-      set(LLPHYSICSEXTENSIONS_LIBRARIES nd_hacdConvexDecomposition hacd nd_Pathing )
-   endif ()
+
+if (HAVOK)
+   include(Havok)
+   use_prebuilt_binary(llphysicsextensions_source)
+   set(LLPHYSICSEXTENSIONS_SRC_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/src)
+   set(LLPHYSICSEXTENSIONS_LIBRARIES    llphysicsextensions)
+   set(LLPHYSICSEXTENSIONS_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/llphysicsextensions) 
+elseif (HAVOK_TPV)
+   use_prebuilt_binary(llphysicsextensions_tpv)
+   set(LLPHYSICSEXTENSIONS_LIBRARIES    ${ARCH_PREBUILT_DIRS}/llphysicsextensions_tpv.lib)
+   set(LLPHYSICSEXTENSIONS_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/llphysicsextensions) 
+else (HAVOK)
+  if (NOT USE_LL_STUBS)
+     use_prebuilt_binary( ndPhysicsStub )
+     if (WINDOWS)
+        set(LLPHYSICSEXTENSIONS_LIBRARIES 
+           debug ${ARCH_PREBUILT_DIRS_DEBUG}/nd_hacdConvexDecomposition.lib
+           optimized ${ARCH_PREBUILT_DIRS_RELEASE}/nd_hacdConvexDecomposition.lib
+           debug ${ARCH_PREBUILT_DIRS_DEBUG}/hacd.lib
+           optimized ${ARCH_PREBUILT_DIRS_RELEASE}/hacd.lib
+           debug ${ARCH_PREBUILT_DIRS_DEBUG}/nd_Pathing.lib
+           optimized ${ARCH_PREBUILT_DIRS_RELEASE}/nd_Pathing.lib)
+     else ()
+        set(LLPHYSICSEXTENSIONS_LIBRARIES nd_hacdConvexDecomposition hacd nd_Pathing )
+     endif ()
    set(LLPHYSICSEXTENSIONS_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/ )
-else ()
+  else()
    use_prebuilt_binary(llphysicsextensions_stub)
    set(LLPHYSICSEXTENSIONS_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/llphysicsextensions) 
    set(LLPHYSICSEXTENSIONS_SRC_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/stub)
    set(LLPHYSICSEXTENSIONS_LIBRARIES    llphysicsextensionsstub)
+  endif()
 endif ()
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index b80649c0b1a40e118eeaeb6e0d4bd72d041344c1..e34c27d7dceb3c8b476df02841320bcda054e229 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -74,6 +74,7 @@
 #include "lluploaddialog.h"
 #include "llfloaterreg.h"
 #include "llviewernetwork.h"
+#include "llviewerbuildconfig.h"
 
 #include <boost/smart_ptr/make_shared.hpp>
 #include <boost/iostreams/device/array.hpp>
@@ -4814,6 +4815,7 @@ S32 LLPhysicsDecomp::llcdCallback(const char* status, S32 p1, S32 p2)
 	return 1;
 }
 
+#if !LL_HAVOK
 bool needTriangles( LLConvexDecomposition *aDC )
 {
 	if( !aDC )
@@ -4838,15 +4840,18 @@ bool needTriangles( LLConvexDecomposition *aDC )
 
 	return false;
 }
+#endif
 
 void LLPhysicsDecomp::setMeshData(LLCDMeshData& mesh, bool vertex_based)
 {
+#if !LL_HAVOK
 	LLConvexDecomposition *pDeComp = LLConvexDecomposition::getInstance();
 	if( !pDeComp )
 		return;
 
 	if( vertex_based )
 		vertex_based = !needTriangles( pDeComp );
+#endif
 
 	mesh.mVertexBase = mCurRequest->mPositions[0].mV;
 	mesh.mVertexStrideBytes = 12;