aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-08-01 19:44:09 -0400
committerDavid Robillard <d@drobilla.net>2016-08-01 19:44:09 -0400
commitf1ed0955cb9f4c1279352b5a9d369b93175ff737 (patch)
treee99d0f8690ceb8dbad088b51c6ff9ed8a8e6db39
parent8a00872910463f16d8914cee1d9fcdde9ab339f7 (diff)
Check for posix_memalign
-rw-r--r--src/masher.c5
-rw-r--r--wscript6
2 files changed, 10 insertions, 1 deletions
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':