It appears Solaris's cc is ignoring the signedness of bitfield types.
[xiph/unicode.git] / dryice / SConstruct
blob7fcac93f4ea9ed2a6e264b45c928a4e5496b2f51
1 deps = {'libogg':{'libs':('ogg',),
2 'headers':('ogg/ogg.h', 'ogg/os_types.h')},
3 'libvorbis':{'libs':('vorbis',),
4 'headers':('vorbis/codec.h', 'vorbis/vorbisenc.h',
5 'vorbis/vorbisfile.h')},
6 'libtheora':{'libs':('theora',),
7 'headers':('theora/theora.h',)},
8 'libshout':{'libs':('shout',),
9 'headers':('shout/shout.h',)},
10 'v4l':{'headers':('linux/videodev.h',)},
11 'jpeg':{'libs':('jpeg',),
12 'headers':('jpeglib.h',)}}
14 libs = []
15 cpppath = ['include']
17 modules = ['null_cam', 'v4l_jpeg']
18 modulesrcs = {'null_cam':['modules/null_cam.c'] ,
19 'v4l_jpeg':['modules/v4l_jpeg.c']}
20 moduledeps = {'null_cam':(),
21 'v4l_jpeg':('v4l', 'jpeg')}
22 modulelibs = {'null_cam':[],
23 'v4l_jpeg':[]}
25 #########################################################################
26 # Shouldn't have to edit anything below this line #
27 #########################################################################
29 def checkdeps(ds, l, checks):
30 for dep in ds :
31 for check in checks:
32 if deps[dep].has_key(check) :
33 for test in deps[dep][check] :
34 if not checks[check](test) :
35 return test
36 if check == 'libs' : l.append(test)
37 return None
39 def configure():
40 global env
41 conf = Configure(env)
42 checks = {'funcs':conf.CheckFunc,
43 'libs':conf.CheckLib,
44 'headers':conf.CheckCHeader}
45 test = checkdeps(('libogg','libvorbis','libtheora','libshout'),
46 libs, checks)
47 if test:
48 print 'Could not find %s, exiting.' % test
49 Exit(1)
50 for module in modules:
51 test = checkdeps(moduledeps[module], modulelibs[module], checks)
52 if test:
53 print 'Could not find %s, not building %s module' % (test, module)
54 modules.remove(module)
55 env = conf.Finish()
57 def saveconfig():
58 f = open('config.cache','w')
59 f.write('libs=%s\n' % str(libs))
60 f.write('cpppath=%s\n' % str(cpppath))
61 f.write('modules=%s\n' % str(modules))
62 f.close()
64 def loadconfig():
65 # There has *GOT* to be a simpler way to do this!
66 # ... but at least it's more secure.
67 local_libs = []
68 local_cpppath = ['include']
69 local_modules = []
70 from os.path import exists
71 if exists('config.cache'):
72 f = open('config.cache','r')
73 b = f.read().splitlines()
74 for l in b:
75 exec 'local_'+l
76 f.close()
77 global libs, cpppath, modules
78 libs = local_libs
79 cpppath = local_cpppath
80 modules = local_modules
81 else :
82 configure()
84 def build():
85 Program('dryice', 'src/core.c', CPPPATH=cpppath, LIBS=libs)
86 for module in modules:
87 SharedLibrary('modules/'+module, modulesrcs[module],
88 CPPPATH=cpppath, LIBS=modulelibs[module])
90 env = Environment()
91 do = ARGUMENTS.get('do', None)
93 if do=='config' :
94 configure()
95 saveconfig()
97 elif do=='build' :
98 loadconfig()
99 build()
101 else :
102 configure()
103 saveconfig()
104 build()