aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/persist.c18
-rw-r--r--wscript4
2 files changed, 16 insertions, 6 deletions
diff --git a/src/persist.c b/src/persist.c
index b1f2272..384dd4b 100644
--- a/src/persist.c
+++ b/src/persist.c
@@ -22,8 +22,11 @@
#include <stdlib.h>
#include <string.h>
-#include "lv2/lv2plug.in/ns/ext/persist/persist.h"
+#ifdef HAVE_LV2_PERSIST
+# include "lv2/lv2plug.in/ns/ext/persist/persist.h"
+#endif
+#include "jalv-config.h"
#include "jalv_internal.h"
#define NS_JALV (const uint8_t*)"http://drobilla.net/ns/jalv#"
@@ -42,6 +45,7 @@ property_cmp(const void* a, const void* b)
return pa->key - pb->key;
}
+#ifdef HAVE_LV2_PERSIST
static int
store_callback(void* host_data,
uint32_t key,
@@ -96,6 +100,7 @@ retrieve_callback(void* host_data,
return NULL;
}
+#endif // HAVE_LV2_PERSIST
static size_t
file_sink(const void* buf, size_t len, void* stream)
@@ -135,9 +140,6 @@ jalv_save(Jalv* jalv, const char* dir)
SerdNode xsd_decimal = serd_node_from_string(SERD_URI, (NS_XSD "decimal"));
SerdNode jalv_port = serd_node_from_string(SERD_URI, (NS_JALV "port"));
- SerdNode persist_instanceState = serd_node_from_string(
- SERD_URI, (NS_PERSIST "instanceState"));
-
SerdNode plugin_uri = serd_node_from_string(SERD_URI, USTR(lilv_node_as_uri(
lilv_plugin_get_uri(jalv->plugin))));
@@ -200,12 +202,16 @@ jalv_save(Jalv* jalv, const char* dir)
serd_writer_end_anon(jalv->writer, &blank);
}
+#ifdef HAVE_LV2_PERSIST
assert(jalv->symap);
const LV2_Persist* persist = (const LV2_Persist*)
lilv_instance_get_extension_data(jalv->instance,
"http://lv2plug.in/ns/ext/persist");
if (persist) {
+ SerdNode persist_instanceState = serd_node_from_string(
+ SERD_URI, (NS_PERSIST "instanceState"));
+
// [] persist:instanceState [
jalv->state_node = serd_node_from_string(SERD_BLANK, USTR("state"));
serd_writer_write_statement(jalv->writer, SERD_ANON_O_BEGIN, NULL,
@@ -222,6 +228,7 @@ jalv_save(Jalv* jalv, const char* dir)
serd_writer_end_anon(jalv->writer, &jalv->state_node);
jalv->state_node = SERD_NODE_NULL;
}
+#endif // HAVE_LV2_PERSIST
// Close state file and clean up Serd
serd_writer_free(jalv->writer);
@@ -320,6 +327,7 @@ jalv_restore(Jalv* jalv, const char* dir)
void
jalv_restore_instance(Jalv* jalv, const char* dir)
{
+#ifdef HAVE_LV2_PERSIST
const LV2_Persist* persist = (const LV2_Persist*)
lilv_instance_get_extension_data(jalv->instance,
"http://lv2plug.in/ns/ext/persist");
@@ -328,5 +336,5 @@ jalv_restore_instance(Jalv* jalv, const char* dir)
retrieve_callback,
jalv);
}
-
+#endif // HAVE_LV2_PERSIST
}
diff --git a/wscript b/wscript
index a8b1482..d7c7a25 100644
--- a/wscript
+++ b/wscript
@@ -54,7 +54,7 @@ def configure(conf):
autowaf.check_pkg(conf, 'lv2-lv2plug.in-ns-ext-uri-map',
uselib_store='LV2_URI_MAP')
autowaf.check_pkg(conf, 'lv2-lv2plug.in-ns-ext-persist',
- uselib_store='LV2_PERSIST')
+ uselib_store='LV2_PERSIST', mandatory=False)
if not Options.options.no_jack_session:
autowaf.define(conf, 'JALV_JACK_SESSION', 1)
@@ -64,6 +64,8 @@ def configure(conf):
conf.write_config_header('jalv-config.h', remove=False)
+ autowaf.display_msg(conf, "LV2 Persist support",
+ conf.is_defined('HAVE_LV2_PERSIST'))
autowaf.display_msg(conf, "Gtk 2.0 support",
conf.is_defined('HAVE_GTK2'))
autowaf.display_msg(conf, "Qt 4.0 support",