From f1ed0955cb9f4c1279352b5a9d369b93175ff737 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 1 Aug 2016 19:44:09 -0400 Subject: Check for posix_memalign --- src/masher.c | 5 ++++- wscript | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/masher.c b/src/masher.c index 6d501c5..0a9eeda 100644 --- a/src/masher.c +++ b/src/masher.c @@ -88,8 +88,11 @@ activate(LV2_Handle instance) plugin->write_grain = 0; for (i=0; i < GRAINSTORE_SIZE; ++i) { - //plugin->grain_store[i].data = (float*)calloc(MAX_GRAIN_SIZE, sizeof(float)); +#ifdef HAVE_POSIX_MEMALIGN posix_memalign((void**)&plugin->grain_store[i].data, 16, MAX_GRAIN_SIZE * sizeof(float)); +#else + plugin->grain_store[i].data = (float*)calloc(MAX_GRAIN_SIZE, sizeof(float)); +#endif plugin->grain_store[i].length = 0; } } diff --git a/wscript b/wscript index d158f33..ce7ad43 100644 --- a/wscript +++ b/wscript @@ -29,6 +29,12 @@ def configure(conf): autowaf.check_pkg(conf, 'lv2', atleast_version='1.0.0', uselib_store='LV2') + conf.check(function_name = 'posix_memalign', + defines = '_POSIX_C_SOURCE=200809L', + header_name = 'stdlib.h', + define_name = 'HAVE_POSIX_MEMALIGN', + mandatory = False) + # Set env.pluginlib_PATTERN pat = conf.env.cshlib_PATTERN if pat[0:3] == 'lib': -- cgit v1.2.1