8 print "Checking", msg
, "...",
10 def execute(cmd
, display
= 0):
15 def run_test(input, flags
= ''):
17 f
= open('_temp.c', 'w')
20 compile_cmd
= '%s -o _temp _temp.c %s' % (os
.environ
.get('CC', 'cc'),
22 if not execute(compile_cmd
):
25 execute('rm -f _temp.c _temp')
27 ogg_test_program
= '''
35 system("touch conf.oggtest");
40 def find_ogg(ogg_prefix
= '/usr/local', enable_oggtest
= 1):
41 """A rough translation of ogg.m4"""
46 ogg_include_dir
= ogg_prefix
+ '/include'
47 ogg_lib_dir
= ogg_prefix
+ '/lib'
50 msg_checking('for Ogg')
53 execute('rm -f conf.oggtest', 0)
56 run_test(ogg_test_program
, flags
="-I" + ogg_include_dir
)
57 if not os
.path
.isfile('conf.oggtest'):
58 raise RuntimeError, "Did not produce output"
59 execute('rm conf.oggtest', 0)
62 print "test program failed"
67 return {'ogg_libs' : ogg_libs
,
68 'ogg_lib_dir' : ogg_lib_dir
,
69 'ogg_include_dir' : ogg_include_dir
}
72 f
= open('Setup', 'w')
73 for item
in data
.items():
74 f
.write('%s = %s\n' % item
)
76 print "Wrote Setup file"
80 --prefix Give the prefix in which ogg was installed.''' % sys
.argv
[0]
86 for pos
in range(len(argv
)):
87 if argv
[pos
] == '--help':
89 if argv
[pos
] == '--prefix':
92 print "Prefix needs an argument"
94 data
['prefix'] = argv
[pos
]
100 prefix
= args
.get('prefix', '/usr/local')
102 data
= find_ogg(ogg_prefix
= prefix
)
104 print "Config failure"
108 if __name__
== '__main__':