diff --git a/configure.ac b/configure.ac index e168e64..ec90cec 100644 --- a/configure.ac +++ b/configure.ac @@ -6,9 +6,24 @@ AM_SILENT_RULES([yes]) AC_PROG_CC AC_LANG([C]) AC_PROG_INSTALL + PKG_PROG_PKG_CONFIG -PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], , bashcompdir="${sysconfdir}/bash_completion.d") -AC_SUBST(bashcompdir) +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="${sysconfdir}/bash_completion.d"]) +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"]) + AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([src/Makefile]) AC_CONFIG_FILES([man/Makefile]) diff --git a/src/Makefile.am b/src/Makefile.am index 321b201..5eeaa72 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,9 +3,14 @@ gotty_SOURCES = tty.c \ options.c \ time.c \ main.c \ + log.c \ include/gotty/tty.h \ include/gotty/options.h \ include/gotty/time.h \ - include/gotty/print.h -bashcompletiondir=@bashcompdir@ + include/gotty/print.h \ + include/gotty/log.h + +if ENABLE_BASH_COMPLETION +bashcompletiondir=@BASH_COMPLETION_DIR@ dist_bashcompletion_DATA=bash-completion/gotty +endif