From f2665fb18a10598dd2756b3c6fa4b3e5dcec1ccd Mon Sep 17 00:00:00 2001
From: Bent Bisballe Nyeng <deva@aasimon.org>
Date: Wed, 18 Jan 2017 18:29:40 +0100
Subject: Add --with-lv2dir to configure and make sure we install the plugin at
 that location and run the unittest against it.

---
 configure.ac       | 15 +++++++++++----
 plugin/Makefile.am |  2 +-
 test/Makefile.am   |  2 +-
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 38e3080..ce2a46f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -212,10 +212,17 @@ AC_ARG_ENABLE([lv2],
 AS_IF(
   [test "x$enable_lv2" = "xyes"],
   [enable_lv2=yes
-  dnl ======================
-  dnl Check for lv2core
-  dnl ======================
-  PKG_CHECK_MODULES(LV2, lv2 >= 1.0)],
+   dnl ======================
+   dnl Check for lv2core
+   dnl ======================
+   PKG_CHECK_MODULES(LV2, lv2 >= 1.0)
+	 AC_ARG_WITH([lv2dir],
+		AS_HELP_STRING([--with-lv2dir=DIR],
+		               [Use DIR as the lv2 plugin directory [default=LIBDIR/lv2]]),
+	  [LV2DIR=$with_lv2dir],
+	  [LV2DIR='$(libdir)/lv2'])
+	 AC_SUBST(LV2DIR)
+	],
 
   [AC_MSG_RESULT([*** LV2 plugin will not be compiled ***])
    enable_lv2=no]
diff --git a/plugin/Makefile.am b/plugin/Makefile.am
index dda7090..38c5c4f 100644
--- a/plugin/Makefile.am
+++ b/plugin/Makefile.am
@@ -8,7 +8,7 @@ include $(top_srcdir)/src/Makefile.am.drumgizmo
 # LV2
 ###
 if ENABLE_LV2
-lv2plugindir = $(libdir)/lv2/drumgizmo.lv2
+lv2plugindir = @LV2DIR@/drumgizmo.lv2
 lv2plugin_LTLIBRARIES = drumgizmo.la
 lv2plugin_DATA = manifest.ttl drumgizmo.ttl
 endif
diff --git a/test/Makefile.am b/test/Makefile.am
index 457b303..fbe10a9 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -129,7 +129,7 @@ resampler_SOURCES = \
 lv2_CXXFLAGS = -DOUTPUT=\"lv2\" $(CPPUNIT_CFLAGS) \
 	-I$(top_srcdir)/src \
 	 `pkg-config --cflags serd-0` `pkg-config --cflags lilv-0` \
-	-DLV2_PATH=\"$(libdir)/lv2\"
+	-DLV2_PATH=\"@LV2DIR@\"
 lv2_LDFLAGS = $(CPPUNIT_LIBS) `pkg-config --libs serd-0` \
 	`pkg-config --libs lilv-0` -lcrypto \
 	$(SNDFILE_LIBS)
-- 
cgit v1.2.3