From 21e4ab8625c326cdd44d84b02b78e8fbc2d6e739 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@hadrons.org>
Date: Thu, 7 Mar 2013 19:15:01 +0100
Subject: [PATCH v2 15/18] build: Unify and centralize plugindir default to be
 PKGLIBDIR/plugins
Status: obsolete

Unify its default value to be under PKGLIBDIR, instead of LIBDIR/near,
which does not match the name of the project nor the daemon. This also
fixes a discrepancy between the directory encoded in the daemon and
the pkg-config file. Centralize the variable to be only set in
configure.ac.
---
 Makefile.am  | 2 +-
 configure.ac | 5 ++++-
 neard.pc.in  | 4 ++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index b89cef1..96cb378 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -56,7 +56,7 @@ AM_CPPFLAGS = \
 
 CLEANFILES = src/builtin.h $(local_headers)
 
-plugindir = $(libdir)/near/plugins
+plugindir = @plugindir@
 
 configdir = ${sysconfdir}/neard
 
diff --git a/configure.ac b/configure.ac
index 00d2b30..976dacd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,7 +14,10 @@ if (test "${libdir}" = '${exec_prefix}/lib'); then
 	libdir='${prefix}/lib'
 fi
 
-plugindir="${libdir}/near/plugins"
+pkglibdir='${libdir}'"/${PACKAGE_TARNAME}"
+AC_SUBST(pkglibdir)
+plugindir='${pkglibdir}/plugins'
+AC_SUBST(plugindir)
 
 PKG_PROG_PKG_CONFIG
 
diff --git a/neard.pc.in b/neard.pc.in
index 22a494c..36ee645 100644
--- a/neard.pc.in
+++ b/neard.pc.in
@@ -2,8 +2,8 @@ prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
 includedir=@includedir@
- 
-plugindir=${libdir}/neard/plugins
+pkglibdir=@pkglibdir@
+plugindir=@plugindir@
 
 Name: neard
 Description: NFC daemon
-- 
1.8.3.1

