diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2009-02-21 18:36:08 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2009-02-21 18:36:08 -0500 |
commit | b2f366882c93e602e17ef65de12b854ac724412d (patch) | |
tree | c3bfe69fd8a59d64d385574c56023a45b4f117cd | |
parent | 1fd869810d2cb0efffe3e928121f3585283d3ede (diff) |
Build: Error out if kernel headers are missing.
-rw-r--r-- | SConstruct | 35 |
1 files changed, 34 insertions, 1 deletions
@@ -7,7 +7,24 @@ LITMUS_KERNEL = '../litmus2008' | |||
7 | DEBUG_FLAGS = '-Wall -g -Wdeclaration-after-statement' | 7 | DEBUG_FLAGS = '-Wall -g -Wdeclaration-after-statement' |
8 | API_FLAGS = '-D_XOPEN_SOURCE=600 -D_GNU_SOURCE' | 8 | API_FLAGS = '-D_XOPEN_SOURCE=600 -D_GNU_SOURCE' |
9 | 9 | ||
10 | INCLUDE_DIRS = 'include/ %s/include/' % LITMUS_KERNEL | 10 | KERNEL_INCLUDE = '%s/include/' % LITMUS_KERNEL |
11 | INCLUDE_DIRS = 'include/ ' + KERNEL_INCLUDE | ||
12 | |||
13 | # ##################################################################### | ||
14 | # Build checks. | ||
15 | |||
16 | nrSrc = """#include <linux/unistd.h> | ||
17 | int main(int argc, char **argv) | ||
18 | { | ||
19 | return __NR_set_rt_task_param; | ||
20 | } | ||
21 | """ | ||
22 | |||
23 | def CheckASMLink(context): | ||
24 | context.Message('Checking for asm/ link in kernel include/... ') | ||
25 | result = context.TryLink(nrSrc, '.c') | ||
26 | context.Result(result) | ||
27 | return result | ||
11 | 28 | ||
12 | # ##################################################################### | 29 | # ##################################################################### |
13 | # Build configuration. | 30 | # Build configuration. |
@@ -34,6 +51,22 @@ if arch == 'sparc64': | |||
34 | v9 = Split('-mcpu=v9 -m64') | 51 | v9 = Split('-mcpu=v9 -m64') |
35 | env.Append(CCFLAGS = v9, LINKFLAGS = v9) | 52 | env.Append(CCFLAGS = v9, LINKFLAGS = v9) |
36 | 53 | ||
54 | # Check compile environment | ||
55 | if not env.GetOption('clean'): | ||
56 | # Check for kernel headers. | ||
57 | conf = Configure(env, custom_tests = {'CheckASMLink' : CheckASMLink}) | ||
58 | if not conf.CheckCHeader('litmus/rt_param.h'): | ||
59 | print "Error: Canot find kernel headers in '%s'." % LITMUS_KERNEL | ||
60 | print "Please ensure that LITMUS_KERNEL in SConstruct", \ | ||
61 | "contains a valid path." | ||
62 | Exit(1) | ||
63 | if not conf.CheckASMLink(): | ||
64 | print "Error: The LITMUS^RT syscall numbers are not available." | ||
65 | print "Please ensure sure that the kernel in '%s' is configured." \ | ||
66 | % LITMUS_KERNEL | ||
67 | Exit(1) | ||
68 | env = conf.Finish() | ||
69 | |||
37 | # link with libst | 70 | # link with libst |
38 | st = env.Clone( | 71 | st = env.Clone( |
39 | LIBS = 'st', | 72 | LIBS = 'st', |