Install bash-completion snippets by default

Added autoconf --with-bash-completion-dir and --without-bash-completion-dir options
This commit is contained in:
Nirgal Vourgère 2020-10-23 18:58:45 +02:00
parent f192c258ab
commit d0d95f6503
2 changed files with 33 additions and 7 deletions

View File

@ -267,6 +267,27 @@ if test "$enable_man" = yes; then
fi
AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" = yes)
##################################################
# Check for bash-completion.
##################################################
AC_ARG_WITH([bash-completion-dir],
AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
[Install the bash auto-completion script in this directory. @<:@default=yes@:>@]),
[],
[with_bash_completion_dir=yes])
if test "x$with_bash_completion_dir" = "xyes"; then
PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0],
[BASH_COMPLETION_DIR="`pkg-config --variable=completionsdir bash-completion`"],
[BASH_COMPLETION_DIR="$datadir/bash-completion/completions"])
else
BASH_COMPLETION_DIR="$with_bash_completion_dir"
fi
AC_SUBST([BASH_COMPLETION_DIR])
AM_CONDITIONAL([ENABLE_BASH_COMPLETION],[test "x$with_bash_completion_dir" != "xno"])
##################################################
# Check for docbook
##################################################
@ -317,4 +338,6 @@ if test x$enable_man = xyes; then summary=${bold_green}enabled; else summary=${b
AC_MSG_NOTICE([ man : ${summary}${reset}])
if test -n "$DOCBOOK_DSL"; then summary=${bold_green}enabled; else summary=${bold_red}disabled; fi
AC_MSG_NOTICE([ html docbook : ${summary}${reset}])
if test "x$with_bash_completion_dir" != "xno"; then summary=${bold_green}enabled; else summary=${bold_red}disabled; fi
AC_MSG_NOTICE([ bash-completion : ${summary}${reset}])
AC_MSG_NOTICE([])

View File

@ -1 +1,4 @@
EXTRA_DIST = mdb-export mdb-hexdump mdb-import mdb-parsecsv mdb-prop mdb-schema mdb-sql mdb-tables mdb-ver
if ENABLE_BASH_COMPLETION
bashcompletiondir = $(BASH_COMPLETION_DIR)
dist_bashcompletion_DATA = mdb-export mdb-hexdump mdb-import mdb-parsecsv mdb-prop mdb-schema mdb-sql mdb-tables mdb-ver
endif