Blame SOURCES/system-libs.patch

79c91f
diff --git a/SConstruct b/SConstruct
8e68eb
index bdafd06..9350c29 100644
79c91f
--- a/SConstruct
79c91f
+++ b/SConstruct
8e68eb
@@ -363,6 +363,11 @@ add_option('use-system-asio',
79c91f
     nargs=0,
79c91f
 )
79c91f
 
79c91f
+add_option('use-system-mozjs',
79c91f
+    help="use system version of mozjs",
79c91f
+    nargs=0,
79c91f
+)
79c91f
+
79c91f
 add_option('use-system-intel_decimal128',
79c91f
     help='use system version of intel decimal128',
79c91f
     nargs=0,
8e68eb
@@ -2394,11 +2399,17 @@ def doConfigure(myenv):
79c91f
     if use_system_version_of_library("intel_decimal128"):
79c91f
         conf.FindSysLibDep("intel_decimal128", ["bid"])
79c91f
 
79c91f
+    if use_system_version_of_library("mozjs"):
79c91f
+        conf.FindSysLibDep("mozjs", ["mozjs-38"])
79c91f
+
79c91f
     if wiredtiger and use_system_version_of_library("wiredtiger"):
79c91f
         if not conf.CheckCXXHeader( "wiredtiger.h" ):
79c91f
             myenv.ConfError("Cannot find wiredtiger headers")
79c91f
         conf.FindSysLibDep("wiredtiger", ["wiredtiger"])
79c91f
 
79c91f
+    if use_system_version_of_library("asio"):
79c91f
+        conf.CheckCXXHeader("asio.hpp")
79c91f
+
79c91f
     conf.env.Append(
79c91f
         CPPDEFINES=[
79c91f
             ("BOOST_THREAD_VERSION", "4"),
79c91f
diff --git a/src/mongo/executor/connection_pool_asio.h b/src/mongo/executor/connection_pool_asio.h
8e68eb
index 2924331..54e5d53 100644
79c91f
--- a/src/mongo/executor/connection_pool_asio.h
79c91f
+++ b/src/mongo/executor/connection_pool_asio.h
79c91f
@@ -35,6 +35,8 @@
8e68eb
 #include "mongo/executor/network_interface_asio.h"
79c91f
 #include "mongo/stdx/mutex.h"
79c91f
 
79c91f
+#include <asio/steady_timer.hpp>
79c91f
+
79c91f
 namespace mongo {
79c91f
 namespace executor {
79c91f
 namespace connection_pool_asio {
79c91f
diff --git a/src/third_party/SConscript b/src/third_party/SConscript
8e68eb
index 5ff1ace..dd3b73f 100644
79c91f
--- a/src/third_party/SConscript
79c91f
+++ b/src/third_party/SConscript
8e68eb
@@ -41,13 +41,18 @@ if not use_system_version_of_library('zlib'):
79c91f
 # TODO: figure out if we want to offer system versions of mozjs.  Mozilla
79c91f
 # hasn't offered a source tarball since 24, but in theory they could.
79c91f
 #
79c91f
-#if not use_system_version_of_library('mozjs'):
79c91f
-if True:
79c91f
+if not use_system_version_of_library('mozjs'):
79c91f
     thirdPartyIncludePathList.append(
79c91f
         ('mozjs', ['#/src/third_party/mozjs' + mozjsSuffix + '/include',
79c91f
                    '#/src/third_party/mozjs' + mozjsSuffix + '/mongo_sources',
79c91f
                    '#/src/third_party/mozjs' + mozjsSuffix + '/platform/' + env["TARGET_ARCH"] + "/" + env["TARGET_OS"] + "/include",
79c91f
         ]))
79c91f
+else:
79c91f
+    thirdPartyIncludePathList.append(
79c91f
+        ('mozjs', ['#/src/third_party/mozjs' + mozjsSuffix + '/mongo_sources', ]))
79c91f
+    if use_system_version_of_library("mozjs"):
79c91f
+        thirdPartyIncludePathList.append(
79c91f
+            ('mozjs', ['/usr/include/mozjs' + mozjsSuffix, ]))
79c91f
 
79c91f
 if not use_system_version_of_library('stemmer'):
79c91f
     thirdPartyIncludePathList.append(
8e68eb
@@ -198,13 +203,20 @@ zlibEnv.Library(
79c91f
     ])
79c91f
 
79c91f
 if usemozjs:
79c91f
-    mozjsEnv = env.Clone()
79c91f
-    mozjsEnv.SConscript('mozjs' + mozjsSuffix + '/SConscript', exports={'env' : mozjsEnv })
79c91f
-    mozjsEnv = mozjsEnv.Clone(
79c91f
-        LIBDEPS=[
79c91f
-            'mozjs' + mozjsSuffix + '/mozjs',
79c91f
-            'shim_zlib',
79c91f
-        ])
79c91f
+    if use_system_version_of_library("mozjs"):
79c91f
+        env.InjectThirdPartyIncludePaths(libraries=['mozjs'])
79c91f
+        mozjsEnv = env.Clone(
79c91f
+            SYSLIBDEPS=[
79c91f
+                env['LIBDEPS_MOZJS_SYSLIBDEP'],
79c91f
+            ])
79c91f
+    else:
79c91f
+        mozjsEnv = env.Clone()
79c91f
+        mozjsEnv.SConscript('mozjs' + mozjsSuffix + '/SConscript', exports={'env' : mozjsEnv })
79c91f
+        mozjsEnv = mozjsEnv.Clone(
79c91f
+            LIBDEPS=[
79c91f
+                'mozjs' + mozjsSuffix + '/mozjs',
79c91f
+                'shim_zlib',
79c91f
+            ])
79c91f
 
79c91f
     mozjsEnv.Library(
79c91f
         target="shim_mozjs",
8e68eb
@@ -316,10 +328,7 @@ if wiredtiger:
79c91f
         ])
79c91f
 
79c91f
 if use_system_version_of_library("asio"):
79c91f
-    asioEnv = env.Clone(
79c91f
-        SYSLIBDEPS=[
79c91f
-            env['LIBDEPS_ASIO_SYSLIBDEP'],
79c91f
-        ])
79c91f
+    asioEnv = env.Clone()
79c91f
 else:
79c91f
     asioEnv = env.Clone()
79c91f
     asioEnv.InjectThirdPartyIncludePaths(libraries=['asio'])