commit c3e58795029fcf414cab73d9fb8167bbc204f20c
Author: Mike Swanson <mikeonthecomputer@gmail.com>
AuthorDate: Tue Oct 27 09:30:24 2015 -0700
Commit: Mike Swanson <mikeonthecomputer@gmail.com>
CommitDate: Tue Oct 27 09:30:24 2015 -0700
bash-completion: Detect the appropriate directory for installation
---
configure.ac | 9 +++++++++
man/bash-completion/.gitignore | 4 ++++
man/bash-completion/Makefile.am | 4 +++-
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 85a8846e..673ddde7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -117,6 +117,13 @@ AC_SDL_MAIN_WORKAROUND([
AC_CHECK_LIB(amd64, amd64_iopl)
])
+AC_ARG_WITH([bashcompletiondir],
+ AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completion directory]),
+ [],
+ [AS_IF([$($PKG_CONFIG --exists bash-completion)],
+ [bashcompletiondir=$($PKG_CONFIG --variable=completionsdir bash-completion)],
+ [bashcompletiondir=${datadir}/bash-completion/completions])])
+
case $host in
*cygwin* | *mingw* )
AC_CHECK_TOOL(WINDRES, windres, )
@@ -167,6 +174,8 @@ AC_SUBST(PACKAGE_MAINTAINER)
AC_SUBST(PACKAGE_URL)
AC_SUBST(PACKAGE_ISSUES)
+AC_SUBST(bashcompletiondir)
+
dnl Shut up the datarootdir warnings.
AC_DEFUN([AC_DATAROOTDIR_CHECKED])
diff --git a/man/bash-completion/.gitignore b/man/bash-completion/.gitignore
new file mode 100644
index 00000000..74c4d54a
--- /dev/null
+++ b/man/bash-completion/.gitignore
@@ -0,0 +1,4 @@
+*doom
+*heretic
+*hexen
+*strife
diff --git a/man/bash-completion/Makefile.am b/man/bash-completion/Makefile.am
index 2b3d62a1..7001aff2 100644
--- a/man/bash-completion/Makefile.am
+++ b/man/bash-completion/Makefile.am
@@ -1,3 +1,5 @@
+bashcompletiondir=@bashcompletiondir@
+
BASH_COMPLETION_TEMPLATES = \
doom.template \
heretic.template \
@@ -12,7 +14,7 @@ BASH_COMPLETION_SCRIPTLETS = \
@PROGRAM_PREFIX@hexen \
@PROGRAM_PREFIX@strife
-noinst_DATA = $(BASH_COMPLETION_SCRIPTLETS)
+bashcompletion_DATA = $(BASH_COMPLETION_SCRIPTLETS)
CLEANFILES = $(BASH_COMPLETION_SCRIPTLETS)
MANDIR = $(top_srcdir)/man