diff --git a/Makefile.am b/Makefile.am index 51e3abf384a69fb7c5ee3e91f2e6580d4329c723..610569898542d5156890c971bf1a730f246137de 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,8 @@ singlehtml install-singlehtml: $(MAKE) -C doc $@ AM_DISTCHECK_CONFIGURE_FLAGS = \ - --disable-code-coverage + --disable-code-coverage \ + --without-bash-completions CODE_COVERAGE_INFO = coverage.info CODE_COVERAGE_HTML = coverage.html diff --git a/configure.ac b/configure.ac index 42a138b374cc35e86ad99b2c97a951a3619b484e..de7732c5f2e1648712db50e445dbb80c5d81781d 100644 --- a/configure.ac +++ b/configure.ac @@ -64,28 +64,6 @@ AC_CONFIG_FILES([src/libknot.pc src/zscanner/libzscanner.pc ]) -# Get Bash completion scripts directory -bash_completion_dir="" -PKG_CHECK_VAR([bash_completion_dir], [bash-completion], [completionsdir],[ - PKG_CHECK_VAR([bash_completion_prefix], [bash-completion], [prefix], [ - # Try to remove full ${datarootdir} first - bash_completion_dir_tmp=$(echo "${bash_completion_dir}" | $SED -e "s,^${bash_completion_prefix}/share,,") - AS_IF([test "${bash_completion_dir}" = "${bash_completion_dir_tmp}"],[ - # Remove and add only a ${prefix} - bash_completion_dir_tmp=$(echo "$bash_completion_dir" | $SED -e "s,^${bash_completion_prefix},,") - AC_SUBST([bash_completion_dir], ['${prefix}'${bash_completion_dir_tmp}]) - ],[ - # And append full ${datarootdir} - AC_SUBST([bash_completion_dir], ['${datarootdir}'${bash_completion_dir_tmp}]) - ]) - ])],[:]) -AM_CONDITIONAL([HAVE_BASH_COMPLETION], [test -n "$bash_completion_dir"]) -AS_IF([test -n "$bash_completion_dir"],[ - bash_completion_output="${bash_completion_dir}" - ],[ - bash_completion_output="no" - ]) - # Build Knot DNS daemon AC_ARG_ENABLE([daemon], AS_HELP_STRING([--disable-daemon], [Don't build Knot DNS main daemon]), [], [enable_daemon=yes]) @@ -394,6 +372,24 @@ AS_IF([test "$with_libidn" != "no"],[ ]) # Knot DNS utilities dependencies +# Bash completions +AC_ARG_WITH([bash-completions], + AC_HELP_STRING([--with-bash-completions=[DIR]], [Bash completions directory [default=auto]]), + [with_bash_completions="$withval"], + [with_bash_completions=auto] +) +AS_CASE([$with_bash_completions], + [auto], [PKG_CHECK_VAR([bash_completions_dir], [bash-completion], [completionsdir])], + [yes], [PKG_CHECK_VAR([bash_completions_dir], [bash-completion], [completionsdir], [], [AC_MSG_ERROR([bash completions not found])])], + [no], [bash_completions_dir=], + [bash_completions_dir="$with_bash_completions"] +) +AM_CONDITIONAL([HAVE_BASH_COMPLETIONS], [test -n "$bash_completions_dir"]) +AS_IF([test -n "$bash_completions_dir"], + [bash_completions_output="${bash_completions_dir}"], + [bash_completions_output=no] +) + AC_SEARCH_LIBS([pow], [m]) AC_SEARCH_LIBS([pthread_create], [pthread], [], [AC_MSG_ERROR([pthreads not found])]) AC_SEARCH_LIBS([dlopen], [dl]) @@ -493,7 +489,7 @@ AC_MSG_RESULT([ Systemd integration: ${enable_systemd} Dnstap support: ${opt_dnstap} Code coverage: ${enable_code_coverage} - Bash completion: ${bash_completion_output} + Bash completions: ${bash_completions_output} Continue with 'make' command ]) diff --git a/samples/Makefile.am b/samples/Makefile.am index 9615fde950405f4c9b84ca1d144564698048405e..4898cb0d57c56cf9c3a50c1f100001c43de48043 100644 --- a/samples/Makefile.am +++ b/samples/Makefile.am @@ -24,19 +24,19 @@ install-data-local: knot.sample.conf $(INSTALL) -d $(DESTDIR)/$(config_dir); \ $(INSTALL_DATA) knot.sample.conf $(srcdir)/example.com.zone $(DESTDIR)/$(config_dir); \ fi -if HAVE_BASH_COMPLETION - if [ \! -f $(DESTDIR)/$(bash_completion_dir)/keymgr ]; then \ - $(INSTALL) -d $(DESTDIR)/$(bash_completion_dir); \ - $(INSTALL_DATA) $(srcdir)/keymgr-completion.sh $(DESTDIR)/$(bash_completion_dir)/keymgr; \ +if HAVE_BASH_COMPLETIONS + if [ \! -f $(DESTDIR)/$(bash_completions_dir)/keymgr ]; then \ + $(INSTALL) -d $(DESTDIR)/$(bash_completions_dir); \ + $(INSTALL_DATA) $(srcdir)/keymgr-completion.sh $(DESTDIR)/$(bash_completions_dir)/keymgr; \ fi -endif # HAVE_BASH_COMPLETION +endif # HAVE_BASH_COMPLETIONS uninstall-local: -rm -rf $(DESTDIR)/$(config_dir)/knot.sample.conf \ $(DESTDIR)/$(config_dir)/example.com.zone -if HAVE_BASH_COMPLETION - -rm -rf $(DESTDIR)/$(bash_completion_dir)/keymgr -endif # HAVE_BASH_COMPLETION +if HAVE_BASH_COMPLETIONS + -rm -rf $(DESTDIR)/$(bash_completions_dir)/keymgr +endif # HAVE_BASH_COMPLETIONS endif # HAVE_DAEMON