build: Install bash completion data
authorLucas De Marchi <lucas.demarchi@intel.com>
Tue, 30 Jul 2013 06:47:19 +0000 (03:47 -0300)
committerLucas De Marchi <lucas.demarchi@intel.com>
Tue, 30 Jul 2013 17:45:21 +0000 (14:45 -0300)
Makefile.am
configure.ac

index 57b7372..91a766a 100644 (file)
@@ -89,6 +89,10 @@ pkgconfig_DATA = libkmod/libkmod.pc
 EXTRA_DIST += libkmod/libkmod.pc.in
 CLEANFILES += libkmod/libkmod.pc
 
+bashcompletiondir=@bashcompletiondir@
+dist_bashcompletion_DATA = \
+       shell-completion/bash/kmod
+
 install-exec-hook:
        if test "$(libdir)" != "$(rootlibdir)"; then \
                $(MKDIR_P) $(DESTDIR)$(rootlibdir) && \
@@ -207,7 +211,8 @@ testsuite-distclean:
 DISTCLEAN_LOCAL_HOOKS += testsuite-distclean
 EXTRA_DIST += testsuite/rootfs-pristine
 
-DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc --sysconfdir=/etc --with-zlib
+DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc --sysconfdir=/etc --with-zlib \
+       --with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir)
 
 distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
 
index 194dfab..15c69d4 100644 (file)
@@ -82,6 +82,15 @@ AS_IF([test "x$with_zlib" != "xno"], [
        AC_MSG_NOTICE([zlib support not requested])
 ])
 
+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])
 
 #####################################################################
 # --enable-
@@ -194,7 +203,7 @@ AC_CONFIG_FILES([
 AC_OUTPUT
 AC_MSG_RESULT([
        $PACKAGE $VERSION
-       ======
+       =======
 
        prefix:                 ${prefix}
        sysconfdir:             ${sysconfdir}
@@ -202,6 +211,7 @@ AC_MSG_RESULT([
        rootlibdir:             ${rootlibdir}
        includedir:             ${includedir}
        bindir:                 ${bindir}
+       Bash completions dir:   ${with_bashcompletiondir}
 
        compiler:               ${CC}
        cflags:                 ${with_cflags} ${CFLAGS}