diff options
author | Andy Schwerin <schwerin@10gen.com> | 2012-08-10 13:32:42 -0400 |
---|---|---|
committer | Andy Schwerin <schwerin@10gen.com> | 2012-08-10 17:19:08 -0400 |
commit | eee3fe4ce66c7bbda9329a3c8bd8e3549b07437c (patch) | |
tree | 7539b815986392be5e98409ffbfb81b077b27f2e /SConstruct | |
parent | b49bac3c24d57d412a623545c9a3c367ca595b7e (diff) | |
download | mongo-eee3fe4ce66c7bbda9329a3c8bd8e3549b07437c.tar.gz |
SERVER-4683 Support the imported tcmalloc, ystem tcmalloc or the default system allocator library.
Pass --allocator=tcmalloc (default on Linux) or --allocator=system (default elsewhere)
to control which allocator is used, and --use-system-tcmalloc to use the system-
installed tcmalloc instead of the one in the mongo source tree if you use --allocator=tcmalloc.
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/SConstruct b/SConstruct index a7c7fcade2c..be95d327aed 100644 --- a/SConstruct +++ b/SConstruct @@ -79,9 +79,10 @@ def add_option( name, help, nargs, contributesToVariantDir, help=help ) options[name] = { "help" : help , - "nargs" : nargs , + "nargs" : nargs , "contributesToVariantDir" : contributesToVariantDir , - "dest" : dest } + "dest" : dest, + "default": default } def get_option( name ): return GetOption( name ) @@ -121,6 +122,8 @@ def get_variant_dir(): continue if not o["contributesToVariantDir"]: continue + if get_option(o["dest"]) == o["default"]: + continue if o["nargs"] == 0: a.append( name ) @@ -199,7 +202,8 @@ add_option( "clang" , "use clang++ rather than g++ (experimental)" , 0 , True ) # debugging/profiling help -add_option( "tcmalloc" , "link against tcmalloc" , 0 , False ) +add_option( "allocator" , "allocator to use (tcmalloc or system)" , 1 , True, + default=(sys.platform.startswith('linux') and 'tcmalloc' or 'system') ) add_option( "gdbserver" , "build in gdb server support" , 0 , True ) add_option( "heapcheck", "link to heap-checking malloc-lib and look for memory leaks during tests" , 0 , False ) add_option( "gcov" , "compile with flags for gcov" , 0 , True ) @@ -207,6 +211,8 @@ add_option( "gcov" , "compile with flags for gcov" , 0 , True ) add_option("smokedbprefix", "prefix to dbpath et al. for smoke tests", 1 , False ) add_option("smokeauth", "run smoke tests with --auth", 0 , False ) +add_option( "use-system-tcmalloc", "use system version of tcmalloc library", 0, True ) + add_option( "use-system-pcre", "use system version of pcre library", 0, True ) add_option( "use-system-boost", "use system version of boost libraries", 0, True ) @@ -298,8 +304,8 @@ env = Environment( BUILD_DIR=variantDir, PYSYSPLATFORM=os.sys.platform, PCRE_VERSION='8.30', - CONFIGUREDIR = scons_data_dir + '/sconf_temp', - CONFIGURELOG = scons_data_dir + '/config.log' + CONFIGUREDIR = '#' + scons_data_dir + '/sconf_temp', + CONFIGURELOG = '#' + scons_data_dir + '/config.log' ) env['_LIBDEPS'] = '$_LIBDEPS_OBJS' @@ -826,9 +832,19 @@ def doConfigure(myenv): # 'tcmalloc' needs to be the last library linked. Please, add new libraries before this # point. - if has_option("tcmalloc") or has_option("heapcheck"): - if not conf.CheckLib("tcmalloc"): + if get_option('allocator') == 'tcmalloc': + if use_system_version_of_library('tcmalloc'): + if not conf.CheckLib("tcmalloc"): + Exit(1) + elif has_option("heapcheck"): + print ("--heapcheck does not work with the tcmalloc embedded in the mongodb source " + "tree. Use --use-system-tcmalloc.") Exit(1) + elif get_option('allocator') == 'system': + pass + else: + print "Invalid --allocator parameter: \"%s\"" % get_option('allocator') + Exit(1) if has_option("heapcheck"): if ( not debugBuild ) and ( not debugLogging ): |