scons: Add --without-tcmalloc build option
Disabling tcmalloc is required for valgrind's memcheck to work properly; this option makes it easier to create such a build.
This commit is contained in:
parent
f7c6a2cbed
commit
ded540a661
1 changed files with 13 additions and 9 deletions
16
SConstruct
16
SConstruct
|
@ -186,6 +186,9 @@ AddLocalOption('--verbose', dest='verbose', action='store_true',
|
||||||
AddLocalOption('--without-python', dest='without_python',
|
AddLocalOption('--without-python', dest='without_python',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='Build without Python configuration support')
|
help='Build without Python configuration support')
|
||||||
|
AddLocalOption('--without-tcmalloc', dest='without_tcmalloc',
|
||||||
|
action='store_true',
|
||||||
|
help='Disable linking against tcmalloc')
|
||||||
|
|
||||||
termcap = get_termcap(GetOption('use_colors'))
|
termcap = get_termcap(GetOption('use_colors'))
|
||||||
|
|
||||||
|
@ -973,15 +976,16 @@ have_posix_timers = \
|
||||||
conf.CheckLibWithHeader([None, 'rt'], [ 'time.h', 'signal.h' ], 'C',
|
conf.CheckLibWithHeader([None, 'rt'], [ 'time.h', 'signal.h' ], 'C',
|
||||||
'timer_create(CLOCK_MONOTONIC, NULL, NULL);')
|
'timer_create(CLOCK_MONOTONIC, NULL, NULL);')
|
||||||
|
|
||||||
if conf.CheckLib('tcmalloc'):
|
if not GetOption('without_tcmalloc'):
|
||||||
|
if conf.CheckLib('tcmalloc'):
|
||||||
main.Append(CCFLAGS=main['TCMALLOC_CCFLAGS'])
|
main.Append(CCFLAGS=main['TCMALLOC_CCFLAGS'])
|
||||||
elif conf.CheckLib('tcmalloc_minimal'):
|
elif conf.CheckLib('tcmalloc_minimal'):
|
||||||
main.Append(CCFLAGS=main['TCMALLOC_CCFLAGS'])
|
main.Append(CCFLAGS=main['TCMALLOC_CCFLAGS'])
|
||||||
else:
|
else:
|
||||||
print termcap.Yellow + termcap.Bold + \
|
print termcap.Yellow + termcap.Bold + \
|
||||||
"You can get a 12% performance improvement by installing tcmalloc "\
|
"You can get a 12% performance improvement by "\
|
||||||
"(libgoogle-perftools-dev package on Ubuntu or RedHat)." + \
|
"installing tcmalloc (libgoogle-perftools-dev package "\
|
||||||
termcap.Normal
|
"on Ubuntu or RedHat)." + termcap.Normal
|
||||||
|
|
||||||
if not have_posix_clock:
|
if not have_posix_clock:
|
||||||
print "Can't find library for POSIX clocks."
|
print "Can't find library for POSIX clocks."
|
||||||
|
|
Loading…
Reference in a new issue