]> git.ipfire.org Git - location/libloc.git/commitdiff
Install bash-completion files.
authorStefan Schantl <stefan.schantl@ipfire.org>
Fri, 24 Feb 2023 16:22:06 +0000 (17:22 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 28 Feb 2023 11:35:49 +0000 (11:35 +0000)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
configure.ac

index 7f0d8d045285df5bf234e3665ef0797a7c4480b6..01e4f01be8ccf59e37234a4560f729b850fea067 100644 (file)
@@ -13,6 +13,8 @@ if ENABLE_PERL
 BINDINGS += perl
 endif
 
+bashcompletiondir = @bashcompletiondir@
+
 AM_CPPFLAGS = \
        -include $(top_builddir)/config.h \
        -DSYSCONFDIR=\""$(sysconfdir)"\" \
@@ -175,6 +177,13 @@ EXTRA_DIST += \
 CLEANFILES += \
        src/libloc.pc
 
+#dist_bashcompletion_DATA =
+
+if BUILD_BASH_COMPLETION
+dist_bashcompletion_DATA = \
+       bash-completion/location
+endif
+
 dist_pkgpython_PYTHON = \
        src/python/location/__init__.py \
        src/python/location/database.py \
index 96e6b0e3cf4d35d10ae6475099e00843ffd017b9..0144dbe0e786326aa77f62fb627ac9951e67ef78 100644 (file)
@@ -55,6 +55,41 @@ AC_CHECK_PROGS(ASCIIDOC, [asciidoc])
 if test "${have_man_pages}" = "yes" && test -z "${ASCIIDOC}"; then
        AC_MSG_ERROR([Required program 'asciidoc' not found])
 fi
+
+# - pkg-config -----------------------------------------------------------------
+
+m4_ifndef([PKG_PROG_PKG_CONFIG],
+       [m4_fatal([Could not locate the pkg-config autoconf
+               macros. These are usually located in /usr/share/aclocal/pkg.m4.
+               If your macros are in a different location, try setting the
+               environment variable AL_OPTS="-I/other/macro/dir" before running
+               ./autogen.sh or autoreconf again. Make sure pkg-config is installed.])])
+
+PKG_PROG_PKG_CONFIG
+PKG_INSTALLDIR(['${usrlib_execdir}/pkgconfig'])
+
+# - bash-completion ------------------------------------------------------------
+
+#enable_bash_completion=yes
+AC_ARG_WITH([bashcompletiondir],
+       AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
+       [],
+       [AS_IF([`$PKG_CONFIG --exists bash-completion`], [
+               with_bashcompletiondir=`$PKG_CONFIG --variable=completionsdir bash-completion`
+       ], [
+               with_bashcompletiondir=${datadir}/bash-completion/completions
+       ])
+])
+
+AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
+
+AC_ARG_ENABLE([bash-completion],
+       AS_HELP_STRING([--disable-bash-completion], [do not install bash completion files]),
+       [], [enable_bash_completion=yes]
+)
+
+AM_CONDITIONAL([BUILD_BASH_COMPLETION], [test "x$enable_bash_completion" = xyes])
+
 # - debug ----------------------------------------------------------------------
 
 AC_ARG_ENABLE([debug],
@@ -229,6 +264,7 @@ AC_MSG_RESULT([
         database path:          ${with_database_path}
         debug:                  ${enable_debug}
         systemd support:        ${have_systemd}
+       bash-completion:        ${enable_bash_completion}
 
        Bindings:
          Perl:                 ${enable_perl}