scons, kvm: Check for the presence of POSIX timers
The kvm-based CPU module requires support for POSIX timers. This changeset adds a check for POSIX timers and ensures that gem5 is linked with librt if necessary. KVM support is disabled if POSIX timers are not supported by the host. This fixes a compilation issue for some glibc versions where clock_nanosleep and timer_create are in different libraries.
This commit is contained in:
parent
7c52865d1b
commit
d3d53938c0
1 changed files with 8 additions and 0 deletions
|
@ -913,6 +913,10 @@ have_posix_clock = \
|
||||||
conf.CheckLibWithHeader('rt', 'time.h', 'C',
|
conf.CheckLibWithHeader('rt', 'time.h', 'C',
|
||||||
'clock_nanosleep(0,0,NULL,NULL);')
|
'clock_nanosleep(0,0,NULL,NULL);')
|
||||||
|
|
||||||
|
have_posix_timers = \
|
||||||
|
conf.CheckLibWithHeader([None, 'rt'], [ 'time.h', 'signal.h' ], 'C',
|
||||||
|
'timer_create(CLOCK_MONOTONIC, NULL, NULL);')
|
||||||
|
|
||||||
if conf.CheckLib('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'):
|
||||||
|
@ -1224,6 +1228,10 @@ for variant_path in variant_paths:
|
||||||
if not have_kvm:
|
if not have_kvm:
|
||||||
print "Warning: Can not enable KVM, host seems to lack KVM support"
|
print "Warning: Can not enable KVM, host seems to lack KVM support"
|
||||||
env['USE_KVM'] = False
|
env['USE_KVM'] = False
|
||||||
|
elif not have_posix_timers:
|
||||||
|
print "Warning: Can not enable KVM, host seems to lack support " \
|
||||||
|
"for POSIX timers"
|
||||||
|
env['USE_KVM'] = False
|
||||||
elif not is_isa_kvm_compatible(env['TARGET_ISA']):
|
elif not is_isa_kvm_compatible(env['TARGET_ISA']):
|
||||||
print "Info: KVM support disabled due to unsupported host and " \
|
print "Info: KVM support disabled due to unsupported host and " \
|
||||||
"target ISA combination"
|
"target ISA combination"
|
||||||
|
|
Loading…
Reference in a new issue