From 43b1c1e9d1a73a5b4d85b35429aab9a964e345f3 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 16 Jan 2012 01:03:38 +0000 Subject: Fix test suite compilation when -lgcov is unavailable. git-svn-id: http://svn.drobilla.net/serd/trunk@286 490d8e77-9747-427b-9fa3-0b8f29cee8a0 --- wscript | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/wscript b/wscript index 2183d326..adc06b96 100644 --- a/wscript +++ b/wscript @@ -59,6 +59,11 @@ def configure(conf): if Options.options.largefile: conf.env.append_unique('CFLAGS', '-D_FILE_OFFSET_BITS=64') + # Check for gcov library (for test coverage) + if conf.env['BUILD_TESTS']: + conf.check_cc(lib='gcov', + define_name='HAVE_GCOV') + # Check for posix_memalign conf.check(function_name='posix_memalign', header_name='stdlib.h', @@ -152,12 +157,16 @@ def build(bld): cflags = [ '-fprofile-arcs', '-ftest-coverage', '-DSERD_INTERNAL' ]) + test_libs = ['m'] + if bld.is_defined('HAVE_GCOV'): + test_libs += ['gcov'] + # Unit test serdi obj = bld(features = 'c cprogram', source = 'src/serdi.c', includes = ['.', './src'], use = 'libserd_profiled', - lib = ['m', 'gcov'], + lib = test_libs, target = 'serdi_static', install_path = '', cflags = [ '-fprofile-arcs', '-ftest-coverage' ]) @@ -167,7 +176,7 @@ def build(bld): source = 'tests/serd_test.c', includes = ['.', './src'], use = 'libserd_profiled', - lib = ['m', 'gcov'], + lib = test_libs, target = 'serd_test', install_path = '', cflags = [ '-fprofile-arcs', '-ftest-coverage' ]) -- cgit v1.2.1