contents = source_file.read()
for k, v in env.items():
try:
- contents = re.sub('@'+k+'@', env.subst('$'+k).replace('\n',r'\\n\\\n'), contents)
- contents = re.sub('%'+k+'%', env.subst('$'+k).replace('\n',r'\\n\\\n'), contents)
+ val = env.subst('$'+k)
+ # temporary fix for the \Resource backslash problem
+ val = val.replace('\\', '/')
+ # multi-line replacement
+ val = val.replace('\n',r'\\n\\\n')
+ contents = re.sub('@'+k+'@', val, contents)
+ contents = re.sub('%'+k+'%', val, contents)
except:
pass
target_file.write(contents + "\n")
#st = os.stat(str(source[0]))
#os.chmod(str(target[0]), stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
+#
+# glob filenames
+#
+def globSource(dir, pattern, build_dir=None, exclude=[], include=[]):
+ ''' glob files, in dir and use build_dir as returned path name '''
+ files = filter(lambda x: x not in exclude, glob.glob1(dir, pattern)) + include
+ if build_dir is None:
+ return files
+ else:
+ return ['%s/%s' % (build_dir, x) for x in files]
#
# autoconf tests
return ret
-def startConfigH(top_src_dir):
+def startConfigH():
''' Write the first part of config.h '''
global config_content
config_content = '''/* src/config.h. Generated by scon. */
'''
-def addToConfig(lines, top_src_dir):
+def addToConfig(lines, newline=2):
''' utility function: shortcut for appending lines to outfile
add newline at the end of lines.
'''
global config_content
if lines.strip() != '':
- config_content += lines + '\n\n'
+ config_content += lines + '\n'*newline
def endConfigH(top_src_dir):
"""
conf.Message('Checking for the number of args for mkdir... ')
ret = conf.TryLink(check_mkdir_one_arg_source, '.c') or \
- conf.TryLink('#include <unistd.h>' + check_mkdir_one_arg_source, '.c')
+ conf.TryLink('#include <unistd.h>' + check_mkdir_one_arg_source, '.c') or \
+ conf.TryLink('#include <direct.h>' + check_mkdir_one_arg_source, '.c')
if ret:
conf.Result('one')
else:
return ret
+# CXX_GLOBAL_CSTD
+def checkCXXGlobalCstd(conf):
+ ''' Check the use of std::tolower or tolower '''
+ check_global_cstd_source = '''
+#include <cctype>
+using std::tolower;
+int main()
+{
+ return 0;
+}
+'''
+ conf.Message('Check for the use of global cstd... ')
+ ret = conf.TryLink(check_global_cstd_source, '.c')
+ conf.Result(ret)
+ return ret
+
+
# SELECT_TYPE_ARG1
# SELECT_TYPE_ARG234
# SELECT_TYPE_ARG5