[lxc-devel] [lxc/master] install bash completion where pkg-config tells us to

evgeni on Github lxc-bot at linuxcontainers.org
Sat Nov 12 13:58:49 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 348 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20161112/94f2691c/attachment.bin>
-------------- next part --------------
From 23f4c8a01a8d6b7fd3cb3e4aed88ed9a4ed03e03 Mon Sep 17 00:00:00 2001
From: Evgeni Golov <evgeni at debian.org>
Date: Sat, 12 Nov 2016 14:44:40 +0100
Subject: [PATCH] install bash completion where pkg-config tells us to

Signed-off-by: Evgeni Golov <evgeni at debian.org>
---
 config/bash/Makefile.am | 11 +----------
 configure.ac            |  8 ++++++++
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/config/bash/Makefile.am b/config/bash/Makefile.am
index b1768c9..b97e2a4 100644
--- a/config/bash/Makefile.am
+++ b/config/bash/Makefile.am
@@ -1,14 +1,5 @@
 EXTRA_DIST = lxc
 
 if ENABLE_BASH
-install-bash:
-	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/bash_completion.d/
-	$(INSTALL_DATA) lxc $(DESTDIR)$(sysconfdir)/bash_completion.d/
-
-uninstall-bash:
-	rm -f $(DESTDIR)$(sysconfdir)/bash_completion.d/lxc
-	rmdir $(DESTDIR)$(sysconfdir)/bash_completion.d/ || :
-
-install-data-local: install-bash
-uninstall-local: uninstall-bash
+dist_bashcomp_DATA = lxc
 endif
diff --git a/configure.ac b/configure.ac
index dcb33ee..cd424c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -479,6 +479,14 @@ AC_ARG_ENABLE([bash],
 	[], [enable_bash=yes])
 AM_CONDITIONAL([ENABLE_BASH], [test "x$enable_bash" = "xyes"])
 
+AM_COND_IF([ENABLE_BASH],
+	[AC_MSG_CHECKING([bash completion directory])
+	PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], ,
+		bashcompdir="${sysconfdir}/bash_completion.d")
+	AC_MSG_RESULT([$bashcompdir])
+	AC_SUBST(bashcompdir)
+	])
+
 # Optional test binaries
 AC_ARG_ENABLE([tests],
 	[AC_HELP_STRING([--enable-tests], [build test/example binaries [default=no]])],


More information about the lxc-devel mailing list