aboutsummaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
Diffstat (limited to 'wscript')
-rw-r--r--wscript46
1 files changed, 34 insertions, 12 deletions
diff --git a/wscript b/wscript
index fedc2bc4..9f67a942 100644
--- a/wscript
+++ b/wscript
@@ -67,6 +67,19 @@ def configure(conf):
defines = ['_POSIX_C_SOURCE=200809L'],
mandatory = False)
+ autowaf.check_pkg(conf, 'libpcre', uselib_store='PCRE', mandatory=False)
+ if conf.env.HAVE_PCRE:
+ if conf.check(cflags=['-pthread'], mandatory=False):
+ conf.env.PTHREAD_CFLAGS = ['-pthread']
+ if conf.env.CC_NAME != 'clang':
+ conf.env.PTHREAD_LINKFLAGS = ['-pthread']
+ elif conf.check(linkflags=['-lpthread'], mandatory=False):
+ conf.env.PTHREAD_CFLAGS = []
+ conf.env.PTHREAD_LINKFLAGS = ['-lpthread']
+ else:
+ conf.env.PTHREAD_CFLAGS = []
+ conf.env.PTHREAD_LINKFLAGS = []
+
dump = Options.options.dump.split(',')
if 'all' in dump or 'iter' in dump:
conf.define('SERD_DEBUG_ITER', 1)
@@ -176,18 +189,27 @@ def build(bld):
# Utilities
if bld.env.BUILD_UTILS:
- obj = bld(features = 'c cprogram',
- source = 'src/serdi.c',
- target = 'serdi',
- includes = ['.', './src'],
- use = 'libserd',
- lib = lib_args['lib'],
- install_path = '${BINDIR}')
- if not bld.env.BUILD_SHARED or bld.env.STATIC_PROGS:
- obj.use = 'libserd_static'
- if bld.env.STATIC_PROGS:
- obj.env.SHLIB_MARKER = obj.env.STLIB_MARKER
- obj.linkflags = ['-static']
+ utils = ['serdi']
+ if bld.env.HAVE_PCRE:
+ utils += ['serd_validate']
+
+ for i in utils:
+ obj = bld(features = 'c cprogram',
+ source = 'src/%s.c' % i,
+ target = i,
+ includes = ['.', './src'],
+ use = 'libserd',
+ lib = lib_args['lib'],
+ install_path = '${BINDIR}')
+ if not bld.env.BUILD_SHARED or bld.env.STATIC_PROGS:
+ obj.use = 'libserd_static'
+ if bld.env.STATIC_PROGS:
+ obj.env.SHLIB_MARKER = obj.env.STLIB_MARKER
+ obj.linkflags = ['-static']
+ if i == 'serd_validate':
+ autowaf.use_lib(bld, obj, 'PCRE')
+ obj.cflags = bld.env.PTHREAD_CFLAGS
+ obj.linkflags = bld.env.PTHREAD_LINKFLAGS
# Documentation
autowaf.build_dox(bld, 'SERD', SERD_VERSION, top, out)